@openclaw/signal 2026.11.3 → 2026.11.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{accounts-B0Pba1-q.mjs → accounts-enJKL3ci.mjs} +4 -8
- package/dist/.setup/api-CrasQEKI.mjs +14 -0
- package/dist/.setup/{api-CbN3mye4.mjs → api-DljZsfUn.mjs} +9 -11
- package/dist/.setup/{approval-auth-DhUKkSkA.mjs → approval-auth-B_5Ytx8K.mjs} +7 -11
- package/dist/.setup/{approval-handler.runtime-CsEcBZoc.mjs → approval-handler.runtime-0RbVmTxx.mjs} +7 -8
- package/dist/.setup/{approval-reactions-JsqCEOHK.mjs → approval-reactions-CvqVSSx8.mjs} +16 -24
- package/dist/.setup/{channel-CM-rLLPN.mjs → channel-ByJj8fSh.mjs} +417 -372
- package/dist/.setup/{client-Duwqbgqi.mjs → client-CesmEjRc.mjs} +170 -186
- package/dist/.setup/{config-schema-DvxZ18SD.mjs → config-schema-BCmW0BLB.mjs} +2 -5
- package/dist/.setup/{doctor-contract-api-BIdVW0PF.mjs → doctor-contract-api-CcLwIhsD.mjs} +88 -95
- package/dist/.setup/{identity-B3JyPqGO.mjs → identity-vKtR3DrM.mjs} +39 -2
- package/dist/.setup/{install-signal-cli-hYVLYGXe.mjs → install-signal-cli-DvLDZfpP.mjs} +95 -109
- package/dist/.setup/{transport-url-CAC0JcuI.mjs → legacy-transport-D_cZC3bS.mjs} +18 -1
- package/dist/.setup/{monitor-C6u1JV2C.mjs → monitor-Cf5sihwl.mjs} +166 -239
- package/dist/.setup/{probe-D_93QCe0.mjs → probe-Caq5Y4kA.mjs} +3 -3
- package/dist/.setup/{send-CM7-016e.mjs → send-BJuOWLky.mjs} +34 -66
- package/dist/.setup/{setup-surface-DvKLwYrl.mjs → setup-surface-DQ1yFZmY.mjs} +3 -3
- package/dist/.setup/{transport-detection-CmlgOybe.mjs → transport-detection-DvR6X_UQ.mjs} +3 -3
- package/dist/.setup/{transport-policy-B6C_LogW.mjs → transport-policy-zIR3lRUj.mjs} +1 -1
- package/dist/.setup/transport-probes.runtime-CoH6UFtc.mjs +1 -0
- package/dist/.source-module-urls/b02c526df8b90083105b63e5b51d5c8bbfe02676df72f6be8dd8f825817b32b9.json +1 -0
- package/dist/api.js +9 -11
- package/dist/channel-config-api.js +1 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/contract-api.js +3 -4
- package/dist/doctor-contract-api.js +1 -2
- package/dist/runtime-api.js +1 -2
- 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-CJBtD3lT.mjs +0 -16
- package/dist/.setup/client-adapter-Chnbch_z.mjs +0 -30
- package/dist/.setup/legacy-transport-QIpaMNST.mjs +0 -18
- package/dist/.setup/normalize-D7kSomXt.mjs +0 -39
- package/dist/.setup/reaction-runtime-api-mdO4k0yv.mjs +0 -65
- package/dist/.setup/reaction-targets-BgPLDHBf.mjs +0 -72
- package/dist/.setup/rpc-context-BAXcX7dI.mjs +0 -13
- package/dist/.setup/transport-probes.runtime-D-xIMRcn.mjs +0 -2
- package/dist/reaction-runtime-api.js +0 -2
- 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-mdO4k0yv.mjs";
|
|
1
|
+
import { a as migrateLegacySignalTransportConfig, i as clearLegacySignalTransportFieldsForAccount, n as normalizeCompatibilityConfig, r as repairSignalAccountKeys } from "./doctor-contract-api-CcLwIhsD.mjs";
|
|
2
|
+
import { c as resolveSignalAccountEntry, l as resolveSignalAccountKey, o as normalizeSignalTransportHost, r as assertSignalSocketTransport, s as normalizeSignalTransportUrl } from "./legacy-transport-D_cZC3bS.mjs";
|
|
3
|
+
import { a as isSignalManagedNativeConnectionUrlForBind, c as resolveLocalSignalTransportPort, i as assignSignalManagedNativePort, o as isValidSignalManagedNativePort, r as allocateSignalManagedNativePort, s as reserveSignalTransportPorts } from "./transport-policy-zIR3lRUj.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-enJKL3ci.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-vKtR3DrM.mjs";
|
|
6
|
+
import { a as resolveSignalTarget, n as signalApprovalAuth, r as listSignalAliasDirectoryEntries, t as getSignalApprovalApprovers } from "./approval-auth-B_5Ytx8K.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-CesmEjRc.mjs";
|
|
9
8
|
import { t as getOptionalSignalRuntime } from "./runtime-8sxUF217.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-DvR6X_UQ.mjs";
|
|
10
|
+
import { t as SignalChannelConfigSchema } from "./config-schema-BCmW0BLB.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-0RbVmTxx.mjs")).signalApprovalNativeRuntime
|
|
106
106
|
})
|
|
107
107
|
});
|
|
108
108
|
const signalApprovalRouting = signalApproval.routing;
|
|
@@ -162,12 +162,12 @@ const SIGNAL_FORMAT_PROFILE = FormatCapabilityProfile.define({
|
|
|
162
162
|
unit: "chars"
|
|
163
163
|
}
|
|
164
164
|
});
|
|
165
|
-
function
|
|
165
|
+
function renderSignalText(ir) {
|
|
166
166
|
const normalize = (value, preserveSuffixCase) => {
|
|
167
167
|
const normalized = value.trim().replace(/^(?:https?:\/\/)?(?:www\.)?/i, "").replace(/\/+$/, "");
|
|
168
168
|
return preserveSuffixCase ? normalized.replace(/^[^/?#]+/, (host) => host.toLowerCase()) : normalizeLowercaseStringOrEmpty(normalized);
|
|
169
169
|
};
|
|
170
|
-
|
|
170
|
+
const rendered = renderMarkdownWithAttributedRanges({
|
|
171
171
|
...ir,
|
|
172
172
|
links: ir.links.filter((link) => {
|
|
173
173
|
const label = ir.text.slice(link.start, link.end);
|
|
@@ -175,10 +175,7 @@ function stripEquivalentSignalLinks(ir) {
|
|
|
175
175
|
const preserveSuffixCase = /^https?:\/\//i.test(href);
|
|
176
176
|
return normalize(label, preserveSuffixCase) !== normalize(href.replace(/^mailto:/, ""), preserveSuffixCase);
|
|
177
177
|
})
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function renderSignalText(ir) {
|
|
181
|
-
const rendered = renderMarkdownWithAttributedRanges(stripEquivalentSignalLinks(ir), {
|
|
178
|
+
}, {
|
|
182
179
|
styleMap: SIGNAL_STYLE_MAP,
|
|
183
180
|
annotationStyleMap: { assistant_transcript_role: "MONOSPACE" },
|
|
184
181
|
trimEnd: true
|
|
@@ -201,16 +198,43 @@ function markdownToSignalIR(markdown, options) {
|
|
|
201
198
|
function markdownToSignalText(markdown, options = {}) {
|
|
202
199
|
return renderSignalText(markdownToSignalIR(markdown, options));
|
|
203
200
|
}
|
|
201
|
+
function chunkSignalIRByParagraph(ir, limit) {
|
|
202
|
+
const codeSpans = ir.styles.filter((span) => span.style === "code" || span.style === "code_block");
|
|
203
|
+
const paragraphs = [];
|
|
204
|
+
let start = 0;
|
|
205
|
+
for (const match of ir.text.matchAll(/\n[\t ]*\n+/g)) {
|
|
206
|
+
const end = match.index + match[0].length;
|
|
207
|
+
if (codeSpans.some((span) => span.start <= match.index && end <= span.end)) continue;
|
|
208
|
+
if (match.index > start) paragraphs.push({
|
|
209
|
+
start,
|
|
210
|
+
end: match.index
|
|
211
|
+
});
|
|
212
|
+
start = end;
|
|
213
|
+
}
|
|
214
|
+
if (start < ir.text.length) paragraphs.push({
|
|
215
|
+
start,
|
|
216
|
+
end: ir.text.length
|
|
217
|
+
});
|
|
218
|
+
const chunks = [];
|
|
219
|
+
let pending;
|
|
220
|
+
for (const paragraph of paragraphs) if (pending && renderSignalText(sliceMarkdownIR(ir, pending.start, paragraph.end)).text.length <= limit) pending.end = paragraph.end;
|
|
221
|
+
else {
|
|
222
|
+
if (pending) chunks.push(sliceMarkdownIR(ir, pending.start, pending.end));
|
|
223
|
+
pending = paragraph;
|
|
224
|
+
}
|
|
225
|
+
if (pending) chunks.push(sliceMarkdownIR(ir, pending.start, pending.end));
|
|
226
|
+
return chunks;
|
|
227
|
+
}
|
|
204
228
|
function markdownToSignalTextChunks(markdown, limit, options = {}) {
|
|
205
229
|
const ir = markdownToSignalIR(markdown, options);
|
|
206
230
|
if (ir.listItems && ir.text.length > limit) ir.listItems = ir.listItems.map((item) => ({ ...item }));
|
|
207
|
-
return renderMarkdownIRChunksWithinLimit({
|
|
208
|
-
ir,
|
|
231
|
+
return (options.chunkMode === "newline" ? chunkSignalIRByParagraph(ir, limit) : [ir]).flatMap((chunk) => renderMarkdownIRChunksWithinLimit({
|
|
232
|
+
ir: chunk,
|
|
209
233
|
limit,
|
|
210
234
|
assistantTranscriptRoleMessageBoundaries: true,
|
|
211
235
|
renderChunk: renderSignalText,
|
|
212
236
|
measureRendered: (rendered) => rendered.text.length
|
|
213
|
-
}).map(({ rendered }) => rendered);
|
|
237
|
+
}).map(({ rendered }) => rendered));
|
|
214
238
|
}
|
|
215
239
|
//#endregion
|
|
216
240
|
//#region extensions/signal/src/media-text.ts
|
|
@@ -238,18 +262,93 @@ function resolveSignalReactionLevel(params) {
|
|
|
238
262
|
});
|
|
239
263
|
}
|
|
240
264
|
//#endregion
|
|
265
|
+
//#region extensions/signal/src/client-adapter.ts
|
|
266
|
+
const DEFAULT_TIMEOUT_MS = 1e4;
|
|
267
|
+
async function signalRpcRequest(method, params, opts) {
|
|
268
|
+
return opts.transportKind === "container" ? containerRpcRequest(method, params, opts) : signalRpcRequest$1(method, params, opts);
|
|
269
|
+
}
|
|
270
|
+
async function signalCheck(baseUrl, timeoutMs = DEFAULT_TIMEOUT_MS, options = {}) {
|
|
271
|
+
try {
|
|
272
|
+
return options.transportKind === "container" ? await containerCheck(baseUrl, timeoutMs, options.account) : await signalCheck$1(baseUrl, timeoutMs);
|
|
273
|
+
} catch (error) {
|
|
274
|
+
return {
|
|
275
|
+
ok: false,
|
|
276
|
+
status: null,
|
|
277
|
+
error: formatErrorMessage(error)
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async function streamSignalEvents(params) {
|
|
282
|
+
if (params.transportKind === "container") return streamContainerEvents({
|
|
283
|
+
...params,
|
|
284
|
+
onEvent: (event) => params.onEvent({
|
|
285
|
+
event: "receive",
|
|
286
|
+
data: JSON.stringify(event)
|
|
287
|
+
})
|
|
288
|
+
});
|
|
289
|
+
return streamSignalEvents$1(params);
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region extensions/signal/src/rpc-context.ts
|
|
293
|
+
function resolveSignalRpcContext(opts, accountInfo) {
|
|
294
|
+
const baseUrlOverride = opts.baseUrl?.trim();
|
|
295
|
+
const accountOverride = opts.account?.trim();
|
|
296
|
+
const baseUrl = baseUrlOverride || accountInfo.baseUrl;
|
|
297
|
+
if (!baseUrl) throw new Error("Signal base URL is required");
|
|
298
|
+
return {
|
|
299
|
+
baseUrl,
|
|
300
|
+
account: accountOverride || accountInfo.config.account?.trim() || void 0
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
//#endregion
|
|
304
|
+
//#region extensions/signal/src/send-reactions.ts
|
|
305
|
+
function createSignalReactionSender(remove) {
|
|
306
|
+
return async (recipient, targetTimestamp, emoji, opts) => {
|
|
307
|
+
const cfg = requireRuntimeConfig(opts.cfg, "Signal reactions");
|
|
308
|
+
const accountInfo = resolveSignalAccount({
|
|
309
|
+
cfg,
|
|
310
|
+
accountId: opts.accountId
|
|
311
|
+
});
|
|
312
|
+
const { baseUrl, account } = resolveSignalRpcContext(opts, accountInfo);
|
|
313
|
+
const normalizedRecipient = normalizeSignalReactionRecipient(recipient);
|
|
314
|
+
const groupId = opts.groupId?.trim();
|
|
315
|
+
const operation = `Signal reaction${remove ? " removal" : ""}`;
|
|
316
|
+
if (!normalizedRecipient && !groupId) throw new Error(`Recipient or groupId is required for ${operation}`);
|
|
317
|
+
if (!Number.isFinite(targetTimestamp) || targetTimestamp <= 0) throw new Error(`Valid targetTimestamp is required for ${operation}`);
|
|
318
|
+
const normalizedEmoji = emoji?.trim();
|
|
319
|
+
if (!normalizedEmoji) throw new Error(`Emoji is required for ${operation}`);
|
|
320
|
+
const targetAuthor = [
|
|
321
|
+
opts.targetAuthor,
|
|
322
|
+
opts.targetAuthorUuid,
|
|
323
|
+
normalizedRecipient
|
|
324
|
+
].map((candidate) => normalizeSignalReactionRecipient(candidate ?? "")).find(Boolean);
|
|
325
|
+
if (groupId && !targetAuthor) throw new Error(`targetAuthor is required for group reaction${remove ? " removal" : "s"}`);
|
|
326
|
+
const requestParams = {
|
|
327
|
+
emoji: normalizedEmoji,
|
|
328
|
+
targetTimestamp,
|
|
329
|
+
...remove ? { remove: true } : {},
|
|
330
|
+
...targetAuthor ? { targetAuthor } : {}
|
|
331
|
+
};
|
|
332
|
+
if (normalizedRecipient) requestParams.recipients = [normalizedRecipient];
|
|
333
|
+
if (groupId) requestParams.groupIds = [groupId];
|
|
334
|
+
if (account) requestParams.account = account;
|
|
335
|
+
return {
|
|
336
|
+
ok: true,
|
|
337
|
+
timestamp: (await signalRpcRequest("sendReaction", requestParams, {
|
|
338
|
+
baseUrl,
|
|
339
|
+
timeoutMs: opts.timeoutMs,
|
|
340
|
+
transportKind: opts.transportKind ?? accountInfo.transport.kind,
|
|
341
|
+
assertDirectAdapterHandoff: opts.assertDirectAdapterHandoff
|
|
342
|
+
}))?.timestamp
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
const sendReactionSignal = createSignalReactionSender(false);
|
|
347
|
+
const removeReactionSignal = createSignalReactionSender(true);
|
|
348
|
+
//#endregion
|
|
241
349
|
//#region extensions/signal/src/message-actions.ts
|
|
242
350
|
const providerId = "signal";
|
|
243
351
|
const GROUP_PREFIX = "group:";
|
|
244
|
-
function resolveSignalReactionTarget(raw) {
|
|
245
|
-
const withoutSignal = raw.trim().replace(/^signal:/i, "").trim();
|
|
246
|
-
if (!withoutSignal) return {};
|
|
247
|
-
if (normalizeLowercaseStringOrEmpty(withoutSignal).startsWith(GROUP_PREFIX)) {
|
|
248
|
-
const groupId = withoutSignal.slice(6).trim();
|
|
249
|
-
return groupId ? { groupId } : {};
|
|
250
|
-
}
|
|
251
|
-
return { recipient: normalizeSignalReactionRecipient(withoutSignal) };
|
|
252
|
-
}
|
|
253
352
|
const signalMessageActions = {
|
|
254
353
|
describeMessageTool: ({ cfg, accountId }) => {
|
|
255
354
|
const configuredAccounts = accountId ? [resolveSignalAccount({
|
|
@@ -284,11 +383,14 @@ const signalMessageActions = {
|
|
|
284
383
|
});
|
|
285
384
|
if (!reactionLevelInfo.agentReactionsEnabled) throw new Error(`Signal agent reactions disabled (reactionLevel="${reactionLevelInfo.level}"). Set channels.signal.reactionLevel to "minimal" or "extensive" to enable.`);
|
|
286
385
|
if (!createActionGate(account.config.actions)("reactions")) throw new Error("Signal reactions are disabled via actions.reactions.");
|
|
287
|
-
const
|
|
386
|
+
const recipientTarget = readStringParam(params, "to", {
|
|
288
387
|
required: true,
|
|
289
388
|
label: "recipient (UUID, phone number, or group)"
|
|
290
|
-
}));
|
|
291
|
-
|
|
389
|
+
}).trim().replace(/^signal:/i, "").trim();
|
|
390
|
+
const isGroup = normalizeLowercaseStringOrEmpty(recipientTarget).startsWith(GROUP_PREFIX);
|
|
391
|
+
const groupId = isGroup ? recipientTarget.slice(6).trim() : void 0;
|
|
392
|
+
const recipient = !isGroup && recipientTarget ? normalizeSignalReactionRecipient(recipientTarget) : void 0;
|
|
393
|
+
if (!recipient && !groupId) throw new Error("recipient or group required");
|
|
292
394
|
const messageIdRaw = resolveReactionMessageId({
|
|
293
395
|
args: params,
|
|
294
396
|
toolContext
|
|
@@ -297,16 +399,16 @@ const signalMessageActions = {
|
|
|
297
399
|
if (!messageId) throw new Error("messageId (timestamp) required. Provide messageId explicitly or react to the current inbound message.");
|
|
298
400
|
const targetAuthor = readStringParam(params, "targetAuthor");
|
|
299
401
|
const targetAuthorUuid = readStringParam(params, "targetAuthorUuid");
|
|
300
|
-
if (
|
|
402
|
+
if (groupId && !targetAuthor && !targetAuthorUuid) throw new Error("targetAuthor or targetAuthorUuid required for group reactions.");
|
|
301
403
|
const emoji = readStringParam(params, "emoji", { allowEmpty: true });
|
|
302
404
|
const remove = typeof params.remove === "boolean" ? params.remove : void 0;
|
|
303
405
|
const timestamp = parseStrictNonNegativeInteger(messageId);
|
|
304
406
|
if (timestamp === void 0) throw new Error(`Invalid messageId: ${messageId}. Expected numeric timestamp.`);
|
|
305
407
|
if (!emoji) throw new Error(`Emoji required to ${remove ? "remove" : "add"} reaction.`);
|
|
306
|
-
await (remove ? removeReactionSignal : sendReactionSignal)(
|
|
408
|
+
await (remove ? removeReactionSignal : sendReactionSignal)(recipient ?? "", timestamp, emoji, {
|
|
307
409
|
cfg,
|
|
308
410
|
accountId: account.accountId,
|
|
309
|
-
groupId
|
|
411
|
+
groupId,
|
|
310
412
|
targetAuthor,
|
|
311
413
|
targetAuthorUuid,
|
|
312
414
|
...assertDirectAdapterHandoff ? { assertDirectAdapterHandoff } : {}
|
|
@@ -324,8 +426,7 @@ const signalMessageActions = {
|
|
|
324
426
|
function resolveSignalOutboundTarget(target) {
|
|
325
427
|
const normalized = normalizeSignalMessagingTarget(target);
|
|
326
428
|
if (!normalized) return null;
|
|
327
|
-
|
|
328
|
-
if (lowered.startsWith("group:")) {
|
|
429
|
+
if (normalized.startsWith("group:")) {
|
|
329
430
|
const groupId = normalized.slice(6);
|
|
330
431
|
return {
|
|
331
432
|
peer: {
|
|
@@ -337,21 +438,8 @@ function resolveSignalOutboundTarget(target) {
|
|
|
337
438
|
to: `group:${groupId}`
|
|
338
439
|
};
|
|
339
440
|
}
|
|
340
|
-
if (lowered.startsWith("username:")) return {
|
|
341
|
-
peer: {
|
|
342
|
-
kind: "direct",
|
|
343
|
-
id: normalized
|
|
344
|
-
},
|
|
345
|
-
chatType: "direct",
|
|
346
|
-
from: `signal:${normalized}`,
|
|
347
|
-
to: `signal:${normalized}`
|
|
348
|
-
};
|
|
349
441
|
const recipient = normalized;
|
|
350
|
-
const
|
|
351
|
-
const sender = resolveSignalSender({
|
|
352
|
-
sourceUuid: looksLikeUuid(uuidCandidate) ? uuidCandidate : null,
|
|
353
|
-
sourceNumber: looksLikeUuid(uuidCandidate) ? null : recipient
|
|
354
|
-
});
|
|
442
|
+
const sender = recipient.startsWith("username:") ? null : resolveSignalSender(looksLikeUuid(recipient) ? { sourceUuid: recipient } : { sourceNumber: recipient });
|
|
355
443
|
const peerId = sender ? resolveSignalPeerId(sender) : recipient;
|
|
356
444
|
const displayRecipient = sender ? resolveSignalRecipient(sender) : recipient;
|
|
357
445
|
return {
|
|
@@ -368,11 +456,6 @@ function resolveSignalOutboundTarget(target) {
|
|
|
368
456
|
//#region extensions/signal/src/presentation-fallback.ts
|
|
369
457
|
/** Materialize presentation content once before Signal's text-only delivery funnels. */
|
|
370
458
|
function materializeSignalPresentationFallback(payload, presentationOverride) {
|
|
371
|
-
const reactionPayload = questionGatewayRuntime.prepareReactionPayloadForDelivery({
|
|
372
|
-
payload,
|
|
373
|
-
presentation: presentationOverride ?? payload.presentation
|
|
374
|
-
});
|
|
375
|
-
if (reactionPayload) return reactionPayload;
|
|
376
459
|
const presentation = presentationOverride ?? normalizeMessagePresentation(payload.presentation);
|
|
377
460
|
if (!presentation) return payload;
|
|
378
461
|
const currentText = payload.text?.trim() ?? "";
|
|
@@ -461,10 +544,13 @@ async function registerSignalReplyContext(params) {
|
|
|
461
544
|
const identity = resolveSignalReplyIdentity(params);
|
|
462
545
|
const author = normalizeOptionalString(params.author);
|
|
463
546
|
const body = normalizeOptionalString(params.body);
|
|
464
|
-
const media = params.media?.map((entry) =>
|
|
465
|
-
contentType
|
|
466
|
-
|
|
467
|
-
|
|
547
|
+
const media = params.media?.map((entry) => {
|
|
548
|
+
const contentType = normalizeOptionalString(entry.contentType);
|
|
549
|
+
return {
|
|
550
|
+
...contentType ? { contentType } : {},
|
|
551
|
+
...entry.kind != null ? { kind: entry.kind } : {}
|
|
552
|
+
};
|
|
553
|
+
});
|
|
468
554
|
const sourceTimestamp = asPositiveSafeInteger(params.sourceTimestamp) ?? Date.now();
|
|
469
555
|
if (!identity || !author) return;
|
|
470
556
|
const { key, ...replyIdentity } = identity;
|
|
@@ -533,54 +619,11 @@ function normalizeTransport(transport) {
|
|
|
533
619
|
url: normalizeSignalTransportUrl(transport.url)
|
|
534
620
|
};
|
|
535
621
|
}
|
|
536
|
-
function assertSignalContainerTransportHasAccount(params) {
|
|
537
|
-
if (params.transport.kind !== "container" || params.cfg.channels?.signal?.enabled === false) return;
|
|
538
|
-
const account = resolveSignalAccountConfig(params.cfg, normalizeAccountId$1(params.accountId));
|
|
539
|
-
if (account.enabled === false || normalizeOptionalString(account.account)) return;
|
|
540
|
-
throw new Error("Signal container transport requires an account number for an enabled account.");
|
|
541
|
-
}
|
|
542
|
-
function assertSignalLocalEndpointDoesNotConflictWithManagedSibling(params) {
|
|
543
|
-
if (params.transport.kind === "managed-native") return;
|
|
544
|
-
const localPort = resolveLocalSignalTransportPort(params.transport.url);
|
|
545
|
-
if (localPort === void 0) return;
|
|
546
|
-
const targetAccountId = normalizeAccountId$1(params.accountId);
|
|
547
|
-
for (const accountId of listSignalAccountIds(params.cfg)) {
|
|
548
|
-
if (normalizeAccountId$1(accountId) === targetAccountId) continue;
|
|
549
|
-
if (resolveSignalAccountEntry(params.cfg.channels?.signal?.accounts, accountId)?.enabled === false) continue;
|
|
550
|
-
const siblingAccount = resolveSignalAccount({
|
|
551
|
-
cfg: params.cfg,
|
|
552
|
-
accountId
|
|
553
|
-
});
|
|
554
|
-
if (!siblingAccount.configured) continue;
|
|
555
|
-
const siblingTransport = siblingAccount.transport;
|
|
556
|
-
if (siblingTransport?.kind !== "managed-native" || siblingTransport.socketPath !== void 0 || siblingTransport.httpPort !== localPort) continue;
|
|
557
|
-
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.`);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
622
|
function resolveConfiguredSignalTransport(cfg, accountId) {
|
|
561
623
|
const signal = cfg.channels?.signal;
|
|
562
624
|
const normalizedAccountId = normalizeAccountId$1(accountId);
|
|
563
625
|
return normalizedAccountId === DEFAULT_ACCOUNT_ID$2 ? signal?.transport ?? resolveSignalAccountEntry(signal?.accounts, normalizedAccountId)?.transport : resolveSignalAccountEntry(signal?.accounts, normalizedAccountId)?.transport;
|
|
564
626
|
}
|
|
565
|
-
function alignManagedConnectionUrlAfterBindChange(params) {
|
|
566
|
-
if (params.hasUrlOverride || !params.existing?.url || !isSignalManagedNativeConnectionUrlForBind(params.existing)) return assignSignalManagedNativePort(params.prepared, params.httpPort);
|
|
567
|
-
const connectionUrl = new URL(params.existing.url);
|
|
568
|
-
connectionUrl.port = String(params.httpPort);
|
|
569
|
-
const alignedPortUrl = normalizeSignalTransportUrl(connectionUrl.toString());
|
|
570
|
-
const next = {
|
|
571
|
-
...params.prepared,
|
|
572
|
-
url: alignedPortUrl,
|
|
573
|
-
httpPort: params.httpPort
|
|
574
|
-
};
|
|
575
|
-
if (isSignalManagedNativeConnectionUrlForBind(next)) return next;
|
|
576
|
-
const bindHost = params.prepared.httpHost ?? "127.0.0.1";
|
|
577
|
-
const connectionHost = bindHost === "0.0.0.0" ? "127.0.0.1" : bindHost === "::" ? "::1" : bindHost;
|
|
578
|
-
connectionUrl.hostname = connectionHost.includes(":") ? `[${connectionHost}]` : connectionHost;
|
|
579
|
-
return {
|
|
580
|
-
...next,
|
|
581
|
-
url: normalizeSignalTransportUrl(connectionUrl.toString())
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
627
|
function prepareSignalManagedNativeTransport(params) {
|
|
585
628
|
const existing = resolveConfiguredSignalTransport(params.cfg, params.accountId);
|
|
586
629
|
const existingManaged = existing?.kind === "managed-native" ? existing : void 0;
|
|
@@ -630,15 +673,27 @@ function prepareSignalManagedNativeTransport(params) {
|
|
|
630
673
|
if (localConnectionPort !== void 0) reservedPorts.add(localConnectionPort);
|
|
631
674
|
}
|
|
632
675
|
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.`);
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
httpPort: allocateSignalManagedNativePort({
|
|
637
|
-
reservedPorts,
|
|
638
|
-
preferredPort
|
|
639
|
-
}),
|
|
640
|
-
hasUrlOverride: params.overrides?.url !== void 0
|
|
676
|
+
const httpPort = allocateSignalManagedNativePort({
|
|
677
|
+
reservedPorts,
|
|
678
|
+
preferredPort
|
|
641
679
|
});
|
|
680
|
+
if (params.overrides?.url !== void 0 || !existingManaged?.url || !isSignalManagedNativeConnectionUrlForBind(existingManaged)) return assignSignalManagedNativePort(prepared, httpPort);
|
|
681
|
+
const connectionUrl = new URL(existingManaged.url);
|
|
682
|
+
connectionUrl.port = String(httpPort);
|
|
683
|
+
const alignedPortUrl = normalizeSignalTransportUrl(connectionUrl.toString());
|
|
684
|
+
const next = {
|
|
685
|
+
...prepared,
|
|
686
|
+
url: alignedPortUrl,
|
|
687
|
+
httpPort
|
|
688
|
+
};
|
|
689
|
+
if (isSignalManagedNativeConnectionUrlForBind(next)) return next;
|
|
690
|
+
const bindHost = prepared.httpHost ?? "127.0.0.1";
|
|
691
|
+
const connectionHost = bindHost === "0.0.0.0" ? "127.0.0.1" : bindHost === "::" ? "::1" : bindHost;
|
|
692
|
+
connectionUrl.hostname = connectionHost.includes(":") ? `[${connectionHost}]` : connectionHost;
|
|
693
|
+
return {
|
|
694
|
+
...next,
|
|
695
|
+
url: normalizeSignalTransportUrl(connectionUrl.toString())
|
|
696
|
+
};
|
|
642
697
|
}
|
|
643
698
|
async function probeSignalTransport(params) {
|
|
644
699
|
const timeoutMs = params.timeoutMs ?? 1e4;
|
|
@@ -648,21 +703,37 @@ async function probeSignalTransport(params) {
|
|
|
648
703
|
overrides: params.transport
|
|
649
704
|
}) : params.transport;
|
|
650
705
|
const resolved = resolveSignalTransport(transport);
|
|
651
|
-
if (resolved.kind === "container") return (params.probeContainer ?? (await import("./transport-probes.runtime-
|
|
652
|
-
return (params.probeNative ?? (await import("./transport-probes.runtime-
|
|
706
|
+
if (resolved.kind === "container") return (params.probeContainer ?? (await import("./transport-probes.runtime-CoH6UFtc.mjs")).containerCheck)(resolved.baseUrl, timeoutMs, params.account);
|
|
707
|
+
return (params.probeNative ?? (await import("./transport-probes.runtime-CoH6UFtc.mjs")).nativeCheck)(resolved.baseUrl, timeoutMs);
|
|
653
708
|
}
|
|
654
709
|
function writeSignalAccountTransport(params) {
|
|
655
710
|
const transport = normalizeTransport(params.transport);
|
|
656
|
-
assertSignalContainerTransportHasAccount({
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
transport
|
|
665
|
-
|
|
711
|
+
function assertSignalContainerTransportHasAccount() {
|
|
712
|
+
if (transport.kind !== "container" || params.cfg.channels?.signal?.enabled === false) return;
|
|
713
|
+
const account = resolveSignalAccountConfig(params.cfg, normalizeAccountId$1(params.accountId));
|
|
714
|
+
if (account.enabled === false || normalizeOptionalString(account.account)) return;
|
|
715
|
+
throw new Error("Signal container transport requires an account number for an enabled account.");
|
|
716
|
+
}
|
|
717
|
+
assertSignalContainerTransportHasAccount();
|
|
718
|
+
function assertSignalLocalEndpointDoesNotConflictWithManagedSibling() {
|
|
719
|
+
if (transport.kind === "managed-native") return;
|
|
720
|
+
const localPort = resolveLocalSignalTransportPort(transport.url);
|
|
721
|
+
if (localPort === void 0) return;
|
|
722
|
+
const targetAccountId = normalizeAccountId$1(params.accountId);
|
|
723
|
+
for (const accountId of listSignalAccountIds(params.cfg)) {
|
|
724
|
+
if (normalizeAccountId$1(accountId) === targetAccountId) continue;
|
|
725
|
+
if (resolveSignalAccountEntry(params.cfg.channels?.signal?.accounts, accountId)?.enabled === false) continue;
|
|
726
|
+
const siblingAccount = resolveSignalAccount({
|
|
727
|
+
cfg: params.cfg,
|
|
728
|
+
accountId
|
|
729
|
+
});
|
|
730
|
+
if (!siblingAccount.configured) continue;
|
|
731
|
+
const siblingTransport = siblingAccount.transport;
|
|
732
|
+
if (siblingTransport?.kind !== "managed-native" || siblingTransport.socketPath !== void 0 || siblingTransport.httpPort !== localPort) continue;
|
|
733
|
+
throw new Error(`Signal ${transport.kind} account "${targetAccountId}" uses local port ${localPort}, which conflicts with managed native account "${accountId}". Choose a distinct transport URL.`);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
assertSignalLocalEndpointDoesNotConflictWithManagedSibling();
|
|
666
737
|
const next = patchChannelConfigForAccount({
|
|
667
738
|
cfg: params.cfg,
|
|
668
739
|
channel: "signal",
|
|
@@ -743,57 +814,6 @@ function normalizeSignalAccountInput(value) {
|
|
|
743
814
|
if (digits.length < MIN_E164_DIGITS || digits.length > MAX_E164_DIGITS) return null;
|
|
744
815
|
return `+${digits}`;
|
|
745
816
|
}
|
|
746
|
-
function isUuidLike(value) {
|
|
747
|
-
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
748
|
-
}
|
|
749
|
-
function parseSignalAllowFromEntries(raw) {
|
|
750
|
-
return parseAllowFromEntries(raw, (entry) => {
|
|
751
|
-
if (normalizeLowercaseStringOrEmpty(entry).startsWith("uuid:")) {
|
|
752
|
-
const id = entry.slice(5).trim();
|
|
753
|
-
if (!id) return { error: "Invalid uuid entry" };
|
|
754
|
-
return { value: `uuid:${id}` };
|
|
755
|
-
}
|
|
756
|
-
if (isUuidLike(entry)) return { value: `uuid:${entry}` };
|
|
757
|
-
const normalized = normalizeSignalAccountInput(entry);
|
|
758
|
-
if (!normalized) return { error: `Invalid entry: ${entry}` };
|
|
759
|
-
return { value: normalized };
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
function buildSignalSetupPatch(input) {
|
|
763
|
-
const account = normalizeSignalAccountInput(input.signalNumber);
|
|
764
|
-
const transport = input.httpUrl ? {
|
|
765
|
-
kind: input.signalTransport ?? "external-native",
|
|
766
|
-
url: normalizeSignalTransportUrl(input.httpUrl)
|
|
767
|
-
} : input.cliPath || input.httpHost || input.httpPort ? {
|
|
768
|
-
kind: "managed-native",
|
|
769
|
-
...managedTransportOverridesFromSetupInput(input)
|
|
770
|
-
} : void 0;
|
|
771
|
-
return {
|
|
772
|
-
...account ? { account } : {},
|
|
773
|
-
...transport ? { transport } : {}
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
|
-
async function prepareSignalSetupInput(params) {
|
|
777
|
-
if (!params.input.httpUrl || params.input.signalTransport) return params.input;
|
|
778
|
-
const account = normalizeSignalAccountInput(params.input.signalNumber) ?? normalizeSignalAccountInput(resolveSignalSetupAccount({
|
|
779
|
-
cfg: params.cfg,
|
|
780
|
-
accountId: params.accountId
|
|
781
|
-
})) ?? void 0;
|
|
782
|
-
try {
|
|
783
|
-
const detected = await detectSignalTransport({
|
|
784
|
-
url: params.input.httpUrl,
|
|
785
|
-
...account ? { account } : {}
|
|
786
|
-
});
|
|
787
|
-
return {
|
|
788
|
-
...params.input,
|
|
789
|
-
signalTransport: detected.kind === "container" ? "container" : "external-native"
|
|
790
|
-
};
|
|
791
|
-
} catch {
|
|
792
|
-
const existing = resolveConfiguredSignalTransport(params.cfg, params.accountId);
|
|
793
|
-
if (existing?.kind === "container" || existing?.kind === "external-native") return params.input;
|
|
794
|
-
throw new Error("Signal could not detect the HTTP transport; start the endpoint or pass --signal-transport external-native|container.");
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
817
|
function managedTransportOverridesFromSetupInput(input) {
|
|
798
818
|
return {
|
|
799
819
|
...input.cliPath ? { cliPath: input.cliPath } : {},
|
|
@@ -830,7 +850,17 @@ const signalDmPolicy = createChannelDmPolicy({
|
|
|
830
850
|
],
|
|
831
851
|
message: t("wizard.signal.allowFromPrompt"),
|
|
832
852
|
placeholder: "+15555550123, uuid:123e4567-e89b-12d3-a456-426614174000",
|
|
833
|
-
parseEntries:
|
|
853
|
+
parseEntries: (raw) => parseAllowFromEntries(raw, (entry) => {
|
|
854
|
+
if (normalizeLowercaseStringOrEmpty(entry).startsWith("uuid:")) {
|
|
855
|
+
const id = entry.slice(5).trim();
|
|
856
|
+
if (!id) return { error: "Invalid uuid entry" };
|
|
857
|
+
return { value: `uuid:${id}` };
|
|
858
|
+
}
|
|
859
|
+
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}` };
|
|
860
|
+
const normalized = normalizeSignalAccountInput(entry);
|
|
861
|
+
if (!normalized) return { error: `Invalid entry: ${entry}` };
|
|
862
|
+
return { value: normalized };
|
|
863
|
+
}),
|
|
834
864
|
getExistingAllowFrom: ({ cfg, accountId }) => resolveSignalAccount({
|
|
835
865
|
cfg,
|
|
836
866
|
accountId
|
|
@@ -844,19 +874,18 @@ const signalDmPolicy = createChannelDmPolicy({
|
|
|
844
874
|
})
|
|
845
875
|
})
|
|
846
876
|
});
|
|
847
|
-
function resolveSignalCliPath(params) {
|
|
848
|
-
const transport = resolveSignalAccount({
|
|
849
|
-
cfg: params.cfg,
|
|
850
|
-
accountId: params.accountId
|
|
851
|
-
}).transport;
|
|
852
|
-
if (transport.kind !== "managed-native") return;
|
|
853
|
-
return typeof params.credentialValues.cliPath === "string" ? params.credentialValues.cliPath : transport.cliPath;
|
|
854
|
-
}
|
|
855
877
|
function createSignalCliPathTextInput(shouldPrompt) {
|
|
856
878
|
return createCliPathTextInput({
|
|
857
879
|
inputKey: "cliPath",
|
|
858
880
|
message: "signal-cli path",
|
|
859
|
-
resolvePath:
|
|
881
|
+
resolvePath: (params) => {
|
|
882
|
+
const transport = resolveSignalAccount({
|
|
883
|
+
cfg: params.cfg,
|
|
884
|
+
accountId: params.accountId
|
|
885
|
+
}).transport;
|
|
886
|
+
if (transport.kind !== "managed-native") return;
|
|
887
|
+
return typeof params.credentialValues.cliPath === "string" ? params.credentialValues.cliPath : transport.cliPath;
|
|
888
|
+
},
|
|
860
889
|
shouldPrompt
|
|
861
890
|
});
|
|
862
891
|
}
|
|
@@ -899,7 +928,20 @@ const signalSetupAdapterBase = createPatchedAccountSetupAdapter({
|
|
|
899
928
|
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.";
|
|
900
929
|
return null;
|
|
901
930
|
} }),
|
|
902
|
-
buildPatch:
|
|
931
|
+
buildPatch: (input) => {
|
|
932
|
+
const account = normalizeSignalAccountInput(input.signalNumber);
|
|
933
|
+
const transport = input.httpUrl ? {
|
|
934
|
+
kind: input.signalTransport ?? "external-native",
|
|
935
|
+
url: normalizeSignalTransportUrl(input.httpUrl)
|
|
936
|
+
} : input.cliPath || input.httpHost || input.httpPort ? {
|
|
937
|
+
kind: "managed-native",
|
|
938
|
+
...managedTransportOverridesFromSetupInput(input)
|
|
939
|
+
} : void 0;
|
|
940
|
+
return {
|
|
941
|
+
...account ? { account } : {},
|
|
942
|
+
...transport ? { transport } : {}
|
|
943
|
+
};
|
|
944
|
+
}
|
|
903
945
|
});
|
|
904
946
|
function restorePromotedSignalDefaultAccount(cfg) {
|
|
905
947
|
const signal = cfg.channels?.signal;
|
|
@@ -922,7 +964,27 @@ function restorePromotedSignalDefaultAccount(cfg) {
|
|
|
922
964
|
const signalSetupAdapter = {
|
|
923
965
|
...signalSetupAdapterBase,
|
|
924
966
|
namedAccountPromotionKeys: [],
|
|
925
|
-
prepareAccountConfigInput:
|
|
967
|
+
prepareAccountConfigInput: async (params) => {
|
|
968
|
+
if (!params.input.httpUrl || params.input.signalTransport) return params.input;
|
|
969
|
+
const account = normalizeSignalAccountInput(params.input.signalNumber) ?? normalizeSignalAccountInput(resolveSignalSetupAccount({
|
|
970
|
+
cfg: params.cfg,
|
|
971
|
+
accountId: params.accountId
|
|
972
|
+
})) ?? void 0;
|
|
973
|
+
try {
|
|
974
|
+
const detected = await detectSignalTransport({
|
|
975
|
+
url: params.input.httpUrl,
|
|
976
|
+
...account ? { account } : {}
|
|
977
|
+
});
|
|
978
|
+
return {
|
|
979
|
+
...params.input,
|
|
980
|
+
signalTransport: detected.kind === "container" ? "container" : "external-native"
|
|
981
|
+
};
|
|
982
|
+
} catch {
|
|
983
|
+
const existing = resolveConfiguredSignalTransport(params.cfg, params.accountId);
|
|
984
|
+
if (existing?.kind === "container" || existing?.kind === "external-native") return params.input;
|
|
985
|
+
throw new Error("Signal could not detect the HTTP transport; start the endpoint or pass --signal-transport external-native|container.");
|
|
986
|
+
}
|
|
987
|
+
},
|
|
926
988
|
singleAccountKeysToMove: [
|
|
927
989
|
"signalNumber",
|
|
928
990
|
"account",
|
|
@@ -1090,25 +1152,20 @@ function usesManagedSignalDaemon(cfg) {
|
|
|
1090
1152
|
}
|
|
1091
1153
|
});
|
|
1092
1154
|
}
|
|
1093
|
-
/** Warn when the managed daemon will not see proxy or trust-store variables set for OpenClaw. */
|
|
1094
|
-
function collectSignalDaemonEnvNotes(params) {
|
|
1095
|
-
const result = {
|
|
1096
|
-
changeNotes: [],
|
|
1097
|
-
warningNotes: []
|
|
1098
|
-
};
|
|
1099
|
-
if (!usesManagedSignalDaemon(params.cfg)) return result;
|
|
1100
|
-
const names = listSignalDaemonDroppedEnvHints(params.env ?? process.env);
|
|
1101
|
-
if (names.length > 0) result.warningNotes.push(`- channels.signal: ${formatSignalDaemonDroppedEnvNotice(names)}`);
|
|
1102
|
-
return result;
|
|
1103
|
-
}
|
|
1104
1155
|
const signalDoctor = {
|
|
1105
1156
|
normalizeCompatibilityConfig,
|
|
1106
|
-
runConfigSequence: ({ cfg, env }) =>
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1157
|
+
runConfigSequence: ({ cfg, env }) => {
|
|
1158
|
+
const result = {
|
|
1159
|
+
changeNotes: [],
|
|
1160
|
+
warningNotes: []
|
|
1161
|
+
};
|
|
1162
|
+
if (!usesManagedSignalDaemon(cfg)) return result;
|
|
1163
|
+
const names = listSignalDaemonDroppedEnvHints(env ?? process.env);
|
|
1164
|
+
if (names.length > 0) result.warningNotes.push(`- channels.signal: ${formatSignalDaemonDroppedEnvNotice(names)}`);
|
|
1165
|
+
return result;
|
|
1166
|
+
},
|
|
1110
1167
|
cleanStaleConfig: async ({ cfg }) => {
|
|
1111
|
-
const { detectSignalTransport } = await import("./transport-detection-
|
|
1168
|
+
const { detectSignalTransport } = await import("./transport-detection-DvR6X_UQ.mjs").then((n) => n.n);
|
|
1112
1169
|
const transport = await migrateLegacySignalTransportConfig({
|
|
1113
1170
|
cfg,
|
|
1114
1171
|
detect: detectSignalTransport
|
|
@@ -1122,7 +1179,7 @@ const signalDoctor = {
|
|
|
1122
1179
|
//#endregion
|
|
1123
1180
|
//#region extensions/signal/src/shared.ts
|
|
1124
1181
|
const SIGNAL_CHANNEL = "signal";
|
|
1125
|
-
const signalSetupWizard = createSignalSetupWizardProxy(async () => (await import("./setup-surface-
|
|
1182
|
+
const signalSetupWizard = createSignalSetupWizardProxy(async () => (await import("./setup-surface-DQ1yFZmY.mjs")).signalSetupWizard);
|
|
1126
1183
|
const signalConfigAdapter = {
|
|
1127
1184
|
...createScopedChannelConfigAdapter({
|
|
1128
1185
|
sectionKey: SIGNAL_CHANNEL,
|
|
@@ -1142,16 +1199,16 @@ const signalConfigAdapter = {
|
|
|
1142
1199
|
const raw = resolveSignalAccount({
|
|
1143
1200
|
cfg,
|
|
1144
1201
|
accountId
|
|
1145
|
-
}).config.defaultTo;
|
|
1146
|
-
if (
|
|
1202
|
+
}).config.defaultTo?.trim();
|
|
1203
|
+
if (!raw) return;
|
|
1147
1204
|
try {
|
|
1148
1205
|
return resolveSignalTarget({
|
|
1149
1206
|
cfg,
|
|
1150
1207
|
accountId,
|
|
1151
1208
|
input: raw
|
|
1152
|
-
})?.to ?? raw
|
|
1209
|
+
})?.to ?? raw;
|
|
1153
1210
|
} catch {
|
|
1154
|
-
return raw
|
|
1211
|
+
return raw;
|
|
1155
1212
|
}
|
|
1156
1213
|
}
|
|
1157
1214
|
};
|
|
@@ -1207,10 +1264,10 @@ function createSignalPluginBase(params) {
|
|
|
1207
1264
|
}
|
|
1208
1265
|
//#endregion
|
|
1209
1266
|
//#region extensions/signal/src/channel.ts
|
|
1210
|
-
const loadSignalMonitorModule = createLazyRuntimeModule(() => import("./monitor-
|
|
1211
|
-
const loadSignalProbeModule = createLazyRuntimeModule(() => import("./probe-
|
|
1212
|
-
const loadSignalSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
1213
|
-
const loadSignalApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-
|
|
1267
|
+
const loadSignalMonitorModule = createLazyRuntimeModule(() => import("./monitor-Cf5sihwl.mjs").then((n) => n.n));
|
|
1268
|
+
const loadSignalProbeModule = createLazyRuntimeModule(() => import("./probe-Caq5Y4kA.mjs").then((n) => n.n));
|
|
1269
|
+
const loadSignalSendRuntime = createLazyRuntimeModule(() => import("./send-BJuOWLky.mjs").then((n) => n.i));
|
|
1270
|
+
const loadSignalApprovalReactionsModule = createLazyRuntimeModule(() => import("./approval-reactions-CvqVSSx8.mjs").then((n) => n.n));
|
|
1214
1271
|
async function createSignalOutboundSender(params) {
|
|
1215
1272
|
const send = resolveOutboundSendDep(params.deps, "signal") ?? (await loadSignalSendRuntime()).sendMessageSignal;
|
|
1216
1273
|
const maxBytes = resolveChannelMediaMaxBytes({
|
|
@@ -1218,11 +1275,26 @@ async function createSignalOutboundSender(params) {
|
|
|
1218
1275
|
resolveChannelLimitMb: () => resolveSignalAccount(params).config.mediaMaxMb
|
|
1219
1276
|
});
|
|
1220
1277
|
return async (to, text, { replyToId, ...options }) => {
|
|
1221
|
-
const
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1278
|
+
const normalizedReplyToId = normalizeOptionalString(replyToId);
|
|
1279
|
+
let replyOptions = {};
|
|
1280
|
+
if (normalizedReplyToId) {
|
|
1281
|
+
const accountId = resolveSignalAccount({
|
|
1282
|
+
cfg: params.cfg,
|
|
1283
|
+
accountId: params.accountId
|
|
1284
|
+
}).accountId;
|
|
1285
|
+
const persistedContext = await resolveSignalReplyContextWithPersistence({
|
|
1286
|
+
accountId,
|
|
1287
|
+
to,
|
|
1288
|
+
replyToId: normalizedReplyToId
|
|
1289
|
+
});
|
|
1290
|
+
const replyToAuthor = persistedContext?.ambiguous === true ? void 0 : persistedContext?.author;
|
|
1291
|
+
const replyToBody = persistedContext?.ambiguous === true ? "" : [persistedContext?.body, formatSignalMediaText(persistedContext?.media ?? [])].filter(Boolean).join("\n");
|
|
1292
|
+
replyOptions = {
|
|
1293
|
+
replyToId: normalizedReplyToId,
|
|
1294
|
+
...replyToAuthor ? { replyToAuthor } : {},
|
|
1295
|
+
...replyToBody ? { replyToBody } : {}
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1226
1298
|
return await send(to, text, {
|
|
1227
1299
|
cfg: params.cfg,
|
|
1228
1300
|
...options,
|
|
@@ -1249,26 +1321,6 @@ async function sendSignalOutbound(params) {
|
|
|
1249
1321
|
...params.mediaReadFile ? { mediaReadFile: params.mediaReadFile } : {}
|
|
1250
1322
|
});
|
|
1251
1323
|
}
|
|
1252
|
-
async function resolveSignalReplyOptions(params) {
|
|
1253
|
-
const replyToId = normalizeOptionalString(params.replyToId);
|
|
1254
|
-
if (!replyToId) return {};
|
|
1255
|
-
const accountId = resolveSignalAccount({
|
|
1256
|
-
cfg: params.cfg,
|
|
1257
|
-
accountId: params.accountId
|
|
1258
|
-
}).accountId;
|
|
1259
|
-
const persistedContext = await resolveSignalReplyContextWithPersistence({
|
|
1260
|
-
accountId,
|
|
1261
|
-
to: params.to,
|
|
1262
|
-
replyToId
|
|
1263
|
-
});
|
|
1264
|
-
const replyToAuthor = persistedContext?.ambiguous === true ? void 0 : persistedContext?.author;
|
|
1265
|
-
const replyToBody = persistedContext?.ambiguous === true ? "" : [persistedContext?.body, formatSignalMediaText(persistedContext?.media ?? [])].filter(Boolean).join("\n");
|
|
1266
|
-
return {
|
|
1267
|
-
replyToId,
|
|
1268
|
-
...replyToAuthor ? { replyToAuthor } : {},
|
|
1269
|
-
...replyToBody ? { replyToBody } : {}
|
|
1270
|
-
};
|
|
1271
|
-
}
|
|
1272
1324
|
function inferSignalTargetChatType(rawTo) {
|
|
1273
1325
|
const to = rawTo.trim().replace(/^signal:/i, "").trim();
|
|
1274
1326
|
if (!to) return;
|
|
@@ -1300,133 +1352,6 @@ const signalMessageAdapter = defineChannelMessageAdapter({
|
|
|
1300
1352
|
media: sendSignalOutbound
|
|
1301
1353
|
}
|
|
1302
1354
|
});
|
|
1303
|
-
function resolveSignalOutboundSessionRoute(params) {
|
|
1304
|
-
const target = params.resolvedTarget?.to ?? params.target;
|
|
1305
|
-
const resolved = resolveSignalOutboundTarget(target);
|
|
1306
|
-
if (!resolved) return null;
|
|
1307
|
-
const normalizedTarget = target.replace(/^signal:/i, "").trim();
|
|
1308
|
-
const recipientSessionExact = resolved.chatType === "group" || /^\+?\d{3,15}$/.test(normalizedTarget) ? true : "direct-alias";
|
|
1309
|
-
const baseSessionKey = buildOutboundBaseSessionKey({
|
|
1310
|
-
channel: "signal",
|
|
1311
|
-
cfg: params.cfg,
|
|
1312
|
-
agentId: params.agentId,
|
|
1313
|
-
accountId: params.accountId,
|
|
1314
|
-
peer: resolved.peer
|
|
1315
|
-
});
|
|
1316
|
-
return {
|
|
1317
|
-
sessionKey: baseSessionKey,
|
|
1318
|
-
baseSessionKey,
|
|
1319
|
-
recipientSessionExact,
|
|
1320
|
-
...resolved
|
|
1321
|
-
};
|
|
1322
|
-
}
|
|
1323
|
-
async function sendFormattedSignalText(ctx) {
|
|
1324
|
-
const send = await createSignalOutboundSender(ctx);
|
|
1325
|
-
const limit = resolveTextChunkLimit(ctx.cfg, "signal", ctx.accountId ?? void 0, { fallbackLimit: 4e3 });
|
|
1326
|
-
const to = resolveSignalSendTarget(ctx);
|
|
1327
|
-
const tableMode = resolveMarkdownTableMode({
|
|
1328
|
-
cfg: ctx.cfg,
|
|
1329
|
-
channel: "signal",
|
|
1330
|
-
accountId: ctx.accountId ?? void 0
|
|
1331
|
-
});
|
|
1332
|
-
let chunks = markdownToSignalTextChunks(ctx.text, limit ?? Number.POSITIVE_INFINITY, { tableMode });
|
|
1333
|
-
if (chunks.length === 0 && ctx.text) chunks = [{
|
|
1334
|
-
text: ctx.text,
|
|
1335
|
-
styles: []
|
|
1336
|
-
}];
|
|
1337
|
-
const effectiveReplyToMode = ctx.replyToMode ?? resolveSignalReplyToMode({
|
|
1338
|
-
cfg: ctx.cfg,
|
|
1339
|
-
accountId: ctx.accountId,
|
|
1340
|
-
chatType: inferSignalTargetChatType(to)
|
|
1341
|
-
});
|
|
1342
|
-
const nextReplyToId = createReplyToFanout({
|
|
1343
|
-
replyToId: ctx.replyToId,
|
|
1344
|
-
replyToIdSource: ctx.replyToIdSource,
|
|
1345
|
-
replyToMode: effectiveReplyToMode
|
|
1346
|
-
});
|
|
1347
|
-
const results = [];
|
|
1348
|
-
for (const chunk of chunks) {
|
|
1349
|
-
ctx.abortSignal?.throwIfAborted();
|
|
1350
|
-
const result = await send(to, chunk.text, {
|
|
1351
|
-
replyToId: nextReplyToId(),
|
|
1352
|
-
textMode: "plain",
|
|
1353
|
-
textStyles: chunk.styles
|
|
1354
|
-
});
|
|
1355
|
-
const deliveryResult = attachChannelToResult("signal", attachSignalVisibleText(result, chunk.text));
|
|
1356
|
-
results.push(deliveryResult);
|
|
1357
|
-
await ctx.onDeliveryResult?.(deliveryResult);
|
|
1358
|
-
}
|
|
1359
|
-
return results;
|
|
1360
|
-
}
|
|
1361
|
-
async function sendFormattedSignalMedia(ctx) {
|
|
1362
|
-
ctx.abortSignal?.throwIfAborted();
|
|
1363
|
-
const send = await createSignalOutboundSender(ctx);
|
|
1364
|
-
const to = resolveSignalSendTarget(ctx);
|
|
1365
|
-
const tableMode = resolveMarkdownTableMode({
|
|
1366
|
-
cfg: ctx.cfg,
|
|
1367
|
-
channel: "signal",
|
|
1368
|
-
accountId: ctx.accountId ?? void 0
|
|
1369
|
-
});
|
|
1370
|
-
const formatted = markdownToSignalTextChunks(ctx.text, Number.POSITIVE_INFINITY, { tableMode })[0] ?? {
|
|
1371
|
-
text: ctx.text,
|
|
1372
|
-
styles: []
|
|
1373
|
-
};
|
|
1374
|
-
const result = await send(to, formatted.text, {
|
|
1375
|
-
replyToId: ctx.replyToId,
|
|
1376
|
-
mediaUrl: ctx.mediaUrl,
|
|
1377
|
-
...ctx.mediaAccess ? { mediaAccess: ctx.mediaAccess } : {},
|
|
1378
|
-
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
1379
|
-
...ctx.mediaReadFile ? { mediaReadFile: ctx.mediaReadFile } : {},
|
|
1380
|
-
textMode: "plain",
|
|
1381
|
-
textStyles: formatted.styles
|
|
1382
|
-
});
|
|
1383
|
-
return attachChannelToResult("signal", attachSignalVisibleText(result, formatted.text));
|
|
1384
|
-
}
|
|
1385
|
-
async function registerDeliveredSignalApprovalPayloadForReactions(params) {
|
|
1386
|
-
const account = resolveSignalAccount({
|
|
1387
|
-
cfg: params.cfg,
|
|
1388
|
-
accountId: params.target.accountId ?? void 0
|
|
1389
|
-
});
|
|
1390
|
-
const targetAuthor = normalizeOptionalString(account.config.account);
|
|
1391
|
-
const targetAuthorUuid = normalizeOptionalString(account.config.accountUuid);
|
|
1392
|
-
if (!targetAuthor && !targetAuthorUuid) return;
|
|
1393
|
-
const { registerSignalReactionTargetsForDeliveredPayload } = await import("./reaction-targets-BgPLDHBf.mjs").then((n) => n.t);
|
|
1394
|
-
await registerSignalReactionTargetsForDeliveredPayload({
|
|
1395
|
-
cfg: params.cfg,
|
|
1396
|
-
target: {
|
|
1397
|
-
...params.target,
|
|
1398
|
-
accountId: account.accountId
|
|
1399
|
-
},
|
|
1400
|
-
payload: params.payload,
|
|
1401
|
-
results: params.results,
|
|
1402
|
-
targetAuthor,
|
|
1403
|
-
targetAuthorUuid
|
|
1404
|
-
});
|
|
1405
|
-
}
|
|
1406
|
-
async function renderSignalApprovalPayloadForReactions(params) {
|
|
1407
|
-
const account = resolveSignalAccount({
|
|
1408
|
-
cfg: params.ctx.cfg,
|
|
1409
|
-
accountId: params.ctx.accountId ?? void 0
|
|
1410
|
-
});
|
|
1411
|
-
const targetAuthor = normalizeOptionalString(account.config.account);
|
|
1412
|
-
const targetAuthorUuid = normalizeOptionalString(account.config.accountUuid);
|
|
1413
|
-
if (!targetAuthor && !targetAuthorUuid) return null;
|
|
1414
|
-
const { addSignalApprovalReactionHintToStructuredPayload } = await loadSignalApprovalReactionsModule();
|
|
1415
|
-
const payload = materializeSignalPresentationFallback(params.payload, params.presentation);
|
|
1416
|
-
const questionPayload = questionGatewayRuntime.prepareReactionPayloadForDelivery({
|
|
1417
|
-
payload: params.payload,
|
|
1418
|
-
presentation: params.presentation
|
|
1419
|
-
});
|
|
1420
|
-
if (questionPayload) return questionPayload;
|
|
1421
|
-
return addSignalApprovalReactionHintToStructuredPayload({
|
|
1422
|
-
cfg: params.ctx.cfg,
|
|
1423
|
-
accountId: params.ctx.accountId ?? void 0,
|
|
1424
|
-
to: params.ctx.to,
|
|
1425
|
-
payload,
|
|
1426
|
-
targetAuthor,
|
|
1427
|
-
targetAuthorUuid
|
|
1428
|
-
});
|
|
1429
|
-
}
|
|
1430
1355
|
const signalPlugin = createChatChannelPlugin({
|
|
1431
1356
|
base: {
|
|
1432
1357
|
...createSignalPluginBase({
|
|
@@ -1462,7 +1387,26 @@ const signalPlugin = createChatChannelPlugin({
|
|
|
1462
1387
|
targetPrefixes: ["signal"],
|
|
1463
1388
|
normalizeTarget: normalizeSignalMessagingTarget,
|
|
1464
1389
|
inferTargetChatType: ({ to }) => inferSignalTargetChatType(to),
|
|
1465
|
-
resolveOutboundSessionRoute:
|
|
1390
|
+
resolveOutboundSessionRoute: (params) => {
|
|
1391
|
+
const target = params.resolvedTarget?.to ?? params.target;
|
|
1392
|
+
const resolved = resolveSignalOutboundTarget(target);
|
|
1393
|
+
if (!resolved) return null;
|
|
1394
|
+
const normalizedTarget = target.replace(/^signal:/i, "").trim();
|
|
1395
|
+
const recipientSessionExact = resolved.chatType === "group" || /^\+?\d{3,15}$/.test(normalizedTarget) ? true : "direct-alias";
|
|
1396
|
+
const baseSessionKey = buildOutboundBaseSessionKey({
|
|
1397
|
+
channel: "signal",
|
|
1398
|
+
cfg: params.cfg,
|
|
1399
|
+
agentId: params.agentId,
|
|
1400
|
+
accountId: params.accountId,
|
|
1401
|
+
peer: resolved.peer
|
|
1402
|
+
});
|
|
1403
|
+
return {
|
|
1404
|
+
sessionKey: baseSessionKey,
|
|
1405
|
+
baseSessionKey,
|
|
1406
|
+
recipientSessionExact,
|
|
1407
|
+
...resolved
|
|
1408
|
+
};
|
|
1409
|
+
},
|
|
1466
1410
|
targetResolver: {
|
|
1467
1411
|
looksLikeId: looksLikeSignalTargetId,
|
|
1468
1412
|
hint: "<E.164|uuid:ID|group:ID|signal:group:ID|signal:+E.164>",
|
|
@@ -1642,10 +1586,111 @@ const signalPlugin = createChatChannelPlugin({
|
|
|
1642
1586
|
payload,
|
|
1643
1587
|
hint
|
|
1644
1588
|
}),
|
|
1645
|
-
afterDeliverPayload:
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1589
|
+
afterDeliverPayload: async (params) => {
|
|
1590
|
+
const account = resolveSignalAccount({
|
|
1591
|
+
cfg: params.cfg,
|
|
1592
|
+
accountId: params.target.accountId ?? void 0
|
|
1593
|
+
});
|
|
1594
|
+
const targetAuthor = normalizeOptionalString(account.config.account);
|
|
1595
|
+
const targetAuthorUuid = normalizeOptionalString(account.config.accountUuid);
|
|
1596
|
+
if (!targetAuthor && !targetAuthorUuid) return;
|
|
1597
|
+
const { registerSignalApprovalReactionTargetForDeliveredPayload } = await loadSignalApprovalReactionsModule();
|
|
1598
|
+
await registerSignalApprovalReactionTargetForDeliveredPayload({
|
|
1599
|
+
cfg: params.cfg,
|
|
1600
|
+
target: {
|
|
1601
|
+
...params.target,
|
|
1602
|
+
accountId: account.accountId
|
|
1603
|
+
},
|
|
1604
|
+
payload: params.payload,
|
|
1605
|
+
results: params.results,
|
|
1606
|
+
targetAuthor,
|
|
1607
|
+
targetAuthorUuid
|
|
1608
|
+
});
|
|
1609
|
+
},
|
|
1610
|
+
renderPresentation: async (params) => {
|
|
1611
|
+
const account = resolveSignalAccount({
|
|
1612
|
+
cfg: params.ctx.cfg,
|
|
1613
|
+
accountId: params.ctx.accountId ?? void 0
|
|
1614
|
+
});
|
|
1615
|
+
const targetAuthor = normalizeOptionalString(account.config.account);
|
|
1616
|
+
const targetAuthorUuid = normalizeOptionalString(account.config.accountUuid);
|
|
1617
|
+
if (!targetAuthor && !targetAuthorUuid) return null;
|
|
1618
|
+
const { addSignalApprovalReactionHintToStructuredPayload } = await loadSignalApprovalReactionsModule();
|
|
1619
|
+
const payload = materializeSignalPresentationFallback(params.payload, params.presentation);
|
|
1620
|
+
return addSignalApprovalReactionHintToStructuredPayload({
|
|
1621
|
+
cfg: params.ctx.cfg,
|
|
1622
|
+
accountId: params.ctx.accountId ?? void 0,
|
|
1623
|
+
to: params.ctx.to,
|
|
1624
|
+
payload,
|
|
1625
|
+
targetAuthor,
|
|
1626
|
+
targetAuthorUuid
|
|
1627
|
+
});
|
|
1628
|
+
},
|
|
1629
|
+
sendFormattedText: async (ctx) => {
|
|
1630
|
+
const send = await createSignalOutboundSender(ctx);
|
|
1631
|
+
const limit = resolveTextChunkLimit(ctx.cfg, "signal", ctx.accountId ?? void 0, { fallbackLimit: 4e3 });
|
|
1632
|
+
const to = resolveSignalSendTarget(ctx);
|
|
1633
|
+
const tableMode = resolveMarkdownTableMode({
|
|
1634
|
+
cfg: ctx.cfg,
|
|
1635
|
+
channel: "signal",
|
|
1636
|
+
accountId: ctx.accountId ?? void 0
|
|
1637
|
+
});
|
|
1638
|
+
let chunks = markdownToSignalTextChunks(ctx.text, limit ?? Number.POSITIVE_INFINITY, {
|
|
1639
|
+
tableMode,
|
|
1640
|
+
chunkMode: ctx.formatting?.chunkMode ?? resolveChunkMode(ctx.cfg, "signal", ctx.accountId)
|
|
1641
|
+
});
|
|
1642
|
+
if (chunks.length === 0 && ctx.text) chunks = [{
|
|
1643
|
+
text: ctx.text,
|
|
1644
|
+
styles: []
|
|
1645
|
+
}];
|
|
1646
|
+
const effectiveReplyToMode = ctx.replyToMode ?? resolveSignalReplyToMode({
|
|
1647
|
+
cfg: ctx.cfg,
|
|
1648
|
+
accountId: ctx.accountId,
|
|
1649
|
+
chatType: inferSignalTargetChatType(to)
|
|
1650
|
+
});
|
|
1651
|
+
const nextReplyToId = createReplyToFanout({
|
|
1652
|
+
replyToId: ctx.replyToId,
|
|
1653
|
+
replyToIdSource: ctx.replyToIdSource,
|
|
1654
|
+
replyToMode: effectiveReplyToMode
|
|
1655
|
+
});
|
|
1656
|
+
const results = [];
|
|
1657
|
+
for (const chunk of chunks) {
|
|
1658
|
+
ctx.abortSignal?.throwIfAborted();
|
|
1659
|
+
const result = await send(to, chunk.text, {
|
|
1660
|
+
replyToId: nextReplyToId(),
|
|
1661
|
+
textMode: "plain",
|
|
1662
|
+
textStyles: chunk.styles
|
|
1663
|
+
});
|
|
1664
|
+
const deliveryResult = attachChannelToResult("signal", attachSignalVisibleText(result, chunk.text));
|
|
1665
|
+
results.push(deliveryResult);
|
|
1666
|
+
await ctx.onDeliveryResult?.(deliveryResult);
|
|
1667
|
+
}
|
|
1668
|
+
return results;
|
|
1669
|
+
},
|
|
1670
|
+
sendFormattedMedia: async (ctx) => {
|
|
1671
|
+
ctx.abortSignal?.throwIfAborted();
|
|
1672
|
+
const send = await createSignalOutboundSender(ctx);
|
|
1673
|
+
const to = resolveSignalSendTarget(ctx);
|
|
1674
|
+
const tableMode = resolveMarkdownTableMode({
|
|
1675
|
+
cfg: ctx.cfg,
|
|
1676
|
+
channel: "signal",
|
|
1677
|
+
accountId: ctx.accountId ?? void 0
|
|
1678
|
+
});
|
|
1679
|
+
const formatted = markdownToSignalTextChunks(ctx.text, Number.POSITIVE_INFINITY, { tableMode })[0] ?? {
|
|
1680
|
+
text: ctx.text,
|
|
1681
|
+
styles: []
|
|
1682
|
+
};
|
|
1683
|
+
const result = await send(to, formatted.text, {
|
|
1684
|
+
replyToId: ctx.replyToId,
|
|
1685
|
+
mediaUrl: ctx.mediaUrl,
|
|
1686
|
+
...ctx.mediaAccess ? { mediaAccess: ctx.mediaAccess } : {},
|
|
1687
|
+
mediaLocalRoots: ctx.mediaLocalRoots,
|
|
1688
|
+
...ctx.mediaReadFile ? { mediaReadFile: ctx.mediaReadFile } : {},
|
|
1689
|
+
textMode: "plain",
|
|
1690
|
+
textStyles: formatted.styles
|
|
1691
|
+
});
|
|
1692
|
+
return attachChannelToResult("signal", attachSignalVisibleText(result, formatted.text));
|
|
1693
|
+
}
|
|
1649
1694
|
},
|
|
1650
1695
|
attachedResults: {
|
|
1651
1696
|
channel: "signal",
|
|
@@ -1655,4 +1700,4 @@ const signalPlugin = createChatChannelPlugin({
|
|
|
1655
1700
|
}
|
|
1656
1701
|
});
|
|
1657
1702
|
//#endregion
|
|
1658
|
-
export {
|
|
1703
|
+
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 };
|