@openclaw/signal 2026.10.10 → 2026.11.5-beta.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.
- package/dist/.setup/{accounts-BZXLLXyZ.mjs → accounts-CUmmZ1Pr.mjs} +4 -8
- package/dist/.setup/api-BMs7TU0j.mjs +13 -0
- package/dist/.setup/{api-COBPAXbQ.mjs → api-D3nebKzw.mjs} +9 -11
- package/dist/.setup/{approval-auth-BC9o4yna.mjs → approval-auth-D1l-4xru.mjs} +7 -11
- package/dist/.setup/{approval-handler.runtime-Dzb_QGFk.mjs → approval-handler.runtime-DckGqWGG.mjs} +7 -8
- package/dist/.setup/{approval-reactions-Drpy356L.mjs → approval-reactions-Cp3jpgz6.mjs} +16 -23
- package/dist/.setup/{channel-Cd52DrmN.mjs → channel-DPL7kj3u.mjs} +514 -357
- package/dist/.setup/{client-CRClyTxP.mjs → client-C73qbpkw.mjs} +170 -184
- package/dist/.setup/{config-schema-WrMl4uyV.mjs → config-schema-DAqfo3aU.mjs} +2 -4
- package/dist/.setup/{doctor-contract-api-BXWnMqDt.mjs → doctor-contract-api-TiY2vogm.mjs} +88 -95
- package/dist/.setup/{identity-DzXre34N.mjs → identity-B6ABNWe_.mjs} +38 -2
- package/dist/.setup/{install-signal-cli-BjCk7EXq.mjs → install-signal-cli-CWCFWOeT.mjs} +95 -109
- package/dist/.setup/{transport-url-BptucYNV.mjs → legacy-transport-CwEWEhge.mjs} +17 -1
- package/dist/.setup/{monitor-C1qvr_Kl.mjs → monitor-CuoDdmDR.mjs} +183 -243
- package/dist/.setup/{probe-BYl1haPH.mjs → probe-DdVlJ_Vx.mjs} +3 -3
- package/dist/.setup/{send-BZd_WrI_.mjs → send-Bi48fdOa.mjs} +34 -66
- package/dist/.setup/{setup-surface-D5p9z7MO.mjs → setup-surface-FE11aiCN.mjs} +3 -3
- package/dist/.setup/{transport-detection-oXau8_7D.mjs → transport-detection-B1h2qGWb.mjs} +3 -3
- package/dist/.setup/{transport-policy-BvaaxIjp.mjs → transport-policy-C_GjqrU-.mjs} +1 -1
- package/dist/.setup/{transport-probes.runtime-Ca_Rb1P2.mjs → transport-probes.runtime-BJTjY0Hv.mjs} +1 -1
- package/dist/.source-module-urls/b02c526df8b90083105b63e5b51d5c8bbfe02676df72f6be8dd8f825817b32b9.json +1 -0
- package/dist/api.js +9 -11
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/contract-api.js +3 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/node_modules/@openclaw/fs-safe/CHANGELOG.md +94 -0
- package/node_modules/@openclaw/fs-safe/dist/archive-parser.wasm +0 -0
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/copy-file-input.js +3 -1
- package/node_modules/@openclaw/fs-safe/dist/copy-path-admission.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/copy-root-file-sync.js +8 -1
- package/node_modules/@openclaw/fs-safe/dist/file-open-error.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/file-open-error.js +14 -0
- package/node_modules/@openclaw/fs-safe/dist/file-sync.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/file-sync.js +6 -1
- package/node_modules/@openclaw/fs-safe/dist/guest-native-python.js +3 -0
- package/node_modules/@openclaw/fs-safe/dist/native-binding.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/native-config.js +14 -3
- package/node_modules/@openclaw/fs-safe/dist/native-operations.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/native-pinned-write-windows.js +9 -2
- package/node_modules/@openclaw/fs-safe/dist/native-staged-file.js +40 -32
- package/node_modules/@openclaw/fs-safe/dist/output.js +6 -0
- package/node_modules/@openclaw/fs-safe/dist/owner-dacl.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/owner-dacl.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/path.js +5 -1
- package/node_modules/@openclaw/fs-safe/dist/pinned-write-staged.js +25 -2
- package/node_modules/@openclaw/fs-safe/dist/publication-handle.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/publication-handle.js +32 -0
- package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/publish-copy-stage.js +19 -9
- package/node_modules/@openclaw/fs-safe/dist/publish-file.js +23 -24
- package/node_modules/@openclaw/fs-safe/dist/publish-rename-fallback.d.ts +21 -0
- package/node_modules/@openclaw/fs-safe/dist/publish-rename-fallback.js +102 -0
- package/node_modules/@openclaw/fs-safe/dist/root-create-native.js +2 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.d.ts +3 -1
- package/node_modules/@openclaw/fs-safe/dist/root-directory-entry.js +8 -5
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list-types.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.d.ts +2 -1
- package/node_modules/@openclaw/fs-safe/dist/root-directory-list.js +19 -9
- package/node_modules/@openclaw/fs-safe/dist/root-file-final-admission.js +3 -3
- package/node_modules/@openclaw/fs-safe/dist/root-path-existing.d.ts +2 -2
- package/node_modules/@openclaw/fs-safe/dist/root-path-existing.js +27 -13
- package/node_modules/@openclaw/fs-safe/dist/root-path.js +2 -2
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.d.ts +3 -0
- package/node_modules/@openclaw/fs-safe/dist/sibling-staged-file.js +18 -3
- package/node_modules/@openclaw/fs-safe/dist/watch-hints.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/watch-hints.js +68 -21
- package/node_modules/@openclaw/fs-safe/dist/watch-io-error.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-io-error.js +27 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-io-worker.d.ts +1 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-io-worker.js +93 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-io.d.ts +47 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-io.js +236 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-native.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/watch-native.js +3 -3
- package/node_modules/@openclaw/fs-safe/dist/watch-probe.d.ts +16 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-probe.js +135 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-rescan.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/watch-rescan.js +86 -24
- package/node_modules/@openclaw/fs-safe/dist/watch-scan.d.ts +4 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-scan.js +78 -16
- package/node_modules/@openclaw/fs-safe/dist/watch-stream.d.ts +2 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-stream.js +23 -0
- package/node_modules/@openclaw/fs-safe/dist/watch-types.d.ts +3 -1
- package/node_modules/@openclaw/fs-safe/dist/watch.js +60 -13
- package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.d.ts +1 -1
- package/node_modules/@openclaw/fs-safe/dist/windows-security-facts.js +1 -0
- package/node_modules/@openclaw/fs-safe/dist/windows-security-helper.exe +0 -0
- package/node_modules/@openclaw/fs-safe/docs/advanced.md +5 -2
- package/node_modules/@openclaw/fs-safe/docs/compiler-qualification.md +392 -0
- package/node_modules/@openclaw/fs-safe/docs/config.md +7 -1
- package/node_modules/@openclaw/fs-safe/docs/contributing.md +25 -5
- package/node_modules/@openclaw/fs-safe/docs/copy.md +10 -0
- package/node_modules/@openclaw/fs-safe/docs/durability.md +9 -3
- package/node_modules/@openclaw/fs-safe/docs/errors.md +13 -0
- package/node_modules/@openclaw/fs-safe/docs/migrating-to-0.5.md +6 -4
- package/node_modules/@openclaw/fs-safe/docs/native-helper.md +6 -4
- package/node_modules/@openclaw/fs-safe/docs/output.md +4 -2
- package/node_modules/@openclaw/fs-safe/docs/path.md +5 -2
- package/node_modules/@openclaw/fs-safe/docs/permissions.md +15 -0
- package/node_modules/@openclaw/fs-safe/docs/security-model.md +9 -0
- package/node_modules/@openclaw/fs-safe/docs/staged-file.md +2 -0
- package/node_modules/@openclaw/fs-safe/docs/testing.md +1 -1
- package/node_modules/@openclaw/fs-safe/docs/watch.md +62 -5
- package/node_modules/@openclaw/fs-safe/docs/writing.md +6 -1
- package/node_modules/@openclaw/fs-safe/package.json +18 -16
- package/node_modules/@openclaw/fs-safe-darwin-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-arm64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-darwin-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-darwin-x64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-freebsd-arm64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-arm64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-freebsd-x64/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-freebsd-x64/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-arm64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-gnu/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-linux-x64-musl/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-arm64-msvc/package.json +1 -1
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/fs-safe-native.node +0 -0
- package/node_modules/@openclaw/fs-safe-win32-x64-msvc/package.json +1 -1
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/openclaw.plugin.json +0 -30
- package/package.json +6 -8
- package/dist/.setup/api-Bw9wRi7s.mjs +0 -15
- package/dist/.setup/client-adapter-CNEkF_Ej.mjs +0 -29
- package/dist/.setup/legacy-transport-UHhcutJ4.mjs +0 -17
- package/dist/.setup/normalize-B_3XS5ez.mjs +0 -38
- package/dist/.setup/reaction-runtime-api-D7bhF81u.mjs +0 -64
- package/dist/.setup/reaction-targets-Bg9NSMJF.mjs +0 -70
- package/dist/.setup/rpc-context-DmtN26AB.mjs +0 -12
- package/dist/.source-module-urls/6644c27f416c8952f1e739724ebf62751ac9fafc7ee3c001a25ab5884899ae60.json +0 -1
- package/dist/reaction-runtime-api.js +0 -1
- package/node_modules/ws/LICENSE +0 -20
- package/node_modules/ws/README.md +0 -548
- package/node_modules/ws/browser.js +0 -8
- package/node_modules/ws/index.js +0 -22
- package/node_modules/ws/lib/buffer-util.js +0 -131
- package/node_modules/ws/lib/constants.js +0 -19
- package/node_modules/ws/lib/event-target.js +0 -292
- package/node_modules/ws/lib/extension.js +0 -203
- package/node_modules/ws/lib/limiter.js +0 -55
- package/node_modules/ws/lib/permessage-deflate.js +0 -530
- package/node_modules/ws/lib/receiver.js +0 -743
- package/node_modules/ws/lib/sender.js +0 -607
- package/node_modules/ws/lib/stream.js +0 -161
- package/node_modules/ws/lib/subprotocol.js +0 -62
- package/node_modules/ws/lib/validation.js +0 -152
- package/node_modules/ws/lib/websocket-server.js +0 -562
- package/node_modules/ws/lib/websocket.js +0 -1421
- package/node_modules/ws/package.json +0 -74
- package/node_modules/ws/wrapper.mjs +0 -21
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { a as migrateLegacySignalTransportConfig, i as clearLegacySignalTransportFieldsForAccount, n as normalizeCompatibilityConfig, r as repairSignalAccountKeys } from "./doctor-contract-api-
|
|
2
|
-
import {
|
|
3
|
-
import { a as isSignalManagedNativeConnectionUrlForBind, c as resolveLocalSignalTransportPort, i as assignSignalManagedNativePort, o as isValidSignalManagedNativePort, r as allocateSignalManagedNativePort, s as reserveSignalTransportPorts } from "./transport-policy-
|
|
4
|
-
import { a as resolveSignalAccountConfig, i as resolveSignalAccount, n as listSignalAccountIds, o as resolveSignalReplyToMode, r as resolveDefaultSignalAccountId, s as resolveSignalTransport, t as listEnabledSignalAccounts } from "./accounts-
|
|
5
|
-
import {
|
|
6
|
-
import { a as resolveSignalTarget, n as signalApprovalAuth, r as listSignalAliasDirectoryEntries, t as getSignalApprovalApprovers } from "./approval-auth-
|
|
7
|
-
import { c as
|
|
8
|
-
import { n as sendReactionSignal, t as removeReactionSignal } from "./reaction-runtime-api-D7bhF81u.mjs";
|
|
1
|
+
import { a as migrateLegacySignalTransportConfig, i as clearLegacySignalTransportFieldsForAccount, n as normalizeCompatibilityConfig, r as repairSignalAccountKeys } from "./doctor-contract-api-TiY2vogm.mjs";
|
|
2
|
+
import { c as resolveSignalAccountEntry, l as resolveSignalAccountKey, o as normalizeSignalTransportHost, r as assertSignalSocketTransport, s as normalizeSignalTransportUrl } from "./legacy-transport-CwEWEhge.mjs";
|
|
3
|
+
import { a as isSignalManagedNativeConnectionUrlForBind, c as resolveLocalSignalTransportPort, i as assignSignalManagedNativePort, o as isValidSignalManagedNativePort, r as allocateSignalManagedNativePort, s as reserveSignalTransportPorts } from "./transport-policy-C_GjqrU-.mjs";
|
|
4
|
+
import { a as resolveSignalAccountConfig, i as resolveSignalAccount, n as listSignalAccountIds, o as resolveSignalReplyToMode, r as resolveDefaultSignalAccountId, s as resolveSignalTransport, t as listEnabledSignalAccounts } from "./accounts-CUmmZ1Pr.mjs";
|
|
5
|
+
import { c as resolveSignalSender, d as normalizeSignalMessagingTarget, f as normalizeSignalReactionRecipient, l as looksLikeUuid, o as resolveSignalPeerId, s as resolveSignalRecipient, u as looksLikeSignalTargetId } from "./identity-B6ABNWe_.mjs";
|
|
6
|
+
import { a as resolveSignalTarget, n as signalApprovalAuth, r as listSignalAliasDirectoryEntries, t as getSignalApprovalApprovers } from "./approval-auth-D1l-4xru.mjs";
|
|
7
|
+
import { c as containerRpcRequest, i as streamSignalEvents$1, l as streamContainerEvents, n as signalCheck$1, r as signalRpcRequest$1, s as containerCheck } from "./client-C73qbpkw.mjs";
|
|
9
8
|
import { t as getOptionalSignalRuntime } from "./runtime-B_1v-nzc.mjs";
|
|
10
|
-
import { t as detectSignalTransport } from "./transport-detection-
|
|
11
|
-
import { t as SignalChannelConfigSchema } from "./config-schema-
|
|
9
|
+
import { t as detectSignalTransport } from "./transport-detection-B1h2qGWb.mjs";
|
|
10
|
+
import { t as SignalChannelConfigSchema } from "./config-schema-DAqfo3aU.mjs";
|
|
12
11
|
import { describeAccountSnapshot, resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk/account-helpers";
|
|
13
12
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
|
|
14
13
|
import { buildDmGroupAccountAllowlistAdapter } from "openclaw/plugin-sdk/allowlist-config-edit";
|
|
@@ -19,12 +18,11 @@ import { attachChannelToResult } from "openclaw/plugin-sdk/channel-send-result";
|
|
|
19
18
|
import { PAIRING_APPROVED_MESSAGE } from "openclaw/plugin-sdk/channel-status";
|
|
20
19
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
21
20
|
import { resolveMarkdownTableMode } from "openclaw/plugin-sdk/markdown-table-runtime";
|
|
22
|
-
import {
|
|
23
|
-
import { chunkText, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
21
|
+
import { chunkText, resolveChunkMode, resolveTextChunkLimit } from "openclaw/plugin-sdk/reply-chunking";
|
|
24
22
|
import { buildOutboundBaseSessionKey, parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
25
23
|
import { buildBaseChannelStatusSummary, collectStatusIssuesFromLastError, createComputedAccountStatusAdapter, createDefaultChannelRuntimeState, resolveReactionLevel } from "openclaw/plugin-sdk/status-helpers";
|
|
26
24
|
import { asPositiveSafeInteger, normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
27
|
-
import { FormatCapabilityProfile, markdownToIR, renderMarkdownIRChunksWithinLimit, renderMarkdownWithAttributedRanges, sanitizeAssistantVisibleText } from "openclaw/plugin-sdk/text-chunking";
|
|
25
|
+
import { FormatCapabilityProfile, markdownToIR, renderMarkdownIRChunksWithinLimit, renderMarkdownWithAttributedRanges, sanitizeAssistantVisibleText, sliceMarkdownIR } from "openclaw/plugin-sdk/text-chunking";
|
|
28
26
|
import { normalizeAccountId as normalizeAccountId$1 } from "openclaw/plugin-sdk/account-resolution";
|
|
29
27
|
import { createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutesAsync } from "openclaw/plugin-sdk/approval-delivery-runtime";
|
|
30
28
|
import { createLazyChannelApprovalNativeRuntimeAdapterAsync } from "openclaw/plugin-sdk/approval-handler-adapter-runtime";
|
|
@@ -35,6 +33,8 @@ import { formatMediaPlaceholderText } from "openclaw/plugin-sdk/channel-inbound"
|
|
|
35
33
|
import { kindFromMime } from "openclaw/plugin-sdk/media-runtime";
|
|
36
34
|
import { createActionGate, jsonResult, readStringParam, resolveReactionMessageId } from "openclaw/plugin-sdk/channel-actions";
|
|
37
35
|
import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
36
|
+
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
37
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
38
38
|
import { createChannelPluginBase, getChatChannelMeta } from "openclaw/plugin-sdk/core";
|
|
39
39
|
import { parseAllowFromEntries } from "openclaw/plugin-sdk/allow-from";
|
|
40
40
|
import { getExecApprovalReplyMetadata } from "openclaw/plugin-sdk/approval-reply-runtime";
|
|
@@ -102,7 +102,7 @@ const signalApproval = createApproverRestrictedNativeApprovalCapabilityFromForwa
|
|
|
102
102
|
approvalKind,
|
|
103
103
|
request
|
|
104
104
|
}),
|
|
105
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
105
|
+
load: async () => (await import("./approval-handler.runtime-DckGqWGG.mjs")).signalApprovalNativeRuntime
|
|
106
106
|
})
|
|
107
107
|
});
|
|
108
108
|
const signalApprovalRouting = signalApproval.routing;
|
|
@@ -161,12 +161,12 @@ const SIGNAL_FORMAT_PROFILE = FormatCapabilityProfile.define({
|
|
|
161
161
|
unit: "chars"
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
-
function
|
|
164
|
+
function renderSignalText(ir) {
|
|
165
165
|
const normalize = (value, preserveSuffixCase) => {
|
|
166
166
|
const normalized = value.trim().replace(/^(?:https?:\/\/)?(?:www\.)?/i, "").replace(/\/+$/, "");
|
|
167
167
|
return preserveSuffixCase ? normalized.replace(/^[^/?#]+/, (host) => host.toLowerCase()) : normalizeLowercaseStringOrEmpty(normalized);
|
|
168
168
|
};
|
|
169
|
-
|
|
169
|
+
const rendered = renderMarkdownWithAttributedRanges({
|
|
170
170
|
...ir,
|
|
171
171
|
links: ir.links.filter((link) => {
|
|
172
172
|
const label = ir.text.slice(link.start, link.end);
|
|
@@ -174,10 +174,7 @@ function stripEquivalentSignalLinks(ir) {
|
|
|
174
174
|
const preserveSuffixCase = /^https?:\/\//i.test(href);
|
|
175
175
|
return normalize(label, preserveSuffixCase) !== normalize(href.replace(/^mailto:/, ""), preserveSuffixCase);
|
|
176
176
|
})
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function renderSignalText(ir) {
|
|
180
|
-
const rendered = renderMarkdownWithAttributedRanges(stripEquivalentSignalLinks(ir), {
|
|
177
|
+
}, {
|
|
181
178
|
styleMap: SIGNAL_STYLE_MAP,
|
|
182
179
|
annotationStyleMap: { assistant_transcript_role: "MONOSPACE" },
|
|
183
180
|
trimEnd: true
|
|
@@ -200,16 +197,43 @@ function markdownToSignalIR(markdown, options) {
|
|
|
200
197
|
function markdownToSignalText(markdown, options = {}) {
|
|
201
198
|
return renderSignalText(markdownToSignalIR(markdown, options));
|
|
202
199
|
}
|
|
200
|
+
function chunkSignalIRByParagraph(ir, limit) {
|
|
201
|
+
const codeSpans = ir.styles.filter((span) => span.style === "code" || span.style === "code_block");
|
|
202
|
+
const paragraphs = [];
|
|
203
|
+
let start = 0;
|
|
204
|
+
for (const match of ir.text.matchAll(/\n[\t ]*\n+/g)) {
|
|
205
|
+
const end = match.index + match[0].length;
|
|
206
|
+
if (codeSpans.some((span) => span.start <= match.index && end <= span.end)) continue;
|
|
207
|
+
if (match.index > start) paragraphs.push({
|
|
208
|
+
start,
|
|
209
|
+
end: match.index
|
|
210
|
+
});
|
|
211
|
+
start = end;
|
|
212
|
+
}
|
|
213
|
+
if (start < ir.text.length) paragraphs.push({
|
|
214
|
+
start,
|
|
215
|
+
end: ir.text.length
|
|
216
|
+
});
|
|
217
|
+
const chunks = [];
|
|
218
|
+
let pending;
|
|
219
|
+
for (const paragraph of paragraphs) if (pending && renderSignalText(sliceMarkdownIR(ir, pending.start, paragraph.end)).text.length <= limit) pending.end = paragraph.end;
|
|
220
|
+
else {
|
|
221
|
+
if (pending) chunks.push(sliceMarkdownIR(ir, pending.start, pending.end));
|
|
222
|
+
pending = paragraph;
|
|
223
|
+
}
|
|
224
|
+
if (pending) chunks.push(sliceMarkdownIR(ir, pending.start, pending.end));
|
|
225
|
+
return chunks;
|
|
226
|
+
}
|
|
203
227
|
function markdownToSignalTextChunks(markdown, limit, options = {}) {
|
|
204
228
|
const ir = markdownToSignalIR(markdown, options);
|
|
205
229
|
if (ir.listItems && ir.text.length > limit) ir.listItems = ir.listItems.map((item) => ({ ...item }));
|
|
206
|
-
return renderMarkdownIRChunksWithinLimit({
|
|
207
|
-
ir,
|
|
230
|
+
return (options.chunkMode === "newline" ? chunkSignalIRByParagraph(ir, limit) : [ir]).flatMap((chunk) => renderMarkdownIRChunksWithinLimit({
|
|
231
|
+
ir: chunk,
|
|
208
232
|
limit,
|
|
209
233
|
assistantTranscriptRoleMessageBoundaries: true,
|
|
210
234
|
renderChunk: renderSignalText,
|
|
211
235
|
measureRendered: (rendered) => rendered.text.length
|
|
212
|
-
}).map(({ rendered }) => rendered);
|
|
236
|
+
}).map(({ rendered }) => rendered));
|
|
213
237
|
}
|
|
214
238
|
// extensions/signal/src/media-text.ts
|
|
215
239
|
/** Keeps Signal's established multi-attachment text while sharing single-item rendering. */
|
|
@@ -234,18 +258,90 @@ function resolveSignalReactionLevel(params) {
|
|
|
234
258
|
invalidFallback: "minimal"
|
|
235
259
|
});
|
|
236
260
|
}
|
|
261
|
+
// extensions/signal/src/client-adapter.ts
|
|
262
|
+
const DEFAULT_TIMEOUT_MS = 1e4;
|
|
263
|
+
async function signalRpcRequest(method, params, opts) {
|
|
264
|
+
return opts.transportKind === "container" ? containerRpcRequest(method, params, opts) : signalRpcRequest$1(method, params, opts);
|
|
265
|
+
}
|
|
266
|
+
async function signalCheck(baseUrl, timeoutMs = DEFAULT_TIMEOUT_MS, options = {}) {
|
|
267
|
+
try {
|
|
268
|
+
return options.transportKind === "container" ? await containerCheck(baseUrl, timeoutMs, options.account) : await signalCheck$1(baseUrl, timeoutMs);
|
|
269
|
+
} catch (error) {
|
|
270
|
+
return {
|
|
271
|
+
ok: false,
|
|
272
|
+
status: null,
|
|
273
|
+
error: formatErrorMessage(error)
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
async function streamSignalEvents(params) {
|
|
278
|
+
if (params.transportKind === "container") return streamContainerEvents({
|
|
279
|
+
...params,
|
|
280
|
+
onEvent: (event) => params.onEvent({
|
|
281
|
+
event: "receive",
|
|
282
|
+
data: JSON.stringify(event)
|
|
283
|
+
})
|
|
284
|
+
});
|
|
285
|
+
return streamSignalEvents$1(params);
|
|
286
|
+
}
|
|
287
|
+
// extensions/signal/src/rpc-context.ts
|
|
288
|
+
function resolveSignalRpcContext(opts, accountInfo) {
|
|
289
|
+
const baseUrlOverride = opts.baseUrl?.trim();
|
|
290
|
+
const accountOverride = opts.account?.trim();
|
|
291
|
+
const baseUrl = baseUrlOverride || accountInfo.baseUrl;
|
|
292
|
+
if (!baseUrl) throw new Error("Signal base URL is required");
|
|
293
|
+
return {
|
|
294
|
+
baseUrl,
|
|
295
|
+
account: accountOverride || accountInfo.config.account?.trim() || void 0
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
// extensions/signal/src/send-reactions.ts
|
|
299
|
+
function createSignalReactionSender(remove) {
|
|
300
|
+
return async (recipient, targetTimestamp, emoji, opts) => {
|
|
301
|
+
const cfg = requireRuntimeConfig(opts.cfg, "Signal reactions");
|
|
302
|
+
const accountInfo = resolveSignalAccount({
|
|
303
|
+
cfg,
|
|
304
|
+
accountId: opts.accountId
|
|
305
|
+
});
|
|
306
|
+
const { baseUrl, account } = resolveSignalRpcContext(opts, accountInfo);
|
|
307
|
+
const normalizedRecipient = normalizeSignalReactionRecipient(recipient);
|
|
308
|
+
const groupId = opts.groupId?.trim();
|
|
309
|
+
const operation = `Signal reaction${remove ? " removal" : ""}`;
|
|
310
|
+
if (!normalizedRecipient && !groupId) throw new Error(`Recipient or groupId is required for ${operation}`);
|
|
311
|
+
if (!Number.isFinite(targetTimestamp) || targetTimestamp <= 0) throw new Error(`Valid targetTimestamp is required for ${operation}`);
|
|
312
|
+
const normalizedEmoji = emoji?.trim();
|
|
313
|
+
if (!normalizedEmoji) throw new Error(`Emoji is required for ${operation}`);
|
|
314
|
+
const targetAuthor = [
|
|
315
|
+
opts.targetAuthor,
|
|
316
|
+
opts.targetAuthorUuid,
|
|
317
|
+
normalizedRecipient
|
|
318
|
+
].map((candidate) => normalizeSignalReactionRecipient(candidate ?? "")).find(Boolean);
|
|
319
|
+
if (groupId && !targetAuthor) throw new Error(`targetAuthor is required for group reaction${remove ? " removal" : "s"}`);
|
|
320
|
+
const requestParams = {
|
|
321
|
+
emoji: normalizedEmoji,
|
|
322
|
+
targetTimestamp,
|
|
323
|
+
...remove ? { remove: true } : {},
|
|
324
|
+
...targetAuthor ? { targetAuthor } : {}
|
|
325
|
+
};
|
|
326
|
+
if (normalizedRecipient) requestParams.recipients = [normalizedRecipient];
|
|
327
|
+
if (groupId) requestParams.groupIds = [groupId];
|
|
328
|
+
if (account) requestParams.account = account;
|
|
329
|
+
return {
|
|
330
|
+
ok: true,
|
|
331
|
+
timestamp: (await signalRpcRequest("sendReaction", requestParams, {
|
|
332
|
+
baseUrl,
|
|
333
|
+
timeoutMs: opts.timeoutMs,
|
|
334
|
+
transportKind: opts.transportKind ?? accountInfo.transport.kind,
|
|
335
|
+
assertDirectAdapterHandoff: opts.assertDirectAdapterHandoff
|
|
336
|
+
}))?.timestamp
|
|
337
|
+
};
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
const sendReactionSignal = createSignalReactionSender(false);
|
|
341
|
+
const removeReactionSignal = createSignalReactionSender(true);
|
|
237
342
|
// extensions/signal/src/message-actions.ts
|
|
238
343
|
const providerId = "signal";
|
|
239
344
|
const GROUP_PREFIX = "group:";
|
|
240
|
-
function resolveSignalReactionTarget(raw) {
|
|
241
|
-
const withoutSignal = raw.trim().replace(/^signal:/i, "").trim();
|
|
242
|
-
if (!withoutSignal) return {};
|
|
243
|
-
if (normalizeLowercaseStringOrEmpty(withoutSignal).startsWith(GROUP_PREFIX)) {
|
|
244
|
-
const groupId = withoutSignal.slice(6).trim();
|
|
245
|
-
return groupId ? { groupId } : {};
|
|
246
|
-
}
|
|
247
|
-
return { recipient: normalizeSignalReactionRecipient(withoutSignal) };
|
|
248
|
-
}
|
|
249
345
|
const signalMessageActions = {
|
|
250
346
|
describeMessageTool: ({ cfg, accountId }) => {
|
|
251
347
|
const configuredAccounts = accountId ? [resolveSignalAccount({
|
|
@@ -280,11 +376,14 @@ const signalMessageActions = {
|
|
|
280
376
|
});
|
|
281
377
|
if (!reactionLevelInfo.agentReactionsEnabled) throw new Error(`Signal agent reactions disabled (reactionLevel="${reactionLevelInfo.level}"). Set channels.signal.reactionLevel to "minimal" or "extensive" to enable.`);
|
|
282
378
|
if (!createActionGate(account.config.actions)("reactions")) throw new Error("Signal reactions are disabled via actions.reactions.");
|
|
283
|
-
const
|
|
379
|
+
const recipientTarget = readStringParam(params, "to", {
|
|
284
380
|
required: true,
|
|
285
381
|
label: "recipient (UUID, phone number, or group)"
|
|
286
|
-
}));
|
|
287
|
-
|
|
382
|
+
}).trim().replace(/^signal:/i, "").trim();
|
|
383
|
+
const isGroup = normalizeLowercaseStringOrEmpty(recipientTarget).startsWith(GROUP_PREFIX);
|
|
384
|
+
const groupId = isGroup ? recipientTarget.slice(6).trim() : void 0;
|
|
385
|
+
const recipient = !isGroup && recipientTarget ? normalizeSignalReactionRecipient(recipientTarget) : void 0;
|
|
386
|
+
if (!recipient && !groupId) throw new Error("recipient or group required");
|
|
288
387
|
const messageIdRaw = resolveReactionMessageId({
|
|
289
388
|
args: params,
|
|
290
389
|
toolContext
|
|
@@ -293,16 +392,16 @@ const signalMessageActions = {
|
|
|
293
392
|
if (!messageId) throw new Error("messageId (timestamp) required. Provide messageId explicitly or react to the current inbound message.");
|
|
294
393
|
const targetAuthor = readStringParam(params, "targetAuthor");
|
|
295
394
|
const targetAuthorUuid = readStringParam(params, "targetAuthorUuid");
|
|
296
|
-
if (
|
|
395
|
+
if (groupId && !targetAuthor && !targetAuthorUuid) throw new Error("targetAuthor or targetAuthorUuid required for group reactions.");
|
|
297
396
|
const emoji = readStringParam(params, "emoji", { allowEmpty: true });
|
|
298
397
|
const remove = typeof params.remove === "boolean" ? params.remove : void 0;
|
|
299
398
|
const timestamp = parseStrictNonNegativeInteger(messageId);
|
|
300
399
|
if (timestamp === void 0) throw new Error(`Invalid messageId: ${messageId}. Expected numeric timestamp.`);
|
|
301
400
|
if (!emoji) throw new Error(`Emoji required to ${remove ? "remove" : "add"} reaction.`);
|
|
302
|
-
await (remove ? removeReactionSignal : sendReactionSignal)(
|
|
401
|
+
await (remove ? removeReactionSignal : sendReactionSignal)(recipient ?? "", timestamp, emoji, {
|
|
303
402
|
cfg,
|
|
304
403
|
accountId: account.accountId,
|
|
305
|
-
groupId
|
|
404
|
+
groupId,
|
|
306
405
|
targetAuthor,
|
|
307
406
|
targetAuthorUuid,
|
|
308
407
|
...assertDirectAdapterHandoff ? { assertDirectAdapterHandoff } : {}
|
|
@@ -319,8 +418,7 @@ const signalMessageActions = {
|
|
|
319
418
|
function resolveSignalOutboundTarget(target) {
|
|
320
419
|
const normalized = normalizeSignalMessagingTarget(target);
|
|
321
420
|
if (!normalized) return null;
|
|
322
|
-
|
|
323
|
-
if (lowered.startsWith("group:")) {
|
|
421
|
+
if (normalized.startsWith("group:")) {
|
|
324
422
|
const groupId = normalized.slice(6);
|
|
325
423
|
return {
|
|
326
424
|
peer: {
|
|
@@ -332,21 +430,8 @@ function resolveSignalOutboundTarget(target) {
|
|
|
332
430
|
to: `group:${groupId}`
|
|
333
431
|
};
|
|
334
432
|
}
|
|
335
|
-
if (lowered.startsWith("username:")) return {
|
|
336
|
-
peer: {
|
|
337
|
-
kind: "direct",
|
|
338
|
-
id: normalized
|
|
339
|
-
},
|
|
340
|
-
chatType: "direct",
|
|
341
|
-
from: `signal:${normalized}`,
|
|
342
|
-
to: `signal:${normalized}`
|
|
343
|
-
};
|
|
344
433
|
const recipient = normalized;
|
|
345
|
-
const
|
|
346
|
-
const sender = resolveSignalSender({
|
|
347
|
-
sourceUuid: looksLikeUuid(uuidCandidate) ? uuidCandidate : null,
|
|
348
|
-
sourceNumber: looksLikeUuid(uuidCandidate) ? null : recipient
|
|
349
|
-
});
|
|
434
|
+
const sender = recipient.startsWith("username:") ? null : resolveSignalSender(looksLikeUuid(recipient) ? { sourceUuid: recipient } : { sourceNumber: recipient });
|
|
350
435
|
const peerId = sender ? resolveSignalPeerId(sender) : recipient;
|
|
351
436
|
const displayRecipient = sender ? resolveSignalRecipient(sender) : recipient;
|
|
352
437
|
return {
|
|
@@ -362,11 +447,6 @@ function resolveSignalOutboundTarget(target) {
|
|
|
362
447
|
// extensions/signal/src/presentation-fallback.ts
|
|
363
448
|
/** Materialize presentation content once before Signal's text-only delivery funnels. */
|
|
364
449
|
function materializeSignalPresentationFallback(payload, presentationOverride) {
|
|
365
|
-
const reactionPayload = questionGatewayRuntime.prepareReactionPayloadForDelivery({
|
|
366
|
-
payload,
|
|
367
|
-
presentation: presentationOverride ?? payload.presentation
|
|
368
|
-
});
|
|
369
|
-
if (reactionPayload) return reactionPayload;
|
|
370
450
|
const presentation = presentationOverride ?? normalizeMessagePresentation(payload.presentation);
|
|
371
451
|
if (!presentation) return payload;
|
|
372
452
|
const currentText = payload.text?.trim() ?? "";
|
|
@@ -453,10 +533,13 @@ async function registerSignalReplyContext(params) {
|
|
|
453
533
|
const identity = resolveSignalReplyIdentity(params);
|
|
454
534
|
const author = normalizeOptionalString(params.author);
|
|
455
535
|
const body = normalizeOptionalString(params.body);
|
|
456
|
-
const media = params.media?.map((entry) =>
|
|
457
|
-
contentType
|
|
458
|
-
|
|
459
|
-
|
|
536
|
+
const media = params.media?.map((entry) => {
|
|
537
|
+
const contentType = normalizeOptionalString(entry.contentType);
|
|
538
|
+
return {
|
|
539
|
+
...contentType ? { contentType } : {},
|
|
540
|
+
...entry.kind != null ? { kind: entry.kind } : {}
|
|
541
|
+
};
|
|
542
|
+
});
|
|
460
543
|
const sourceTimestamp = asPositiveSafeInteger(params.sourceTimestamp) ?? Date.now();
|
|
461
544
|
if (!identity || !author) return;
|
|
462
545
|
const { key, ...replyIdentity } = identity;
|
|
@@ -524,54 +607,11 @@ function normalizeTransport(transport) {
|
|
|
524
607
|
url: normalizeSignalTransportUrl(transport.url)
|
|
525
608
|
};
|
|
526
609
|
}
|
|
527
|
-
function assertSignalContainerTransportHasAccount(params) {
|
|
528
|
-
if (params.transport.kind !== "container" || params.cfg.channels?.signal?.enabled === false) return;
|
|
529
|
-
const account = resolveSignalAccountConfig(params.cfg, normalizeAccountId$1(params.accountId));
|
|
530
|
-
if (account.enabled === false || normalizeOptionalString(account.account)) return;
|
|
531
|
-
throw new Error("Signal container transport requires an account number for an enabled account.");
|
|
532
|
-
}
|
|
533
|
-
function assertSignalLocalEndpointDoesNotConflictWithManagedSibling(params) {
|
|
534
|
-
if (params.transport.kind === "managed-native") return;
|
|
535
|
-
const localPort = resolveLocalSignalTransportPort(params.transport.url);
|
|
536
|
-
if (localPort === void 0) return;
|
|
537
|
-
const targetAccountId = normalizeAccountId$1(params.accountId);
|
|
538
|
-
for (const accountId of listSignalAccountIds(params.cfg)) {
|
|
539
|
-
if (normalizeAccountId$1(accountId) === targetAccountId) continue;
|
|
540
|
-
if (resolveSignalAccountEntry(params.cfg.channels?.signal?.accounts, accountId)?.enabled === false) continue;
|
|
541
|
-
const siblingAccount = resolveSignalAccount({
|
|
542
|
-
cfg: params.cfg,
|
|
543
|
-
accountId
|
|
544
|
-
});
|
|
545
|
-
if (!siblingAccount.configured) continue;
|
|
546
|
-
const siblingTransport = siblingAccount.transport;
|
|
547
|
-
if (siblingTransport?.kind !== "managed-native" || siblingTransport.socketPath !== void 0 || siblingTransport.httpPort !== localPort) continue;
|
|
548
|
-
throw new Error(`Signal ${params.transport.kind} account "${targetAccountId}" uses local port ${localPort}, which conflicts with managed native account "${accountId}". Choose a distinct transport URL.`);
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
610
|
function resolveConfiguredSignalTransport(cfg, accountId) {
|
|
552
611
|
const signal = cfg.channels?.signal;
|
|
553
612
|
const normalizedAccountId = normalizeAccountId$1(accountId);
|
|
554
613
|
return normalizedAccountId === DEFAULT_ACCOUNT_ID$2 ? signal?.transport ?? resolveSignalAccountEntry(signal?.accounts, normalizedAccountId)?.transport : resolveSignalAccountEntry(signal?.accounts, normalizedAccountId)?.transport;
|
|
555
614
|
}
|
|
556
|
-
function alignManagedConnectionUrlAfterBindChange(params) {
|
|
557
|
-
if (params.hasUrlOverride || !params.existing?.url || !isSignalManagedNativeConnectionUrlForBind(params.existing)) return assignSignalManagedNativePort(params.prepared, params.httpPort);
|
|
558
|
-
const connectionUrl = new URL(params.existing.url);
|
|
559
|
-
connectionUrl.port = String(params.httpPort);
|
|
560
|
-
const alignedPortUrl = normalizeSignalTransportUrl(connectionUrl.toString());
|
|
561
|
-
const next = {
|
|
562
|
-
...params.prepared,
|
|
563
|
-
url: alignedPortUrl,
|
|
564
|
-
httpPort: params.httpPort
|
|
565
|
-
};
|
|
566
|
-
if (isSignalManagedNativeConnectionUrlForBind(next)) return next;
|
|
567
|
-
const bindHost = params.prepared.httpHost ?? "127.0.0.1";
|
|
568
|
-
const connectionHost = bindHost === "0.0.0.0" ? "127.0.0.1" : bindHost === "::" ? "::1" : bindHost;
|
|
569
|
-
connectionUrl.hostname = connectionHost.includes(":") ? `[${connectionHost}]` : connectionHost;
|
|
570
|
-
return {
|
|
571
|
-
...next,
|
|
572
|
-
url: normalizeSignalTransportUrl(connectionUrl.toString())
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
615
|
function prepareSignalManagedNativeTransport(params) {
|
|
576
616
|
const existing = resolveConfiguredSignalTransport(params.cfg, params.accountId);
|
|
577
617
|
const existingManaged = existing?.kind === "managed-native" ? existing : void 0;
|
|
@@ -621,15 +661,27 @@ function prepareSignalManagedNativeTransport(params) {
|
|
|
621
661
|
if (localConnectionPort !== void 0) reservedPorts.add(localConnectionPort);
|
|
622
662
|
}
|
|
623
663
|
if (params.overrides?.httpPort !== void 0 && reservedPorts.has(params.overrides.httpPort)) throw new Error(`Signal managed native port ${params.overrides.httpPort} is already reserved by another account or local transport endpoint.`);
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
httpPort: allocateSignalManagedNativePort({
|
|
628
|
-
reservedPorts,
|
|
629
|
-
preferredPort
|
|
630
|
-
}),
|
|
631
|
-
hasUrlOverride: params.overrides?.url !== void 0
|
|
664
|
+
const httpPort = allocateSignalManagedNativePort({
|
|
665
|
+
reservedPorts,
|
|
666
|
+
preferredPort
|
|
632
667
|
});
|
|
668
|
+
if (params.overrides?.url !== void 0 || !existingManaged?.url || !isSignalManagedNativeConnectionUrlForBind(existingManaged)) return assignSignalManagedNativePort(prepared, httpPort);
|
|
669
|
+
const connectionUrl = new URL(existingManaged.url);
|
|
670
|
+
connectionUrl.port = String(httpPort);
|
|
671
|
+
const alignedPortUrl = normalizeSignalTransportUrl(connectionUrl.toString());
|
|
672
|
+
const next = {
|
|
673
|
+
...prepared,
|
|
674
|
+
url: alignedPortUrl,
|
|
675
|
+
httpPort
|
|
676
|
+
};
|
|
677
|
+
if (isSignalManagedNativeConnectionUrlForBind(next)) return next;
|
|
678
|
+
const bindHost = prepared.httpHost ?? "127.0.0.1";
|
|
679
|
+
const connectionHost = bindHost === "0.0.0.0" ? "127.0.0.1" : bindHost === "::" ? "::1" : bindHost;
|
|
680
|
+
connectionUrl.hostname = connectionHost.includes(":") ? `[${connectionHost}]` : connectionHost;
|
|
681
|
+
return {
|
|
682
|
+
...next,
|
|
683
|
+
url: normalizeSignalTransportUrl(connectionUrl.toString())
|
|
684
|
+
};
|
|
633
685
|
}
|
|
634
686
|
async function probeSignalTransport(params) {
|
|
635
687
|
const timeoutMs = params.timeoutMs ?? 1e4;
|
|
@@ -639,21 +691,37 @@ async function probeSignalTransport(params) {
|
|
|
639
691
|
overrides: params.transport
|
|
640
692
|
}) : params.transport;
|
|
641
693
|
const resolved = resolveSignalTransport(transport);
|
|
642
|
-
if (resolved.kind === "container") return (params.probeContainer ?? (await import("./transport-probes.runtime-
|
|
643
|
-
return (params.probeNative ?? (await import("./transport-probes.runtime-
|
|
694
|
+
if (resolved.kind === "container") return (params.probeContainer ?? (await import("./transport-probes.runtime-BJTjY0Hv.mjs")).containerCheck)(resolved.baseUrl, timeoutMs, params.account);
|
|
695
|
+
return (params.probeNative ?? (await import("./transport-probes.runtime-BJTjY0Hv.mjs")).nativeCheck)(resolved.baseUrl, timeoutMs);
|
|
644
696
|
}
|
|
645
697
|
function writeSignalAccountTransport(params) {
|
|
646
698
|
const transport = normalizeTransport(params.transport);
|
|
647
|
-
assertSignalContainerTransportHasAccount({
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
transport
|
|
656
|
-
|
|
699
|
+
function assertSignalContainerTransportHasAccount() {
|
|
700
|
+
if (transport.kind !== "container" || params.cfg.channels?.signal?.enabled === false) return;
|
|
701
|
+
const account = resolveSignalAccountConfig(params.cfg, normalizeAccountId$1(params.accountId));
|
|
702
|
+
if (account.enabled === false || normalizeOptionalString(account.account)) return;
|
|
703
|
+
throw new Error("Signal container transport requires an account number for an enabled account.");
|
|
704
|
+
}
|
|
705
|
+
assertSignalContainerTransportHasAccount();
|
|
706
|
+
function assertSignalLocalEndpointDoesNotConflictWithManagedSibling() {
|
|
707
|
+
if (transport.kind === "managed-native") return;
|
|
708
|
+
const localPort = resolveLocalSignalTransportPort(transport.url);
|
|
709
|
+
if (localPort === void 0) return;
|
|
710
|
+
const targetAccountId = normalizeAccountId$1(params.accountId);
|
|
711
|
+
for (const accountId of listSignalAccountIds(params.cfg)) {
|
|
712
|
+
if (normalizeAccountId$1(accountId) === targetAccountId) continue;
|
|
713
|
+
if (resolveSignalAccountEntry(params.cfg.channels?.signal?.accounts, accountId)?.enabled === false) continue;
|
|
714
|
+
const siblingAccount = resolveSignalAccount({
|
|
715
|
+
cfg: params.cfg,
|
|
716
|
+
accountId
|
|
717
|
+
});
|
|
718
|
+
if (!siblingAccount.configured) continue;
|
|
719
|
+
const siblingTransport = siblingAccount.transport;
|
|
720
|
+
if (siblingTransport?.kind !== "managed-native" || siblingTransport.socketPath !== void 0 || siblingTransport.httpPort !== localPort) continue;
|
|
721
|
+
throw new Error(`Signal ${transport.kind} account "${targetAccountId}" uses local port ${localPort}, which conflicts with managed native account "${accountId}". Choose a distinct transport URL.`);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
assertSignalLocalEndpointDoesNotConflictWithManagedSibling();
|
|
657
725
|
const next = patchChannelConfigForAccount({
|
|
658
726
|
cfg: params.cfg,
|
|
659
727
|
channel: "signal",
|
|
@@ -733,57 +801,6 @@ function normalizeSignalAccountInput(value) {
|
|
|
733
801
|
if (digits.length < MIN_E164_DIGITS || digits.length > MAX_E164_DIGITS) return null;
|
|
734
802
|
return `+${digits}`;
|
|
735
803
|
}
|
|
736
|
-
function isUuidLike(value) {
|
|
737
|
-
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
738
|
-
}
|
|
739
|
-
function parseSignalAllowFromEntries(raw) {
|
|
740
|
-
return parseAllowFromEntries(raw, (entry) => {
|
|
741
|
-
if (normalizeLowercaseStringOrEmpty(entry).startsWith("uuid:")) {
|
|
742
|
-
const id = entry.slice(5).trim();
|
|
743
|
-
if (!id) return { error: "Invalid uuid entry" };
|
|
744
|
-
return { value: `uuid:${id}` };
|
|
745
|
-
}
|
|
746
|
-
if (isUuidLike(entry)) return { value: `uuid:${entry}` };
|
|
747
|
-
const normalized = normalizeSignalAccountInput(entry);
|
|
748
|
-
if (!normalized) return { error: `Invalid entry: ${entry}` };
|
|
749
|
-
return { value: normalized };
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
function buildSignalSetupPatch(input) {
|
|
753
|
-
const account = normalizeSignalAccountInput(input.signalNumber);
|
|
754
|
-
const transport = input.httpUrl ? {
|
|
755
|
-
kind: input.signalTransport ?? "external-native",
|
|
756
|
-
url: normalizeSignalTransportUrl(input.httpUrl)
|
|
757
|
-
} : input.cliPath || input.httpHost || input.httpPort ? {
|
|
758
|
-
kind: "managed-native",
|
|
759
|
-
...managedTransportOverridesFromSetupInput(input)
|
|
760
|
-
} : void 0;
|
|
761
|
-
return {
|
|
762
|
-
...account ? { account } : {},
|
|
763
|
-
...transport ? { transport } : {}
|
|
764
|
-
};
|
|
765
|
-
}
|
|
766
|
-
async function prepareSignalSetupInput(params) {
|
|
767
|
-
if (!params.input.httpUrl || params.input.signalTransport) return params.input;
|
|
768
|
-
const account = normalizeSignalAccountInput(params.input.signalNumber) ?? normalizeSignalAccountInput(resolveSignalSetupAccount({
|
|
769
|
-
cfg: params.cfg,
|
|
770
|
-
accountId: params.accountId
|
|
771
|
-
})) ?? void 0;
|
|
772
|
-
try {
|
|
773
|
-
const detected = await detectSignalTransport({
|
|
774
|
-
url: params.input.httpUrl,
|
|
775
|
-
...account ? { account } : {}
|
|
776
|
-
});
|
|
777
|
-
return {
|
|
778
|
-
...params.input,
|
|
779
|
-
signalTransport: detected.kind === "container" ? "container" : "external-native"
|
|
780
|
-
};
|
|
781
|
-
} catch {
|
|
782
|
-
const existing = resolveConfiguredSignalTransport(params.cfg, params.accountId);
|
|
783
|
-
if (existing?.kind === "container" || existing?.kind === "external-native") return params.input;
|
|
784
|
-
throw new Error("Signal could not detect the HTTP transport; start the endpoint or pass --signal-transport external-native|container.");
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
804
|
function managedTransportOverridesFromSetupInput(input) {
|
|
788
805
|
return {
|
|
789
806
|
...input.cliPath ? { cliPath: input.cliPath } : {},
|
|
@@ -820,7 +837,17 @@ const signalDmPolicy = createChannelDmPolicy({
|
|
|
820
837
|
],
|
|
821
838
|
message: t("wizard.signal.allowFromPrompt"),
|
|
822
839
|
placeholder: "+15555550123, uuid:123e4567-e89b-12d3-a456-426614174000",
|
|
823
|
-
parseEntries:
|
|
840
|
+
parseEntries: (raw) => parseAllowFromEntries(raw, (entry) => {
|
|
841
|
+
if (normalizeLowercaseStringOrEmpty(entry).startsWith("uuid:")) {
|
|
842
|
+
const id = entry.slice(5).trim();
|
|
843
|
+
if (!id) return { error: "Invalid uuid entry" };
|
|
844
|
+
return { value: `uuid:${id}` };
|
|
845
|
+
}
|
|
846
|
+
if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(entry)) return { value: `uuid:${entry}` };
|
|
847
|
+
const normalized = normalizeSignalAccountInput(entry);
|
|
848
|
+
if (!normalized) return { error: `Invalid entry: ${entry}` };
|
|
849
|
+
return { value: normalized };
|
|
850
|
+
}),
|
|
824
851
|
getExistingAllowFrom: ({ cfg, accountId }) => resolveSignalAccount({
|
|
825
852
|
cfg,
|
|
826
853
|
accountId
|
|
@@ -834,19 +861,18 @@ const signalDmPolicy = createChannelDmPolicy({
|
|
|
834
861
|
})
|
|
835
862
|
})
|
|
836
863
|
});
|
|
837
|
-
function resolveSignalCliPath(params) {
|
|
838
|
-
const transport = resolveSignalAccount({
|
|
839
|
-
cfg: params.cfg,
|
|
840
|
-
accountId: params.accountId
|
|
841
|
-
}).transport;
|
|
842
|
-
if (transport.kind !== "managed-native") return;
|
|
843
|
-
return typeof params.credentialValues.cliPath === "string" ? params.credentialValues.cliPath : transport.cliPath;
|
|
844
|
-
}
|
|
845
864
|
function createSignalCliPathTextInput(shouldPrompt) {
|
|
846
865
|
return createCliPathTextInput({
|
|
847
866
|
inputKey: "cliPath",
|
|
848
867
|
message: "signal-cli path",
|
|
849
|
-
resolvePath:
|
|
868
|
+
resolvePath: (params) => {
|
|
869
|
+
const transport = resolveSignalAccount({
|
|
870
|
+
cfg: params.cfg,
|
|
871
|
+
accountId: params.accountId
|
|
872
|
+
}).transport;
|
|
873
|
+
if (transport.kind !== "managed-native") return;
|
|
874
|
+
return typeof params.credentialValues.cliPath === "string" ? params.credentialValues.cliPath : transport.cliPath;
|
|
875
|
+
},
|
|
850
876
|
shouldPrompt
|
|
851
877
|
});
|
|
852
878
|
}
|
|
@@ -889,7 +915,20 @@ const signalSetupAdapterBase = createPatchedAccountSetupAdapter({
|
|
|
889
915
|
if (!input.signalNumber && !input.httpUrl && !input.httpHost && !input.httpPort && !input.cliPath) return "Signal requires --signal-number or --http-url/--http-host/--http-port/--cli-path.";
|
|
890
916
|
return null;
|
|
891
917
|
} }),
|
|
892
|
-
buildPatch:
|
|
918
|
+
buildPatch: (input) => {
|
|
919
|
+
const account = normalizeSignalAccountInput(input.signalNumber);
|
|
920
|
+
const transport = input.httpUrl ? {
|
|
921
|
+
kind: input.signalTransport ?? "external-native",
|
|
922
|
+
url: normalizeSignalTransportUrl(input.httpUrl)
|
|
923
|
+
} : input.cliPath || input.httpHost || input.httpPort ? {
|
|
924
|
+
kind: "managed-native",
|
|
925
|
+
...managedTransportOverridesFromSetupInput(input)
|
|
926
|
+
} : void 0;
|
|
927
|
+
return {
|
|
928
|
+
...account ? { account } : {},
|
|
929
|
+
...transport ? { transport } : {}
|
|
930
|
+
};
|
|
931
|
+
}
|
|
893
932
|
});
|
|
894
933
|
function restorePromotedSignalDefaultAccount(cfg) {
|
|
895
934
|
const signal = cfg.channels?.signal;
|
|
@@ -912,7 +951,27 @@ function restorePromotedSignalDefaultAccount(cfg) {
|
|
|
912
951
|
const signalSetupAdapter = {
|
|
913
952
|
...signalSetupAdapterBase,
|
|
914
953
|
namedAccountPromotionKeys: [],
|
|
915
|
-
prepareAccountConfigInput:
|
|
954
|
+
prepareAccountConfigInput: async (params) => {
|
|
955
|
+
if (!params.input.httpUrl || params.input.signalTransport) return params.input;
|
|
956
|
+
const account = normalizeSignalAccountInput(params.input.signalNumber) ?? normalizeSignalAccountInput(resolveSignalSetupAccount({
|
|
957
|
+
cfg: params.cfg,
|
|
958
|
+
accountId: params.accountId
|
|
959
|
+
})) ?? void 0;
|
|
960
|
+
try {
|
|
961
|
+
const detected = await detectSignalTransport({
|
|
962
|
+
url: params.input.httpUrl,
|
|
963
|
+
...account ? { account } : {}
|
|
964
|
+
});
|
|
965
|
+
return {
|
|
966
|
+
...params.input,
|
|
967
|
+
signalTransport: detected.kind === "container" ? "container" : "external-native"
|
|
968
|
+
};
|
|
969
|
+
} catch {
|
|
970
|
+
const existing = resolveConfiguredSignalTransport(params.cfg, params.accountId);
|
|
971
|
+
if (existing?.kind === "container" || existing?.kind === "external-native") return params.input;
|
|
972
|
+
throw new Error("Signal could not detect the HTTP transport; start the endpoint or pass --signal-transport external-native|container.");
|
|
973
|
+
}
|
|
974
|
+
},
|
|
916
975
|
singleAccountKeysToMove: [
|
|
917
976
|
"signalNumber",
|
|
918
977
|
"account",
|
|
@@ -977,11 +1036,121 @@ function createSignalSetupWizardProxy(loadWizard) {
|
|
|
977
1036
|
disable: (cfg) => setSetupChannelEnabled$1(cfg, channel, false)
|
|
978
1037
|
});
|
|
979
1038
|
}
|
|
1039
|
+
// extensions/signal/src/daemon-env.ts
|
|
1040
|
+
const SIGNAL_CLI_INHERITED_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
1041
|
+
"PATH",
|
|
1042
|
+
"HOME",
|
|
1043
|
+
"USER",
|
|
1044
|
+
"LOGNAME",
|
|
1045
|
+
"LANG",
|
|
1046
|
+
"LANGUAGE",
|
|
1047
|
+
"TZ",
|
|
1048
|
+
"TMPDIR",
|
|
1049
|
+
"TMP",
|
|
1050
|
+
"TEMP",
|
|
1051
|
+
"JAVA_HOME",
|
|
1052
|
+
"JAVA_OPTS",
|
|
1053
|
+
"JAVA_TOOL_OPTIONS",
|
|
1054
|
+
"JDK_JAVA_OPTIONS",
|
|
1055
|
+
"_JAVA_OPTIONS",
|
|
1056
|
+
"SIGNAL_CLI_OPTS",
|
|
1057
|
+
"SIGNAL_CLI_CONFIG",
|
|
1058
|
+
"SIGNAL_CLI_USER_AGENT",
|
|
1059
|
+
"LD_LIBRARY_PATH",
|
|
1060
|
+
"DYLD_LIBRARY_PATH",
|
|
1061
|
+
"DYLD_FALLBACK_LIBRARY_PATH",
|
|
1062
|
+
"SYSTEMROOT",
|
|
1063
|
+
"SYSTEMDRIVE",
|
|
1064
|
+
"WINDIR",
|
|
1065
|
+
"COMSPEC",
|
|
1066
|
+
"PATHEXT",
|
|
1067
|
+
"USERPROFILE",
|
|
1068
|
+
"USERNAME",
|
|
1069
|
+
"HOMEDRIVE",
|
|
1070
|
+
"HOMEPATH",
|
|
1071
|
+
"APPDATA",
|
|
1072
|
+
"LOCALAPPDATA",
|
|
1073
|
+
"PROGRAMDATA",
|
|
1074
|
+
"PROGRAMFILES",
|
|
1075
|
+
"PROGRAMFILES(X86)",
|
|
1076
|
+
"PROGRAMW6432",
|
|
1077
|
+
"ALLUSERSPROFILE",
|
|
1078
|
+
"PUBLIC",
|
|
1079
|
+
"OS",
|
|
1080
|
+
"PROCESSOR_ARCHITECTURE",
|
|
1081
|
+
"NUMBER_OF_PROCESSORS"
|
|
1082
|
+
]);
|
|
1083
|
+
const SIGNAL_CLI_INHERITED_ENV_PREFIXES = ["LC_", "XDG_"];
|
|
1084
|
+
const SIGNAL_CLI_DROPPED_ENV_HINT_KEYS = /* @__PURE__ */ new Set([
|
|
1085
|
+
"HTTP_PROXY",
|
|
1086
|
+
"HTTPS_PROXY",
|
|
1087
|
+
"NO_PROXY",
|
|
1088
|
+
"ALL_PROXY",
|
|
1089
|
+
"SSL_CERT_FILE",
|
|
1090
|
+
"SSL_CERT_DIR",
|
|
1091
|
+
"REQUESTS_CA_BUNDLE",
|
|
1092
|
+
"CURL_CA_BUNDLE",
|
|
1093
|
+
"NODE_EXTRA_CA_CERTS"
|
|
1094
|
+
]);
|
|
1095
|
+
const SIGNAL_MANAGED_DAEMON_ENV_DOCS_URL = "https://docs.openclaw.ai/channels/signal#managed-daemon-environment";
|
|
1096
|
+
function isSignalDaemonEnvKeyInherited(name) {
|
|
1097
|
+
return SIGNAL_CLI_INHERITED_ENV_KEYS.has(name) || SIGNAL_CLI_INHERITED_ENV_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
1098
|
+
}
|
|
1099
|
+
function buildSignalDaemonEnv(source = process.env, platform = process.platform) {
|
|
1100
|
+
const env = {};
|
|
1101
|
+
const retainedWindowsKeys = /* @__PURE__ */ new Map();
|
|
1102
|
+
for (const [key, value] of Object.entries(source)) {
|
|
1103
|
+
if (typeof value !== "string") continue;
|
|
1104
|
+
const name = platform === "win32" ? key.toUpperCase() : key;
|
|
1105
|
+
if (!isSignalDaemonEnvKeyInherited(name)) continue;
|
|
1106
|
+
if (platform === "win32") {
|
|
1107
|
+
const previousKey = retainedWindowsKeys.get(name);
|
|
1108
|
+
if (previousKey !== void 0) delete env[previousKey];
|
|
1109
|
+
retainedWindowsKeys.set(name, key);
|
|
1110
|
+
}
|
|
1111
|
+
env[key] = value;
|
|
1112
|
+
}
|
|
1113
|
+
return env;
|
|
1114
|
+
}
|
|
1115
|
+
/** Names (as set, sorted) of commonly needed non-secret variables the daemon does not inherit. */
|
|
1116
|
+
function listSignalDaemonDroppedEnvHints(source = process.env) {
|
|
1117
|
+
const names = /* @__PURE__ */ new Set();
|
|
1118
|
+
for (const [key, value] of Object.entries(source)) if (typeof value === "string" && value.trim() && SIGNAL_CLI_DROPPED_ENV_HINT_KEYS.has(key.toUpperCase())) names.add(key);
|
|
1119
|
+
return [...names].toSorted();
|
|
1120
|
+
}
|
|
1121
|
+
/** Operator notice naming the dropped variables and the supported ways to supply them. */
|
|
1122
|
+
function formatSignalDaemonDroppedEnvNotice(names) {
|
|
1123
|
+
return `The managed signal-cli daemon does not inherit ${names.join(", ")} from the OpenClaw process environment. signal-cli's JVM takes proxy and trust-store settings from Java system properties: pass them in JAVA_TOOL_OPTIONS (for example -Dhttps.proxyHost=<host> -Dhttps.proxyPort=<port>, or -Djavax.net.ssl.trustStore=<path> for a private CA), set the variables inside a transport.cliPath wrapper script, or run the daemon yourself with transport.kind external-native. See ${SIGNAL_MANAGED_DAEMON_ENV_DOCS_URL}`;
|
|
1124
|
+
}
|
|
980
1125
|
// extensions/signal/src/doctor.ts
|
|
1126
|
+
function usesManagedSignalDaemon(cfg) {
|
|
1127
|
+
if (!cfg.channels?.signal) return false;
|
|
1128
|
+
return listSignalAccountIds(cfg).some((accountId) => {
|
|
1129
|
+
try {
|
|
1130
|
+
const account = resolveSignalAccount({
|
|
1131
|
+
cfg,
|
|
1132
|
+
accountId
|
|
1133
|
+
});
|
|
1134
|
+
return account.enabled && account.configured && account.transport.kind === "managed-native";
|
|
1135
|
+
} catch {
|
|
1136
|
+
return false;
|
|
1137
|
+
}
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
981
1140
|
const signalDoctor = {
|
|
982
1141
|
normalizeCompatibilityConfig,
|
|
1142
|
+
runConfigSequence: ({ cfg, env }) => {
|
|
1143
|
+
const result = {
|
|
1144
|
+
changeNotes: [],
|
|
1145
|
+
warningNotes: []
|
|
1146
|
+
};
|
|
1147
|
+
if (!usesManagedSignalDaemon(cfg)) return result;
|
|
1148
|
+
const names = listSignalDaemonDroppedEnvHints(env ?? process.env);
|
|
1149
|
+
if (names.length > 0) result.warningNotes.push(`- channels.signal: ${formatSignalDaemonDroppedEnvNotice(names)}`);
|
|
1150
|
+
return result;
|
|
1151
|
+
},
|
|
983
1152
|
cleanStaleConfig: async ({ cfg }) => {
|
|
984
|
-
const { detectSignalTransport } = await import("./transport-detection-
|
|
1153
|
+
const { detectSignalTransport } = await import("./transport-detection-B1h2qGWb.mjs").then((n) => n.n);
|
|
985
1154
|
const transport = await migrateLegacySignalTransportConfig({
|
|
986
1155
|
cfg,
|
|
987
1156
|
detect: detectSignalTransport
|
|
@@ -994,7 +1163,7 @@ const signalDoctor = {
|
|
|
994
1163
|
};
|
|
995
1164
|
// extensions/signal/src/shared.ts
|
|
996
1165
|
const SIGNAL_CHANNEL = "signal";
|
|
997
|
-
const signalSetupWizard = createSignalSetupWizardProxy(async () => (await import("./setup-surface-
|
|
1166
|
+
const signalSetupWizard = createSignalSetupWizardProxy(async () => (await import("./setup-surface-FE11aiCN.mjs")).signalSetupWizard);
|
|
998
1167
|
const signalConfigAdapter = {
|
|
999
1168
|
...createScopedChannelConfigAdapter({
|
|
1000
1169
|
sectionKey: SIGNAL_CHANNEL,
|
|
@@ -1014,16 +1183,16 @@ const signalConfigAdapter = {
|
|
|
1014
1183
|
const raw = resolveSignalAccount({
|
|
1015
1184
|
cfg,
|
|
1016
1185
|
accountId
|
|
1017
|
-
}).config.defaultTo;
|
|
1018
|
-
if (
|
|
1186
|
+
}).config.defaultTo?.trim();
|
|
1187
|
+
if (!raw) return;
|
|
1019
1188
|
try {
|
|
1020
1189
|
return resolveSignalTarget({
|
|
1021
1190
|
cfg,
|
|
1022
1191
|
accountId,
|
|
1023
1192
|
input: raw
|
|
1024
|
-
})?.to ?? raw
|
|
1193
|
+
})?.to ?? raw;
|
|
1025
1194
|
} catch {
|
|
1026
|
-
return raw
|
|
1195
|
+
return raw;
|
|
1027
1196
|
}
|
|
1028
1197
|
}
|
|
1029
1198
|
};
|
|
@@ -1078,10 +1247,10 @@ function createSignalPluginBase(params) {
|
|
|
1078
1247
|
};
|
|
1079
1248
|
}
|
|
1080
1249
|
// extensions/signal/src/channel.ts
|
|
1081
|
-
const loadSignalMonitorModule = createLazyRuntimeModule(() => import("./monitor-
|
|
1082
|
-
const loadSignalProbeModule = createLazyRuntimeModule(() => import("./probe-
|
|
1083
|
-
const loadSignalSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
1084
|
-
const loadSignalApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-
|
|
1250
|
+
const loadSignalMonitorModule = createLazyRuntimeModule(() => import("./monitor-CuoDdmDR.mjs").then((n) => n.n));
|
|
1251
|
+
const loadSignalProbeModule = createLazyRuntimeModule(() => import("./probe-DdVlJ_Vx.mjs").then((n) => n.n));
|
|
1252
|
+
const loadSignalSendRuntime = createLazyRuntimeModule(() => import("./send-Bi48fdOa.mjs").then((n) => n.i));
|
|
1253
|
+
const loadSignalApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-Cp3jpgz6.mjs").then((n) => n.n));
|
|
1085
1254
|
async function createSignalOutboundSender(params) {
|
|
1086
1255
|
const send = resolveOutboundSendDep(params.deps, "signal") ?? (await loadSignalSendRuntime()).sendMessageSignal;
|
|
1087
1256
|
const maxBytes = resolveChannelMediaMaxBytes({
|
|
@@ -1089,11 +1258,26 @@ async function createSignalOutboundSender(params) {
|
|
|
1089
1258
|
resolveChannelLimitMb: () => resolveSignalAccount(params).config.mediaMaxMb
|
|
1090
1259
|
});
|
|
1091
1260
|
return async (to, text, { replyToId, ...options }) => {
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1261
|
+
const normalizedReplyToId = normalizeOptionalString(replyToId);
|
|
1262
|
+
let replyOptions = {};
|
|
1263
|
+
if (normalizedReplyToId) {
|
|
1264
|
+
const accountId = resolveSignalAccount({
|
|
1265
|
+
cfg: params.cfg,
|
|
1266
|
+
accountId: params.accountId
|
|
1267
|
+
}).accountId;
|
|
1268
|
+
const persistedContext = await resolveSignalReplyContextWithPersistence({
|
|
1269
|
+
accountId,
|
|
1270
|
+
to,
|
|
1271
|
+
replyToId: normalizedReplyToId
|
|
1272
|
+
});
|
|
1273
|
+
const replyToAuthor = persistedContext?.ambiguous === true ? void 0 : persistedContext?.author;
|
|
1274
|
+
const replyToBody = persistedContext?.ambiguous === true ? "" : [persistedContext?.body, formatSignalMediaText(persistedContext?.media ?? [])].filter(Boolean).join("\n");
|
|
1275
|
+
replyOptions = {
|
|
1276
|
+
replyToId: normalizedReplyToId,
|
|
1277
|
+
...replyToAuthor ? { replyToAuthor } : {},
|
|
1278
|
+
...replyToBody ? { replyToBody } : {}
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1097
1281
|
return await send(to, text, {
|
|
1098
1282
|
cfg: params.cfg,
|
|
1099
1283
|
...options,
|
|
@@ -1120,26 +1304,6 @@ async function sendSignalOutbound(params) {
|
|
|
1120
1304
|
...params.mediaReadFile ? { mediaReadFile: params.mediaReadFile } : {}
|
|
1121
1305
|
});
|
|
1122
1306
|
}
|
|
1123
|
-
async function resolveSignalReplyOptions(params) {
|
|
1124
|
-
const replyToId = normalizeOptionalString(params.replyToId);
|
|
1125
|
-
if (!replyToId) return {};
|
|
1126
|
-
const accountId = resolveSignalAccount({
|
|
1127
|
-
cfg: params.cfg,
|
|
1128
|
-
accountId: params.accountId
|
|
1129
|
-
}).accountId;
|
|
1130
|
-
const persistedContext = await resolveSignalReplyContextWithPersistence({
|
|
1131
|
-
accountId,
|
|
1132
|
-
to: params.to,
|
|
1133
|
-
replyToId
|
|
1134
|
-
});
|
|
1135
|
-
const replyToAuthor = persistedContext?.ambiguous === true ? void 0 : persistedContext?.author;
|
|
1136
|
-
const replyToBody = persistedContext?.ambiguous === true ? "" : [persistedContext?.body, formatSignalMediaText(persistedContext?.media ?? [])].filter(Boolean).join("\n");
|
|
1137
|
-
return {
|
|
1138
|
-
replyToId,
|
|
1139
|
-
...replyToAuthor ? { replyToAuthor } : {},
|
|
1140
|
-
...replyToBody ? { replyToBody } : {}
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
1307
|
function inferSignalTargetChatType(rawTo) {
|
|
1144
1308
|
const to = rawTo.trim().replace(/^signal:/i, "").trim();
|
|
1145
1309
|
if (!to) return;
|
|
@@ -1171,133 +1335,6 @@ const signalMessageAdapter = defineChannelMessageAdapter({
|
|
|
1171
1335
|
media: sendSignalOutbound
|
|
1172
1336
|
}
|
|
1173
1337
|
});
|
|
1174
|
-
function resolveSignalOutboundSessionRoute(params) {
|
|
1175
|
-
const target = params.resolvedTarget?.to ?? params.target;
|
|
1176
|
-
const resolved = resolveSignalOutboundTarget(target);
|
|
1177
|
-
if (!resolved) return null;
|
|
1178
|
-
const normalizedTarget = target.replace(/^signal:/i, "").trim();
|
|
1179
|
-
const recipientSessionExact = resolved.chatType === "group" || /^\+?\d{3,15}$/.test(normalizedTarget) ? true : "direct-alias";
|
|
1180
|
-
const baseSessionKey = buildOutboundBaseSessionKey({
|
|
1181
|
-
channel: "signal",
|
|
1182
|
-
cfg: params.cfg,
|
|
1183
|
-
agentId: params.agentId,
|
|
1184
|
-
accountId: params.accountId,
|
|
1185
|
-
peer: resolved.peer
|
|
1186
|
-
});
|
|
1187
|
-
return {
|
|
1188
|
-
sessionKey: baseSessionKey,
|
|
1189
|
-
baseSessionKey,
|
|
1190
|
-
recipientSessionExact,
|
|
1191
|
-
...resolved
|
|
1192
|
-
};
|
|
1193
|
-
}
|
|
1194
|
-
async function sendFormattedSignalText(ctx) {
|
|
1195
|
-
const send = await createSignalOutboundSender(ctx);
|
|
1196
|
-
const limit = resolveTextChunkLimit(ctx.cfg, "signal", ctx.accountId ?? void 0, { fallbackLimit: 4e3 });
|
|
1197
|
-
const to = resolveSignalSendTarget(ctx);
|
|
1198
|
-
const tableMode = resolveMarkdownTableMode({
|
|
1199
|
-
cfg: ctx.cfg,
|
|
1200
|
-
channel: "signal",
|
|
1201
|
-
accountId: ctx.accountId ?? void 0
|
|
1202
|
-
});
|
|
1203
|
-
let chunks = markdownToSignalTextChunks(ctx.text, limit ?? Number.POSITIVE_INFINITY, { tableMode });
|
|
1204
|
-
if (chunks.length === 0 && ctx.text) chunks = [{
|
|
1205
|
-
text: ctx.text,
|
|
1206
|
-
styles: []
|
|
1207
|
-
}];
|
|
1208
|
-
const effectiveReplyToMode = ctx.replyToMode ?? resolveSignalReplyToMode({
|
|
1209
|
-
cfg: ctx.cfg,
|
|
1210
|
-
accountId: ctx.accountId,
|
|
1211
|
-
chatType: inferSignalTargetChatType(to)
|
|
1212
|
-
});
|
|
1213
|
-
const nextReplyToId = createReplyToFanout({
|
|
1214
|
-
replyToId: ctx.replyToId,
|
|
1215
|
-
replyToIdSource: ctx.replyToIdSource,
|
|
1216
|
-
replyToMode: effectiveReplyToMode
|
|
1217
|
-
});
|
|
1218
|
-
const results = [];
|
|
1219
|
-
for (const chunk of chunks) {
|
|
1220
|
-
ctx.abortSignal?.throwIfAborted();
|
|
1221
|
-
const result = await send(to, chunk.text, {
|
|
1222
|
-
replyToId: nextReplyToId(),
|
|
1223
|
-
textMode: "plain",
|
|
1224
|
-
textStyles: chunk.styles
|
|
1225
|
-
});
|
|
1226
|
-
const deliveryResult = attachChannelToResult("signal", attachSignalVisibleText(result, chunk.text));
|
|
1227
|
-
results.push(deliveryResult);
|
|
1228
|
-
await ctx.onDeliveryResult?.(deliveryResult);
|
|
1229
|
-
}
|
|
1230
|
-
return results;
|
|
1231
|
-
}
|
|
1232
|
-
async function sendFormattedSignalMedia(ctx) {
|
|
1233
|
-
ctx.abortSignal?.throwIfAborted();
|
|
1234
|
-
const send = await createSignalOutboundSender(ctx);
|
|
1235
|
-
const to = resolveSignalSendTarget(ctx);
|
|
1236
|
-
const tableMode = resolveMarkdownTableMode({
|
|
1237
|
-
cfg: ctx.cfg,
|
|
1238
|
-
channel: "signal",
|
|
1239
|
-
accountId: ctx.accountId ?? void 0
|
|
1240
|
-
});
|
|
1241
|
-
const formatted = markdownToSignalTextChunks(ctx.text, Number.POSITIVE_INFINITY, { tableMode })[0] ?? {
|
|
1242
|
-
text: ctx.text,
|
|
1243
|
-
styles: []
|
|
1244
|
-
};
|
|
1245
|
-
const result = await send(to, formatted.text, {
|
|
1246
|
-
replyToId: ctx.replyToId,
|
|
1247
|
-
mediaUrl: ctx.mediaUrl,
|
|
1248
|
-
...ctx.mediaAccess ? { mediaAccess: ctx.mediaAccess } : {},
|
|
1249
|
-
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
1250
|
-
...ctx.mediaReadFile ? { mediaReadFile: ctx.mediaReadFile } : {},
|
|
1251
|
-
textMode: "plain",
|
|
1252
|
-
textStyles: formatted.styles
|
|
1253
|
-
});
|
|
1254
|
-
return attachChannelToResult("signal", attachSignalVisibleText(result, formatted.text));
|
|
1255
|
-
}
|
|
1256
|
-
async function registerDeliveredSignalApprovalPayloadForReactions(params) {
|
|
1257
|
-
const account = resolveSignalAccount({
|
|
1258
|
-
cfg: params.cfg,
|
|
1259
|
-
accountId: params.target.accountId ?? void 0
|
|
1260
|
-
});
|
|
1261
|
-
const targetAuthor = normalizeOptionalString(account.config.account);
|
|
1262
|
-
const targetAuthorUuid = normalizeOptionalString(account.config.accountUuid);
|
|
1263
|
-
if (!targetAuthor && !targetAuthorUuid) return;
|
|
1264
|
-
const { registerSignalReactionTargetsForDeliveredPayload } = await import("./reaction-targets-Bg9NSMJF.mjs").then((n) => n.t);
|
|
1265
|
-
await registerSignalReactionTargetsForDeliveredPayload({
|
|
1266
|
-
cfg: params.cfg,
|
|
1267
|
-
target: {
|
|
1268
|
-
...params.target,
|
|
1269
|
-
accountId: account.accountId
|
|
1270
|
-
},
|
|
1271
|
-
payload: params.payload,
|
|
1272
|
-
results: params.results,
|
|
1273
|
-
targetAuthor,
|
|
1274
|
-
targetAuthorUuid
|
|
1275
|
-
});
|
|
1276
|
-
}
|
|
1277
|
-
async function renderSignalApprovalPayloadForReactions(params) {
|
|
1278
|
-
const account = resolveSignalAccount({
|
|
1279
|
-
cfg: params.ctx.cfg,
|
|
1280
|
-
accountId: params.ctx.accountId ?? void 0
|
|
1281
|
-
});
|
|
1282
|
-
const targetAuthor = normalizeOptionalString(account.config.account);
|
|
1283
|
-
const targetAuthorUuid = normalizeOptionalString(account.config.accountUuid);
|
|
1284
|
-
if (!targetAuthor && !targetAuthorUuid) return null;
|
|
1285
|
-
const { addSignalApprovalReactionHintToStructuredPayload } = await loadSignalApprovalReactionsModule();
|
|
1286
|
-
const payload = materializeSignalPresentationFallback(params.payload, params.presentation);
|
|
1287
|
-
const questionPayload = questionGatewayRuntime.prepareReactionPayloadForDelivery({
|
|
1288
|
-
payload: params.payload,
|
|
1289
|
-
presentation: params.presentation
|
|
1290
|
-
});
|
|
1291
|
-
if (questionPayload) return questionPayload;
|
|
1292
|
-
return addSignalApprovalReactionHintToStructuredPayload({
|
|
1293
|
-
cfg: params.ctx.cfg,
|
|
1294
|
-
accountId: params.ctx.accountId ?? void 0,
|
|
1295
|
-
to: params.ctx.to,
|
|
1296
|
-
payload,
|
|
1297
|
-
targetAuthor,
|
|
1298
|
-
targetAuthorUuid
|
|
1299
|
-
});
|
|
1300
|
-
}
|
|
1301
1338
|
const signalPlugin = createChatChannelPlugin({
|
|
1302
1339
|
base: {
|
|
1303
1340
|
...createSignalPluginBase({
|
|
@@ -1333,7 +1370,26 @@ const signalPlugin = createChatChannelPlugin({
|
|
|
1333
1370
|
targetPrefixes: ["signal"],
|
|
1334
1371
|
normalizeTarget: normalizeSignalMessagingTarget,
|
|
1335
1372
|
inferTargetChatType: ({ to }) => inferSignalTargetChatType(to),
|
|
1336
|
-
resolveOutboundSessionRoute:
|
|
1373
|
+
resolveOutboundSessionRoute: (params) => {
|
|
1374
|
+
const target = params.resolvedTarget?.to ?? params.target;
|
|
1375
|
+
const resolved = resolveSignalOutboundTarget(target);
|
|
1376
|
+
if (!resolved) return null;
|
|
1377
|
+
const normalizedTarget = target.replace(/^signal:/i, "").trim();
|
|
1378
|
+
const recipientSessionExact = resolved.chatType === "group" || /^\+?\d{3,15}$/.test(normalizedTarget) ? true : "direct-alias";
|
|
1379
|
+
const baseSessionKey = buildOutboundBaseSessionKey({
|
|
1380
|
+
channel: "signal",
|
|
1381
|
+
cfg: params.cfg,
|
|
1382
|
+
agentId: params.agentId,
|
|
1383
|
+
accountId: params.accountId,
|
|
1384
|
+
peer: resolved.peer
|
|
1385
|
+
});
|
|
1386
|
+
return {
|
|
1387
|
+
sessionKey: baseSessionKey,
|
|
1388
|
+
baseSessionKey,
|
|
1389
|
+
recipientSessionExact,
|
|
1390
|
+
...resolved
|
|
1391
|
+
};
|
|
1392
|
+
},
|
|
1337
1393
|
targetResolver: {
|
|
1338
1394
|
looksLikeId: looksLikeSignalTargetId,
|
|
1339
1395
|
hint: "<E.164|uuid:ID|group:ID|signal:group:ID|signal:+E.164>",
|
|
@@ -1513,10 +1569,111 @@ const signalPlugin = createChatChannelPlugin({
|
|
|
1513
1569
|
payload,
|
|
1514
1570
|
hint
|
|
1515
1571
|
}),
|
|
1516
|
-
afterDeliverPayload:
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1572
|
+
afterDeliverPayload: async (params) => {
|
|
1573
|
+
const account = resolveSignalAccount({
|
|
1574
|
+
cfg: params.cfg,
|
|
1575
|
+
accountId: params.target.accountId ?? void 0
|
|
1576
|
+
});
|
|
1577
|
+
const targetAuthor = normalizeOptionalString(account.config.account);
|
|
1578
|
+
const targetAuthorUuid = normalizeOptionalString(account.config.accountUuid);
|
|
1579
|
+
if (!targetAuthor && !targetAuthorUuid) return;
|
|
1580
|
+
const { registerSignalApprovalReactionTargetForDeliveredPayload } = await loadSignalApprovalReactionsModule();
|
|
1581
|
+
await registerSignalApprovalReactionTargetForDeliveredPayload({
|
|
1582
|
+
cfg: params.cfg,
|
|
1583
|
+
target: {
|
|
1584
|
+
...params.target,
|
|
1585
|
+
accountId: account.accountId
|
|
1586
|
+
},
|
|
1587
|
+
payload: params.payload,
|
|
1588
|
+
results: params.results,
|
|
1589
|
+
targetAuthor,
|
|
1590
|
+
targetAuthorUuid
|
|
1591
|
+
});
|
|
1592
|
+
},
|
|
1593
|
+
renderPresentation: async (params) => {
|
|
1594
|
+
const account = resolveSignalAccount({
|
|
1595
|
+
cfg: params.ctx.cfg,
|
|
1596
|
+
accountId: params.ctx.accountId ?? void 0
|
|
1597
|
+
});
|
|
1598
|
+
const targetAuthor = normalizeOptionalString(account.config.account);
|
|
1599
|
+
const targetAuthorUuid = normalizeOptionalString(account.config.accountUuid);
|
|
1600
|
+
if (!targetAuthor && !targetAuthorUuid) return null;
|
|
1601
|
+
const { addSignalApprovalReactionHintToStructuredPayload } = await loadSignalApprovalReactionsModule();
|
|
1602
|
+
const payload = materializeSignalPresentationFallback(params.payload, params.presentation);
|
|
1603
|
+
return addSignalApprovalReactionHintToStructuredPayload({
|
|
1604
|
+
cfg: params.ctx.cfg,
|
|
1605
|
+
accountId: params.ctx.accountId ?? void 0,
|
|
1606
|
+
to: params.ctx.to,
|
|
1607
|
+
payload,
|
|
1608
|
+
targetAuthor,
|
|
1609
|
+
targetAuthorUuid
|
|
1610
|
+
});
|
|
1611
|
+
},
|
|
1612
|
+
sendFormattedText: async (ctx) => {
|
|
1613
|
+
const send = await createSignalOutboundSender(ctx);
|
|
1614
|
+
const limit = resolveTextChunkLimit(ctx.cfg, "signal", ctx.accountId ?? void 0, { fallbackLimit: 4e3 });
|
|
1615
|
+
const to = resolveSignalSendTarget(ctx);
|
|
1616
|
+
const tableMode = resolveMarkdownTableMode({
|
|
1617
|
+
cfg: ctx.cfg,
|
|
1618
|
+
channel: "signal",
|
|
1619
|
+
accountId: ctx.accountId ?? void 0
|
|
1620
|
+
});
|
|
1621
|
+
let chunks = markdownToSignalTextChunks(ctx.text, limit ?? Number.POSITIVE_INFINITY, {
|
|
1622
|
+
tableMode,
|
|
1623
|
+
chunkMode: ctx.formatting?.chunkMode ?? resolveChunkMode(ctx.cfg, "signal", ctx.accountId)
|
|
1624
|
+
});
|
|
1625
|
+
if (chunks.length === 0 && ctx.text) chunks = [{
|
|
1626
|
+
text: ctx.text,
|
|
1627
|
+
styles: []
|
|
1628
|
+
}];
|
|
1629
|
+
const effectiveReplyToMode = ctx.replyToMode ?? resolveSignalReplyToMode({
|
|
1630
|
+
cfg: ctx.cfg,
|
|
1631
|
+
accountId: ctx.accountId,
|
|
1632
|
+
chatType: inferSignalTargetChatType(to)
|
|
1633
|
+
});
|
|
1634
|
+
const nextReplyToId = createReplyToFanout({
|
|
1635
|
+
replyToId: ctx.replyToId,
|
|
1636
|
+
replyToIdSource: ctx.replyToIdSource,
|
|
1637
|
+
replyToMode: effectiveReplyToMode
|
|
1638
|
+
});
|
|
1639
|
+
const results = [];
|
|
1640
|
+
for (const chunk of chunks) {
|
|
1641
|
+
ctx.abortSignal?.throwIfAborted();
|
|
1642
|
+
const result = await send(to, chunk.text, {
|
|
1643
|
+
replyToId: nextReplyToId(),
|
|
1644
|
+
textMode: "plain",
|
|
1645
|
+
textStyles: chunk.styles
|
|
1646
|
+
});
|
|
1647
|
+
const deliveryResult = attachChannelToResult("signal", attachSignalVisibleText(result, chunk.text));
|
|
1648
|
+
results.push(deliveryResult);
|
|
1649
|
+
await ctx.onDeliveryResult?.(deliveryResult);
|
|
1650
|
+
}
|
|
1651
|
+
return results;
|
|
1652
|
+
},
|
|
1653
|
+
sendFormattedMedia: async (ctx) => {
|
|
1654
|
+
ctx.abortSignal?.throwIfAborted();
|
|
1655
|
+
const send = await createSignalOutboundSender(ctx);
|
|
1656
|
+
const to = resolveSignalSendTarget(ctx);
|
|
1657
|
+
const tableMode = resolveMarkdownTableMode({
|
|
1658
|
+
cfg: ctx.cfg,
|
|
1659
|
+
channel: "signal",
|
|
1660
|
+
accountId: ctx.accountId ?? void 0
|
|
1661
|
+
});
|
|
1662
|
+
const formatted = markdownToSignalTextChunks(ctx.text, Number.POSITIVE_INFINITY, { tableMode })[0] ?? {
|
|
1663
|
+
text: ctx.text,
|
|
1664
|
+
styles: []
|
|
1665
|
+
};
|
|
1666
|
+
const result = await send(to, formatted.text, {
|
|
1667
|
+
replyToId: ctx.replyToId,
|
|
1668
|
+
mediaUrl: ctx.mediaUrl,
|
|
1669
|
+
...ctx.mediaAccess ? { mediaAccess: ctx.mediaAccess } : {},
|
|
1670
|
+
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
1671
|
+
...ctx.mediaReadFile ? { mediaReadFile: ctx.mediaReadFile } : {},
|
|
1672
|
+
textMode: "plain",
|
|
1673
|
+
textStyles: formatted.styles
|
|
1674
|
+
});
|
|
1675
|
+
return attachChannelToResult("signal", attachSignalVisibleText(result, formatted.text));
|
|
1676
|
+
}
|
|
1520
1677
|
},
|
|
1521
1678
|
attachedResults: {
|
|
1522
1679
|
channel: "signal",
|
|
@@ -1525,4 +1682,4 @@ const signalPlugin = createChatChannelPlugin({
|
|
|
1525
1682
|
}
|
|
1526
1683
|
}
|
|
1527
1684
|
});
|
|
1528
|
-
export { resolveSignalReactionLevel as _,
|
|
1685
|
+
export { isSignalNativeApprovalHandlerConfigured as A, signalCheck as C, formatSignalMediaText as D, resolveSignalReactionLevel as E, markdownToSignalText as O, resolveSignalRpcContext as S, streamSignalEvents as T, materializeSignalPresentationFallback as _, formatSignalDaemonDroppedEnvNotice as a, removeReactionSignal as b, normalizeSignalAccountInput as c, signalNumberTextInput as d, signalSetupContract as f, registerSignalReplyContext as g, writeSignalAccountTransport as h, buildSignalDaemonEnv as i, markdownToSignalTextChunks as k, signalCompletionNote as l, probeSignalTransport as m, createSignalPluginBase as n, listSignalDaemonDroppedEnvHints as o, prepareSignalManagedNativeTransport as p, signalSetupWizard as r, createSignalCliPathTextInput as s, signalPlugin as t, signalDmPolicy as u, resolveSignalOutboundTarget as v, signalRpcRequest as w, sendReactionSignal as x, signalMessageActions as y };
|