@openclaw/signal 2026.8.1-beta.2 → 2026.8.1-beta.3
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/dist/{accounts-DrStJjiK.js → accounts-DO4HMqaK.js} +2 -2
- package/dist/api.js +9 -9
- package/dist/{runtime-JPrGlV7h.js → approval-auth-BY6uuApE.js} +2 -9
- package/dist/{approval-handler.runtime-Bi5yNhnj.js → approval-handler.runtime-Co6EVTqY.js} +4 -4
- package/dist/{approval-reactions-BulCzhdB.js → approval-reactions-cs3Ox9Ow.js} +60 -152
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-CzDJMDtX.js → channel-zIopSllO.js} +22 -16
- package/dist/{channel.runtime-D12iYzJB.js → channel.runtime-CpDBElG8.js} +2 -2
- package/dist/{monitor-DiN2hKnG.js → monitor-BLFIkpH0.js} +183 -81
- package/dist/{probe-C_THuQzn.js → probe-B0E_cXQw.js} +1 -1
- package/dist/{question-reactions-ByjH5qST.js → question-reactions-BaatFqJ7.js} +2 -2
- package/dist/{reaction-runtime-api-Cf6QHcE5.js → reaction-runtime-api-YGD6hhDh.js} +2 -2
- package/dist/reaction-runtime-api.js +1 -1
- package/dist/rpc-context-dXSy4NtF.js +15 -0
- package/dist/runtime-api.js +6 -7
- package/dist/{send-BvGgByMd.js → send-BNl5folj.js} +4 -22
- package/dist/{send.runtime-CtTBBrjL.js → send.runtime-DnMoKk27.js} +1 -1
- package/dist/{transport-detection-BItHawMq.js → transport-detection-D_M79R5f.js} +12 -5
- package/dist/{transport-detection.runtime-DoiwPcrG.js → transport-detection.runtime-DKuuIHvf.js} +1 -1
- package/package.json +4 -4
- package/dist/rpc-context-CZUoE0-A.js +0 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isSignalManagedNativeConnectionUrlForBind, c as buildSignalTransportHttpUrl, i as assignSignalManagedNativePort, n as DEFAULT_SIGNAL_MANAGED_NATIVE_PORT, r as allocateSignalManagedNativePort, s as resolveLocalSignalTransportPort } from "./transport-policy-DxvSMHp9.js";
|
|
1
|
+
import { a as isSignalManagedNativeConnectionUrlForBind, c as buildSignalTransportHttpUrl, i as assignSignalManagedNativePort, l as normalizeSignalTransportHost, n as DEFAULT_SIGNAL_MANAGED_NATIVE_PORT, r as allocateSignalManagedNativePort, s as resolveLocalSignalTransportPort } from "./transport-policy-DxvSMHp9.js";
|
|
2
2
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { DEFAULT_ACCOUNT_ID, createAccountListHelpers, normalizeAccountId, resolveAccountEntry, resolveMergedAccountConfig } from "openclaw/plugin-sdk/account-resolution";
|
|
4
4
|
//#region extensions/signal/src/accounts.ts
|
|
@@ -80,7 +80,7 @@ function resolveSignalTransport(transport, managedNativePort = DEFAULT_SIGNAL_MA
|
|
|
80
80
|
baseUrl: transport.url.trim()
|
|
81
81
|
};
|
|
82
82
|
const managedTransport = transport?.kind === "managed-native" ? assignSignalManagedNativePort(transport, transport.httpPort ?? managedNativePort) : transport;
|
|
83
|
-
const httpHost = normalizeOptionalString(managedTransport?.httpHost) ?? "127.0.0.1";
|
|
83
|
+
const httpHost = normalizeSignalTransportHost(normalizeOptionalString(managedTransport?.httpHost) ?? "127.0.0.1");
|
|
84
84
|
const httpPort = managedTransport?.httpPort ?? managedNativePort;
|
|
85
85
|
const configPath = normalizeOptionalString(managedTransport?.configPath);
|
|
86
86
|
return {
|
package/dist/api.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { i as resolveSignalAccount, n as listSignalAccountIds, r as resolveDefaultSignalAccountId, t as listEnabledSignalAccounts } from "./accounts-
|
|
1
|
+
import { i as resolveSignalAccount, n as listSignalAccountIds, r as resolveDefaultSignalAccountId, t as listEnabledSignalAccounts } from "./accounts-DO4HMqaK.js";
|
|
2
2
|
import { a as normalizeSignalAllowRecipient, c as resolveSignalSender, d as normalizeSignalMessagingTarget, i as isSignalSenderAllowed, l as looksLikeUuid, n as formatSignalSenderDisplay, o as resolveSignalPeerId, r as formatSignalSenderId, s as resolveSignalRecipient, t as formatSignalPairingIdLine, u as looksLikeSignalTargetId } from "./identity-BQ4OzXXk.js";
|
|
3
|
-
import {
|
|
4
|
-
import { n as sendReactionSignal, t as removeReactionSignal } from "./reaction-runtime-api-
|
|
5
|
-
import { a as normalizeSignalAccountInput, d as probeSignalTransport, f as writeSignalAccountTransport, l as signalSetupContract, n as createSignalPluginBase, p as resolveSignalOutboundTarget, r as signalSetupWizard, t as signalPlugin, u as prepareSignalManagedNativeTransport } from "./channel-
|
|
6
|
-
import { i as installSignalCli
|
|
7
|
-
import { t as monitorSignalProvider } from "./monitor-
|
|
8
|
-
import { n as sendReadReceiptSignal, r as sendTypingSignal, t as sendMessageSignal } from "./send-
|
|
9
|
-
import { t as probeSignal } from "./probe-
|
|
3
|
+
import { c as resolveSignalReactionLevel, d as markdownToSignalTextChunks, s as signalMessageActions, t as detectSignalTransport, u as markdownToSignalText } from "./transport-detection-D_M79R5f.js";
|
|
4
|
+
import { n as sendReactionSignal, t as removeReactionSignal } from "./reaction-runtime-api-YGD6hhDh.js";
|
|
5
|
+
import { a as normalizeSignalAccountInput, d as probeSignalTransport, f as writeSignalAccountTransport, l as signalSetupContract, n as createSignalPluginBase, p as resolveSignalOutboundTarget, r as signalSetupWizard, t as signalPlugin, u as prepareSignalManagedNativeTransport } from "./channel-zIopSllO.js";
|
|
6
|
+
import { i as installSignalCli } from "./install-signal-cli-Cpiyk0k1.js";
|
|
7
|
+
import { t as monitorSignalProvider } from "./monitor-BLFIkpH0.js";
|
|
8
|
+
import { n as sendReadReceiptSignal, r as sendTypingSignal, t as sendMessageSignal } from "./send-BNl5folj.js";
|
|
9
|
+
import { t as probeSignal } from "./probe-B0E_cXQw.js";
|
|
10
10
|
//#region extensions/signal/src/channel.setup.ts
|
|
11
11
|
const signalSetupPlugin = { ...createSignalPluginBase({
|
|
12
12
|
setupWizard: signalSetupWizard,
|
|
13
13
|
setupContract: signalSetupContract
|
|
14
14
|
}) };
|
|
15
15
|
//#endregion
|
|
16
|
-
export { detectSignalTransport,
|
|
16
|
+
export { detectSignalTransport, formatSignalPairingIdLine, formatSignalSenderDisplay, formatSignalSenderId, installSignalCli, isSignalSenderAllowed, listEnabledSignalAccounts, listSignalAccountIds, looksLikeSignalTargetId, looksLikeUuid, markdownToSignalText, markdownToSignalTextChunks, monitorSignalProvider, normalizeSignalAccountInput, normalizeSignalAllowRecipient, normalizeSignalMessagingTarget, prepareSignalManagedNativeTransport, probeSignal, probeSignalTransport, removeReactionSignal, resolveDefaultSignalAccountId, resolveSignalAccount, resolveSignalOutboundTarget, resolveSignalPeerId, resolveSignalReactionLevel, resolveSignalRecipient, resolveSignalSender, sendMessageSignal, sendReactionSignal, sendReadReceiptSignal, sendTypingSignal, signalMessageActions, signalPlugin, signalSetupPlugin, writeSignalAccountTransport };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { i as resolveSignalAccount } from "./accounts-
|
|
1
|
+
import { i as resolveSignalAccount } from "./accounts-DO4HMqaK.js";
|
|
2
2
|
import { d as normalizeSignalMessagingTarget, l as looksLikeUuid, u as looksLikeSignalTargetId } from "./identity-BQ4OzXXk.js";
|
|
3
3
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { createChannelApprovalAuth } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
5
5
|
import { normalizeE164 } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
|
-
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
7
6
|
//#region extensions/signal/src/aliases.ts
|
|
8
7
|
function normalizeAliasKey(raw) {
|
|
9
8
|
const trimmed = raw.trim();
|
|
@@ -152,10 +151,4 @@ const signalApproval = createChannelApprovalAuth({
|
|
|
152
151
|
const getSignalApprovalApprovers = signalApproval.resolveApprovers;
|
|
153
152
|
const signalApprovalAuth = signalApproval.approvalAuth;
|
|
154
153
|
//#endregion
|
|
155
|
-
|
|
156
|
-
const { setRuntime: setSignalRuntime, tryGetRuntime: getOptionalSignalRuntime } = createPluginRuntimeStore({
|
|
157
|
-
pluginId: "signal",
|
|
158
|
-
errorMessage: "Signal runtime not initialized"
|
|
159
|
-
});
|
|
160
|
-
//#endregion
|
|
161
|
-
export { listSignalAliasDirectoryEntries as a, signalApprovalAuth as i, setSignalRuntime as n, resolveSignalTarget as o, getSignalApprovalApprovers as r, getOptionalSignalRuntime as t };
|
|
154
|
+
export { resolveSignalTarget as i, signalApprovalAuth as n, listSignalAliasDirectoryEntries as r, getSignalApprovalApprovers as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as resolveDefaultSignalAccountId } from "./accounts-
|
|
1
|
+
import { r as resolveDefaultSignalAccountId } from "./accounts-DO4HMqaK.js";
|
|
2
2
|
import { d as normalizeSignalMessagingTarget } from "./identity-BQ4OzXXk.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { r as sendTypingSignal, t as sendMessageSignal } from "./send-
|
|
3
|
+
import { i as resolveSignalTarget } from "./approval-auth-BY6uuApE.js";
|
|
4
|
+
import { a as registerSignalApprovalReactionTarget, c as resolveSignalApprovalTargetAuthorKeys, l as unregisterSignalApprovalReactionTarget, r as hasSignalApprovalReactionApprovers, s as resolveSignalApprovalConversationKey } from "./approval-reactions-cs3Ox9Ow.js";
|
|
5
|
+
import { r as sendTypingSignal, t as sendMessageSignal } from "./send-BNl5folj.js";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
7
7
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
8
8
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
@@ -1,44 +1,17 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
2
|
import { d as normalizeSignalMessagingTarget, l as looksLikeUuid } from "./identity-BQ4OzXXk.js";
|
|
3
|
-
import { i as
|
|
3
|
+
import { i as resolveSignalTarget, n as signalApprovalAuth, t as getSignalApprovalApprovers } from "./approval-auth-BY6uuApE.js";
|
|
4
|
+
import { i as getOptionalSignalRuntime } from "./transport-detection-D_M79R5f.js";
|
|
4
5
|
import { createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
|
|
5
6
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
6
7
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
-
import { addApprovalReactionHintToText,
|
|
8
|
+
import { addApprovalReactionHintToText, createApprovalReactionTargetStore, hasApprovalReactionHintText, listApprovalReactionBindings, readApprovalReactionDecisionList, resolveTypedApprovalReactionTarget } from "openclaw/plugin-sdk/approval-reaction-runtime";
|
|
8
9
|
import { normalizeE164 } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
9
10
|
import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
|
|
10
11
|
import { getExecApprovalReplyMetadata } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
11
|
-
import { matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
|
|
12
12
|
import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
addSignalApprovalReactionHintToStructuredPayload: () => addSignalApprovalReactionHintToStructuredPayload,
|
|
16
|
-
addSignalApprovalReactionHintToText: () => addSignalApprovalReactionHintToText,
|
|
17
|
-
appendSignalApprovalReactionHintForOutboundMessage: () => appendSignalApprovalReactionHintForOutboundMessage,
|
|
18
|
-
buildSignalApprovalReactionHint: () => buildSignalApprovalReactionHint,
|
|
19
|
-
clearSignalApprovalReactionTargetsForTest: () => clearSignalApprovalReactionTargetsForTest,
|
|
20
|
-
hasSignalApprovalReactionApprovers: () => hasSignalApprovalReactionApprovers,
|
|
21
|
-
maybeResolveSignalApprovalReaction: () => maybeResolveSignalApprovalReaction,
|
|
22
|
-
registerSignalApprovalReactionTarget: () => registerSignalApprovalReactionTarget,
|
|
23
|
-
registerSignalApprovalReactionTargetForDeliveredPayload: () => registerSignalApprovalReactionTargetForDeliveredPayload,
|
|
24
|
-
registerSignalApprovalReactionTargetForOutboundMessage: () => registerSignalApprovalReactionTargetForOutboundMessage,
|
|
25
|
-
resolveSignalApprovalConversationKey: () => resolveSignalApprovalConversationKey,
|
|
26
|
-
resolveSignalApprovalReactionTargetWithPersistence: () => resolveSignalApprovalReactionTargetWithPersistence,
|
|
27
|
-
resolveSignalApprovalTargetAuthorKeys: () => resolveSignalApprovalTargetAuthorKeys,
|
|
28
|
-
unregisterSignalApprovalReactionTarget: () => unregisterSignalApprovalReactionTarget
|
|
29
|
-
});
|
|
30
|
-
const PERSISTENT_NAMESPACE = "signal.approval-reactions.v2";
|
|
31
|
-
const PERSISTENT_MAX_ENTRIES = 1e3;
|
|
32
|
-
const DEFAULT_REACTION_TARGET_TTL_MS = 1440 * 60 * 1e3;
|
|
33
|
-
const loadResolveApprovalOverGateway = createLazyRuntimeSurface(() => import("openclaw/plugin-sdk/approval-gateway-runtime"), (runtime) => runtime.resolveApprovalOverGateway);
|
|
34
|
-
const signalApprovalReactionTargets = createApprovalReactionTargetStore({
|
|
35
|
-
namespace: PERSISTENT_NAMESPACE,
|
|
36
|
-
maxEntries: PERSISTENT_MAX_ENTRIES,
|
|
37
|
-
defaultTtlMs: DEFAULT_REACTION_TARGET_TTL_MS,
|
|
38
|
-
openStore: (storeParams) => getOptionalSignalRuntime()?.state.openKeyedStore(storeParams),
|
|
39
|
-
logPersistentError: createPluginStateErrorReporter(getOptionalSignalRuntime, "signal", "approval-reaction-state", "Signal persistent approval reaction state failed"),
|
|
40
|
-
readPersistedTarget
|
|
41
|
-
});
|
|
13
|
+
import { matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
|
|
14
|
+
//#region extensions/signal/src/approval-reaction-routes.ts
|
|
42
15
|
function resolveApprovalForwardingConfig(params) {
|
|
43
16
|
return params.approvalKind === "plugin" ? params.cfg.approvals?.plugin : params.cfg.approvals?.exec;
|
|
44
17
|
}
|
|
@@ -115,6 +88,54 @@ function isSignalApprovalReactionRouteStillEnabled(params) {
|
|
|
115
88
|
route: params.target.route
|
|
116
89
|
});
|
|
117
90
|
}
|
|
91
|
+
function buildTargetRoute(params) {
|
|
92
|
+
const to = resolveSignalApprovalRouteTarget({
|
|
93
|
+
cfg: params.cfg,
|
|
94
|
+
accountId: params.accountId,
|
|
95
|
+
to: params.to
|
|
96
|
+
});
|
|
97
|
+
if (!to) return null;
|
|
98
|
+
const route = {
|
|
99
|
+
deliveryMode: "target",
|
|
100
|
+
to,
|
|
101
|
+
...normalizeOptionalString(params.accountId) ? { accountId: normalizeOptionalString(params.accountId) } : {},
|
|
102
|
+
...normalizeOptionalString(params.agentId) ? { agentId: normalizeOptionalString(params.agentId) } : {},
|
|
103
|
+
...normalizeOptionalString(params.sessionKey) ? { sessionKey: normalizeOptionalString(params.sessionKey) } : {}
|
|
104
|
+
};
|
|
105
|
+
return isSignalApprovalReactionRouteStillEnabled({
|
|
106
|
+
cfg: params.cfg,
|
|
107
|
+
target: {
|
|
108
|
+
approvalKind: params.approvalKind,
|
|
109
|
+
route
|
|
110
|
+
}
|
|
111
|
+
}) ? route : null;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region extensions/signal/src/approval-reactions.ts
|
|
115
|
+
var approval_reactions_exports = /* @__PURE__ */ __exportAll({
|
|
116
|
+
addSignalApprovalReactionHintToStructuredPayload: () => addSignalApprovalReactionHintToStructuredPayload,
|
|
117
|
+
clearSignalApprovalReactionTargetsForTest: () => clearSignalApprovalReactionTargetsForTest,
|
|
118
|
+
hasSignalApprovalReactionApprovers: () => hasSignalApprovalReactionApprovers,
|
|
119
|
+
maybeResolveSignalApprovalReaction: () => maybeResolveSignalApprovalReaction,
|
|
120
|
+
registerSignalApprovalReactionTarget: () => registerSignalApprovalReactionTarget,
|
|
121
|
+
registerSignalApprovalReactionTargetForDeliveredPayload: () => registerSignalApprovalReactionTargetForDeliveredPayload,
|
|
122
|
+
resolveSignalApprovalConversationKey: () => resolveSignalApprovalConversationKey,
|
|
123
|
+
resolveSignalApprovalReactionTargetWithPersistence: () => resolveSignalApprovalReactionTargetWithPersistence,
|
|
124
|
+
resolveSignalApprovalTargetAuthorKeys: () => resolveSignalApprovalTargetAuthorKeys,
|
|
125
|
+
unregisterSignalApprovalReactionTarget: () => unregisterSignalApprovalReactionTarget
|
|
126
|
+
});
|
|
127
|
+
const PERSISTENT_NAMESPACE = "signal.approval-reactions.v2";
|
|
128
|
+
const PERSISTENT_MAX_ENTRIES = 1e3;
|
|
129
|
+
const DEFAULT_REACTION_TARGET_TTL_MS = 1440 * 60 * 1e3;
|
|
130
|
+
const loadResolveApprovalOverGateway = createLazyRuntimeSurface(() => import("openclaw/plugin-sdk/approval-gateway-runtime"), (runtime) => runtime.resolveApprovalOverGateway);
|
|
131
|
+
const signalApprovalReactionTargets = createApprovalReactionTargetStore({
|
|
132
|
+
namespace: PERSISTENT_NAMESPACE,
|
|
133
|
+
maxEntries: PERSISTENT_MAX_ENTRIES,
|
|
134
|
+
defaultTtlMs: DEFAULT_REACTION_TARGET_TTL_MS,
|
|
135
|
+
openStore: (storeParams) => getOptionalSignalRuntime()?.state.openKeyedStore(storeParams),
|
|
136
|
+
logPersistentError: createPluginStateErrorReporter(getOptionalSignalRuntime, "signal", "approval-reaction-state", "Signal persistent approval reaction state failed"),
|
|
137
|
+
readPersistedTarget
|
|
138
|
+
});
|
|
118
139
|
function resolveSignalApprovalConversationKey(to) {
|
|
119
140
|
return normalizeSignalMessagingTarget(to) ?? null;
|
|
120
141
|
}
|
|
@@ -154,7 +175,9 @@ function buildReactionTargetKey(params) {
|
|
|
154
175
|
}
|
|
155
176
|
function readPersistedTarget(target) {
|
|
156
177
|
const value = target;
|
|
157
|
-
if (!value || typeof value.approvalId !== "string" || value.approvalKind !== "exec" && value.approvalKind !== "plugin" || !value.route || value.route.deliveryMode !== "session" && value.route.deliveryMode !== "target" || !Array.isArray(value.targetAuthorKeys)
|
|
178
|
+
if (!value || typeof value.approvalId !== "string" || value.approvalKind !== "exec" && value.approvalKind !== "plugin" || !value.route || value.route.deliveryMode !== "session" && value.route.deliveryMode !== "target" || !Array.isArray(value.targetAuthorKeys)) return null;
|
|
179
|
+
const allowedDecisions = readApprovalReactionDecisionList(value.allowedDecisions);
|
|
180
|
+
if (!allowedDecisions) return null;
|
|
158
181
|
const targetRouteTo = value.route.deliveryMode === "target" && typeof value.route.to === "string" ? normalizeSignalMessagingTarget(value.route.to) : null;
|
|
159
182
|
if (value.route.deliveryMode === "target" && !targetRouteTo) return null;
|
|
160
183
|
const route = value.route.deliveryMode === "target" ? {
|
|
@@ -171,89 +194,11 @@ function readPersistedTarget(target) {
|
|
|
171
194
|
return {
|
|
172
195
|
approvalId: value.approvalId,
|
|
173
196
|
approvalKind: value.approvalKind,
|
|
174
|
-
allowedDecisions
|
|
197
|
+
allowedDecisions,
|
|
175
198
|
targetAuthorKeys: value.targetAuthorKeys,
|
|
176
199
|
route
|
|
177
200
|
};
|
|
178
201
|
}
|
|
179
|
-
function listSignalApprovalReactionBindings(allowedDecisions) {
|
|
180
|
-
return listApprovalReactionBindings({ allowedDecisions });
|
|
181
|
-
}
|
|
182
|
-
function buildSignalApprovalReactionHint(allowedDecisions) {
|
|
183
|
-
return buildApprovalReactionHint({ allowedDecisions });
|
|
184
|
-
}
|
|
185
|
-
function addSignalApprovalReactionHintToText(params) {
|
|
186
|
-
return addApprovalReactionHintToText(params);
|
|
187
|
-
}
|
|
188
|
-
function resolveStandaloneApprovalPromptKind(text) {
|
|
189
|
-
const firstLine = text.split(/\r?\n/).map((line) => line.replace(/\*\*/g, "").trim()).find(Boolean);
|
|
190
|
-
if (/^(?:🔒\s*)?Exec approval required$/.test(firstLine ?? "")) return "exec";
|
|
191
|
-
if (/^(?:(?:🛡️|🛡|🚨|ℹ️|ℹ)\s*)?Plugin approval required$/.test(firstLine ?? "")) return "plugin";
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
function isStandaloneApprovalPromptText(text) {
|
|
195
|
-
return resolveStandaloneApprovalPromptKind(text) !== null;
|
|
196
|
-
}
|
|
197
|
-
function extractSignalApprovalPromptBinding(text) {
|
|
198
|
-
const approvalKind = resolveStandaloneApprovalPromptKind(text);
|
|
199
|
-
return approvalKind ? extractApprovalReactionPromptBinding({
|
|
200
|
-
text,
|
|
201
|
-
approvalKind,
|
|
202
|
-
replyInstructionOnly: true
|
|
203
|
-
}) : null;
|
|
204
|
-
}
|
|
205
|
-
function buildTargetRoute(params) {
|
|
206
|
-
const to = resolveSignalApprovalRouteTarget({
|
|
207
|
-
cfg: params.cfg,
|
|
208
|
-
accountId: params.accountId,
|
|
209
|
-
to: params.to
|
|
210
|
-
});
|
|
211
|
-
if (!to) return null;
|
|
212
|
-
const route = {
|
|
213
|
-
deliveryMode: "target",
|
|
214
|
-
to,
|
|
215
|
-
...normalizeOptionalString(params.accountId) ? { accountId: normalizeOptionalString(params.accountId) } : {},
|
|
216
|
-
...normalizeOptionalString(params.agentId) ? { agentId: normalizeOptionalString(params.agentId) } : {},
|
|
217
|
-
...normalizeOptionalString(params.sessionKey) ? { sessionKey: normalizeOptionalString(params.sessionKey) } : {}
|
|
218
|
-
};
|
|
219
|
-
return isSignalApprovalReactionRouteStillEnabled({
|
|
220
|
-
cfg: params.cfg,
|
|
221
|
-
target: {
|
|
222
|
-
approvalKind: params.approvalKind,
|
|
223
|
-
route
|
|
224
|
-
}
|
|
225
|
-
}) ? route : null;
|
|
226
|
-
}
|
|
227
|
-
function shouldAppendSignalApprovalReactionHintForOutboundMessage(params) {
|
|
228
|
-
const binding = extractSignalApprovalPromptBinding(params.text);
|
|
229
|
-
if (!binding) return false;
|
|
230
|
-
if (resolveSignalApprovalTargetAuthorKeys(params).length === 0) return false;
|
|
231
|
-
if (!hasSignalApprovalReactionApprovers({
|
|
232
|
-
cfg: params.cfg,
|
|
233
|
-
accountId: params.accountId
|
|
234
|
-
})) return false;
|
|
235
|
-
return Boolean(buildTargetRoute({
|
|
236
|
-
cfg: params.cfg,
|
|
237
|
-
accountId: params.accountId,
|
|
238
|
-
to: params.to,
|
|
239
|
-
approvalId: binding.approvalId,
|
|
240
|
-
approvalKind: binding.approvalKind,
|
|
241
|
-
agentId: params.agentId,
|
|
242
|
-
sessionKey: params.sessionKey
|
|
243
|
-
}));
|
|
244
|
-
}
|
|
245
|
-
function appendSignalApprovalReactionHintForOutboundMessage(params) {
|
|
246
|
-
if (!isStandaloneApprovalPromptText(params.text)) return params.text;
|
|
247
|
-
const binding = extractSignalApprovalPromptBinding(params.text);
|
|
248
|
-
if (!binding || !shouldAppendSignalApprovalReactionHintForOutboundMessage({
|
|
249
|
-
...params,
|
|
250
|
-
text: params.text
|
|
251
|
-
})) return params.text;
|
|
252
|
-
return addSignalApprovalReactionHintToText({
|
|
253
|
-
text: params.text,
|
|
254
|
-
allowedDecisions: binding.allowedDecisions
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
202
|
function hasSignalApprovalReactionApprovers(params) {
|
|
258
203
|
return getSignalApprovalApprovers(params).length > 0;
|
|
259
204
|
}
|
|
@@ -261,7 +206,7 @@ function registerSignalApprovalReactionTarget(params) {
|
|
|
261
206
|
const key = buildReactionTargetKey(params);
|
|
262
207
|
const approvalId = params.approvalId.trim();
|
|
263
208
|
const targetAuthorKeys = Array.from(new Set(params.targetAuthorKeys.map((entry) => normalizeSignalApprovalTargetAuthorKey(entry)).filter((entry) => Boolean(entry))));
|
|
264
|
-
const allowedDecisions =
|
|
209
|
+
const allowedDecisions = listApprovalReactionBindings({ allowedDecisions: params.allowedDecisions }).map((binding) => binding.decision);
|
|
265
210
|
if (!params.routeAllowed || params.approvalKind !== "exec" && params.approvalKind !== "plugin" || !key || !approvalId || allowedDecisions.length === 0) return null;
|
|
266
211
|
if (targetAuthorKeys.length === 0) return null;
|
|
267
212
|
const route = params.route.deliveryMode === "target" ? {
|
|
@@ -301,14 +246,13 @@ function addSignalApprovalReactionHintToStructuredPayload(params) {
|
|
|
301
246
|
cfg: params.cfg,
|
|
302
247
|
accountId: params.accountId,
|
|
303
248
|
to: params.to,
|
|
304
|
-
approvalId: metadata.approvalId,
|
|
305
249
|
approvalKind: metadata.approvalKind,
|
|
306
250
|
agentId: metadata.agentId,
|
|
307
251
|
sessionKey: metadata.sessionKey
|
|
308
252
|
}) || !params.payload.text) return null;
|
|
309
253
|
return {
|
|
310
254
|
...params.payload,
|
|
311
|
-
text:
|
|
255
|
+
text: addApprovalReactionHintToText({
|
|
312
256
|
text: params.payload.text,
|
|
313
257
|
allowedDecisions: metadata.allowedDecisions
|
|
314
258
|
})
|
|
@@ -345,7 +289,6 @@ function registerSignalApprovalReactionTargetForDeliveredPayload(params) {
|
|
|
345
289
|
cfg: params.cfg,
|
|
346
290
|
accountId: params.target.accountId,
|
|
347
291
|
to: params.target.to,
|
|
348
|
-
approvalId: metadata.approvalId,
|
|
349
292
|
approvalKind: metadata.approvalKind,
|
|
350
293
|
agentId: metadata.agentId,
|
|
351
294
|
sessionKey: metadata.sessionKey
|
|
@@ -371,41 +314,6 @@ function registerSignalApprovalReactionTargetForDeliveredPayload(params) {
|
|
|
371
314
|
})) || registered;
|
|
372
315
|
return registered;
|
|
373
316
|
}
|
|
374
|
-
function registerSignalApprovalReactionTargetForOutboundMessage(params) {
|
|
375
|
-
if (!isStandaloneApprovalPromptText(params.text)) return false;
|
|
376
|
-
const binding = extractSignalApprovalPromptBinding(params.text);
|
|
377
|
-
if (!binding) return false;
|
|
378
|
-
if (!hasSignalApprovalReactionApprovers({
|
|
379
|
-
cfg: params.cfg,
|
|
380
|
-
accountId: params.accountId
|
|
381
|
-
})) return false;
|
|
382
|
-
const targetAuthorKeys = resolveSignalApprovalTargetAuthorKeys(params);
|
|
383
|
-
if (targetAuthorKeys.length === 0) return false;
|
|
384
|
-
const conversationKey = resolveSignalApprovalConversationKey(params.to);
|
|
385
|
-
if (!conversationKey) return false;
|
|
386
|
-
const route = buildTargetRoute({
|
|
387
|
-
cfg: params.cfg,
|
|
388
|
-
accountId: params.accountId,
|
|
389
|
-
to: params.to,
|
|
390
|
-
approvalId: binding.approvalId,
|
|
391
|
-
approvalKind: binding.approvalKind,
|
|
392
|
-
agentId: params.agentId,
|
|
393
|
-
sessionKey: params.sessionKey
|
|
394
|
-
});
|
|
395
|
-
if (!route) return false;
|
|
396
|
-
return Boolean(registerSignalApprovalReactionTarget({
|
|
397
|
-
accountId: params.accountId,
|
|
398
|
-
conversationKey,
|
|
399
|
-
messageId: params.messageId,
|
|
400
|
-
approvalId: binding.approvalId,
|
|
401
|
-
approvalKind: binding.approvalKind,
|
|
402
|
-
allowedDecisions: binding.allowedDecisions,
|
|
403
|
-
targetAuthorKeys,
|
|
404
|
-
route,
|
|
405
|
-
routeAllowed: true,
|
|
406
|
-
ttlMs: params.ttlMs
|
|
407
|
-
}));
|
|
408
|
-
}
|
|
409
317
|
function unregisterSignalApprovalReactionTarget(params) {
|
|
410
318
|
const key = buildReactionTargetKey(params);
|
|
411
319
|
if (!key) return;
|
|
@@ -520,4 +428,4 @@ function clearSignalApprovalReactionTargetsForTest() {
|
|
|
520
428
|
loadResolveApprovalOverGateway.clear();
|
|
521
429
|
}
|
|
522
430
|
//#endregion
|
|
523
|
-
export {
|
|
431
|
+
export { registerSignalApprovalReactionTarget as a, resolveSignalApprovalTargetAuthorKeys as c, maybeResolveSignalApprovalReaction as i, unregisterSignalApprovalReactionTarget as l, approval_reactions_exports as n, registerSignalApprovalReactionTargetForDeliveredPayload as o, hasSignalApprovalReactionApprovers as r, resolveSignalApprovalConversationKey as s, addSignalApprovalReactionHintToStructuredPayload as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as signalPlugin } from "./channel-
|
|
1
|
+
import { t as signalPlugin } from "./channel-zIopSllO.js";
|
|
2
2
|
export { signalPlugin };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as isSignalManagedNativeConnectionUrlForBind, i as assignSignalManagedNativePort, l as normalizeSignalTransportHost, o as isValidSignalManagedNativePort, r as allocateSignalManagedNativePort, s as resolveLocalSignalTransportPort, u as normalizeSignalTransportUrl } from "./transport-policy-DxvSMHp9.js";
|
|
2
|
-
import { a as resolveSignalAccountConfig, i as resolveSignalAccount, n as listSignalAccountIds, o as resolveSignalReplyToMode, r as resolveDefaultSignalAccountId, s as resolveSignalTransport } from "./accounts-
|
|
2
|
+
import { a as resolveSignalAccountConfig, i as resolveSignalAccount, n as listSignalAccountIds, o as resolveSignalReplyToMode, r as resolveDefaultSignalAccountId, s as resolveSignalTransport } from "./accounts-DO4HMqaK.js";
|
|
3
3
|
import { c as resolveSignalSender, d as normalizeSignalMessagingTarget, l as looksLikeUuid, o as resolveSignalPeerId, s as resolveSignalRecipient, u as looksLikeSignalTargetId } from "./identity-BQ4OzXXk.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { i as resolveSignalTarget, r as listSignalAliasDirectoryEntries } from "./approval-auth-BY6uuApE.js";
|
|
5
|
+
import { c as resolveSignalReactionLevel, d as markdownToSignalTextChunks, l as formatSignalMediaText, m as signalApprovalCapability, o as materializeSignalPresentationFallback, p as shouldSuppressLocalSignalExecApprovalPrompt, r as resolveSignalReplyContextWithPersistence, s as signalMessageActions, t as detectSignalTransport } from "./transport-detection-D_M79R5f.js";
|
|
6
6
|
import { i as migrateLegacySignalTransportConfig, n as normalizeCompatibilityConfig, r as clearLegacySignalTransportFieldsForAccount } from "./doctor-contract-api-Dnp5eQQJ.js";
|
|
7
7
|
import { t as SignalChannelConfigSchema } from "./config-schema-CkMIK7zp.js";
|
|
8
8
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
@@ -570,7 +570,7 @@ function createSignalSetupWizardProxy(loadWizard) {
|
|
|
570
570
|
const signalDoctor = {
|
|
571
571
|
normalizeCompatibilityConfig,
|
|
572
572
|
cleanStaleConfig: async ({ cfg }) => {
|
|
573
|
-
const { detectSignalTransport } = await import("./transport-detection.runtime-
|
|
573
|
+
const { detectSignalTransport } = await import("./transport-detection.runtime-DKuuIHvf.js");
|
|
574
574
|
return await migrateLegacySignalTransportConfig({
|
|
575
575
|
cfg,
|
|
576
576
|
detect: detectSignalTransport
|
|
@@ -581,7 +581,7 @@ const signalDoctor = {
|
|
|
581
581
|
//#region extensions/signal/src/shared.ts
|
|
582
582
|
const SIGNAL_CHANNEL = "signal";
|
|
583
583
|
async function loadSignalChannelRuntime() {
|
|
584
|
-
return await import("./channel.runtime-
|
|
584
|
+
return await import("./channel.runtime-CpDBElG8.js");
|
|
585
585
|
}
|
|
586
586
|
const signalSetupWizard = createSignalSetupWizardProxy(async () => (await loadSignalChannelRuntime()).signalSetupWizard);
|
|
587
587
|
const signalConfigAdapter = {
|
|
@@ -627,6 +627,7 @@ const signalSecurityAdapter = createRestrictSendersChannelSecurity({
|
|
|
627
627
|
groupPolicyPath: "channels.signal.groupPolicy",
|
|
628
628
|
groupAllowFromPath: "channels.signal.groupAllowFrom",
|
|
629
629
|
mentionGated: false,
|
|
630
|
+
findingTitle: "Signal security warning",
|
|
630
631
|
policyPathSuffix: "dmPolicy",
|
|
631
632
|
normalizeDmEntry: (raw) => normalizeE164(raw.replace(/^signal:/i, "").trim())
|
|
632
633
|
});
|
|
@@ -665,10 +666,10 @@ function createSignalPluginBase(params) {
|
|
|
665
666
|
}
|
|
666
667
|
//#endregion
|
|
667
668
|
//#region extensions/signal/src/channel.ts
|
|
668
|
-
const loadSignalMonitorModule = createLazyRuntimeModule(() => import("./monitor-
|
|
669
|
-
const loadSignalProbeModule = createLazyRuntimeModule(() => import("./probe-
|
|
670
|
-
const loadSignalSendRuntime = createLazyRuntimeModule(() => import("./send.runtime-
|
|
671
|
-
const loadSignalApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-
|
|
669
|
+
const loadSignalMonitorModule = createLazyRuntimeModule(() => import("./monitor-BLFIkpH0.js").then((n) => n.n));
|
|
670
|
+
const loadSignalProbeModule = createLazyRuntimeModule(() => import("./probe-B0E_cXQw.js").then((n) => n.n));
|
|
671
|
+
const loadSignalSendRuntime = createLazyRuntimeModule(() => import("./send.runtime-DnMoKk27.js"));
|
|
672
|
+
const loadSignalApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-cs3Ox9Ow.js").then((n) => n.n));
|
|
672
673
|
async function resolveSignalSendContext(params) {
|
|
673
674
|
return {
|
|
674
675
|
send: resolveOutboundSendDep(params.deps, "signal") ?? (await loadSignalSendRuntime()).sendMessageSignal,
|
|
@@ -748,6 +749,7 @@ function attachSignalVisibleText(result, visibleText) {
|
|
|
748
749
|
...result,
|
|
749
750
|
meta: {
|
|
750
751
|
...meta,
|
|
752
|
+
visibleText,
|
|
751
753
|
signalVisibleText: visibleText
|
|
752
754
|
}
|
|
753
755
|
};
|
|
@@ -756,7 +758,10 @@ const signalMessageAdapter = defineChannelMessageAdapter({
|
|
|
756
758
|
id: "signal",
|
|
757
759
|
durableFinal: { capabilities: {
|
|
758
760
|
text: true,
|
|
759
|
-
media: true
|
|
761
|
+
media: true,
|
|
762
|
+
payload: true,
|
|
763
|
+
replyTo: true,
|
|
764
|
+
messageSendingHooks: true
|
|
760
765
|
} },
|
|
761
766
|
send: {
|
|
762
767
|
text: sendSignalOutbound,
|
|
@@ -810,14 +815,15 @@ async function sendFormattedSignalText(ctx) {
|
|
|
810
815
|
text: ctx.text,
|
|
811
816
|
styles: []
|
|
812
817
|
}];
|
|
818
|
+
const effectiveReplyToMode = ctx.replyToMode ?? resolveSignalReplyToMode({
|
|
819
|
+
cfg: ctx.cfg,
|
|
820
|
+
accountId: ctx.accountId,
|
|
821
|
+
chatType: inferSignalTargetChatType(to)
|
|
822
|
+
});
|
|
813
823
|
const nextReplyToId = createReplyToFanout({
|
|
814
824
|
replyToId: ctx.replyToId,
|
|
815
825
|
replyToIdSource: ctx.replyToIdSource,
|
|
816
|
-
replyToMode:
|
|
817
|
-
cfg: ctx.cfg,
|
|
818
|
-
accountId: ctx.accountId,
|
|
819
|
-
chatType: inferSignalTargetChatType(to)
|
|
820
|
-
})
|
|
826
|
+
replyToMode: effectiveReplyToMode
|
|
821
827
|
});
|
|
822
828
|
const results = [];
|
|
823
829
|
for (const chunk of chunks) {
|
|
@@ -890,7 +896,7 @@ async function registerDeliveredSignalApprovalPayloadForReactions(params) {
|
|
|
890
896
|
const targetAuthor = normalizeOptionalString(account.config.account);
|
|
891
897
|
const targetAuthorUuid = normalizeOptionalString(account.config.accountUuid);
|
|
892
898
|
if (!targetAuthor && !targetAuthorUuid) return;
|
|
893
|
-
const { registerSignalQuestionReactionTargetForDeliveredPayload } = await import("./question-reactions-
|
|
899
|
+
const { registerSignalQuestionReactionTargetForDeliveredPayload } = await import("./question-reactions-BaatFqJ7.js").then((n) => n.n);
|
|
894
900
|
registerSignalQuestionReactionTargetForDeliveredPayload({
|
|
895
901
|
cfg: params.cfg,
|
|
896
902
|
target: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as resolveSignalAccount, n as listSignalAccountIds } from "./accounts-
|
|
2
|
-
import { c as signalNumberTextInput, i as createSignalCliPathTextInput, o as signalCompletionNote, s as signalDmPolicy } from "./channel-
|
|
1
|
+
import { i as resolveSignalAccount, n as listSignalAccountIds } from "./accounts-DO4HMqaK.js";
|
|
2
|
+
import { c as signalNumberTextInput, i as createSignalCliPathTextInput, o as signalCompletionNote, s as signalDmPolicy } from "./channel-zIopSllO.js";
|
|
3
3
|
import { i as installSignalCli } from "./install-signal-cli-Cpiyk0k1.js";
|
|
4
4
|
import { detectBinary } from "openclaw/plugin-sdk/setup-tools";
|
|
5
5
|
import { createDetectedBinaryStatus, createSetupTranslator, setSetupChannelEnabled } from "openclaw/plugin-sdk/setup";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import {
|
|
2
|
+
import { l as normalizeSignalTransportHost } from "./transport-policy-DxvSMHp9.js";
|
|
3
|
+
import { i as resolveSignalAccount, o as resolveSignalReplyToMode } from "./accounts-DO4HMqaK.js";
|
|
3
4
|
import { a as normalizeSignalAllowRecipient, c as resolveSignalSender, d as normalizeSignalMessagingTarget, i as isSignalSenderAllowed, l as looksLikeUuid, n as formatSignalSenderDisplay, o as resolveSignalPeerId, r as formatSignalSenderId, s as resolveSignalRecipient, t as formatSignalPairingIdLine } from "./identity-BQ4OzXXk.js";
|
|
4
|
-
import {
|
|
5
|
-
import { i as materializeSignalPresentationFallback, n as registerSignalReplyContext, o as resolveSignalReactionLevel, s as formatSignalMediaText, u as isSignalNativeApprovalHandlerConfigured } from "./transport-detection-BItHawMq.js";
|
|
5
|
+
import { c as resolveSignalReactionLevel, f as isSignalNativeApprovalHandlerConfigured, i as getOptionalSignalRuntime, l as formatSignalMediaText, n as registerSignalReplyContext, o as materializeSignalPresentationFallback } from "./transport-detection-D_M79R5f.js";
|
|
6
6
|
import { n as signalRpcRequest, r as streamSignalEvents, t as signalCheck } from "./client-adapter-D9SNPaNx.js";
|
|
7
|
-
import { n as sendReactionSignal } from "./reaction-runtime-api-
|
|
8
|
-
import {
|
|
9
|
-
import { r as registerSignalQuestionReactionTargetForDeliveredPayload, t as maybeResolveSignalQuestionReaction } from "./question-reactions-
|
|
10
|
-
import { n as sendReadReceiptSignal, r as sendTypingSignal, t as sendMessageSignal } from "./send-
|
|
7
|
+
import { n as sendReactionSignal } from "./reaction-runtime-api-YGD6hhDh.js";
|
|
8
|
+
import { i as maybeResolveSignalApprovalReaction, o as registerSignalApprovalReactionTargetForDeliveredPayload, s as resolveSignalApprovalConversationKey, t as addSignalApprovalReactionHintToStructuredPayload } from "./approval-reactions-cs3Ox9Ow.js";
|
|
9
|
+
import { r as registerSignalQuestionReactionTargetForDeliveredPayload, t as maybeResolveSignalQuestionReaction } from "./question-reactions-BaatFqJ7.js";
|
|
10
|
+
import { n as sendReadReceiptSignal, r as sendTypingSignal, t as sendMessageSignal } from "./send-BNl5folj.js";
|
|
11
11
|
import { bindIngressLifecycleToReplyOptions, createChannelIngressError, createChannelIngressMonitor, createChannelMessageReplyPipeline, resolveChannelStreamingBlockEnabled } from "openclaw/plugin-sdk/channel-outbound";
|
|
12
12
|
import { createChannelPairingChallengeIssuer } from "openclaw/plugin-sdk/channel-pairing";
|
|
13
13
|
import { canonicalizeBase64, detectMime, estimateBase64DecodedBytes, kindFromMime, saveMediaBuffer } from "openclaw/plugin-sdk/media-runtime";
|
|
@@ -17,7 +17,7 @@ import { CHANNEL_APPROVAL_NATIVE_RUNTIME_CONTEXT_CAPABILITY } from "openclaw/plu
|
|
|
17
17
|
import { normalizeE164, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
18
18
|
import { buildChannelInboundEventContext, buildMentionRegexes, createChannelInboundDebouncer, filterChannelInboundQuoteContext, formatInboundEnvelope, formatInboundFromLabel, formatInboundMediaUnavailableText, hasVisibleInboundReplyDispatch, logInboundDrop, matchesMentionPatterns, readAgentRunTerminalOutcome, resolveEnvelopeFormatOptions, resolveInboundMentionDecision, resolveInboundSupplementalSenderAllowed, runChannelInboundEvent, shouldDebounceTextInbound, toHistoryMediaEntries, toInboundMediaFactsWithMetadata } from "openclaw/plugin-sdk/channel-inbound";
|
|
19
19
|
import { collectErrorGraphCandidates, formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
20
|
-
import { resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
20
|
+
import { ensurePortAvailable, extractErrorCode, formatErrorMessage as formatErrorMessage$1, resolvePinnedMainDmOwnerFromAllowlist } from "openclaw/plugin-sdk/security-runtime";
|
|
21
21
|
import { resolveChannelGroupPolicy, resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy";
|
|
22
22
|
import path from "node:path";
|
|
23
23
|
import { registerChannelRuntimeContext } from "openclaw/plugin-sdk/channel-runtime-context";
|
|
@@ -50,6 +50,47 @@ const SIGNAL_DAEMON_STOP_KILL_TIMEOUT_MS = 1500;
|
|
|
50
50
|
function formatSignalDaemonExit(exit) {
|
|
51
51
|
return `signal daemon exited (source=${exit.source} code=${exit.code ?? "null"} signal=${exit.signal ?? "null"})`;
|
|
52
52
|
}
|
|
53
|
+
function formatSignalDaemonEndpoint(httpHost, httpPort) {
|
|
54
|
+
return `${httpHost.includes(":") ? `[${httpHost}]` : httpHost}:${httpPort}`;
|
|
55
|
+
}
|
|
56
|
+
async function assertSignalDaemonEndpointAvailable(params) {
|
|
57
|
+
try {
|
|
58
|
+
await ensurePortAvailable(params.httpPort, params.httpHost, params.abortSignal);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (params.abortSignal?.aborted) throw params.abortSignal.reason;
|
|
61
|
+
if (!(extractErrorCode(error) === "EADDRINUSE" || error instanceof Error && error.name === "PortInUseError")) return;
|
|
62
|
+
const endpoint = formatSignalDaemonEndpoint(params.httpHost, params.httpPort);
|
|
63
|
+
throw new Error(`Signal managed native endpoint ${endpoint} is unavailable: ${formatErrorMessage$1(error)} Stop the conflicting service, configure this Signal account with a different transport.httpPort, or use external-native for an intentionally operator-managed daemon.`, { cause: error });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async function waitForSignalDaemonReady(params) {
|
|
67
|
+
await (params.waitForTransportReadyFn ?? waitForTransportReady)({
|
|
68
|
+
label: "signal daemon",
|
|
69
|
+
timeoutMs: Math.max(0, params.startupDeadlineMs - Date.now()),
|
|
70
|
+
logAfterMs: params.logAfterMs,
|
|
71
|
+
logIntervalMs: params.logIntervalMs,
|
|
72
|
+
pollIntervalMs: 150,
|
|
73
|
+
abortSignal: params.abortSignal,
|
|
74
|
+
runtime: params.runtime,
|
|
75
|
+
check: async () => {
|
|
76
|
+
const remainingMs = params.startupDeadlineMs - Date.now();
|
|
77
|
+
if (remainingMs <= 0) return {
|
|
78
|
+
ok: false,
|
|
79
|
+
error: "startup deadline exceeded"
|
|
80
|
+
};
|
|
81
|
+
const res = await signalCheck(params.baseUrl, Math.min(1e3, remainingMs));
|
|
82
|
+
if (Date.now() >= params.startupDeadlineMs) return {
|
|
83
|
+
ok: false,
|
|
84
|
+
error: "startup deadline exceeded"
|
|
85
|
+
};
|
|
86
|
+
if (res.ok) return { ok: true };
|
|
87
|
+
return {
|
|
88
|
+
ok: false,
|
|
89
|
+
error: res.error ?? (res.status ? `HTTP ${res.status}` : "unreachable")
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
53
94
|
function isRecoverableSignalCliReceiveException(line) {
|
|
54
95
|
return /\breceive exception:\s+.*\binvalid PreKey message:\s+decryption failed\b/i.test(line);
|
|
55
96
|
}
|
|
@@ -211,6 +252,68 @@ function createSignalDaemonLifecycle(params) {
|
|
|
211
252
|
};
|
|
212
253
|
}
|
|
213
254
|
//#endregion
|
|
255
|
+
//#region extensions/signal/src/native-reply.ts
|
|
256
|
+
function resolveSignalNativeReplyId(params) {
|
|
257
|
+
if (params.payload.replyToCurrent === false) return;
|
|
258
|
+
const payloadReplyToId = normalizeOptionalString(params.payload.replyToId);
|
|
259
|
+
const isExplicitCurrentReply = params.payload.replyToTag === true || params.payload.replyToCurrent === true;
|
|
260
|
+
if (!payloadReplyToId && !isExplicitCurrentReply && params.replyContext?.allowImplicitCurrentMessage === false) return;
|
|
261
|
+
const contextReplyToId = normalizeOptionalString(params.replyContext?.replyToId);
|
|
262
|
+
if (!contextReplyToId || payloadReplyToId && payloadReplyToId !== contextReplyToId) return;
|
|
263
|
+
return payloadReplyToId ?? contextReplyToId;
|
|
264
|
+
}
|
|
265
|
+
function isSignalStatusNoticePayload(payload) {
|
|
266
|
+
return Boolean(payload.isCompactionNotice || payload.isFallbackNotice || payload.isStatusNotice);
|
|
267
|
+
}
|
|
268
|
+
function createSignalNativeReplyIdPlan(params) {
|
|
269
|
+
const replyToId = resolveSignalNativeReplyId(params);
|
|
270
|
+
if (!replyToId) return {
|
|
271
|
+
peek: () => void 0,
|
|
272
|
+
use: () => void 0,
|
|
273
|
+
markSent: () => void 0
|
|
274
|
+
};
|
|
275
|
+
const isExplicitReply = params.payload.replyToTag === true || params.payload.replyToCurrent === true;
|
|
276
|
+
if (isSignalStatusNoticePayload(params.payload)) {
|
|
277
|
+
const resolve = params.replyToMode === "off" ? () => void 0 : () => replyToId;
|
|
278
|
+
return {
|
|
279
|
+
peek: resolve,
|
|
280
|
+
use: resolve,
|
|
281
|
+
markSent: () => void 0
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
if (isExplicitReply) {
|
|
285
|
+
const resolve = () => replyToId;
|
|
286
|
+
return {
|
|
287
|
+
peek: resolve,
|
|
288
|
+
use: resolve,
|
|
289
|
+
markSent: () => void 0
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
const planner = createReplyReferencePlanner({
|
|
293
|
+
replyToMode: params.replyToMode,
|
|
294
|
+
existingId: replyToId,
|
|
295
|
+
hasReplied: params.replyContext?.state?.hasReplied
|
|
296
|
+
});
|
|
297
|
+
const syncState = () => {
|
|
298
|
+
if (params.replyContext?.state) params.replyContext.state.hasReplied = planner.hasReplied();
|
|
299
|
+
};
|
|
300
|
+
return {
|
|
301
|
+
peek: () => planner.peek(),
|
|
302
|
+
use: () => {
|
|
303
|
+
const nextReplyToId = planner.use();
|
|
304
|
+
syncState();
|
|
305
|
+
return nextReplyToId;
|
|
306
|
+
},
|
|
307
|
+
markSent: () => {
|
|
308
|
+
planner.markSent();
|
|
309
|
+
syncState();
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function createSignalNativeReplyIdResolver(params) {
|
|
314
|
+
return createSignalNativeReplyIdPlan(params).use;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
214
317
|
//#region extensions/signal/src/monitor/access-policy.ts
|
|
215
318
|
const SIGNAL_UUID_KIND = "plugin:signal-uuid";
|
|
216
319
|
const SIGNAL_GROUP_KIND = "plugin:signal-group";
|
|
@@ -556,8 +659,7 @@ function resolveSignalStatusReactionTimestamp(params) {
|
|
|
556
659
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
557
660
|
}
|
|
558
661
|
function hasSignalStatusReplyDeliveryFailure(result) {
|
|
559
|
-
|
|
560
|
-
return (failedCounts?.tool ?? 0) > 0 || (failedCounts?.block ?? 0) > 0 || (failedCounts?.final ?? 0) > 0;
|
|
662
|
+
return Object.values(result.settledReceipt?.counts ?? {}).some((counts) => counts.failedBeforeSend > 0 || counts.failedAfterSend > 0);
|
|
561
663
|
}
|
|
562
664
|
function resolveSignalStatusReactionEmojis(emojis) {
|
|
563
665
|
if (emojis?.stallHard !== void 0) return emojis;
|
|
@@ -775,6 +877,7 @@ function createSignalEventHandler(deps) {
|
|
|
775
877
|
};
|
|
776
878
|
const dispatcherOptions = {
|
|
777
879
|
...replyPipeline,
|
|
880
|
+
propagateRetryableNoSendFailure: true,
|
|
778
881
|
humanDelay: resolveHumanDelayConfig(deps.cfg, route.agentId),
|
|
779
882
|
typingCallbacks
|
|
780
883
|
};
|
|
@@ -795,6 +898,32 @@ function createSignalEventHandler(deps) {
|
|
|
795
898
|
chatType: entry.isGroup ? "group" : "direct"
|
|
796
899
|
});
|
|
797
900
|
},
|
|
901
|
+
durable: (payload, info) => {
|
|
902
|
+
if (info.kind !== "final") return false;
|
|
903
|
+
const replyPlan = createSignalNativeReplyIdPlan({
|
|
904
|
+
payload,
|
|
905
|
+
replyContext: nativeReplyContext,
|
|
906
|
+
replyToMode
|
|
907
|
+
});
|
|
908
|
+
const send = async (to, text, options) => {
|
|
909
|
+
entry.turnAdoptionLifecycle?.abortSignal.throwIfAborted();
|
|
910
|
+
deps.abortSignal?.throwIfAborted();
|
|
911
|
+
const result = await sendMessageSignal(to, text, {
|
|
912
|
+
...options,
|
|
913
|
+
baseUrl: deps.baseUrl,
|
|
914
|
+
account: deps.account,
|
|
915
|
+
maxBytes: deps.mediaMaxBytes,
|
|
916
|
+
accountId: deps.accountId
|
|
917
|
+
});
|
|
918
|
+
replyPlan.markSent();
|
|
919
|
+
return result;
|
|
920
|
+
};
|
|
921
|
+
return {
|
|
922
|
+
deps: { signal: send },
|
|
923
|
+
replyToId: replyPlan.peek() ?? null,
|
|
924
|
+
replyToMode
|
|
925
|
+
};
|
|
926
|
+
},
|
|
798
927
|
onError: (err, info) => {
|
|
799
928
|
deps.runtime.error?.(danger(`signal ${info.kind} reply failed: ${String(err)}`));
|
|
800
929
|
}
|
|
@@ -823,6 +952,7 @@ function createSignalEventHandler(deps) {
|
|
|
823
952
|
sessionKey: route.sessionKey
|
|
824
953
|
},
|
|
825
954
|
ctxPayload,
|
|
955
|
+
dispatchReplyFromConfig: deps.channelRuntime?.reply?.dispatchReplyFromConfig,
|
|
826
956
|
record: {
|
|
827
957
|
updateLastRoute: !entry.isGroup ? {
|
|
828
958
|
sessionKey: inboundLastRouteSessionKey,
|
|
@@ -994,7 +1124,7 @@ function createSignalEventHandler(deps) {
|
|
|
994
1124
|
if (!isSignalReplySessionInitConflictError(err)) throw err;
|
|
995
1125
|
if (deps.abortSignal?.aborted) return;
|
|
996
1126
|
await retrySignalInboundFlush(entries, admissionLifecycle, settle, err).catch(async (terminalError) => {
|
|
997
|
-
await
|
|
1127
|
+
await lifecycle?.onAbandoned();
|
|
998
1128
|
throw terminalError;
|
|
999
1129
|
});
|
|
1000
1130
|
}
|
|
@@ -1117,10 +1247,10 @@ function createSignalEventHandler(deps) {
|
|
|
1117
1247
|
});
|
|
1118
1248
|
return true;
|
|
1119
1249
|
}
|
|
1120
|
-
return async (event, turnAdoptionLifecycle) => {
|
|
1250
|
+
return async (event, turnAdoptionLifecycle, preparedPayload) => {
|
|
1121
1251
|
if (event.event !== "receive" || !event.data) return;
|
|
1122
|
-
let payload;
|
|
1123
|
-
try {
|
|
1252
|
+
let payload = preparedPayload ?? null;
|
|
1253
|
+
if (!preparedPayload) try {
|
|
1124
1254
|
payload = JSON.parse(event.data);
|
|
1125
1255
|
} catch (err) {
|
|
1126
1256
|
deps.runtime.error?.(`failed to parse event: ${String(err)}`);
|
|
@@ -1444,7 +1574,7 @@ const SignalIngressPermanentError = createChannelIngressError("SignalIngressPerm
|
|
|
1444
1574
|
function normalizeTimestamp(value) {
|
|
1445
1575
|
return asPositiveSafeInteger(value) ?? null;
|
|
1446
1576
|
}
|
|
1447
|
-
function
|
|
1577
|
+
function parseReceivePayload(event) {
|
|
1448
1578
|
if (event.event !== "receive" || !event.data) return null;
|
|
1449
1579
|
let parsed;
|
|
1450
1580
|
try {
|
|
@@ -1453,14 +1583,15 @@ function parseReceiveEnvelope(event) {
|
|
|
1453
1583
|
throw new SignalIngressPermanentError("parse-error", "Signal receive event contains invalid JSON", { cause: error });
|
|
1454
1584
|
}
|
|
1455
1585
|
if (!isRecord(parsed)) throw new SignalIngressPermanentError("parse-error", "Signal receive event must contain a JSON object");
|
|
1456
|
-
return
|
|
1586
|
+
return parsed;
|
|
1457
1587
|
}
|
|
1458
1588
|
function resolveDataMessage(envelope) {
|
|
1459
1589
|
if (isRecord(envelope.dataMessage)) return envelope.dataMessage;
|
|
1460
1590
|
return isRecord(envelope.editMessage?.dataMessage) ? envelope.editMessage.dataMessage : null;
|
|
1461
1591
|
}
|
|
1462
|
-
function inspectSignalIngressEvent(
|
|
1463
|
-
const
|
|
1592
|
+
function inspectSignalIngressEvent(prepared) {
|
|
1593
|
+
const payload = prepared[1] ??= parseReceivePayload(prepared[0]);
|
|
1594
|
+
const envelope = isRecord(payload?.envelope) ? payload.envelope : null;
|
|
1464
1595
|
if (!envelope || "syncMessage" in envelope) return null;
|
|
1465
1596
|
const dataMessage = resolveDataMessage(envelope);
|
|
1466
1597
|
const reactionMessage = isRecord(envelope.reactionMessage) ? envelope.reactionMessage : null;
|
|
@@ -1497,14 +1628,14 @@ async function startSignalIngressMonitor(params) {
|
|
|
1497
1628
|
const ingressQueue = queue;
|
|
1498
1629
|
const monitor = createChannelIngressMonitor({
|
|
1499
1630
|
queue: ingressQueue,
|
|
1500
|
-
inspect: (
|
|
1631
|
+
inspect: (prepared) => inspectSignalIngressEvent(prepared),
|
|
1501
1632
|
payload: {
|
|
1502
1633
|
version: 1,
|
|
1503
|
-
serialize: (event, { receivedAt }) => ({
|
|
1634
|
+
serialize: ([event], { receivedAt }) => ({
|
|
1504
1635
|
receivedAt,
|
|
1505
1636
|
event
|
|
1506
1637
|
}),
|
|
1507
|
-
deserialize: (body) => body.event,
|
|
1638
|
+
deserialize: (body) => [body.event, void 0],
|
|
1508
1639
|
encode: ({ body }) => ({
|
|
1509
1640
|
version: 1,
|
|
1510
1641
|
...body
|
|
@@ -1515,7 +1646,7 @@ async function startSignalIngressMonitor(params) {
|
|
|
1515
1646
|
}),
|
|
1516
1647
|
createClaimError: (_kind, claim) => new SignalIngressPermanentError("unsupported-event", `Signal ingress row ${claim.id} has an invalid payload`)
|
|
1517
1648
|
},
|
|
1518
|
-
deliver: (event, lifecycle) => params.dispatch(event, lifecycle),
|
|
1649
|
+
deliver: ([event, parsedPayload], lifecycle) => parsedPayload ? params.dispatch(event, lifecycle, parsedPayload) : void 0,
|
|
1519
1650
|
onDurableAdmission: async (_event, { facts }) => {
|
|
1520
1651
|
const { numberAliasEventId } = facts;
|
|
1521
1652
|
if (!numberAliasEventId) return;
|
|
@@ -1537,7 +1668,7 @@ async function startSignalIngressMonitor(params) {
|
|
|
1537
1668
|
monitor.start();
|
|
1538
1669
|
return {
|
|
1539
1670
|
receive: async (event) => {
|
|
1540
|
-
await monitor.admit(event);
|
|
1671
|
+
await monitor.admit([event, void 0]);
|
|
1541
1672
|
await monitor.waitForPumpIdle();
|
|
1542
1673
|
},
|
|
1543
1674
|
stop: monitor.stop,
|
|
@@ -1684,25 +1815,6 @@ function buildSignalReactionSystemEventText(params) {
|
|
|
1684
1815
|
const withTarget = params.targetLabel ? `${base} from ${params.targetLabel}` : base;
|
|
1685
1816
|
return params.groupLabel ? `${withTarget} in ${params.groupLabel}` : withTarget;
|
|
1686
1817
|
}
|
|
1687
|
-
async function waitForSignalDaemonReady(params) {
|
|
1688
|
-
await (params.waitForTransportReadyFn ?? waitForTransportReady)({
|
|
1689
|
-
label: "signal daemon",
|
|
1690
|
-
timeoutMs: params.timeoutMs,
|
|
1691
|
-
logAfterMs: params.logAfterMs,
|
|
1692
|
-
logIntervalMs: params.logIntervalMs,
|
|
1693
|
-
pollIntervalMs: 150,
|
|
1694
|
-
abortSignal: params.abortSignal,
|
|
1695
|
-
runtime: params.runtime,
|
|
1696
|
-
check: async () => {
|
|
1697
|
-
const res = await signalCheck(params.baseUrl, 1e3);
|
|
1698
|
-
if (res.ok) return { ok: true };
|
|
1699
|
-
return {
|
|
1700
|
-
ok: false,
|
|
1701
|
-
error: res.error ?? (res.status ? `HTTP ${res.status}` : "unreachable")
|
|
1702
|
-
};
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
}
|
|
1706
1818
|
const SIGNAL_ATTACHMENT_RPC_RESPONSE_HEADROOM_BYTES = 64 * 1024;
|
|
1707
1819
|
const SIGNAL_BASE64_OVERHEAD_NUMERATOR = 4;
|
|
1708
1820
|
const SIGNAL_BASE64_OVERHEAD_DENOMINATOR = 3;
|
|
@@ -1814,45 +1926,19 @@ async function deliverReplies(params) {
|
|
|
1814
1926
|
}
|
|
1815
1927
|
}
|
|
1816
1928
|
}
|
|
1817
|
-
function resolveSignalNativeReplyOptions(params) {
|
|
1818
|
-
if (params.payload.replyToCurrent === false) return {};
|
|
1819
|
-
const payloadReplyToId = normalizeOptionalString(params.payload.replyToId);
|
|
1820
|
-
const isExplicitCurrentReply = params.payload.replyToTag === true || params.payload.replyToCurrent === true;
|
|
1821
|
-
if (!payloadReplyToId && !isExplicitCurrentReply && params.replyContext?.allowImplicitCurrentMessage === false) return {};
|
|
1822
|
-
const contextReplyToId = normalizeOptionalString(params.replyContext?.replyToId);
|
|
1823
|
-
if (!contextReplyToId || payloadReplyToId && payloadReplyToId !== contextReplyToId) return {};
|
|
1824
|
-
const replyToId = payloadReplyToId ?? contextReplyToId;
|
|
1825
|
-
const replyToAuthor = normalizeOptionalString(params.replyContext?.author);
|
|
1826
|
-
if (!replyToAuthor) return { replyToId };
|
|
1827
|
-
return {
|
|
1828
|
-
replyToId,
|
|
1829
|
-
replyToAuthor,
|
|
1830
|
-
replyToBody: params.replyContext?.body ?? ""
|
|
1831
|
-
};
|
|
1832
|
-
}
|
|
1833
|
-
function isSignalStatusNoticePayload(payload) {
|
|
1834
|
-
return Boolean(payload.isCompactionNotice || payload.isFallbackNotice || payload.isStatusNotice);
|
|
1835
|
-
}
|
|
1836
1929
|
function createSignalNativeReplyResolver(params) {
|
|
1837
|
-
const
|
|
1838
|
-
if (!nativeReply.replyToId) return () => ({});
|
|
1839
|
-
const isExplicitReply = params.payload.replyToTag === true || params.payload.replyToCurrent === true;
|
|
1840
|
-
const isStatusNotice = isSignalStatusNoticePayload(params.payload);
|
|
1841
|
-
if (isStatusNotice && params.replyToMode === "off") return () => ({});
|
|
1842
|
-
if (isExplicitReply) return () => nativeReply;
|
|
1843
|
-
if (isStatusNotice) return () => nativeReply;
|
|
1844
|
-
const planner = createReplyReferencePlanner({
|
|
1845
|
-
replyToMode: params.replyToMode,
|
|
1846
|
-
existingId: nativeReply.replyToId,
|
|
1847
|
-
hasReplied: params.replyContext?.state?.hasReplied
|
|
1848
|
-
});
|
|
1930
|
+
const nextReplyToId = createSignalNativeReplyIdResolver(params);
|
|
1849
1931
|
return () => {
|
|
1850
|
-
const replyToId =
|
|
1851
|
-
if (
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
replyToId
|
|
1855
|
-
|
|
1932
|
+
const replyToId = nextReplyToId();
|
|
1933
|
+
if (!replyToId) return {};
|
|
1934
|
+
const replyToAuthor = normalizeOptionalString(params.replyContext?.author);
|
|
1935
|
+
return {
|
|
1936
|
+
replyToId,
|
|
1937
|
+
...replyToAuthor ? {
|
|
1938
|
+
replyToAuthor,
|
|
1939
|
+
replyToBody: params.replyContext?.body ?? ""
|
|
1940
|
+
} : {}
|
|
1941
|
+
};
|
|
1856
1942
|
};
|
|
1857
1943
|
}
|
|
1858
1944
|
async function monitorSignalProvider(opts = {}) {
|
|
@@ -1898,11 +1984,27 @@ async function monitorSignalProvider(opts = {}) {
|
|
|
1898
1984
|
const monitorTaskRunner = createSignalMonitorTaskRunner(runtime);
|
|
1899
1985
|
let daemonHandle = null;
|
|
1900
1986
|
let ingressMonitor;
|
|
1987
|
+
const startupDeadline = Date.now() + startupTimeoutMs;
|
|
1901
1988
|
if (autoStart) {
|
|
1902
1989
|
const cliPath = opts.cliPath ?? managedTransport?.cliPath ?? "signal-cli";
|
|
1903
1990
|
const configPath = normalizeOptionalString(opts.configPath) ?? normalizeOptionalString(managedTransport?.configPath);
|
|
1904
|
-
const httpHost = opts.httpHost ?? managedTransport?.httpHost ?? "127.0.0.1";
|
|
1991
|
+
const httpHost = normalizeSignalTransportHost(opts.httpHost ?? managedTransport?.httpHost ?? "127.0.0.1");
|
|
1905
1992
|
const httpPort = opts.httpPort ?? managedTransport?.httpPort ?? 8080;
|
|
1993
|
+
const startupTimeoutSignal = AbortSignal.timeout(startupTimeoutMs);
|
|
1994
|
+
const endpointProbeSignal = opts.abortSignal ? AbortSignal.any([opts.abortSignal, startupTimeoutSignal]) : startupTimeoutSignal;
|
|
1995
|
+
try {
|
|
1996
|
+
await assertSignalDaemonEndpointAvailable({
|
|
1997
|
+
httpHost,
|
|
1998
|
+
httpPort,
|
|
1999
|
+
abortSignal: endpointProbeSignal
|
|
2000
|
+
});
|
|
2001
|
+
} catch (error) {
|
|
2002
|
+
if (opts.abortSignal?.aborted) return;
|
|
2003
|
+
if (startupTimeoutSignal.aborted || Date.now() >= startupDeadline) throw new Error(`signal daemon startup timed out after ${startupTimeoutMs}ms while checking its endpoint`, { cause: error });
|
|
2004
|
+
throw error;
|
|
2005
|
+
}
|
|
2006
|
+
if (opts.abortSignal?.aborted) return;
|
|
2007
|
+
if (Date.now() >= startupDeadline) throw new Error(`signal daemon startup timed out after ${startupTimeoutMs}ms before starting`);
|
|
1906
2008
|
daemonHandle = spawnSignalDaemon({
|
|
1907
2009
|
cliPath,
|
|
1908
2010
|
...configPath ? { configPath } : {},
|
|
@@ -1924,7 +2026,7 @@ async function monitorSignalProvider(opts = {}) {
|
|
|
1924
2026
|
await waitForSignalDaemonReady({
|
|
1925
2027
|
baseUrl,
|
|
1926
2028
|
abortSignal: daemonLifecycle.abortSignal,
|
|
1927
|
-
|
|
2029
|
+
startupDeadlineMs: startupDeadline,
|
|
1928
2030
|
logAfterMs: 1e4,
|
|
1929
2031
|
logIntervalMs: 1e4,
|
|
1930
2032
|
runtime,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { t as detectSignalTransport } from "./transport-detection-
|
|
2
|
+
import { t as detectSignalTransport } from "./transport-detection-D_M79R5f.js";
|
|
3
3
|
import { n as signalRpcRequest, t as signalCheck } from "./client-adapter-D9SNPaNx.js";
|
|
4
4
|
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
5
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { i as resolveSignalTarget } from "./approval-auth-BY6uuApE.js";
|
|
3
|
+
import { c as resolveSignalApprovalTargetAuthorKeys, s as resolveSignalApprovalConversationKey } from "./approval-reactions-cs3Ox9Ow.js";
|
|
4
4
|
import { createQuestionReactionTargetStore, questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
5
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
6
6
|
//#region extensions/signal/src/question-reactions.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as resolveSignalAccount } from "./accounts-
|
|
1
|
+
import { i as resolveSignalAccount } from "./accounts-DO4HMqaK.js";
|
|
2
2
|
import { n as signalRpcRequest } from "./client-adapter-D9SNPaNx.js";
|
|
3
|
-
import { t as resolveSignalRpcContext } from "./rpc-context-
|
|
3
|
+
import { t as resolveSignalRpcContext } from "./rpc-context-dXSy4NtF.js";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
6
6
|
//#region extensions/signal/src/send-reactions.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as sendReactionSignal, t as removeReactionSignal } from "./reaction-runtime-api-
|
|
1
|
+
import { n as sendReactionSignal, t as removeReactionSignal } from "./reaction-runtime-api-YGD6hhDh.js";
|
|
2
2
|
export { removeReactionSignal, sendReactionSignal };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./accounts-DO4HMqaK.js";
|
|
2
|
+
//#region extensions/signal/src/rpc-context.ts
|
|
3
|
+
function resolveSignalRpcContext(opts, accountInfo) {
|
|
4
|
+
const baseUrlOverride = opts.baseUrl?.trim();
|
|
5
|
+
const accountOverride = opts.account?.trim();
|
|
6
|
+
if ((!baseUrlOverride || !accountOverride) && !accountInfo) throw new Error("Signal account config is required when baseUrl or account is missing");
|
|
7
|
+
const baseUrl = baseUrlOverride || accountInfo?.baseUrl;
|
|
8
|
+
if (!baseUrl) throw new Error("Signal base URL is required");
|
|
9
|
+
return {
|
|
10
|
+
baseUrl,
|
|
11
|
+
account: accountOverride || accountInfo?.config.account?.trim() || void 0
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { resolveSignalRpcContext as t };
|
package/dist/runtime-api.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { i as resolveSignalAccount, n as listSignalAccountIds, r as resolveDefaultSignalAccountId, t as listEnabledSignalAccounts } from "./accounts-
|
|
1
|
+
import { i as resolveSignalAccount, n as listSignalAccountIds, r as resolveDefaultSignalAccountId, t as listEnabledSignalAccounts } from "./accounts-DO4HMqaK.js";
|
|
2
2
|
import { d as normalizeSignalMessagingTarget, u as looksLikeSignalTargetId } from "./identity-BQ4OzXXk.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { n as sendReactionSignal, t as removeReactionSignal } from "./reaction-runtime-api-Cf6QHcE5.js";
|
|
3
|
+
import { a as setSignalRuntime, c as resolveSignalReactionLevel, s as signalMessageActions } from "./transport-detection-D_M79R5f.js";
|
|
4
|
+
import { n as sendReactionSignal, t as removeReactionSignal } from "./reaction-runtime-api-YGD6hhDh.js";
|
|
6
5
|
import { n as SignalConfigSchema } from "./config-schema-CkMIK7zp.js";
|
|
7
6
|
import { i as installSignalCli } from "./install-signal-cli-Cpiyk0k1.js";
|
|
8
|
-
import { t as monitorSignalProvider } from "./monitor-
|
|
9
|
-
import { t as sendMessageSignal } from "./send-
|
|
10
|
-
import { t as probeSignal } from "./probe-
|
|
7
|
+
import { t as monitorSignalProvider } from "./monitor-BLFIkpH0.js";
|
|
8
|
+
import { t as sendMessageSignal } from "./send-BNl5folj.js";
|
|
9
|
+
import { t as probeSignal } from "./probe-B0E_cXQw.js";
|
|
11
10
|
import { PAIRING_APPROVED_MESSAGE } from "openclaw/plugin-sdk/channel-status";
|
|
12
11
|
import { resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/media-runtime";
|
|
13
12
|
import { buildBaseAccountStatusSnapshot, buildBaseChannelStatusSummary, collectStatusIssuesFromLastError, createDefaultChannelRuntimeState } from "openclaw/plugin-sdk/status-helpers";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { i as resolveSignalAccount } from "./accounts-
|
|
1
|
+
import { i as resolveSignalAccount } from "./accounts-DO4HMqaK.js";
|
|
2
2
|
import { d as normalizeSignalMessagingTarget } from "./identity-BQ4OzXXk.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as registerSignalReplyContext, u as markdownToSignalText } from "./transport-detection-D_M79R5f.js";
|
|
4
4
|
import { n as signalRpcRequest } from "./client-adapter-D9SNPaNx.js";
|
|
5
|
-
import { t as resolveSignalRpcContext } from "./rpc-context-
|
|
6
|
-
import { c as registerSignalApprovalReactionTargetForOutboundMessage, n as appendSignalApprovalReactionHintForOutboundMessage } from "./approval-reactions-BulCzhdB.js";
|
|
5
|
+
import { t as resolveSignalRpcContext } from "./rpc-context-dXSy4NtF.js";
|
|
7
6
|
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
8
7
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
9
8
|
import { kindFromMime, resolveOutboundAttachmentFromUrl } from "openclaw/plugin-sdk/media-runtime";
|
|
@@ -135,15 +134,7 @@ async function sendMessageSignal(to, text, opts) {
|
|
|
135
134
|
const target = parseTarget(to);
|
|
136
135
|
const targetAuthor = normalizeOptionalString(account);
|
|
137
136
|
const targetAuthorUuid = normalizeOptionalString(accountInfo.config.accountUuid);
|
|
138
|
-
|
|
139
|
-
cfg,
|
|
140
|
-
accountId: accountInfo.accountId,
|
|
141
|
-
to,
|
|
142
|
-
text: text ?? "",
|
|
143
|
-
targetAuthor,
|
|
144
|
-
targetAuthorUuid
|
|
145
|
-
});
|
|
146
|
-
let message = outboundText;
|
|
137
|
+
let message = text ?? "";
|
|
147
138
|
let outboundMedia;
|
|
148
139
|
let textStyles = [];
|
|
149
140
|
const textMode = opts.textMode ?? "markdown";
|
|
@@ -223,15 +214,6 @@ async function sendMessageSignal(to, text, opts) {
|
|
|
223
214
|
media: outboundMedia ? [outboundMedia] : void 0,
|
|
224
215
|
sourceTimestamp: timestamp
|
|
225
216
|
});
|
|
226
|
-
registerSignalApprovalReactionTargetForOutboundMessage({
|
|
227
|
-
cfg,
|
|
228
|
-
accountId: accountInfo.accountId,
|
|
229
|
-
to,
|
|
230
|
-
messageId,
|
|
231
|
-
text: outboundText,
|
|
232
|
-
targetAuthor,
|
|
233
|
-
targetAuthorUuid
|
|
234
|
-
});
|
|
235
217
|
return {
|
|
236
218
|
messageId,
|
|
237
219
|
timestamp,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as sendTypingSignal, t as sendMessageSignal } from "./send-
|
|
1
|
+
import { r as sendTypingSignal, t as sendMessageSignal } from "./send-BNl5folj.js";
|
|
2
2
|
export { sendMessageSignal, sendTypingSignal };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { u as normalizeSignalTransportUrl } from "./transport-policy-DxvSMHp9.js";
|
|
2
|
-
import { i as resolveSignalAccount, n as listSignalAccountIds, r as resolveDefaultSignalAccountId, t as listEnabledSignalAccounts } from "./accounts-
|
|
2
|
+
import { i as resolveSignalAccount, n as listSignalAccountIds, r as resolveDefaultSignalAccountId, t as listEnabledSignalAccounts } from "./accounts-DO4HMqaK.js";
|
|
3
3
|
import { d as normalizeSignalMessagingTarget } from "./identity-BQ4OzXXk.js";
|
|
4
|
-
import {
|
|
5
|
-
import { n as sendReactionSignal, t as removeReactionSignal } from "./reaction-runtime-api-
|
|
4
|
+
import { n as signalApprovalAuth, t as getSignalApprovalApprovers } from "./approval-auth-BY6uuApE.js";
|
|
5
|
+
import { n as sendReactionSignal, t as removeReactionSignal } from "./reaction-runtime-api-YGD6hhDh.js";
|
|
6
6
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
7
7
|
import { kindFromMime } from "openclaw/plugin-sdk/media-runtime";
|
|
8
8
|
import { questionGatewayRuntime } from "openclaw/plugin-sdk/question-gateway-runtime";
|
|
@@ -19,6 +19,7 @@ import { createActionGate, jsonResult, readStringParam, resolveReactionMessageId
|
|
|
19
19
|
import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
20
20
|
import { getExecApprovalReplyMetadata } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
21
21
|
import { isMessagePresentationInteractiveBlock, normalizeMessagePresentation, renderMessagePresentationFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
|
|
22
|
+
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
|
|
22
23
|
//#region extensions/signal/src/approval-native.ts
|
|
23
24
|
function isSignalApprovalTransportEnabled(params) {
|
|
24
25
|
return resolveSignalAccount({
|
|
@@ -68,7 +69,7 @@ const signalApproval = createApproverRestrictedNativeApprovalCapabilityFromForwa
|
|
|
68
69
|
approvalKind,
|
|
69
70
|
request
|
|
70
71
|
}),
|
|
71
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
72
|
+
load: async () => (await import("./approval-handler.runtime-Co6EVTqY.js")).signalApprovalNativeRuntime
|
|
72
73
|
})
|
|
73
74
|
});
|
|
74
75
|
const signalApprovalRouting = signalApproval.routing;
|
|
@@ -364,6 +365,12 @@ const signalReplyAuthorState = {
|
|
|
364
365
|
persistentStoreDisabled: false
|
|
365
366
|
};
|
|
366
367
|
//#endregion
|
|
368
|
+
//#region extensions/signal/src/runtime.ts
|
|
369
|
+
const { setRuntime: setSignalRuntime, tryGetRuntime: getOptionalSignalRuntime } = createPluginRuntimeStore({
|
|
370
|
+
pluginId: "signal",
|
|
371
|
+
errorMessage: "Signal runtime not initialized"
|
|
372
|
+
});
|
|
373
|
+
//#endregion
|
|
367
374
|
//#region extensions/signal/src/reply-authors.ts
|
|
368
375
|
const PERSISTENT_NAMESPACE = "signal.reply-authors.v1";
|
|
369
376
|
const PERSISTENT_MAX_ENTRIES = 5e3;
|
|
@@ -554,4 +561,4 @@ async function detectSignalTransport(params) {
|
|
|
554
561
|
throw new Error(`Signal transport not reachable at ${url}`);
|
|
555
562
|
}
|
|
556
563
|
//#endregion
|
|
557
|
-
export {
|
|
564
|
+
export { setSignalRuntime as a, resolveSignalReactionLevel as c, markdownToSignalTextChunks as d, isSignalNativeApprovalHandlerConfigured as f, getOptionalSignalRuntime as i, formatSignalMediaText as l, signalApprovalCapability as m, registerSignalReplyContext as n, materializeSignalPresentationFallback as o, shouldSuppressLocalSignalExecApprovalPrompt as p, resolveSignalReplyContextWithPersistence as r, signalMessageActions as s, detectSignalTransport as t, markdownToSignalText as u };
|
package/dist/{transport-detection.runtime-DoiwPcrG.js → transport-detection.runtime-DKuuIHvf.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as detectSignalTransport } from "./transport-detection-
|
|
1
|
+
import { t as detectSignalTransport } from "./transport-detection-D_M79R5f.js";
|
|
2
2
|
export { detectSignalTransport };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/signal",
|
|
3
|
-
"version": "2026.8.1-beta.
|
|
3
|
+
"version": "2026.8.1-beta.3",
|
|
4
4
|
"description": "OpenClaw Signal channel plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
@@ -93,10 +93,10 @@
|
|
|
93
93
|
"allowInvalidConfigRecovery": true
|
|
94
94
|
},
|
|
95
95
|
"compat": {
|
|
96
|
-
"pluginApi": ">=2026.8.1-beta.
|
|
96
|
+
"pluginApi": ">=2026.8.1-beta.3"
|
|
97
97
|
},
|
|
98
98
|
"build": {
|
|
99
|
-
"openclawVersion": "2026.8.1-beta.
|
|
99
|
+
"openclawVersion": "2026.8.1-beta.3",
|
|
100
100
|
"bundledDist": false
|
|
101
101
|
},
|
|
102
102
|
"release": {
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
"README.md"
|
|
119
119
|
],
|
|
120
120
|
"peerDependencies": {
|
|
121
|
-
"openclaw": ">=2026.8.1-beta.
|
|
121
|
+
"openclaw": ">=2026.8.1-beta.3"
|
|
122
122
|
},
|
|
123
123
|
"peerDependenciesMeta": {
|
|
124
124
|
"openclaw": {
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "./accounts-DrStJjiK.js";
|
|
2
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
-
//#region extensions/signal/src/rpc-context.ts
|
|
4
|
-
function resolveSignalRpcContext(opts, accountInfo) {
|
|
5
|
-
const hasBaseUrl = Boolean(normalizeOptionalString(opts.baseUrl));
|
|
6
|
-
const hasAccount = Boolean(normalizeOptionalString(opts.account));
|
|
7
|
-
if ((!hasBaseUrl || !hasAccount) && !accountInfo) throw new Error("Signal account config is required when baseUrl or account is missing");
|
|
8
|
-
const resolvedAccount = accountInfo;
|
|
9
|
-
const baseUrl = normalizeOptionalString(opts.baseUrl) ?? resolvedAccount?.baseUrl;
|
|
10
|
-
if (!baseUrl) throw new Error("Signal base URL is required");
|
|
11
|
-
return {
|
|
12
|
-
baseUrl,
|
|
13
|
-
account: normalizeOptionalString(opts.account) ?? normalizeOptionalString(resolvedAccount?.config.account)
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { resolveSignalRpcContext as t };
|