@openclaw/matrix 2026.6.2-beta.1 → 2026.6.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/api.js +4 -4
- package/dist/{approval-handler.runtime-CzuSSYKB.js → approval-handler.runtime-DBUlR5vu.js} +4 -4
- package/dist/{approval-ids-DclE17FF.js → approval-ids-BWuh0wZT.js} +1 -1
- package/dist/{approval-reaction-auth-EVeOTYxE.js → approval-reaction-auth-NgDjrK6V.js} +2 -2
- package/dist/{channel-8WZPKRKE.js → channel-6UUus7Ba.js} +11 -10
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-DI-GooXD.js → channel.runtime-CPXd3XKs.js} +6 -6
- package/dist/{cli-DtamlyMf.js → cli-CM0h-B_j.js} +10 -10
- package/dist/{cli-metadata-Cf07R_gl.js → cli-metadata-CW6xSM2K.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-BT3pHI8c.js → client-CdP9vWOu.js} +2 -2
- package/dist/{client-D8mT5W6r.js → client-DRRL7Zv5.js} +2 -2
- package/dist/{client-bootstrap-B0wcXXlD.js → client-bootstrap-D5vrHEms.js} +1 -1
- package/dist/{config-schema-BKGAVlax.js → config-schema-CVJYP50t.js} +1 -1
- package/dist/contract-api.js +3 -3
- package/dist/{create-client-D4x1reLU.js → create-client-B90Sb7LG.js} +2 -2
- package/dist/{crypto-runtime-C6v1fiVu.js → crypto-runtime-DWVNNqa3.js} +2 -2
- package/dist/{directory-live-D0OsjRmq.js → directory-live-5uWtLQ41.js} +3 -3
- package/dist/{draft-stream-B7lCkUfU.js → draft-stream-DZ2X1RHP.js} +1 -1
- package/dist/{http-client-KTzUzlpv.js → http-client-nipb5tk1.js} +18 -2
- package/dist/index.js +1 -1
- package/dist/{logging-6apMqI4e.js → logging-Cm8vxO3E.js} +1 -1
- package/dist/{media-text-DxT-tkdx.js → media-text-DVhXN81h.js} +2 -2
- package/dist/{messages-CnMMyKaw.js → messages-sk1eTx7H.js} +70 -9
- package/dist/{monitor-Y8rwS-7u.js → monitor-DXW0sFfU.js} +423 -91
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/preflight-audio.runtime-BZxxQsxY.js +11 -0
- package/dist/probe.runtime-BO0mNIe8.js +3 -0
- package/dist/{profile-update-CdrpnVB1.js → profile-update-rzynJvpi.js} +2 -2
- package/dist/{reaction-events-BWDww7_l.js → reaction-events-DRKzlo8q.js} +1 -1
- package/dist/{recovery-key-store--lhj0He2.js → recovery-key-store-D6RbiZMM.js} +1 -1
- package/dist/{resolve-targets-BjEKWSku.js → resolve-targets-CAwsoBQK.js} +1 -1
- package/dist/{resolver.runtime-DjAttKeb.js → resolver.runtime-phS2hwm9.js} +1 -1
- package/dist/{sdk-BmcTTd2D.js → sdk-BdCZ5WwA.js} +5 -5
- package/dist/{send-BAtT4Rtk.js → send-DEgWxp1p.js} +24 -7
- package/dist/{setup-bootstrap-D3tm10tD.js → setup-bootstrap-B4xc58Ww.js} +2 -2
- package/dist/{setup-core-CHX8Zcxh.js → setup-core-DJosJdWt.js} +1 -1
- package/dist/setup-plugin-api.js +3 -3
- package/dist/{setup-surface-DwudaOZp.js → setup-surface-CqxGV1WL.js} +4 -4
- package/dist/{shared-D5SFm-Dp.js → shared-BbT5LdPp.js} +2 -2
- package/dist/{startup-verification-MAPgdkTX.js → startup-verification-D1p_LRmg.js} +1 -1
- package/dist/{thread-bindings-xGy-RpZ_.js → thread-bindings-gLQYbsB9.js} +1 -1
- package/dist/{tool-actions.runtime-BaWmHE7Q.js → tool-actions.runtime-o06m9bgN.js} +8 -6
- package/dist/{verification-DEaJQn5O.js → verification-BiA5IWPK.js} +1 -1
- package/npm-shrinkwrap.json +3 -3
- package/package.json +4 -4
- package/dist/probe.runtime-BRG4lO-g.js +0 -3
package/dist/api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-DEMtY2cn.js";
|
|
2
2
|
import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./env-vars-KzaYveuy.js";
|
|
3
3
|
import { a as resolveMatrixCredentialsPath, c as resolveMatrixLegacyFlatStoreRoot, i as resolveMatrixCredentialsFilename, l as sanitizeMatrixPathSegment, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as resolveMatrixLegacyFlatStoragePaths, t as hashMatrixAccessToken } from "./storage-paths-BWo_ZEMC.js";
|
|
4
|
-
import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-
|
|
5
|
-
import { t as matrixPlugin } from "./channel-
|
|
4
|
+
import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-DJosJdWt.js";
|
|
5
|
+
import { t as matrixPlugin } from "./channel-6UUus7Ba.js";
|
|
6
6
|
import { d as setMatrixThreadBindingIdleTimeoutBySessionKey, n as getMatrixThreadBindingManager, p as setMatrixThreadBindingMaxAgeBySessionKey, s as resetMatrixThreadBindingsForTests } from "./thread-bindings-shared-CKnY4LSd.js";
|
|
7
|
-
import { n as matrixOnboardingAdapter } from "./setup-surface-
|
|
8
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
7
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-CqxGV1WL.js";
|
|
8
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-gLQYbsB9.js";
|
|
9
9
|
//#region extensions/matrix/api.ts
|
|
10
10
|
const matrixSessionBindingAdapterChannels = ["matrix"];
|
|
11
11
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { g as resolveMatrixAccount } from "./setup-core-
|
|
2
|
-
import { _ as shouldHandleMatrixApprovalRequest, g as isMatrixAnyApprovalClientEnabled } from "./channel-
|
|
1
|
+
import { g as resolveMatrixAccount } from "./setup-core-DJosJdWt.js";
|
|
2
|
+
import { _ as shouldHandleMatrixApprovalRequest, g as isMatrixAnyApprovalClientEnabled } from "./channel-6UUus7Ba.js";
|
|
3
3
|
import { a as resolveMatrixTargetIdentity } from "./target-ids-B-5aQxwn.js";
|
|
4
|
-
import { a as sendMessageMatrix, i as reactMatrixMessage, p as repairMatrixDirectRooms, s as sendSingleTextMessageMatrix } from "./send-
|
|
4
|
+
import { a as sendMessageMatrix, i as reactMatrixMessage, p as repairMatrixDirectRooms, s as sendSingleTextMessageMatrix } from "./send-DEgWxp1p.js";
|
|
5
5
|
import { a as unregisterMatrixApprovalReactionTarget, n as listMatrixApprovalReactionBindings, r as registerMatrixApprovalReactionTarget, t as buildMatrixApprovalReactionHint } from "./approval-reactions-BRGQgOu2.js";
|
|
6
|
-
import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-
|
|
6
|
+
import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-sk1eTx7H.js";
|
|
7
7
|
import { listMessageReceiptPlatformIds, resolveMessageReceiptPrimaryId } from "openclaw/plugin-sdk/channel-outbound";
|
|
8
8
|
import { normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as normalizeMatrixUserId } from "./config-schema-
|
|
1
|
+
import { a as normalizeMatrixUserId } from "./config-schema-CVJYP50t.js";
|
|
2
2
|
//#region extensions/matrix/src/approval-ids.ts
|
|
3
3
|
function normalizeMatrixApproverId(value) {
|
|
4
4
|
return normalizeMatrixUserId(String(value)) || void 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as resolveMatrixAccount } from "./setup-core-
|
|
2
|
-
import { t as normalizeMatrixApproverId } from "./approval-ids-
|
|
1
|
+
import { g as resolveMatrixAccount } from "./setup-core-DJosJdWt.js";
|
|
2
|
+
import { t as normalizeMatrixApproverId } from "./approval-ids-BWuh0wZT.js";
|
|
3
3
|
import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
4
4
|
//#region extensions/matrix/src/approval-reaction-auth.ts
|
|
5
5
|
function normalizeMatrixExecApproverId(value) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-DEMtY2cn.js";
|
|
2
2
|
import { c as resolveMatrixAccountConfig } from "./config-paths-ZBCMwSos.js";
|
|
3
|
-
import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, n as matrixSetupAdapter, p as listMatrixAccountIds, t as createMatrixSetupWizardProxy, u as namedAccountPromotionKeys } from "./setup-core-
|
|
4
|
-
import { a as normalizeMatrixUserId, n as DEFAULT_ACCOUNT_ID$2, r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-
|
|
5
|
-
import { t as normalizeMatrixApproverId } from "./approval-ids-
|
|
3
|
+
import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, n as matrixSetupAdapter, p as listMatrixAccountIds, t as createMatrixSetupWizardProxy, u as namedAccountPromotionKeys } from "./setup-core-DJosJdWt.js";
|
|
4
|
+
import { a as normalizeMatrixUserId, n as DEFAULT_ACCOUNT_ID$2, r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-CVJYP50t.js";
|
|
5
|
+
import { t as normalizeMatrixApproverId } from "./approval-ids-BWuh0wZT.js";
|
|
6
6
|
import { a as resolveMatrixTargetIdentity, i as resolveMatrixDirectUserId, n as normalizeMatrixMessagingTarget, r as normalizeMatrixResolvableTarget } from "./target-ids-B-5aQxwn.js";
|
|
7
7
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
8
8
|
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-D9oKDvsJ.js";
|
|
@@ -129,7 +129,7 @@ const matrixMessageActions = {
|
|
|
129
129
|
return extractToolSend(args, "sendMessage");
|
|
130
130
|
},
|
|
131
131
|
handleAction: async (ctx) => {
|
|
132
|
-
const { handleMatrixAction } = await import("./tool-actions.runtime-
|
|
132
|
+
const { handleMatrixAction } = await import("./tool-actions.runtime-o06m9bgN.js");
|
|
133
133
|
const { action, params, cfg, accountId, mediaLocalRoots } = ctx;
|
|
134
134
|
const dispatch = async (actionParams) => await handleMatrixAction({
|
|
135
135
|
...actionParams,
|
|
@@ -189,7 +189,8 @@ const matrixMessageActions = {
|
|
|
189
189
|
roomId: resolveRoomId(),
|
|
190
190
|
limit,
|
|
191
191
|
before: readStringParam(params, "before"),
|
|
192
|
-
after: readStringParam(params, "after")
|
|
192
|
+
after: readStringParam(params, "after"),
|
|
193
|
+
threadId: readStringParam(params, "threadId")
|
|
193
194
|
});
|
|
194
195
|
}
|
|
195
196
|
if (action === "edit") {
|
|
@@ -593,7 +594,7 @@ const matrixNativeApprovalCapability = createApproverRestrictedNativeApprovalCap
|
|
|
593
594
|
accountId,
|
|
594
595
|
request
|
|
595
596
|
}),
|
|
596
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
597
|
+
load: async () => (await import("./approval-handler.runtime-DBUlR5vu.js")).matrixApprovalNativeRuntime
|
|
597
598
|
})
|
|
598
599
|
});
|
|
599
600
|
const splitMatrixApprovalCapability = splitChannelApprovalCapability(matrixNativeApprovalCapability);
|
|
@@ -755,7 +756,7 @@ function resolveMatrixGroupToolPolicy(params) {
|
|
|
755
756
|
}
|
|
756
757
|
//#endregion
|
|
757
758
|
//#region extensions/matrix/src/resolver.ts
|
|
758
|
-
const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-
|
|
759
|
+
const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-phS2hwm9.js"), "matrixResolverRuntime");
|
|
759
760
|
const matrixResolverAdapter = { resolveTargets: async ({ cfg, accountId, inputs, kind, runtime }) => (await loadMatrixChannelRuntime$1()).resolveMatrixTargets({
|
|
760
761
|
cfg,
|
|
761
762
|
accountId,
|
|
@@ -944,8 +945,8 @@ async function runMatrixStartupMaintenance(params) {
|
|
|
944
945
|
//#endregion
|
|
945
946
|
//#region extensions/matrix/src/channel.ts
|
|
946
947
|
let matrixStartupLock = Promise.resolve();
|
|
947
|
-
const loadMatrixSetupWizard = createLazyRuntimeNamedExport(() => import("./setup-surface-
|
|
948
|
-
const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
948
|
+
const loadMatrixSetupWizard = createLazyRuntimeNamedExport(() => import("./setup-surface-CqxGV1WL.js").then((n) => n.t), "matrixSetupWizard");
|
|
949
|
+
const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-CPXd3XKs.js"), "matrixChannelRuntime");
|
|
949
950
|
let matrixDoctorModulePromise = null;
|
|
950
951
|
const loadMatrixDoctorModule = async () => {
|
|
951
952
|
matrixDoctorModulePromise ??= import("./doctor-BKjr6uua.js");
|
|
@@ -1321,7 +1322,7 @@ const matrixPlugin = createChatChannelPlugin({
|
|
|
1321
1322
|
await previousLock;
|
|
1322
1323
|
let monitorMatrixProvider;
|
|
1323
1324
|
try {
|
|
1324
|
-
monitorMatrixProvider = (await import("./monitor-
|
|
1325
|
+
monitorMatrixProvider = (await import("./monitor-DXW0sFfU.js")).monitorMatrixProvider;
|
|
1325
1326
|
} finally {
|
|
1326
1327
|
releaseLock();
|
|
1327
1328
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as matrixPlugin } from "./channel-
|
|
1
|
+
import { t as matrixPlugin } from "./channel-6UUus7Ba.js";
|
|
2
2
|
export { matrixPlugin };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as sendMessageMatrix, c as sendTypingMatrix, o as sendPollMatrix } from "./send-
|
|
1
|
+
import { a as sendMessageMatrix, c as sendTypingMatrix, o as sendPollMatrix } from "./send-DEgWxp1p.js";
|
|
2
2
|
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
3
|
-
import { g as resolveMatrixAuth } from "./shared-
|
|
4
|
-
import "./client-
|
|
5
|
-
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-
|
|
3
|
+
import { g as resolveMatrixAuth } from "./shared-BbT5LdPp.js";
|
|
4
|
+
import "./client-DRRL7Zv5.js";
|
|
5
|
+
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-5uWtLQ41.js";
|
|
6
6
|
import { f as resolveOutboundSendDep, n as chunkTextForOutbound } from "./runtime-api-CsBoesCU.js";
|
|
7
|
-
import { t as resolveMatrixTargets } from "./resolve-targets-
|
|
7
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-CAwsoBQK.js";
|
|
8
8
|
import { createReplyToFanout } from "openclaw/plugin-sdk/channel-outbound";
|
|
9
9
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
10
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -13,7 +13,7 @@ import { resolvePayloadMediaUrls } from "openclaw/plugin-sdk/reply-payload";
|
|
|
13
13
|
//#region extensions/matrix/src/matrix/probe.ts
|
|
14
14
|
let matrixProbeRuntimeDepsPromise;
|
|
15
15
|
async function loadMatrixProbeRuntimeDeps() {
|
|
16
|
-
matrixProbeRuntimeDepsPromise ??= import("./probe.runtime-
|
|
16
|
+
matrixProbeRuntimeDepsPromise ??= import("./probe.runtime-BO0mNIe8.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient }));
|
|
17
17
|
return await matrixProbeRuntimeDepsPromise;
|
|
18
18
|
}
|
|
19
19
|
async function probeMatrix(params) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { c as resolveMatrixAccountConfig } from "./config-paths-ZBCMwSos.js";
|
|
2
2
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
|
-
import { c as resolveMatrixConfigPath, g as resolveMatrixAccount, l as updateMatrixAccountConfig, n as matrixSetupAdapter } from "./setup-core-
|
|
3
|
+
import { c as resolveMatrixConfigPath, g as resolveMatrixAccount, l as updateMatrixAccountConfig, n as matrixSetupAdapter } from "./setup-core-DJosJdWt.js";
|
|
4
4
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
5
|
-
import { n as withResolvedActionClient } from "./client-
|
|
6
|
-
import { _ as resolveMatrixAuthContext } from "./shared-
|
|
7
|
-
import "./client-
|
|
5
|
+
import { n as withResolvedActionClient } from "./client-CdP9vWOu.js";
|
|
6
|
+
import { _ as resolveMatrixAuthContext } from "./shared-BbT5LdPp.js";
|
|
7
|
+
import "./client-DRRL7Zv5.js";
|
|
8
8
|
import { i as formatZonedTimestamp } from "./runtime-api-CsBoesCU.js";
|
|
9
9
|
import { isOpenClawManagedMatrixDevice, summarizeMatrixDeviceHealth } from "./device-health-D4LBxuPq.js";
|
|
10
|
-
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-
|
|
11
|
-
import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-
|
|
10
|
+
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-rzynJvpi.js";
|
|
11
|
+
import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-BiA5IWPK.js";
|
|
12
12
|
import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.js";
|
|
13
|
-
import { setMatrixSdkConsoleLogging, setMatrixSdkLogMode } from "./logging-
|
|
13
|
+
import { setMatrixSdkConsoleLogging, setMatrixSdkLogMode } from "./logging-Cm8vxO3E.js";
|
|
14
14
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
15
15
|
import { parseStrictInteger, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
16
16
|
//#region extensions/matrix/src/matrix/actions/devices.ts
|
|
@@ -38,11 +38,11 @@ let matrixCliExitScheduled = false;
|
|
|
38
38
|
let matrixActionClientModulePromise;
|
|
39
39
|
let matrixDirectManagementModulePromise;
|
|
40
40
|
function loadMatrixActionClientModule() {
|
|
41
|
-
matrixActionClientModulePromise ??= import("./client-
|
|
41
|
+
matrixActionClientModulePromise ??= import("./client-CdP9vWOu.js").then((n) => n.t);
|
|
42
42
|
return matrixActionClientModulePromise;
|
|
43
43
|
}
|
|
44
44
|
function loadMatrixDirectManagementModule() {
|
|
45
|
-
matrixDirectManagementModulePromise ??= import("./send-
|
|
45
|
+
matrixDirectManagementModulePromise ??= import("./send-DEgWxp1p.js").then((n) => n.d);
|
|
46
46
|
return matrixDirectManagementModulePromise;
|
|
47
47
|
}
|
|
48
48
|
function scheduleMatrixCliExit() {
|
|
@@ -210,7 +210,7 @@ async function addMatrixAccount(params) {
|
|
|
210
210
|
backupVersion: null
|
|
211
211
|
};
|
|
212
212
|
if (accountConfig.encryption === true) {
|
|
213
|
-
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-
|
|
213
|
+
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-B4xc58Ww.js");
|
|
214
214
|
verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
|
|
215
215
|
previousCfg: cfg,
|
|
216
216
|
cfg: updated,
|
|
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
|
2
2
|
//#region extensions/matrix/src/cli-metadata.ts
|
|
3
3
|
function registerMatrixCliMetadata(api) {
|
|
4
4
|
api.registerCli(async ({ program }) => {
|
|
5
|
-
const { registerMatrixCli } = await import("./cli-
|
|
5
|
+
const { registerMatrixCli } = await import("./cli-CM0h-B_j.js");
|
|
6
6
|
registerMatrixCli({ program });
|
|
7
7
|
}, { descriptors: [{
|
|
8
8
|
name: "matrix",
|
package/dist/cli-metadata.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as registerMatrixCliMetadata, t as cli_metadata_default } from "./cli-metadata-
|
|
1
|
+
import { n as registerMatrixCliMetadata, t as cli_metadata_default } from "./cli-metadata-CW6xSM2K.js";
|
|
2
2
|
export { cli_metadata_default as default, registerMatrixCliMetadata };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { u as resolveMatrixRoomId } from "./send-
|
|
3
|
-
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-
|
|
2
|
+
import { u as resolveMatrixRoomId } from "./send-DEgWxp1p.js";
|
|
3
|
+
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-D5vrHEms.js";
|
|
4
4
|
//#region extensions/matrix/src/matrix/actions/client.ts
|
|
5
5
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
withResolvedActionClient: () => withResolvedActionClient,
|
|
@@ -3,8 +3,8 @@ import { t as getMatrixScopedEnvVarNames } from "./env-vars-KzaYveuy.js";
|
|
|
3
3
|
import { i as resolveScopedMatrixEnvConfig, r as resolveMatrixEnvAuthReadiness, t as hasReadyMatrixEnvAuth } from "./env-auth-DIzOApj0.js";
|
|
4
4
|
import { n as validateMatrixHomeserverUrl, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
5
5
|
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
6
|
-
import { _ as resolveMatrixAuthContext, g as resolveMatrixAuth, h as backfillMatrixAuthDeviceIdAfterStartup, i as resolveSharedMatrixClient, n as releaseSharedClientInstance, o as stopSharedClientForAccount, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient, v as resolveMatrixConfigForAccount } from "./shared-
|
|
7
|
-
import { t as createMatrixClient } from "./create-client-
|
|
6
|
+
import { _ as resolveMatrixAuthContext, g as resolveMatrixAuth, h as backfillMatrixAuthDeviceIdAfterStartup, i as resolveSharedMatrixClient, n as releaseSharedClientInstance, o as stopSharedClientForAccount, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient, v as resolveMatrixConfigForAccount } from "./shared-BbT5LdPp.js";
|
|
7
|
+
import { t as createMatrixClient } from "./create-client-B90Sb7LG.js";
|
|
8
8
|
//#region extensions/matrix/src/matrix/client.ts
|
|
9
9
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
acquireSharedMatrixClient: () => acquireSharedMatrixClient,
|
|
@@ -10,7 +10,7 @@ var client_bootstrap_exports = /* @__PURE__ */ __exportAll({
|
|
|
10
10
|
});
|
|
11
11
|
let matrixSharedClientRuntimeDepsPromise;
|
|
12
12
|
async function loadMatrixSharedClientRuntimeDeps() {
|
|
13
|
-
matrixSharedClientRuntimeDepsPromise ??= Promise.all([import("./client-
|
|
13
|
+
matrixSharedClientRuntimeDepsPromise ??= Promise.all([import("./client-DRRL7Zv5.js").then((n) => n.t), import("./shared-BbT5LdPp.js").then((n) => n.a)]).then(([clientModule, sharedModule]) => ({
|
|
14
14
|
acquireSharedMatrixClient: clientModule.acquireSharedMatrixClient,
|
|
15
15
|
resolveMatrixAuthContext: clientModule.resolveMatrixAuthContext,
|
|
16
16
|
releaseSharedClientInstance: sharedModule.releaseSharedClientInstance
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as resolveMatrixAccountConfig } from "./config-paths-ZBCMwSos.js";
|
|
2
|
-
import { g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, p as listMatrixAccountIds } from "./setup-core-
|
|
2
|
+
import { g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, p as listMatrixAccountIds } from "./setup-core-DJosJdWt.js";
|
|
3
3
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
4
4
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/account-id";
|
package/dist/contract-api.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as setMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
2
|
-
import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, n as matrixSetupAdapter, u as namedAccountPromotionKeys } from "./setup-core-
|
|
2
|
+
import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, n as matrixSetupAdapter, u as namedAccountPromotionKeys } from "./setup-core-DJosJdWt.js";
|
|
3
3
|
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-D9oKDvsJ.js";
|
|
4
4
|
import { s as resetMatrixThreadBindingsForTests } from "./thread-bindings-shared-CKnY4LSd.js";
|
|
5
5
|
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-DTgQyQxc.js";
|
|
6
|
-
import { n as matrixOnboardingAdapter } from "./setup-surface-
|
|
7
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
6
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-CqxGV1WL.js";
|
|
7
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-gLQYbsB9.js";
|
|
8
8
|
export { collectRuntimeConfigAssignments, createMatrixThreadBindingManager, legacyConfigRules, matrixSetupAdapter, matrixOnboardingAdapter as matrixSetupWizard, namedAccountPromotionKeys, normalizeCompatibilityConfig, resetMatrixThreadBindingsForTests, resolveSingleAccountPromotionTarget, secretTargetRegistryEntries, setMatrixRuntime, singleAccountKeysToMove };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
3
3
|
import { n as maybeMigrateLegacyStorage, o as resolveMatrixStoragePaths, s as writeStorageMeta } from "./storage-DSVcH_zM.js";
|
|
4
|
-
import "./shared-
|
|
4
|
+
import "./shared-BbT5LdPp.js";
|
|
5
5
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import { ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
@@ -9,7 +9,7 @@ import { ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sd
|
|
|
9
9
|
var create_client_exports = /* @__PURE__ */ __exportAll({ createMatrixClient: () => createMatrixClient });
|
|
10
10
|
let matrixCreateClientRuntimeDepsPromise;
|
|
11
11
|
async function loadMatrixCreateClientRuntimeDeps() {
|
|
12
|
-
matrixCreateClientRuntimeDepsPromise ??= Promise.all([import("./sdk-
|
|
12
|
+
matrixCreateClientRuntimeDepsPromise ??= Promise.all([import("./sdk-BdCZ5WwA.js"), import("./logging-Cm8vxO3E.js")]).then(([sdkModule, loggingModule]) => ({
|
|
13
13
|
MatrixClient: sdkModule.MatrixClient,
|
|
14
14
|
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
15
15
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
2
2
|
import { t as ensureMatrixCryptoRuntime } from "./deps-BVWGd2XS.js";
|
|
3
|
-
import { f as LogService, p as noop } from "./shared-
|
|
4
|
-
import { i as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, n as isRepairableSecretStorageAccessError } from "./recovery-key-store
|
|
3
|
+
import { f as LogService, p as noop } from "./shared-BbT5LdPp.js";
|
|
4
|
+
import { i as MATRIX_IDB_SNAPSHOT_LOCK_OPTIONS, n as isRepairableSecretStorageAccessError } from "./recovery-key-store-D6RbiZMM.js";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { n as normalizeMatrixMessagingTarget, t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
|
|
3
|
-
import { g as resolveMatrixAuth } from "./shared-
|
|
4
|
-
import "./client-
|
|
5
|
-
import { t as MatrixAuthedHttpClient } from "./http-client-
|
|
3
|
+
import { g as resolveMatrixAuth } from "./shared-BbT5LdPp.js";
|
|
4
|
+
import "./client-DRRL7Zv5.js";
|
|
5
|
+
import { t as MatrixAuthedHttpClient } from "./http-client-nipb5tk1.js";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
//#region extensions/matrix/src/directory-live.ts
|
|
8
8
|
var directory_live_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as editMessageMatrix, r as prepareMatrixSingleText, s as sendSingleTextMessageMatrix, y as MsgType } from "./send-
|
|
1
|
+
import { n as editMessageMatrix, r as prepareMatrixSingleText, s as sendSingleTextMessageMatrix, y as MsgType } from "./send-DEgWxp1p.js";
|
|
2
2
|
import { createDraftStreamLoop } from "openclaw/plugin-sdk/channel-outbound";
|
|
3
3
|
//#region extensions/matrix/src/matrix/draft-stream.ts
|
|
4
4
|
const DEFAULT_THROTTLE_MS = 1e3;
|
|
@@ -7,19 +7,35 @@ import { closeDispatcher, createPinnedDispatcher, resolvePinnedHostnameWithPolic
|
|
|
7
7
|
function matrixEventToRaw(event, opts = {}) {
|
|
8
8
|
const unsigned = event.getUnsigned?.() ?? {};
|
|
9
9
|
const eventWithOriginalContent = event;
|
|
10
|
-
const
|
|
10
|
+
const normalizedContent = preserveMatrixRelation(event, (opts.contentMode === "original" ? eventWithOriginalContent.getOriginalContent?.() ?? event.getContent?.() ?? {} : event.getContent?.() ?? eventWithOriginalContent.getOriginalContent?.() ?? {}) || {});
|
|
11
11
|
const raw = {
|
|
12
12
|
event_id: event.getId() ?? "",
|
|
13
13
|
sender: event.getSender() ?? "",
|
|
14
14
|
type: event.getType() ?? "",
|
|
15
15
|
origin_server_ts: event.getTs() ?? 0,
|
|
16
|
-
content:
|
|
16
|
+
content: normalizedContent,
|
|
17
17
|
unsigned
|
|
18
18
|
};
|
|
19
19
|
const stateKey = resolveMatrixStateKey(event);
|
|
20
20
|
if (typeof stateKey === "string") raw.state_key = stateKey;
|
|
21
21
|
return raw;
|
|
22
22
|
}
|
|
23
|
+
function preserveMatrixRelation(event, content) {
|
|
24
|
+
if (Object.hasOwn(content, "m.relates_to")) return content;
|
|
25
|
+
const relation = resolveMatrixRelation(event);
|
|
26
|
+
return relation ? {
|
|
27
|
+
...content,
|
|
28
|
+
"m.relates_to": relation
|
|
29
|
+
} : content;
|
|
30
|
+
}
|
|
31
|
+
function resolveMatrixRelation(event) {
|
|
32
|
+
const originalRelation = (event.getOriginalContent?.())?.["m.relates_to"];
|
|
33
|
+
if (originalRelation) return originalRelation;
|
|
34
|
+
const wireRelation = (event.getWireContent?.())?.["m.relates_to"];
|
|
35
|
+
if (wireRelation) return wireRelation;
|
|
36
|
+
const rawContent = event.event?.content;
|
|
37
|
+
if (rawContent && typeof rawContent === "object") return rawContent["m.relates_to"];
|
|
38
|
+
}
|
|
23
39
|
function parseMxc(url) {
|
|
24
40
|
const match = /^mxc:\/\/([^/]+)\/(.+)$/.exec(url.trim());
|
|
25
41
|
if (!match) return null;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as registerMatrixCliMetadata } from "./cli-metadata-
|
|
1
|
+
import { n as registerMatrixCliMetadata } from "./cli-metadata-CW6xSM2K.js";
|
|
2
2
|
import { registerMatrixSubagentHooks } from "./subagent-hooks-api.js";
|
|
3
3
|
import { defineBundledChannelEntry } from "openclaw/plugin-sdk/channel-entry-contract";
|
|
4
4
|
//#region extensions/matrix/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as ConsoleLogger, f as LogService, m as setMatrixConsoleLogging } from "./shared-
|
|
1
|
+
import { d as ConsoleLogger, f as LogService, m as setMatrixConsoleLogging } from "./shared-BbT5LdPp.js";
|
|
2
2
|
import { logger } from "matrix-js-sdk/lib/logger.js";
|
|
3
3
|
//#region extensions/matrix/src/matrix/client/logging.ts
|
|
4
4
|
let matrixSdkLoggingConfigured = false;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as formatPollResultsAsText, D as parsePollStartContent, O as resolvePollReferenceEventId, S as formatPollAsText, T as isPollStartType, w as isPollEventType, x as buildPollResultsSummary } from "./send-
|
|
1
|
+
import { C as formatPollResultsAsText, D as parsePollStartContent, O as resolvePollReferenceEventId, S as formatPollAsText, T as isPollStartType, w as isPollEventType, x as buildPollResultsSummary } from "./send-DEgWxp1p.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
//#region extensions/matrix/src/matrix/poll-summary.ts
|
|
4
4
|
function resolveMatrixPollRootEventId(event) {
|
|
@@ -143,4 +143,4 @@ function formatMatrixMediaTooLargeText(params) {
|
|
|
143
143
|
}) ?? "";
|
|
144
144
|
}
|
|
145
145
|
//#endregion
|
|
146
|
-
export {
|
|
146
|
+
export { resolveMatrixMessageAttachment as a, fetchMatrixPollSnapshot as c, isLikelyBareFilename as i, resolveMatrixPollRootEventId as l, formatMatrixMediaUnavailableText as n, resolveMatrixMessageBody as o, formatMatrixMessageText as r, fetchMatrixPollMessageSummary as s, formatMatrixMediaTooLargeText as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as isMatrixNotFoundError } from "./errors-C47hvAF8.js";
|
|
2
|
-
import { a as sendMessageMatrix, n as editMessageMatrix, w as isPollEventType } from "./send-
|
|
2
|
+
import { T as isPollStartType, a as sendMessageMatrix, n as editMessageMatrix, w as isPollEventType } from "./send-DEgWxp1p.js";
|
|
3
3
|
import { n as MATRIX_REACTION_EVENT_TYPE } from "./reaction-common-DkrQdBSZ.js";
|
|
4
|
-
import { a as
|
|
5
|
-
import { r as withResolvedRoomAction } from "./client-
|
|
4
|
+
import { a as resolveMatrixMessageAttachment, l as resolveMatrixPollRootEventId, o as resolveMatrixMessageBody, s as fetchMatrixPollMessageSummary } from "./media-text-DVhXN81h.js";
|
|
5
|
+
import { r as withResolvedRoomAction } from "./client-CdP9vWOu.js";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { resolveIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
8
8
|
//#region extensions/matrix/src/matrix/actions/limits.ts
|
|
@@ -73,6 +73,7 @@ async function fetchEventSummary(client, roomId, eventId) {
|
|
|
73
73
|
}
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region extensions/matrix/src/matrix/actions/messages.ts
|
|
76
|
+
const MATRIX_THREAD_RELATIONS_START_CURSOR_PREFIX = "openclaw.matrix.thread-relations-start:";
|
|
76
77
|
async function sendMatrixMessage(to, content, opts = {}) {
|
|
77
78
|
if (!opts.cfg) throw new Error("Matrix message actions require a resolved runtime config.");
|
|
78
79
|
return await sendMessageMatrix(to, content, {
|
|
@@ -106,35 +107,95 @@ async function deleteMatrixMessage(roomId, messageId, opts = {}) {
|
|
|
106
107
|
async function readMatrixMessages(roomId, opts = {}) {
|
|
107
108
|
return await withResolvedRoomAction(roomId, opts, async (client, resolvedRoom) => {
|
|
108
109
|
const limit = resolveMatrixActionLimit(opts.limit, 20);
|
|
109
|
-
const
|
|
110
|
+
const rawBefore = normalizeOptionalString(opts.before);
|
|
111
|
+
const rawAfter = normalizeOptionalString(opts.after);
|
|
110
112
|
const dir = opts.after ? "f" : "b";
|
|
111
|
-
const
|
|
113
|
+
const threadId = normalizeOptionalString(opts.threadId);
|
|
114
|
+
const isThreadRelationsStartCursor = threadId ? isMatrixThreadRelationsStartCursor(rawBefore, threadId) : false;
|
|
115
|
+
const token = isThreadRelationsStartCursor ? void 0 : rawBefore ?? rawAfter;
|
|
116
|
+
const threadRootSummary = threadId !== void 0 && !token && !isThreadRelationsStartCursor && threadId ? await fetchDisplayableThreadRootSummary(client, resolvedRoom, threadId) : void 0;
|
|
117
|
+
const rootCountsTowardLimit = threadRootSummary !== void 0;
|
|
118
|
+
const rootFillsThreadPage = rootCountsTowardLimit && limit === 1;
|
|
119
|
+
const relationLimit = rootCountsTowardLimit ? Math.max(limit - 1, 1) : limit;
|
|
120
|
+
const seenPollRoots = /* @__PURE__ */ new Set();
|
|
121
|
+
const threadRootEventId = normalizeOptionalString(threadRootSummary?.eventId);
|
|
122
|
+
if (threadRootEventId) seenPollRoots.add(threadRootEventId);
|
|
123
|
+
const relationPage = threadId && relationLimit > 0 ? await client.getRelations(resolvedRoom, threadId, "m.thread", void 0, {
|
|
124
|
+
dir,
|
|
125
|
+
from: token,
|
|
126
|
+
limit: relationLimit
|
|
127
|
+
}) : null;
|
|
128
|
+
const flatPage = threadId ? null : await client.doRequest("GET", `/_matrix/client/v3/rooms/${encodeURIComponent(resolvedRoom)}/messages`, {
|
|
112
129
|
dir,
|
|
113
130
|
limit,
|
|
114
131
|
from: token
|
|
115
132
|
});
|
|
116
|
-
const hydratedChunk = await client.hydrateEvents(resolvedRoom,
|
|
117
|
-
const seenPollRoots = /* @__PURE__ */ new Set();
|
|
133
|
+
const hydratedChunk = await client.hydrateEvents(resolvedRoom, relationPage ? rootFillsThreadPage ? [] : relationPage.events : flatPage?.chunk ?? []);
|
|
118
134
|
const messages = [];
|
|
135
|
+
if (threadRootSummary) messages.push(threadRootSummary);
|
|
119
136
|
for (const event of hydratedChunk) {
|
|
120
137
|
if (event.unsigned?.redacted_because) continue;
|
|
138
|
+
if (!threadId && isMatrixThreadEvent(event)) continue;
|
|
121
139
|
if (event.type === EventType.RoomMessage) {
|
|
140
|
+
if (threadId && event.event_id === threadId) continue;
|
|
122
141
|
messages.push(summarizeMatrixRawEvent(event));
|
|
123
142
|
continue;
|
|
124
143
|
}
|
|
125
144
|
if (!isPollEventType(event.type)) continue;
|
|
126
145
|
const pollRootId = resolveMatrixPollRootEventId(event);
|
|
127
146
|
if (!pollRootId || seenPollRoots.has(pollRootId)) continue;
|
|
147
|
+
if (!threadId && await isMatrixPollRootThreaded({
|
|
148
|
+
client,
|
|
149
|
+
event,
|
|
150
|
+
pollRootId,
|
|
151
|
+
resolvedRoom
|
|
152
|
+
})) continue;
|
|
128
153
|
seenPollRoots.add(pollRootId);
|
|
129
154
|
const pollSummary = await fetchMatrixPollMessageSummary(client, resolvedRoom, event);
|
|
130
155
|
if (pollSummary) messages.push(pollSummary);
|
|
131
156
|
}
|
|
132
157
|
return {
|
|
133
158
|
messages,
|
|
134
|
-
nextBatch:
|
|
135
|
-
prevBatch:
|
|
159
|
+
nextBatch: rootFillsThreadPage && threadId && relationPage?.events.length ? encodeMatrixThreadRelationsStartCursor(threadId) : relationPage?.nextBatch ?? flatPage?.end ?? null,
|
|
160
|
+
prevBatch: relationPage?.prevBatch ?? flatPage?.start ?? null
|
|
136
161
|
};
|
|
137
162
|
});
|
|
138
163
|
}
|
|
164
|
+
function encodeMatrixThreadRelationsStartCursor(threadId) {
|
|
165
|
+
return `${MATRIX_THREAD_RELATIONS_START_CURSOR_PREFIX}${Buffer.from(JSON.stringify({
|
|
166
|
+
v: 1,
|
|
167
|
+
threadId
|
|
168
|
+
}), "utf8").toString("base64url")}`;
|
|
169
|
+
}
|
|
170
|
+
function isMatrixThreadRelationsStartCursor(raw, threadId) {
|
|
171
|
+
if (!raw?.startsWith(MATRIX_THREAD_RELATIONS_START_CURSOR_PREFIX)) return false;
|
|
172
|
+
const encoded = raw.slice(39);
|
|
173
|
+
try {
|
|
174
|
+
const decoded = JSON.parse(Buffer.from(encoded, "base64url").toString("utf8"));
|
|
175
|
+
return decoded.v === 1 && decoded.threadId === threadId;
|
|
176
|
+
} catch {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async function fetchDisplayableThreadRootSummary(client, resolvedRoom, threadId) {
|
|
181
|
+
const rawRootEvent = await client.getEvent(resolvedRoom, threadId).catch(() => null);
|
|
182
|
+
if (!rawRootEvent) return;
|
|
183
|
+
const rootEvent = (await client.hydrateEvents(resolvedRoom, [rawRootEvent]))[0];
|
|
184
|
+
if (!rootEvent || rootEvent.unsigned?.redacted_because) return;
|
|
185
|
+
if (rootEvent.type === EventType.RoomMessage) return summarizeMatrixRawEvent(rootEvent);
|
|
186
|
+
if (isPollStartType(rootEvent.type)) return await fetchMatrixPollMessageSummary(client, resolvedRoom, rootEvent) ?? void 0;
|
|
187
|
+
}
|
|
188
|
+
function isMatrixThreadEvent(event) {
|
|
189
|
+
const relates = event.content?.["m.relates_to"];
|
|
190
|
+
if (!relates || typeof relates !== "object") return false;
|
|
191
|
+
return relates.rel_type === "m.thread";
|
|
192
|
+
}
|
|
193
|
+
async function isMatrixPollRootThreaded(params) {
|
|
194
|
+
if (isMatrixThreadEvent(params.event)) return true;
|
|
195
|
+
const rootEvent = await params.client.getEvent(params.resolvedRoom, params.pollRootId).catch(() => null);
|
|
196
|
+
if (!rootEvent) return false;
|
|
197
|
+
const hydratedRoot = (await params.client.hydrateEvents(params.resolvedRoom, [rootEvent]))[0];
|
|
198
|
+
return hydratedRoot ? isMatrixThreadEvent(hydratedRoot) : false;
|
|
199
|
+
}
|
|
139
200
|
//#endregion
|
|
140
201
|
export { fetchEventSummary as a, resolveMatrixActionLimit as c, sendMatrixMessage as i, editMatrixMessage as n, readPinnedEvents as o, readMatrixMessages as r, EventType as s, deleteMatrixMessage as t };
|