@openclaw/matrix 2026.8.2 → 2026.9.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/api.js +4 -4
- package/dist/{approval-handler.runtime-xcVrZw9o.js → approval-handler.runtime-B_6ytY5I.js} +32 -9
- package/dist/{approval-ids-hmvhDNBj.js → approval-ids-CfHtZ9d1.js} +1 -1
- package/dist/{approval-reaction-auth-DziFGHSk.js → approval-reaction-auth-BpDvJqfy.js} +1 -1
- package/dist/{channel-D6-ajB_u.js → channel-b-jES-oi.js} +18 -11
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-BkqjwEDU.js +76 -0
- package/dist/{channel.setup-OIEzCzSs.js → channel.setup-BY42QaL7.js} +2 -2
- package/dist/{cli-B6HF7Hmn.js → cli-CtYeU7ol.js} +8 -8
- package/dist/{cli-metadata-Mtzu5-AY.js → cli-metadata-B7MQjR5S.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-B0yMDho1.js → client-D2utPQ1E.js} +2 -2
- package/dist/{client-DFsRJEgB.js → client-Dj4mcf-s.js} +2 -2
- package/dist/{client-bootstrap-DjXCKEtg.js → client-bootstrap-n1Rqc8Go.js} +1 -1
- package/dist/contract-api.js +2 -2
- package/dist/{crypto-runtime-QvlgyCkj.js → crypto-runtime-m1eplj3b.js} +3 -3
- package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
- package/dist/{directory-live-Drh343TW.js → directory-live-DLUgWBhA.js} +1 -1
- package/dist/doctor-contract-api.js +85 -105
- package/dist/{draft-stream-DhGHVdO4.js → draft-stream-DPYdv4fE.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-DlMQaC02.js → messages-C1U3b1oN.js} +2 -2
- package/dist/{monitor-U2LcVtHt.js → monitor-SNnu-0bp.js} +29 -17
- package/dist/outbound-CeCEtF_q.js +220 -0
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-B1YPxG9x.js +2 -0
- package/dist/{profile-update-CsyKA9jI.js → profile-update-Cd1p8ABr.js} +1 -1
- package/dist/{reaction-events-lwNc5I1X.js → reaction-events-DveJRUaX.js} +3 -3
- package/dist/{resolve-targets-D3Eakgzs.js → resolve-targets-B64O69Nd.js} +1 -1
- package/dist/{resolver.runtime-DJQxR35r.js → resolver.runtime-TRmePJDV.js} +1 -1
- package/dist/{room-info-DIU67XLP.js → room-info-DVkKDscD.js} +3 -3
- package/dist/{sdk-Jl2CgAbJ.js → sdk-C1yfda1L.js} +4 -4
- package/dist/{send-DfS5ciUL.js → send-DG7Bnj7_.js} +12 -14
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-CWoIWudw.js → setup-bootstrap-Co985F63.js} +1 -1
- package/dist/{setup-core-CZM496H-.js → setup-core-CEF6exLW.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DSZtOsWK.js → setup-surface-BSlj1vnL.js} +4 -4
- package/dist/{thread-bindings-2HN2AyLu.js → thread-bindings-DgxQEB99.js} +1 -1
- package/dist/{tool-actions.runtime-CFZZPG5g.js → tool-actions.runtime-vbkQgU7D.js} +7 -7
- package/dist/{verification-CD7k5vE9.js → verification-D-iOebn4.js} +1 -1
- package/package.json +6 -5
- package/dist/channel.runtime-BMA0dG2k.js +0 -280
- package/dist/probe.runtime-CNo-5_iz.js +0 -2
- package/dist/{idb-persistence-D4NGNQxt.js → idb-persistence-CU7CNLlX.js} +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
2
|
import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-BnX26jCO.js";
|
|
3
3
|
import { r as syncMatrixOwnProfile } from "./profile-vmjsmhh4.js";
|
|
4
|
-
import { n as withResolvedActionClient } from "./client-
|
|
4
|
+
import { n as withResolvedActionClient } from "./client-D2utPQ1E.js";
|
|
5
5
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
6
6
|
//#region extensions/matrix/src/matrix/actions/profile.ts
|
|
7
7
|
async function updateMatrixOwnProfile(opts = {}) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
|
-
import { a as resolveMatrixThreadRootId, o as resolveMatrixThreadRouting, r as resolveMatrixInboundRoute } from "./channel-
|
|
2
|
+
import { a as resolveMatrixThreadRootId, o as resolveMatrixThreadRouting, r as resolveMatrixInboundRoute } from "./channel-b-jES-oi.js";
|
|
3
3
|
import { a as extractMatrixReactionAnnotation } from "./reaction-common-DkrQdBSZ.js";
|
|
4
4
|
import { i as resolveMatrixApprovalReactionTargetWithPersistence, o as unregisterMatrixApprovalReactionTargetsForApproval } from "./approval-reactions-1fwEhoK9.js";
|
|
5
5
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
@@ -7,9 +7,9 @@ import { isApprovalNotFoundError } from "openclaw/plugin-sdk/error-runtime";
|
|
|
7
7
|
import { normalizeAccountId } from "openclaw/plugin-sdk/routing";
|
|
8
8
|
import { getSessionBindingService } from "openclaw/plugin-sdk/session-binding-runtime";
|
|
9
9
|
//#region extensions/matrix/src/matrix/monitor/reaction-events.ts
|
|
10
|
-
const loadApprovalReactionAuth = createLazyRuntimeModule(() => import("./approval-reaction-auth-
|
|
10
|
+
const loadApprovalReactionAuth = createLazyRuntimeModule(() => import("./approval-reaction-auth-BpDvJqfy.js"));
|
|
11
11
|
const loadExecApprovalResolver = createLazyRuntimeModule(() => import("openclaw/plugin-sdk/approval-gateway-runtime"));
|
|
12
|
-
const loadMatrixSend = createLazyRuntimeModule(() => import("./send-
|
|
12
|
+
const loadMatrixSend = createLazyRuntimeModule(() => import("./send-DG7Bnj7_.js").then((n) => n.s));
|
|
13
13
|
function buildMatrixApprovalTerminalText(result) {
|
|
14
14
|
const approval = result.approval;
|
|
15
15
|
const terminalLabel = approval.status === "allowed" ? approval.decision === "allow-always" ? "Allowed always" : "Allowed once" : approval.status === "denied" ? "Denied" : approval.status === "expired" ? "Expired" : "Cancelled";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { r as normalizeMatrixMessagingTarget, t as isMatrixQualifiedUserId } from "./target-ids-Nwx7cMVE.js";
|
|
3
|
-
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-
|
|
3
|
+
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DLUgWBhA.js";
|
|
4
4
|
import { normalizeOptionalLowercaseString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/matrix/src/resolve-targets.ts
|
|
6
6
|
var resolve_targets_exports = /* @__PURE__ */ __exportAll({ resolveMatrixTargets: () => resolveMatrixTargets });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as resolveMatrixTargets } from "./resolve-targets-
|
|
1
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-B64O69Nd.js";
|
|
2
2
|
//#region extensions/matrix/src/resolver.runtime.ts
|
|
3
3
|
const matrixResolverRuntime = { resolveMatrixTargets };
|
|
4
4
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as resolveMatrixRoomId } from "./send-
|
|
2
|
-
import { s as EventType } from "./messages-
|
|
3
|
-
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-
|
|
1
|
+
import { b as resolveMatrixRoomId } from "./send-DG7Bnj7_.js";
|
|
2
|
+
import { s as EventType } from "./messages-C1U3b1oN.js";
|
|
3
|
+
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-D2utPQ1E.js";
|
|
4
4
|
import { n as isMatrixNotFoundError } from "./errors-DKVS3_DO.js";
|
|
5
5
|
//#region extensions/matrix/src/matrix/monitor/bounded-cache.ts
|
|
6
6
|
function setBoundedMap(map, key, value, maxEntries) {
|
|
@@ -3,14 +3,14 @@ import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
|
3
3
|
import "./reaction-common-DkrQdBSZ.js";
|
|
4
4
|
import { A as writeMatrixRecoveryKeyStateForPath, E as readMatrixRecoveryKeyStateForPath, S as readLegacyMatrixRecoveryKeyFile, _ as migrateLegacyMatrixRecoveryKeyFilePathToStore, t as claimCurrentTokenStorageState } from "./storage-BVf4uucD.js";
|
|
5
5
|
import { i as openMatrixSyncCacheStoreOptions, l as writeMatrixSyncCacheStateToSyncStore, n as deleteMatrixSyncCacheStateFromSyncStore, o as readPersistedStoreFromSyncStore } from "./sync-cache-state-d-A_OhbU.js";
|
|
6
|
-
import { t as MATRIX_IDB_PERSIST_INTERVAL_MS } from "./idb-persistence-lock-B3fZXyF_.js";
|
|
7
|
-
import { n as LogService, r as noop, t as ConsoleLogger } from "./logger-B_71hN6W.js";
|
|
8
6
|
import { n as isMatrixNotFoundError, t as formatMatrixErrorReason } from "./errors-DKVS3_DO.js";
|
|
9
|
-
import { a as throwIfMatrixStartupAborted, r as createMatrixStartupAbortError } from "./client-
|
|
7
|
+
import { a as throwIfMatrixStartupAborted, r as createMatrixStartupAbortError } from "./client-Dj4mcf-s.js";
|
|
8
|
+
import { n as LogService, r as noop, t as ConsoleLogger } from "./logger-B_71hN6W.js";
|
|
10
9
|
import { n as matrixEventToRaw, r as parseMxc } from "./event-helpers-XRfAbOIh.js";
|
|
11
10
|
import { n as createMatrixGuardedFetch, t as MatrixAuthedHttpClient } from "./http-client-DOmFvKvB.js";
|
|
12
11
|
import { n as resolveMatrixRoomKeyBackupReadinessError } from "./backup-health-Dm_YMVFT.js";
|
|
13
12
|
import { t as createMatrixJsSdkClientLogger } from "./logging-DRjvUOIh.js";
|
|
13
|
+
import { t as MATRIX_IDB_PERSIST_INTERVAL_MS } from "./idb-persistence-lock-B3fZXyF_.js";
|
|
14
14
|
import { a as isMatrixAccessTokenInvalidatedError, c as resolveMatrixLocalTimeoutMs, f as isMatrixReadySyncState, i as createMatrixExplicitBootstrapOptions, l as unresolvedMatrixDeviceVerificationStatus, n as MATRIX_INITIAL_CRYPTO_BOOTSTRAP_OPTIONS, o as resolveMatrixDiagnostic, p as isMatrixTerminalSyncState, r as MATRIX_STATUS_DIAGNOSTIC_TIMEOUT_MS, s as resolveMatrixDiagnosticResult, t as MATRIX_AUTOMATIC_REPAIR_BOOTSTRAP_OPTIONS, u as unresolvedMatrixRoomKeyBackupStatus } from "./client-support-DLj4vDeu.js";
|
|
15
15
|
import { createRequire } from "node:module";
|
|
16
16
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
@@ -707,7 +707,7 @@ function resolveMessageWireDispatch(resource, init) {
|
|
|
707
707
|
};
|
|
708
708
|
}
|
|
709
709
|
let loadedMatrixCryptoRuntime = null;
|
|
710
|
-
const loadMatrixCryptoRuntime = createLazyRuntimeModule(() => import("./crypto-runtime-
|
|
710
|
+
const loadMatrixCryptoRuntime = createLazyRuntimeModule(() => import("./crypto-runtime-m1eplj3b.js").then((runtime) => {
|
|
711
711
|
loadedMatrixCryptoRuntime = runtime;
|
|
712
712
|
return runtime;
|
|
713
713
|
}));
|
|
@@ -19,7 +19,7 @@ import { isAutoLinkedFileRef } from "openclaw/plugin-sdk/text-autolink-runtime";
|
|
|
19
19
|
import { isVoiceMessageCompatibleAudio } from "openclaw/plugin-sdk/media-runtime";
|
|
20
20
|
import { parseBuffer } from "music-metadata";
|
|
21
21
|
//#region extensions/matrix/src/matrix/send/client.ts
|
|
22
|
-
const loadMatrixSendClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-
|
|
22
|
+
const loadMatrixSendClientRuntime = createLazyRuntimeModule(() => import("./client-bootstrap-n1Rqc8Go.js").then((n) => n.t));
|
|
23
23
|
function resolveMediaMaxBytes(accountId, cfg) {
|
|
24
24
|
if (!cfg) throw new Error("Matrix media limits requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
|
|
25
25
|
const resolvedCfg = requireRuntimeConfig(cfg, "Matrix media limits");
|
|
@@ -1043,11 +1043,12 @@ function findMatrixSpoilerDelimiterOffsets(markdown) {
|
|
|
1043
1043
|
function hasMatrixSpoilerMetadataCollision(markdown) {
|
|
1044
1044
|
const projected = projectMatrixMarkdown(markdown);
|
|
1045
1045
|
const ordinary = new Set(findMatrixSpoilerDelimiterOffsets(projected));
|
|
1046
|
-
const
|
|
1046
|
+
const underlineTags = [...tokenizeHtmlTags(projected)].filter((tag) => (tag.name === "u" || tag.name === "ins") && !isMarkdownEscaped(projected, tag.start));
|
|
1047
|
+
const literalRanges = [...findMatrixTableSourceRanges(projected), ...findCodeRegions(projected).filter((code) => !underlineTags.some((tag) => code.start > tag.start && code.start < tag.end))];
|
|
1047
1048
|
for (let index = 0; index < projected.length - 1; index += 1) {
|
|
1048
1049
|
if (projected[index] !== "|" || projected[index + 1] !== "|") continue;
|
|
1049
1050
|
if (ordinary.has(index) || isMarkdownEscaped(projected, index)) continue;
|
|
1050
|
-
if (
|
|
1051
|
+
if (literalRanges.some((range) => index >= range.start && index < range.end)) continue;
|
|
1051
1052
|
return true;
|
|
1052
1053
|
}
|
|
1053
1054
|
return false;
|
|
@@ -1495,7 +1496,6 @@ async function renderMarkdownToMatrixHtmlWithMentions(params) {
|
|
|
1495
1496
|
}
|
|
1496
1497
|
//#endregion
|
|
1497
1498
|
//#region extensions/matrix/src/matrix/send/chunking.ts
|
|
1498
|
-
const getCore$2 = () => getMatrixRuntime();
|
|
1499
1499
|
function normalizeMatrixEventLimit(limit) {
|
|
1500
1500
|
if (!Number.isFinite(limit) || limit <= 0) return limit;
|
|
1501
1501
|
return Math.max(1, Math.floor(limit));
|
|
@@ -1600,14 +1600,14 @@ function prepareMatrixSingleText(text, opts) {
|
|
|
1600
1600
|
const normalizedText = text.replace(/\r\n?/gu, "\n");
|
|
1601
1601
|
const trimmedText = opts.preserveWhitespace ? normalizedText : normalizedText.trim();
|
|
1602
1602
|
const cfg = requireRuntimeConfig(opts.cfg, "Matrix text preparation");
|
|
1603
|
-
const tableMode = opts.tableMode ??
|
|
1603
|
+
const tableMode = opts.tableMode ?? getMatrixRuntime().channel.text.resolveMarkdownTableMode({
|
|
1604
1604
|
cfg,
|
|
1605
1605
|
channel: "matrix",
|
|
1606
1606
|
accountId: opts.accountId,
|
|
1607
1607
|
supportsBlockTables: MATRIX_FORMAT_PROFILE.constructs.table === "native"
|
|
1608
1608
|
});
|
|
1609
1609
|
const convertedText = renderMatrixMarkdownTables(trimmedText, tableMode);
|
|
1610
|
-
const singleEventLimit = normalizeMatrixEventLimit(Math.min(
|
|
1610
|
+
const singleEventLimit = normalizeMatrixEventLimit(Math.min(getMatrixRuntime().channel.text.resolveTextChunkLimit(cfg, "matrix", opts.accountId), MATRIX_FORMAT_PROFILE.chunk.limit));
|
|
1611
1611
|
const preparedBody = markdownToMatrixBody(convertedText);
|
|
1612
1612
|
const eventTextLength = Math.max(convertedText.length, preparedBody.length);
|
|
1613
1613
|
return {
|
|
@@ -1627,7 +1627,7 @@ function chunkMatrixText(text, opts) {
|
|
|
1627
1627
|
chunks: preparedText.convertedText ? [preparedText.convertedText] : []
|
|
1628
1628
|
};
|
|
1629
1629
|
const cfg = requireRuntimeConfig(opts.cfg, "Matrix text chunking");
|
|
1630
|
-
const chunkMode =
|
|
1630
|
+
const chunkMode = getMatrixRuntime().channel.text.resolveChunkMode(cfg, "matrix", opts.accountId);
|
|
1631
1631
|
const collisionRedacted = hasMatrixSpoilerMetadataCollision(preparedText.convertedText) ? markdownToMatrixBody(preparedText.convertedText) : void 0;
|
|
1632
1632
|
const chunkSegment = (segmentText) => {
|
|
1633
1633
|
const protectedUnderline = protectMatrixUnderlineTags(hasMatrixSpoilerMetadataCollision(segmentText) ? markdownToMatrixBody(segmentText) : segmentText);
|
|
@@ -1640,7 +1640,7 @@ function chunkMatrixText(text, opts) {
|
|
|
1640
1640
|
] : []);
|
|
1641
1641
|
let reserve = wrapperReserve;
|
|
1642
1642
|
while (reserve < preparedText.singleEventLimit) {
|
|
1643
|
-
const protectedChunks =
|
|
1643
|
+
const protectedChunks = getMatrixRuntime().channel.text.chunkMarkdownTextWithMode(protectedSpoilers.markdown, preparedText.singleEventLimit - reserve, chunkMode);
|
|
1644
1644
|
const restored = restoreMatrixStyleChunks(protectedChunks, protectedSpoilers.markers, protectedUnderline.markers).filter((_, index) => {
|
|
1645
1645
|
return privateMarkers.reduce((value, marker) => value.replaceAll(marker, ""), protectedChunks[index] ?? "").length > 0;
|
|
1646
1646
|
});
|
|
@@ -1661,7 +1661,6 @@ function chunkMatrixText(text, opts) {
|
|
|
1661
1661
|
}
|
|
1662
1662
|
//#endregion
|
|
1663
1663
|
//#region extensions/matrix/src/matrix/send/formatting.ts
|
|
1664
|
-
const getCore$1 = () => getMatrixRuntime();
|
|
1665
1664
|
async function renderMatrixFormattedContent(params) {
|
|
1666
1665
|
const markdown = params.markdown ?? "";
|
|
1667
1666
|
const body = params.preparedBody ?? markdownToMatrixBody(markdown);
|
|
@@ -1756,7 +1755,7 @@ function buildThreadRelation(threadId, replyToId) {
|
|
|
1756
1755
|
return relation;
|
|
1757
1756
|
}
|
|
1758
1757
|
function resolveMatrixMsgType(contentType, _fileName) {
|
|
1759
|
-
switch (
|
|
1758
|
+
switch (getMatrixRuntime().media.mediaKindFromMime(contentType ?? "")) {
|
|
1760
1759
|
case "image": return MsgType.Image;
|
|
1761
1760
|
case "audio": return MsgType.Audio;
|
|
1762
1761
|
case "video": return MsgType.Video;
|
|
@@ -1776,7 +1775,6 @@ function isMatrixVoiceCompatibleAudio(opts) {
|
|
|
1776
1775
|
}
|
|
1777
1776
|
//#endregion
|
|
1778
1777
|
//#region extensions/matrix/src/matrix/send/media.ts
|
|
1779
|
-
const getCore = () => getMatrixRuntime();
|
|
1780
1778
|
function buildMatrixMediaInfo(params) {
|
|
1781
1779
|
const base = {};
|
|
1782
1780
|
if (Number.isFinite(params.size)) base.size = params.size;
|
|
@@ -1855,20 +1853,20 @@ function resolveAifcIma4DurationSeconds(buffer, sampleRate) {
|
|
|
1855
1853
|
return packetCount * AIFC_IMA4_FRAMES_PER_PACKET / sampleRate;
|
|
1856
1854
|
}
|
|
1857
1855
|
async function prepareImageInfo(params) {
|
|
1858
|
-
const meta = await
|
|
1856
|
+
const meta = await getMatrixRuntime().media.getImageMetadata(params.buffer).catch(() => null);
|
|
1859
1857
|
if (!meta) return;
|
|
1860
1858
|
const imageInfo = {
|
|
1861
1859
|
w: meta.width,
|
|
1862
1860
|
h: meta.height
|
|
1863
1861
|
};
|
|
1864
1862
|
if (Math.max(meta.width, meta.height) > THUMBNAIL_MAX_SIDE) try {
|
|
1865
|
-
const thumbBuffer = await
|
|
1863
|
+
const thumbBuffer = await getMatrixRuntime().media.resizeToJpeg({
|
|
1866
1864
|
buffer: params.buffer,
|
|
1867
1865
|
maxSide: THUMBNAIL_MAX_SIDE,
|
|
1868
1866
|
quality: THUMBNAIL_QUALITY,
|
|
1869
1867
|
withoutEnlargement: true
|
|
1870
1868
|
});
|
|
1871
|
-
const thumbMeta = await
|
|
1869
|
+
const thumbMeta = await getMatrixRuntime().media.getImageMetadata(thumbBuffer).catch(() => null);
|
|
1872
1870
|
const result = await uploadMediaWithEncryption(params.client, params.roomId, thumbBuffer, {
|
|
1873
1871
|
contentType: "image/jpeg",
|
|
1874
1872
|
filename: "thumbnail.jpg"
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { r as setMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
2
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-DgxQEB99.js";
|
|
3
3
|
export { createMatrixThreadBindingManager, setMatrixRuntime };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
2
|
import "./accounts-DR1c4xF_.js";
|
|
3
|
-
import { n as bootstrapMatrixVerification } from "./verification-
|
|
3
|
+
import { n as bootstrapMatrixVerification } from "./verification-D-iOebn4.js";
|
|
4
4
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
5
5
|
//#region extensions/matrix/src/setup-bootstrap.ts
|
|
6
6
|
async function maybeBootstrapNewEncryptedMatrixAccount(params) {
|
|
@@ -311,7 +311,7 @@ const matrixSetupAdapter = {
|
|
|
311
311
|
input
|
|
312
312
|
}),
|
|
313
313
|
afterAccountConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
314
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
314
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-Co985F63.js");
|
|
315
315
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
316
316
|
previousCfg,
|
|
317
317
|
cfg,
|
package/dist/setup-plugin-api.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as matrixSetupPlugin } from "./channel.setup-
|
|
1
|
+
import { n as matrixSetupPlugin } from "./channel.setup-BY42QaL7.js";
|
|
2
2
|
export { matrixSetupPlugin };
|
|
@@ -4,7 +4,7 @@ import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
|
4
4
|
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-DR1c4xF_.js";
|
|
5
5
|
import { n as isMatrixRoomId } from "./target-ids-Nwx7cMVE.js";
|
|
6
6
|
import { r as updateMatrixAccountConfig } from "./config-update-BnX26jCO.js";
|
|
7
|
-
import { a as moveSingleMatrixAccountConfigToNamedAccount, i as createMatrixSetupDmPolicy } from "./setup-core-
|
|
7
|
+
import { a as moveSingleMatrixAccountConfigToNamedAccount, i as createMatrixSetupDmPolicy } from "./setup-core-CEF6exLW.js";
|
|
8
8
|
import { n as validateMatrixHomeserverUrl, r as isPrivateOrLoopbackHost, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
9
9
|
import { n as ensureMatrixSdkInstalled, r as isMatrixSdkAvailable } from "./deps-mtxF2mHI.js";
|
|
10
10
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeStringifiedOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -91,7 +91,7 @@ async function promptMatrixAllowFrom(params) {
|
|
|
91
91
|
pending.push(part);
|
|
92
92
|
}
|
|
93
93
|
if (pending.length > 0) {
|
|
94
|
-
const { resolveMatrixTargets } = await import("./resolve-targets-
|
|
94
|
+
const { resolveMatrixTargets } = await import("./resolve-targets-B64O69Nd.js").then((n) => n.n);
|
|
95
95
|
const results = await resolveMatrixTargets({
|
|
96
96
|
cfg,
|
|
97
97
|
accountId,
|
|
@@ -211,7 +211,7 @@ async function configureMatrixAccessPrompts(params) {
|
|
|
211
211
|
resolvedIds.push(cleaned);
|
|
212
212
|
continue;
|
|
213
213
|
}
|
|
214
|
-
const { listMatrixDirectoryGroupsLive } = await import("./directory-live-
|
|
214
|
+
const { listMatrixDirectoryGroupsLive } = await import("./directory-live-DLUgWBhA.js").then((n) => n.t);
|
|
215
215
|
const matches = await listMatrixDirectoryGroupsLive({
|
|
216
216
|
cfg: next,
|
|
217
217
|
accountId: params.accountId,
|
|
@@ -464,7 +464,7 @@ const matrixOnboardingAdapter = {
|
|
|
464
464
|
});
|
|
465
465
|
},
|
|
466
466
|
afterConfigWritten: async ({ previousCfg, cfg, accountId, runtime }) => {
|
|
467
|
-
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-
|
|
467
|
+
const { runMatrixSetupBootstrapAfterConfigWrite } = await import("./setup-bootstrap-Co985F63.js");
|
|
468
468
|
await runMatrixSetupBootstrapAfterConfigWrite({
|
|
469
469
|
previousCfg,
|
|
470
470
|
cfg,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
2
|
import { a as listBindingsForAccount, c as resolveEffectiveBindingExpiry, d as setMatrixThreadBindingManagerEntry, l as setBindingRecord, m as toSessionBindingRecord, o as removeBindingRecord, p as toMatrixBindingTargetKind, r as getMatrixThreadBindingManagerEntry, s as resolveBindingKey, t as deleteMatrixThreadBindingManagerEntry } from "./thread-bindings-shared-oNPiyMWY.js";
|
|
3
3
|
import { M as resolveMatrixSqliteStateEnv, N as resolveMatrixSqliteStateKey, c as resolveMatrixStateFilePath, t as claimCurrentTokenStorageState } from "./storage-BVf4uucD.js";
|
|
4
|
-
import { r as sendMessageMatrix } from "./send-
|
|
4
|
+
import { r as sendMessageMatrix } from "./send-DG7Bnj7_.js";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import path from "node:path";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
2
|
import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
|
|
3
|
-
import { l as resolveMatrixRoomConfig } from "./channel-
|
|
3
|
+
import { l as resolveMatrixRoomConfig } from "./channel-b-jES-oi.js";
|
|
4
4
|
import { i as normalizeMatrixResolvableTarget } from "./target-ids-Nwx7cMVE.js";
|
|
5
5
|
import { i as buildMatrixReactionRelationsPath, o as selectOwnMatrixReactionEventIds, s as summarizeMatrixReactionEvents } from "./reaction-common-DkrQdBSZ.js";
|
|
6
|
-
import { b as resolveMatrixRoomId, h as parsePollStart, l as buildPollResponseContent, m as isPollStartType, n as reactMatrixMessage } from "./send-
|
|
6
|
+
import { b as resolveMatrixRoomId, h as parsePollStart, l as buildPollResponseContent, m as isPollStartType, n as reactMatrixMessage } from "./send-DG7Bnj7_.js";
|
|
7
7
|
import { i as isStrictDirectMembership, n as hasDirectMatrixMemberFlag, o as readJoinedMatrixMembers } from "./direct-room-RinHjtqX.js";
|
|
8
|
-
import { a as fetchEventSummary, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, p as resolveMatrixActionLimit, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-
|
|
9
|
-
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-
|
|
8
|
+
import { a as fetchEventSummary, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, p as resolveMatrixActionLimit, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-C1U3b1oN.js";
|
|
9
|
+
import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-D2utPQ1E.js";
|
|
10
10
|
import { r as parseMxc } from "./event-helpers-XRfAbOIh.js";
|
|
11
|
-
import { t as applyMatrixProfileUpdate } from "./profile-update-
|
|
12
|
-
import { _ as scanMatrixVerificationQr, a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, h as restoreMatrixRoomKeyBackup, i as confirmMatrixVerificationReciprocateQr, l as getMatrixVerificationSas, n as bootstrapMatrixVerification, o as generateMatrixVerificationQr, p as requestMatrixVerification, r as cancelMatrixVerification, s as getMatrixEncryptionStatus, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-
|
|
13
|
-
import { n as getMatrixMemberInfo, r as getMatrixRoomInfo, t as createMatrixRoomInfoResolver } from "./room-info-
|
|
11
|
+
import { t as applyMatrixProfileUpdate } from "./profile-update-Cd1p8ABr.js";
|
|
12
|
+
import { _ as scanMatrixVerificationQr, a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, h as restoreMatrixRoomKeyBackup, i as confirmMatrixVerificationReciprocateQr, l as getMatrixVerificationSas, n as bootstrapMatrixVerification, o as generateMatrixVerificationQr, p as requestMatrixVerification, r as cancelMatrixVerification, s as getMatrixEncryptionStatus, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-D-iOebn4.js";
|
|
13
|
+
import { n as getMatrixMemberInfo, r as getMatrixRoomInfo, t as createMatrixRoomInfoResolver } from "./room-info-DVkKDscD.js";
|
|
14
14
|
import { isRecord, normalizeOptionalLowercaseString, uniqueStrings, uniqueValues } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
15
15
|
import { ToolAuthorizationError, createActionGate, jsonResult, readPositiveIntegerParam, readReactionParams, readStringArrayParam, readStringParam } from "openclaw/plugin-sdk/channel-actions";
|
|
16
16
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-
|
|
2
|
+
import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-D2utPQ1E.js";
|
|
3
3
|
import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-BNcZNQZI.js";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/matrix",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.9.1",
|
|
4
4
|
"description": "OpenClaw Matrix channel plugin for rooms and direct messages.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"zod": "4.4.3"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"openclaw": ">=2026.
|
|
21
|
+
"openclaw": ">=2026.9.1"
|
|
22
22
|
},
|
|
23
23
|
"peerDependenciesMeta": {
|
|
24
24
|
"openclaw": {
|
|
@@ -162,15 +162,16 @@
|
|
|
162
162
|
"install": {
|
|
163
163
|
"clawhubSpec": "clawhub:@openclaw/matrix",
|
|
164
164
|
"npmSpec": "@openclaw/matrix",
|
|
165
|
-
"defaultChoice": "
|
|
165
|
+
"defaultChoice": "npm",
|
|
166
166
|
"minHostVersion": ">=2026.4.10",
|
|
167
167
|
"allowInvalidConfigRecovery": true
|
|
168
168
|
},
|
|
169
169
|
"compat": {
|
|
170
|
-
"pluginApi": ">=2026.
|
|
170
|
+
"pluginApi": ">=2026.9.1"
|
|
171
171
|
},
|
|
172
172
|
"build": {
|
|
173
|
-
"
|
|
173
|
+
"bundledDist": false,
|
|
174
|
+
"openclawVersion": "2026.9.1"
|
|
174
175
|
},
|
|
175
176
|
"release": {
|
|
176
177
|
"publishToClawHub": true,
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { i as sendPollMatrix, o as sendTypingMatrix, r as sendMessageMatrix, v as cleanupMatrixDeliveryPlans, y as reconcileMatrixUnknownSend } from "./send-DfS5ciUL.js";
|
|
2
|
-
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
3
|
-
import { l as resolveMatrixAuth } from "./client-DFsRJEgB.js";
|
|
4
|
-
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-Drh343TW.js";
|
|
5
|
-
import { t as resolveMatrixTargets } from "./resolve-targets-D3Eakgzs.js";
|
|
6
|
-
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
7
|
-
import { createMessageReceiptFromOutboundResults, createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
8
|
-
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
-
import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
|
10
|
-
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
11
|
-
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
12
|
-
import { attachChannelToResult } from "openclaw/plugin-sdk/channel-send-result";
|
|
13
|
-
import { renderMessagePresentationFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
|
|
14
|
-
import { resolveSendableOutboundReplyParts, sendPayloadMediaSequence } from "openclaw/plugin-sdk/reply-payload";
|
|
15
|
-
//#region extensions/matrix/src/matrix/probe.ts
|
|
16
|
-
const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-CNo-5_iz.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient })));
|
|
17
|
-
async function probeMatrix(params) {
|
|
18
|
-
return await runChannelProbe(void 0, async () => {
|
|
19
|
-
const result = {
|
|
20
|
-
ok: false,
|
|
21
|
-
status: null,
|
|
22
|
-
error: null
|
|
23
|
-
};
|
|
24
|
-
if (isBunRuntime()) return {
|
|
25
|
-
...result,
|
|
26
|
-
error: "Matrix probe requires Node (bun runtime not supported)"
|
|
27
|
-
};
|
|
28
|
-
if (!params.homeserver?.trim()) return {
|
|
29
|
-
...result,
|
|
30
|
-
error: "missing homeserver"
|
|
31
|
-
};
|
|
32
|
-
if (!params.accessToken?.trim()) return {
|
|
33
|
-
...result,
|
|
34
|
-
error: "missing access token"
|
|
35
|
-
};
|
|
36
|
-
const { createMatrixClient } = await loadMatrixProbeRuntimeDeps();
|
|
37
|
-
const inputUserId = normalizeOptionalString(params.userId);
|
|
38
|
-
const userId = await (await createMatrixClient({
|
|
39
|
-
homeserver: params.homeserver,
|
|
40
|
-
userId: void 0,
|
|
41
|
-
accessToken: params.accessToken,
|
|
42
|
-
deviceId: params.deviceId,
|
|
43
|
-
persistStorage: false,
|
|
44
|
-
localTimeoutMs: params.timeoutMs,
|
|
45
|
-
accountId: params.accountId,
|
|
46
|
-
allowPrivateNetwork: params.allowPrivateNetwork,
|
|
47
|
-
ssrfPolicy: params.ssrfPolicy,
|
|
48
|
-
dispatcherPolicy: params.dispatcherPolicy
|
|
49
|
-
})).getUserId();
|
|
50
|
-
if (inputUserId && inputUserId !== userId) return {
|
|
51
|
-
...result,
|
|
52
|
-
error: "Matrix access token user does not match configured userId"
|
|
53
|
-
};
|
|
54
|
-
return {
|
|
55
|
-
...result,
|
|
56
|
-
ok: true,
|
|
57
|
-
userId
|
|
58
|
-
};
|
|
59
|
-
}, (error) => ({
|
|
60
|
-
ok: false,
|
|
61
|
-
status: typeof error === "object" && error && "statusCode" in error ? Number(error.statusCode) : null,
|
|
62
|
-
error: formatErrorMessage(error)
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region extensions/matrix/src/outbound.ts
|
|
67
|
-
const MATRIX_OPENCLAW_PRESENTATION_KEY = "com.openclaw.presentation";
|
|
68
|
-
const MATRIX_OPENCLAW_PRESENTATION_TYPE = "message.presentation";
|
|
69
|
-
const MATRIX_EMPTY_PRESENTATION_FALLBACK_TEXT = "---";
|
|
70
|
-
function toMatrixOutboundResult(result) {
|
|
71
|
-
const { roomId, ...delivery } = result;
|
|
72
|
-
return {
|
|
73
|
-
...delivery,
|
|
74
|
-
target: {
|
|
75
|
-
kind: "room",
|
|
76
|
-
id: roomId
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
function resolveMatrixChannelData(payload) {
|
|
81
|
-
const raw = asOptionalRecord(payload.channelData)?.matrix;
|
|
82
|
-
return asOptionalRecord(raw) ?? {};
|
|
83
|
-
}
|
|
84
|
-
function buildMatrixPresentationContent(presentation) {
|
|
85
|
-
return {
|
|
86
|
-
...presentation,
|
|
87
|
-
version: 1,
|
|
88
|
-
type: MATRIX_OPENCLAW_PRESENTATION_TYPE
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
function resolveMatrixPresentationContent(payload) {
|
|
92
|
-
const extraContent = asOptionalRecord(resolveMatrixChannelData(payload).extraContent);
|
|
93
|
-
const presentation = asOptionalRecord(extraContent?.[MATRIX_OPENCLAW_PRESENTATION_KEY]);
|
|
94
|
-
if (!presentation || presentation.version !== 1 || presentation.type !== MATRIX_OPENCLAW_PRESENTATION_TYPE) return;
|
|
95
|
-
return presentation;
|
|
96
|
-
}
|
|
97
|
-
function renderMatrixPresentationPayload(params) {
|
|
98
|
-
const matrixData = resolveMatrixChannelData(params.payload);
|
|
99
|
-
const fallbackText = renderMessagePresentationFallbackText({
|
|
100
|
-
text: params.payload.text,
|
|
101
|
-
presentation: params.presentation,
|
|
102
|
-
emptyFallback: MATRIX_EMPTY_PRESENTATION_FALLBACK_TEXT
|
|
103
|
-
});
|
|
104
|
-
return {
|
|
105
|
-
...params.payload,
|
|
106
|
-
text: fallbackText,
|
|
107
|
-
channelData: {
|
|
108
|
-
...params.payload.channelData,
|
|
109
|
-
matrix: {
|
|
110
|
-
...matrixData,
|
|
111
|
-
extraContent: { [MATRIX_OPENCLAW_PRESENTATION_KEY]: buildMatrixPresentationContent(params.presentation) }
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
function resolveMatrixPayloadText(payload) {
|
|
117
|
-
const text = payload.text ?? "";
|
|
118
|
-
if (text.trim() || !resolveMatrixPresentationContent(payload)) return text;
|
|
119
|
-
return MATRIX_EMPTY_PRESENTATION_FALLBACK_TEXT;
|
|
120
|
-
}
|
|
121
|
-
function resolveMatrixExtraContent(payload) {
|
|
122
|
-
const presentation = resolveMatrixPresentationContent(payload);
|
|
123
|
-
return presentation ? { [MATRIX_OPENCLAW_PRESENTATION_KEY]: presentation } : void 0;
|
|
124
|
-
}
|
|
125
|
-
function resolveMatrixDeliveryProgress(onDeliveryResult) {
|
|
126
|
-
return onDeliveryResult ? async (result) => {
|
|
127
|
-
await onDeliveryResult(attachChannelToResult("matrix", toMatrixOutboundResult(result)));
|
|
128
|
-
} : void 0;
|
|
129
|
-
}
|
|
130
|
-
//#endregion
|
|
131
|
-
//#region extensions/matrix/src/channel.runtime.ts
|
|
132
|
-
const matrixChannelRuntime = {
|
|
133
|
-
cleanupMatrixDeliveryPlans,
|
|
134
|
-
listMatrixDirectoryGroupsLive,
|
|
135
|
-
listMatrixDirectoryPeersLive,
|
|
136
|
-
matrixOutbound: {
|
|
137
|
-
deliveryMode: "direct",
|
|
138
|
-
chunker: chunkTextForOutbound,
|
|
139
|
-
chunkerMode: "markdown",
|
|
140
|
-
textChunkLimit: 4e3,
|
|
141
|
-
presentationCapabilities: {
|
|
142
|
-
supported: true,
|
|
143
|
-
buttons: true,
|
|
144
|
-
selects: true,
|
|
145
|
-
context: true,
|
|
146
|
-
divider: true,
|
|
147
|
-
limits: { text: {
|
|
148
|
-
markdownDialect: "markdown",
|
|
149
|
-
supportsEdit: true
|
|
150
|
-
} }
|
|
151
|
-
},
|
|
152
|
-
renderPresentation: ({ payload, presentation }) => renderMatrixPresentationPayload({
|
|
153
|
-
payload,
|
|
154
|
-
presentation
|
|
155
|
-
}),
|
|
156
|
-
sendPayload: async ({ cfg, to, payload, mediaLocalRoots, mediaReadFile, mediaAccess, deps, replyToId, replyToIdSource, replyToMode, threadId, accountId, audioAsVoice, deliveryQueueId, onPlatformSendDispatch, onDeliveryResult }) => {
|
|
157
|
-
const send = resolveOutboundSendDep(deps, "matrix") ?? sendMessageMatrix;
|
|
158
|
-
const resolvedThreadId = threadId !== void 0 && threadId !== null ? String(threadId) : void 0;
|
|
159
|
-
const resolveReplyToId = createReplyToFanout({
|
|
160
|
-
...replyToId != null ? { replyToId } : {},
|
|
161
|
-
...replyToIdSource !== void 0 ? { replyToIdSource } : {},
|
|
162
|
-
...replyToMode !== void 0 ? { replyToMode } : {}
|
|
163
|
-
});
|
|
164
|
-
const urls = resolveSendableOutboundReplyParts(payload).mediaUrls;
|
|
165
|
-
const payloadText = resolveMatrixPayloadText(payload);
|
|
166
|
-
if (urls.length > 0) {
|
|
167
|
-
const sentResults = [];
|
|
168
|
-
const lastResult = await sendPayloadMediaSequence({
|
|
169
|
-
text: payloadText,
|
|
170
|
-
mediaUrls: urls,
|
|
171
|
-
send: async ({ text, mediaUrl, index, isFirst }) => await send(to, text, {
|
|
172
|
-
cfg,
|
|
173
|
-
mediaUrl,
|
|
174
|
-
mediaAccess,
|
|
175
|
-
mediaLocalRoots,
|
|
176
|
-
mediaReadFile,
|
|
177
|
-
replyToId: resolveReplyToId(),
|
|
178
|
-
threadId: resolvedThreadId,
|
|
179
|
-
accountId: accountId ?? void 0,
|
|
180
|
-
audioAsVoice: payload.audioAsVoice ?? audioAsVoice,
|
|
181
|
-
deliveryQueueId,
|
|
182
|
-
deliveryPartIndex: index,
|
|
183
|
-
deliveryPartCount: urls.length,
|
|
184
|
-
onPlatformSendDispatch,
|
|
185
|
-
extraContent: isFirst ? resolveMatrixExtraContent(payload) : void 0,
|
|
186
|
-
onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
|
|
187
|
-
}),
|
|
188
|
-
onResult: (result) => {
|
|
189
|
-
sentResults.push(result);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
if (lastResult !== void 0) {
|
|
193
|
-
const receipt = createMessageReceiptFromOutboundResults({ results: sentResults });
|
|
194
|
-
receipt.parts = receipt.parts.map((part, index) => ({
|
|
195
|
-
...part,
|
|
196
|
-
index
|
|
197
|
-
}));
|
|
198
|
-
return attachChannelToResult("matrix", toMatrixOutboundResult({
|
|
199
|
-
...lastResult,
|
|
200
|
-
primaryMessageId: receipt.primaryPlatformMessageId,
|
|
201
|
-
receipt,
|
|
202
|
-
content: sentResults.map((result) => result.content).join("\n")
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
const result = await send(to, payloadText, {
|
|
207
|
-
cfg,
|
|
208
|
-
mediaAccess,
|
|
209
|
-
mediaLocalRoots,
|
|
210
|
-
mediaReadFile,
|
|
211
|
-
replyToId: resolveReplyToId(),
|
|
212
|
-
threadId: resolvedThreadId,
|
|
213
|
-
accountId: accountId ?? void 0,
|
|
214
|
-
audioAsVoice: payload.audioAsVoice ?? audioAsVoice,
|
|
215
|
-
deliveryQueueId,
|
|
216
|
-
deliveryPartIndex: 0,
|
|
217
|
-
deliveryPartCount: 1,
|
|
218
|
-
onPlatformSendDispatch,
|
|
219
|
-
extraContent: resolveMatrixExtraContent(payload),
|
|
220
|
-
onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
|
|
221
|
-
});
|
|
222
|
-
return attachChannelToResult("matrix", toMatrixOutboundResult(result));
|
|
223
|
-
},
|
|
224
|
-
sendText: async ({ cfg, to, text, deps, replyToId, threadId, accountId, audioAsVoice, deliveryQueueId, deliveryPartIndex, deliveryPartCount, onPlatformSendDispatch, onDeliveryResult }) => {
|
|
225
|
-
const result = await (resolveOutboundSendDep(deps, "matrix") ?? sendMessageMatrix)(to, text, {
|
|
226
|
-
cfg,
|
|
227
|
-
replyToId: replyToId ?? void 0,
|
|
228
|
-
threadId: threadId !== void 0 && threadId !== null ? String(threadId) : void 0,
|
|
229
|
-
accountId: accountId ?? void 0,
|
|
230
|
-
audioAsVoice,
|
|
231
|
-
deliveryQueueId,
|
|
232
|
-
deliveryPartIndex,
|
|
233
|
-
...deliveryQueueId !== void 0 ? { deliveryPartCount } : {},
|
|
234
|
-
onPlatformSendDispatch,
|
|
235
|
-
onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
|
|
236
|
-
});
|
|
237
|
-
return attachChannelToResult("matrix", toMatrixOutboundResult(result));
|
|
238
|
-
},
|
|
239
|
-
sendMedia: async ({ cfg, to, text, mediaUrl, mediaLocalRoots, mediaReadFile, mediaAccess, deps, replyToId, threadId, accountId, audioAsVoice, deliveryQueueId, deliveryPartIndex, deliveryPartCount, onPlatformSendDispatch, onDeliveryResult }) => {
|
|
240
|
-
const result = await (resolveOutboundSendDep(deps, "matrix") ?? sendMessageMatrix)(to, text, {
|
|
241
|
-
cfg,
|
|
242
|
-
mediaUrl,
|
|
243
|
-
mediaLocalRoots,
|
|
244
|
-
mediaReadFile,
|
|
245
|
-
mediaAccess,
|
|
246
|
-
replyToId: replyToId ?? void 0,
|
|
247
|
-
threadId: threadId !== void 0 && threadId !== null ? String(threadId) : void 0,
|
|
248
|
-
accountId: accountId ?? void 0,
|
|
249
|
-
audioAsVoice,
|
|
250
|
-
deliveryQueueId,
|
|
251
|
-
deliveryPartIndex,
|
|
252
|
-
...deliveryQueueId !== void 0 ? { deliveryPartCount } : {},
|
|
253
|
-
onPlatformSendDispatch,
|
|
254
|
-
onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
|
|
255
|
-
});
|
|
256
|
-
return attachChannelToResult("matrix", toMatrixOutboundResult(result));
|
|
257
|
-
},
|
|
258
|
-
sendPoll: async ({ cfg, to, poll, threadId, accountId }) => {
|
|
259
|
-
const result = await sendPollMatrix(to, poll, {
|
|
260
|
-
cfg,
|
|
261
|
-
threadId: threadId !== void 0 && threadId !== null ? threadId : void 0,
|
|
262
|
-
accountId: accountId ?? void 0
|
|
263
|
-
});
|
|
264
|
-
return {
|
|
265
|
-
channel: "matrix",
|
|
266
|
-
messageId: result.eventId,
|
|
267
|
-
roomId: result.roomId,
|
|
268
|
-
pollId: result.eventId
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
probeMatrix,
|
|
273
|
-
resolveMatrixAuth,
|
|
274
|
-
resolveMatrixTargets,
|
|
275
|
-
reconcileMatrixUnknownSend,
|
|
276
|
-
sendMessageMatrix,
|
|
277
|
-
sendTypingMatrix
|
|
278
|
-
};
|
|
279
|
-
//#endregion
|
|
280
|
-
export { matrixChannelRuntime };
|