@openclaw/matrix 2026.5.12 → 2026.5.14-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.
Files changed (99) hide show
  1. package/dist/api.js +4 -4
  2. package/dist/{approval-handler.runtime-LpWmoFyw.js → approval-handler.runtime-Q8ZlmQv_.js} +5 -6
  3. package/dist/{approval-ids-DoC2z7tR.js → approval-ids-D6IQvvRE.js} +1 -1
  4. package/dist/{approval-reaction-auth-DbcA1gGd.js → approval-reaction-auth-99PRu7rF.js} +2 -2
  5. package/dist/{channel-B-R2dceO.js → channel-BLKRuTHs.js} +285 -26
  6. package/dist/channel-plugin-api.js +1 -1
  7. package/dist/{channel.runtime-DdtNY_To.js → channel.runtime-9qwvlUwp.js} +8 -8
  8. package/dist/{cli-Cq80go7q.js → cli-BeWdjXLV.js} +15 -17
  9. package/dist/{cli-metadata-OtekEqAD.js → cli-metadata-B2_76YSe.js} +1 -1
  10. package/dist/cli-metadata.js +1 -1
  11. package/dist/{client-DzjShjVN.js → client-D6fFVbNM.js} +2 -2
  12. package/dist/{client-bootstrap-Am_ZEH3x.js → client-bootstrap-DBwUKgC3.js} +3 -3
  13. package/dist/{client-CyxIx4Fv.js → client-oci1tD6-.js} +4 -5
  14. package/dist/{account-config-D2W-V1eQ.js → config-paths-msaDGRh6.js} +20 -2
  15. package/dist/{config-schema-B975BYl0.js → config-schema-BPCzSyjT.js} +102 -4
  16. package/dist/contract-api.js +5 -6
  17. package/dist/{create-client-DpoW106T.js → create-client-BahCtURn.js} +4 -4
  18. package/dist/{credentials-DV6fWXhC.js → credentials-DK0lK9cZ.js} +1 -1
  19. package/dist/{credentials-write.runtime-zniTq-Gr.js → credentials-write.runtime-DhPvBU-C.js} +1 -1
  20. package/dist/{crypto-runtime-DS6R8y_n.js → crypto-runtime-B-SPS5mv.js} +5 -5
  21. package/dist/{deps-CU5W9Ixu.js → deps-LqqGWPWt.js} +10 -14
  22. package/dist/{directory-live-Bn66SRSD.js → directory-live-BCfx1C0G.js} +3 -3
  23. package/dist/{doctor-KjAvjAJu.js → doctor-KuNYX5N3.js} +3 -3
  24. package/dist/doctor-contract-api.js +1 -1
  25. package/dist/{draft-stream-D_FlbmCh.js → draft-stream-BayHVmtO.js} +1 -2
  26. package/dist/{encryption-guidance-BPi3A_m3.js → encryption-guidance-1QoIvd-g.js} +1 -1
  27. package/dist/{http-client-C7AeVJay.js → http-client-DS3UoC_p.js} +1 -1
  28. package/dist/index.js +2 -2
  29. package/dist/{legacy-crypto-inspector-pB252vPO.js → legacy-crypto-inspector-_gWJGVQ_.js} +1 -1
  30. package/dist/{legacy-crypto-restore-Biw-w2ng.js → legacy-crypto-restore-B9eF1gob.js} +1 -1
  31. package/dist/{logging-DZHSPP5N.js → logging-bJ8EEe1G.js} +1 -1
  32. package/dist/{matrix-migration.runtime-DfjNMeoX.js → matrix-migration.runtime-Cf_wX9mk.js} +3 -3
  33. package/dist/{media-text-psyGloYl.js → media-text-4h4YwCGC.js} +1 -1
  34. package/dist/{messages-DQ8xXWiP.js → messages-BKTEUSwJ.js} +5 -5
  35. package/dist/{migration-snapshot.runtime-CKHE3xF9.js → migration-snapshot.runtime-C7yiKWS7.js} +1 -1
  36. package/dist/{monitor-C8cEvvTe.js → monitor-k-b_TmCm.js} +66 -46
  37. package/dist/plugin-entry.handlers.runtime.js +2 -2
  38. package/dist/probe.runtime-zExLz3Ek.js +3 -0
  39. package/dist/{profile-update-DleMeUHj.js → profile-update-BAAflurI.js} +2 -3
  40. package/dist/{reaction-events-CiARZfjk.js → reaction-events-Dimh8FUE.js} +6 -6
  41. package/dist/{resolve-targets-BbzYe9Qi.js → resolve-targets-DPqngj4V.js} +1 -1
  42. package/dist/{resolver.runtime-BWFMWEsg.js → resolver.runtime-C0RDK0VW.js} +1 -1
  43. package/dist/{route-D6rg-iXN.js → route-R-ajT21_.js} +1 -1
  44. package/dist/{runtime-api-DTKcXOhp.js → runtime-api-C-QeChQj.js} +1 -1
  45. package/dist/runtime-api.js +1 -1
  46. package/dist/runtime-heavy-api.js +2 -2
  47. package/dist/{sdk-DXWmb94u.js → sdk-BwfNtBhM.js} +301 -13
  48. package/dist/secret-contract-api.js +1 -1
  49. package/dist/{send-Df-pDuG6.js → send-CdoJ1pZY.js} +323 -6
  50. package/dist/{setup-bootstrap-DXWxzR7A.js → setup-bootstrap-krQU60Az.js} +4 -4
  51. package/dist/setup-core-CgOV8zmh.js +675 -0
  52. package/dist/setup-plugin-api.js +3 -4
  53. package/dist/{setup-surface-DuRQrrpU.js → setup-surface-BgUaEySF.js} +7 -10
  54. package/dist/{config-BR4uLzNs.js → shared-BlXw87Kp.js} +199 -9
  55. package/dist/{logger-CnZRVrux.js → startup-abort-br7BZHJQ.js} +32 -1
  56. package/dist/{startup-verification-Demyp0bP.js → startup-verification-CTfhD7V_.js} +2 -2
  57. package/dist/{storage-tC3ujLiW.js → storage-HI1nL3im.js} +1 -1
  58. package/dist/{subagent-hooks-DQbyqq9V.js → subagent-hooks-api-BgQgDwAS.js} +22 -1
  59. package/dist/subagent-hooks-api.js +1 -22
  60. package/dist/test-api.js +2 -2
  61. package/dist/thread-binding-api.js +1 -1
  62. package/dist/{thread-bindings--P1UYe7t.js → thread-bindings-8AyQOYDT.js} +2 -2
  63. package/dist/{tool-actions.runtime-AFGhzK--.js → tool-actions.runtime-BuCnleVD.js} +9 -9
  64. package/dist/{verification-BbGdzYQl.js → verification-DvC37Z_y.js} +2 -2
  65. package/openclaw.plugin.json +96 -0
  66. package/package.json +6 -6
  67. package/dist/accounts-Bm90Rzvp.js +0 -130
  68. package/dist/allowlist-sTzpCn5d.js +0 -68
  69. package/dist/config-paths-nsVaysCu.js +0 -19
  70. package/dist/config-update-wZX-HLMn.js +0 -143
  71. package/dist/direct-management--Y8ypgLv.js +0 -251
  72. package/dist/direct-room-XkutHjES.js +0 -76
  73. package/dist/exec-approvals-Crnh543m.js +0 -196
  74. package/dist/probe.runtime-NE73hi9o.js +0 -3
  75. package/dist/profile-BlHu0wDX.js +0 -111
  76. package/dist/recovery-key-store-BTJ6jz5v.js +0 -294
  77. package/dist/session-store-metadata-DQXjgNLt.js +0 -77
  78. package/dist/setup-core-B5X7HxAP.js +0 -116
  79. package/dist/setup-dm-policy-Ca3jA4YW.js +0 -195
  80. package/dist/shared-CkbpEI5j.js +0 -195
  81. package/dist/startup-abort-56edvmbM.js +0 -32
  82. /package/dist/{active-client-uhlxdhEy.js → active-client-DUi-lumi.js} +0 -0
  83. /package/dist/{approval-reactions-o2_tuH8D.js → approval-reactions-Cwd1PMCC.js} +0 -0
  84. /package/dist/{async-lock-uQfhfQIY.js → async-lock-SsmtFXtt.js} +0 -0
  85. /package/dist/{backup-health-Cabu_WQC.js → backup-health-3BHbHxyd.js} +0 -0
  86. /package/dist/{config-secret-input.runtime-DiKFehsE.js → config-secret-input.runtime-nbLCnJq7.js} +0 -0
  87. /package/dist/{crypto-node.runtime-pihzdpY7.js → crypto-node.runtime-D9qxgRPa.js} +0 -0
  88. /package/dist/{device-health-UVYpbA_W.js → device-health-Di9MUzFj.js} +0 -0
  89. /package/dist/{doctor-contract-D4-64QuJ.js → doctor-contract-s4gUPmRN.js} +0 -0
  90. /package/dist/{errors-CTcpEDq-.js → errors-BpHgvm2o.js} +0 -0
  91. /package/dist/{exec-approval-resolver-Bza9Dhlm.js → exec-approval-resolver-C8faS0XB.js} +0 -0
  92. /package/dist/{migration-snapshot-backup-DaCHTp8C.js → migration-snapshot-backup-BWTIFXgQ.js} +0 -0
  93. /package/dist/{reaction-common-ejrL19w-.js → reaction-common-B-QgNfEs.js} +0 -0
  94. /package/dist/{runtime-C6X4h_SJ.js → runtime-lwTSy9Yt.js} +0 -0
  95. /package/dist/{secret-contract-DcrJWCQI.js → secret-contract-e4SdhUtT.js} +0 -0
  96. /package/dist/{sync-state-C_beeevA.js → sync-state-Bx0gPaGA.js} +0 -0
  97. /package/dist/{thread-binding-api-Cq_E-E1K.js → thread-binding-api-Bx55B6hm.js} +0 -0
  98. /package/dist/{timeout-abort-signal-CtaIaP1v.js → timeout-abort-signal-sT0wAxVn.js} +0 -0
  99. /package/dist/{url-validation-DiK9j7jz.js → url-validation-CBZBxN3F.js} +0 -0
@@ -1,10 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
2
2
  import { r as normalizeMatrixResolvableTarget, t as isMatrixQualifiedUserId } from "./target-ids-80nQ2gql.js";
3
- import { a as resolveMatrixAccountConfig } from "./account-config-D2W-V1eQ.js";
3
+ import { c as resolveMatrixAccountConfig } from "./config-paths-msaDGRh6.js";
4
4
  import { t as getMatrixRuntime } from "./runtime-Dog86njy.js";
5
- import { r as buildMatrixReactionContent } from "./reaction-common-ejrL19w-.js";
6
- import { c as MSC4357_LIVE_KEY, l as MsgType, n as inspectMatrixDirectRooms, o as EventType, r as persistMatrixDirectRoomMapping, u as RelationType } from "./direct-management--Y8ypgLv.js";
7
- import { a as isStrictDirectRoom } from "./direct-room-XkutHjES.js";
5
+ import { n as MATRIX_REACTION_EVENT_TYPE, r as buildMatrixReactionContent, t as MATRIX_ANNOTATION_RELATION_TYPE } from "./reaction-common-B-QgNfEs.js";
8
6
  import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
9
7
  import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-message";
10
8
  import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
@@ -13,6 +11,7 @@ import { normalizePollInput } from "openclaw/plugin-sdk/poll-runtime";
13
11
  import MarkdownIt from "markdown-it";
14
12
  import { isAutoLinkedFileRef } from "openclaw/plugin-sdk/text-autolink-runtime";
15
13
  import { parseBuffer } from "music-metadata";
14
+ import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
16
15
  //#region extensions/matrix/src/matrix/poll-types.ts
17
16
  /**
18
17
  * Matrix Poll Types (MSC3381)
@@ -230,7 +229,7 @@ function buildPollResponseContent(pollEventId, answerIds) {
230
229
  //#region extensions/matrix/src/matrix/send/client.ts
231
230
  let matrixSendClientRuntimePromise = null;
232
231
  async function loadMatrixSendClientRuntime() {
233
- matrixSendClientRuntimePromise ??= import("./client-bootstrap-Am_ZEH3x.js").then((n) => n.t);
232
+ matrixSendClientRuntimePromise ??= import("./client-bootstrap-DBwUKgC3.js").then((n) => n.t);
234
233
  return await matrixSendClientRuntimePromise;
235
234
  }
236
235
  function resolveMediaMaxBytes(accountId, cfg) {
@@ -536,6 +535,36 @@ async function renderMarkdownToMatrixHtmlWithMentions(params) {
536
535
  };
537
536
  }
538
537
  //#endregion
538
+ //#region extensions/matrix/src/matrix/send/types.ts
539
+ const MsgType = {
540
+ Text: "m.text",
541
+ Image: "m.image",
542
+ Audio: "m.audio",
543
+ Video: "m.video",
544
+ File: "m.file",
545
+ Notice: "m.notice"
546
+ };
547
+ const RelationType = {
548
+ Annotation: MATRIX_ANNOTATION_RELATION_TYPE,
549
+ Replace: "m.replace",
550
+ Thread: "m.thread"
551
+ };
552
+ const EventType = {
553
+ Direct: "m.direct",
554
+ Reaction: MATRIX_REACTION_EVENT_TYPE,
555
+ RoomMessage: "m.room.message"
556
+ };
557
+ const MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY = "com.openclaw.finalized_preview";
558
+ /**
559
+ * MSC4357 live marker key.
560
+ * When present on event content, signals that the message is still being
561
+ * streamed (e.g. an LLM generating a response). Supporting clients render
562
+ * the message with a streaming animation until an edit without this marker
563
+ * arrives, indicating the stream is complete.
564
+ * @see https://github.com/matrix-org/matrix-spec-proposals/pull/4357
565
+ */
566
+ const MSC4357_LIVE_KEY = "org.matrix.msc4357.live";
567
+ //#endregion
539
568
  //#region extensions/matrix/src/matrix/send/formatting.ts
540
569
  const getCore$2 = () => getMatrixRuntime();
541
570
  async function renderMatrixFormattedContent(params) {
@@ -760,6 +789,294 @@ async function uploadMediaMaybeEncrypted(client, roomId, buffer, params) {
760
789
  });
761
790
  }
762
791
  //#endregion
792
+ //#region extensions/matrix/src/matrix/direct-room.ts
793
+ var direct_room_exports = /* @__PURE__ */ __exportAll({
794
+ hasDirectMatrixMemberFlag: () => hasDirectMatrixMemberFlag,
795
+ inspectMatrixDirectRoomEvidence: () => inspectMatrixDirectRoomEvidence,
796
+ isStrictDirectMembership: () => isStrictDirectMembership,
797
+ isStrictDirectRoom: () => isStrictDirectRoom,
798
+ normalizeJoinedMatrixMembers: () => normalizeJoinedMatrixMembers,
799
+ readJoinedMatrixMembers: () => readJoinedMatrixMembers
800
+ });
801
+ function trimMaybeString(value) {
802
+ if (typeof value !== "string") return null;
803
+ const trimmed = value.trim();
804
+ return trimmed.length > 0 ? trimmed : null;
805
+ }
806
+ function normalizeJoinedMatrixMembers(joinedMembers) {
807
+ if (!Array.isArray(joinedMembers)) return [];
808
+ return joinedMembers.map((entry) => trimMaybeString(entry)).filter((entry) => Boolean(entry));
809
+ }
810
+ function isStrictDirectMembership(params) {
811
+ const selfUserId = trimMaybeString(params.selfUserId);
812
+ const remoteUserId = trimMaybeString(params.remoteUserId);
813
+ const joinedMembers = params.joinedMembers ?? [];
814
+ return Boolean(selfUserId && remoteUserId && joinedMembers.length === 2 && joinedMembers.includes(selfUserId) && joinedMembers.includes(remoteUserId));
815
+ }
816
+ async function readJoinedMatrixMembers(client, roomId) {
817
+ try {
818
+ return normalizeJoinedMatrixMembers(await client.getJoinedRoomMembers(roomId));
819
+ } catch {
820
+ return null;
821
+ }
822
+ }
823
+ async function hasDirectMatrixMemberFlag(client, roomId, userId) {
824
+ const normalizedUserId = trimMaybeString(userId);
825
+ if (!normalizedUserId) return null;
826
+ try {
827
+ const state = await client.getRoomStateEvent(roomId, "m.room.member", normalizedUserId);
828
+ if (state?.is_direct === true) return true;
829
+ if (state?.is_direct === false) return false;
830
+ return null;
831
+ } catch {
832
+ return null;
833
+ }
834
+ }
835
+ async function inspectMatrixDirectRoomEvidence(params) {
836
+ const selfUserId = params.selfUserId !== void 0 ? trimMaybeString(params.selfUserId) : trimMaybeString(await params.client.getUserId().catch(() => null));
837
+ const joinedMembers = await readJoinedMatrixMembers(params.client, params.roomId);
838
+ const strict = isStrictDirectMembership({
839
+ selfUserId,
840
+ remoteUserId: params.remoteUserId,
841
+ joinedMembers
842
+ });
843
+ if (!strict) return {
844
+ joinedMembers,
845
+ strict: false,
846
+ viaMemberState: false,
847
+ memberStateFlag: null
848
+ };
849
+ const memberStateFlag = await hasDirectMatrixMemberFlag(params.client, params.roomId, selfUserId);
850
+ return {
851
+ joinedMembers,
852
+ strict,
853
+ viaMemberState: memberStateFlag === true,
854
+ memberStateFlag
855
+ };
856
+ }
857
+ async function isStrictDirectRoom(params) {
858
+ return (await inspectMatrixDirectRoomEvidence({
859
+ client: params.client,
860
+ roomId: params.roomId,
861
+ remoteUserId: params.remoteUserId,
862
+ selfUserId: params.selfUserId
863
+ })).strict;
864
+ }
865
+ //#endregion
866
+ //#region extensions/matrix/src/matrix/direct-management.ts
867
+ var direct_management_exports = /* @__PURE__ */ __exportAll({
868
+ inspectMatrixDirectRooms: () => inspectMatrixDirectRooms,
869
+ persistMatrixDirectRoomMapping: () => persistMatrixDirectRoomMapping,
870
+ promoteMatrixDirectRoomCandidate: () => promoteMatrixDirectRoomCandidate,
871
+ repairMatrixDirectRooms: () => repairMatrixDirectRooms
872
+ });
873
+ const DIRECT_ACCOUNT_DATA_QUEUE_KEY = EventType.Direct;
874
+ const directAccountDataWriteQueues = /* @__PURE__ */ new WeakMap();
875
+ async function readMatrixDirectAccountData(client) {
876
+ try {
877
+ const direct = await client.getAccountData(EventType.Direct);
878
+ return direct && typeof direct === "object" && !Array.isArray(direct) ? direct : {};
879
+ } catch {
880
+ return {};
881
+ }
882
+ }
883
+ function normalizeRemoteUserId(remoteUserId) {
884
+ const normalized = normalizeOptionalString(remoteUserId) ?? "";
885
+ if (!isMatrixQualifiedUserId(normalized)) throw new Error(`Matrix user IDs must be fully qualified (got "${remoteUserId}")`);
886
+ return normalized;
887
+ }
888
+ function normalizeMappedRoomIds(direct, remoteUserId) {
889
+ const current = direct[remoteUserId];
890
+ if (!Array.isArray(current)) return [];
891
+ const seen = /* @__PURE__ */ new Set();
892
+ const normalized = [];
893
+ for (const value of current) {
894
+ const roomId = normalizeOptionalString(value) ?? "";
895
+ if (!roomId || seen.has(roomId)) continue;
896
+ seen.add(roomId);
897
+ normalized.push(roomId);
898
+ }
899
+ return normalized;
900
+ }
901
+ function normalizeRoomIdList(values) {
902
+ const seen = /* @__PURE__ */ new Set();
903
+ const normalized = [];
904
+ for (const value of values) {
905
+ const roomId = value.trim();
906
+ if (!roomId || seen.has(roomId)) continue;
907
+ seen.add(roomId);
908
+ normalized.push(roomId);
909
+ }
910
+ return normalized;
911
+ }
912
+ function hasMatrixDirectRoomMappings(params) {
913
+ const current = normalizeMappedRoomIds(params.directContent, params.remoteUserId);
914
+ const next = normalizeRoomIdList([...params.roomIds, ...current]);
915
+ return current.length === next.length && current.every((roomId, index) => roomId === next[index]);
916
+ }
917
+ function resolveDirectAccountDataWriteQueue(client) {
918
+ const existing = directAccountDataWriteQueues.get(client);
919
+ if (existing) return existing;
920
+ const created = new KeyedAsyncQueue();
921
+ directAccountDataWriteQueues.set(client, created);
922
+ return created;
923
+ }
924
+ async function writeMatrixDirectRoomMappings(params) {
925
+ return await resolveDirectAccountDataWriteQueue(params.client).enqueue(DIRECT_ACCOUNT_DATA_QUEUE_KEY, async () => {
926
+ const directContentBefore = await readMatrixDirectAccountData(params.client);
927
+ const directContentAfter = buildNextDirectContent({
928
+ directContent: directContentBefore,
929
+ remoteUserId: params.remoteUserId,
930
+ roomIds: params.roomIds
931
+ });
932
+ const changed = !hasMatrixDirectRoomMappings({
933
+ directContent: directContentBefore,
934
+ remoteUserId: params.remoteUserId,
935
+ roomIds: params.roomIds
936
+ });
937
+ if (changed) await params.client.setAccountData(EventType.Direct, directContentAfter);
938
+ return {
939
+ changed,
940
+ directContentBefore,
941
+ directContentAfter
942
+ };
943
+ });
944
+ }
945
+ async function classifyDirectRoomCandidate(params) {
946
+ const evidence = await inspectMatrixDirectRoomEvidence({
947
+ client: params.client,
948
+ roomId: params.roomId,
949
+ remoteUserId: params.remoteUserId,
950
+ selfUserId: params.selfUserId
951
+ });
952
+ return {
953
+ roomId: params.roomId,
954
+ joinedMembers: evidence.joinedMembers,
955
+ strict: evidence.strict && (params.source === "account-data" || evidence.memberStateFlag !== false),
956
+ explicit: evidence.strict && (params.source === "account-data" || evidence.memberStateFlag !== false) && (params.source === "account-data" || evidence.viaMemberState),
957
+ source: params.source
958
+ };
959
+ }
960
+ function buildNextDirectContent(params) {
961
+ const current = normalizeMappedRoomIds(params.directContent, params.remoteUserId);
962
+ const nextRooms = normalizeRoomIdList([...params.roomIds, ...current]);
963
+ return {
964
+ ...params.directContent,
965
+ [params.remoteUserId]: nextRooms
966
+ };
967
+ }
968
+ async function persistMatrixDirectRoomMapping(params) {
969
+ const remoteUserId = normalizeRemoteUserId(params.remoteUserId);
970
+ return (await writeMatrixDirectRoomMappings({
971
+ client: params.client,
972
+ remoteUserId,
973
+ roomIds: [params.roomId]
974
+ })).changed;
975
+ }
976
+ async function promoteMatrixDirectRoomCandidate(params) {
977
+ const remoteUserId = normalizeRemoteUserId(params.remoteUserId);
978
+ const evidence = await inspectMatrixDirectRoomEvidence({
979
+ client: params.client,
980
+ roomId: params.roomId,
981
+ remoteUserId,
982
+ selfUserId: params.selfUserId
983
+ });
984
+ if (!evidence.strict) return {
985
+ classifyAsDirect: false,
986
+ repaired: false,
987
+ reason: "not-strict"
988
+ };
989
+ if (evidence.memberStateFlag === false) return {
990
+ classifyAsDirect: false,
991
+ repaired: false,
992
+ reason: "local-explicit-false"
993
+ };
994
+ try {
995
+ const repaired = await persistMatrixDirectRoomMapping({
996
+ client: params.client,
997
+ remoteUserId,
998
+ roomId: params.roomId
999
+ });
1000
+ return {
1001
+ classifyAsDirect: true,
1002
+ repaired,
1003
+ roomId: params.roomId,
1004
+ reason: repaired ? "promoted" : "already-mapped"
1005
+ };
1006
+ } catch {
1007
+ return {
1008
+ classifyAsDirect: true,
1009
+ repaired: false,
1010
+ roomId: params.roomId,
1011
+ reason: "repair-failed"
1012
+ };
1013
+ }
1014
+ }
1015
+ async function inspectMatrixDirectRooms(params) {
1016
+ const remoteUserId = normalizeRemoteUserId(params.remoteUserId);
1017
+ const selfUserId = normalizeOptionalString(await params.client.getUserId().catch(() => null)) ?? null;
1018
+ const mappedRoomIds = normalizeMappedRoomIds(await readMatrixDirectAccountData(params.client), remoteUserId);
1019
+ const mappedRooms = await Promise.all(mappedRoomIds.map(async (roomId) => await classifyDirectRoomCandidate({
1020
+ client: params.client,
1021
+ roomId,
1022
+ remoteUserId,
1023
+ selfUserId,
1024
+ source: "account-data"
1025
+ })));
1026
+ const mappedStrict = mappedRooms.find((room) => room.strict);
1027
+ let joinedRooms = [];
1028
+ if (typeof params.client.getJoinedRooms === "function") try {
1029
+ const resolved = await params.client.getJoinedRooms();
1030
+ joinedRooms = Array.isArray(resolved) ? resolved : [];
1031
+ } catch {
1032
+ joinedRooms = [];
1033
+ }
1034
+ const discoveredStrictRooms = [];
1035
+ for (const roomId of normalizeRoomIdList(joinedRooms)) {
1036
+ if (mappedRoomIds.includes(roomId)) continue;
1037
+ const candidate = await classifyDirectRoomCandidate({
1038
+ client: params.client,
1039
+ roomId,
1040
+ remoteUserId,
1041
+ selfUserId,
1042
+ source: "joined"
1043
+ });
1044
+ if (candidate.strict) discoveredStrictRooms.push(candidate);
1045
+ }
1046
+ const discoveredStrictRoomIds = discoveredStrictRooms.map((room) => room.roomId);
1047
+ const discoveredExplicit = discoveredStrictRooms.find((room) => room.explicit);
1048
+ return {
1049
+ selfUserId,
1050
+ remoteUserId,
1051
+ mappedRoomIds,
1052
+ mappedRooms,
1053
+ discoveredStrictRoomIds,
1054
+ activeRoomId: mappedStrict?.roomId ?? discoveredExplicit?.roomId ?? discoveredStrictRoomIds[0] ?? null
1055
+ };
1056
+ }
1057
+ async function repairMatrixDirectRooms(params) {
1058
+ const remoteUserId = normalizeRemoteUserId(params.remoteUserId);
1059
+ const inspected = await inspectMatrixDirectRooms({
1060
+ client: params.client,
1061
+ remoteUserId
1062
+ });
1063
+ const activeRoomId = inspected.activeRoomId ?? await params.client.createDirectRoom(remoteUserId, { encrypted: params.encrypted === true });
1064
+ const createdRoomId = inspected.activeRoomId ? null : activeRoomId;
1065
+ const mappingWrite = await writeMatrixDirectRoomMappings({
1066
+ client: params.client,
1067
+ remoteUserId,
1068
+ roomIds: [activeRoomId, ...inspected.discoveredStrictRoomIds]
1069
+ });
1070
+ return {
1071
+ ...inspected,
1072
+ activeRoomId,
1073
+ createdRoomId,
1074
+ changed: mappingWrite.changed,
1075
+ directContentBefore: mappingWrite.directContentBefore,
1076
+ directContentAfter: mappingWrite.directContentAfter
1077
+ };
1078
+ }
1079
+ //#endregion
763
1080
  //#region extensions/matrix/src/matrix/send/targets.ts
764
1081
  function normalizeTarget(raw) {
765
1082
  const trimmed = raw.trim();
@@ -1197,4 +1514,4 @@ async function reactMatrixMessage(roomId, messageId, emoji, opts) {
1197
1514
  });
1198
1515
  }
1199
1516
  //#endregion
1200
- export { parsePollStart as _, sendMessageMatrix as a, sendTypingMatrix as c, buildPollResponseContent as d, buildPollResultsSummary as f, isPollStartType as g, isPollEventType as h, reactMatrixMessage as i, send_exports as l, formatPollResultsAsText as m, editMessageMatrix as n, sendPollMatrix as o, formatPollAsText as p, prepareMatrixSingleText as r, sendSingleTextMessageMatrix as s, chunkMatrixText as t, resolveMatrixRoomId as u, parsePollStartContent as v, resolvePollReferenceEventId as y };
1517
+ export { formatPollResultsAsText as C, parsePollStartContent as D, parsePollStart as E, resolvePollReferenceEventId as O, formatPollAsText as S, isPollStartType as T, readJoinedMatrixMembers as _, sendMessageMatrix as a, buildPollResponseContent as b, sendTypingMatrix as c, direct_management_exports as d, promoteMatrixDirectRoomCandidate as f, isStrictDirectMembership as g, hasDirectMatrixMemberFlag as h, reactMatrixMessage as i, send_exports as l, direct_room_exports as m, editMessageMatrix as n, sendPollMatrix as o, repairMatrixDirectRooms as p, prepareMatrixSingleText as r, sendSingleTextMessageMatrix as s, chunkMatrixText as t, resolveMatrixRoomId as u, MATRIX_OPENCLAW_FINALIZED_PREVIEW_KEY as v, isPollEventType as w, buildPollResultsSummary as x, MsgType as y };
@@ -1,7 +1,7 @@
1
- import { a as resolveMatrixAccountConfig, n as hasExplicitMatrixAccountConfig } from "./account-config-D2W-V1eQ.js";
2
- import "./accounts-Bm90Rzvp.js";
3
- import { t as formatMatrixErrorMessage } from "./errors-CTcpEDq-.js";
4
- import { n as bootstrapMatrixVerification } from "./verification-BbGdzYQl.js";
1
+ import { a as hasExplicitMatrixAccountConfig, c as resolveMatrixAccountConfig } from "./config-paths-msaDGRh6.js";
2
+ import "./setup-core-CgOV8zmh.js";
3
+ import { t as formatMatrixErrorMessage } from "./errors-BpHgvm2o.js";
4
+ import { n as bootstrapMatrixVerification } from "./verification-DvC37Z_y.js";
5
5
  //#region extensions/matrix/src/setup-bootstrap.ts
6
6
  async function maybeBootstrapNewEncryptedMatrixAccount(params) {
7
7
  const accountConfig = resolveMatrixAccountConfig({