@openclaw/matrix 2026.9.1-beta.1 → 2026.9.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 (103) hide show
  1. package/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
  2. package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
  3. package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
  4. package/dist/api.js +5 -5
  5. package/dist/{approval-handler.runtime-G9fLHUWe.js → approval-handler.runtime-BJCD4dLf.js} +34 -11
  6. package/dist/{approval-ids-C6FD3pVY.js → approval-ids-Bst7HM_o.js} +1 -1
  7. package/dist/{approval-reaction-auth-60xHiDtQ.js → approval-reaction-auth-DhH8QOSe.js} +2 -2
  8. package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
  9. package/dist/{channel-CBEvelTE.js → channel-Bs8VLb6q.js} +63 -58
  10. package/dist/channel-plugin-api.js +1 -1
  11. package/dist/channel.runtime-CCJRhdH5.js +76 -0
  12. package/dist/{channel.setup-sWPOGyQG.js → channel.setup-DhmDXwPp.js} +32 -22
  13. package/dist/{cli-DrTD2a_q.js → cli-IvDUuiDH.js} +179 -135
  14. package/dist/{cli-metadata-DrYVwQ_r.js → cli-metadata-BGryAl2e.js} +1 -1
  15. package/dist/cli-metadata.js +1 -1
  16. package/dist/{client-hs1ePy2O.js → client-Dj4mcf-s.js} +73 -22
  17. package/dist/{client-bootstrap-BxdxjCwA.js → client-bootstrap-n1Rqc8Go.js} +1 -1
  18. package/dist/{client-BUtHbzib.js → client-oNOlldJI.js} +2 -2
  19. package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
  20. package/dist/contract-api.js +2 -2
  21. package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
  22. package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
  23. package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
  24. package/dist/{crypto-runtime-C4WDYxlP.js → crypto-runtime-m1eplj3b.js} +7 -7
  25. package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
  26. package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
  27. package/dist/{directory-live-D0KfJlby.js → directory-live-DLUgWBhA.js} +8 -6
  28. package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
  29. package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
  30. package/dist/doctor-contract-api.js +89 -109
  31. package/dist/{draft-stream-B_m79Ynb.js → draft-stream-DglwxWzJ.js} +1 -1
  32. package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
  33. package/dist/helper-api.js +1 -1
  34. package/dist/{http-client-D8o8b9u6.js → http-client-DOmFvKvB.js} +10 -7
  35. package/dist/{idb-persistence-DfgW720p.js → idb-persistence-CU7CNLlX.js} +2 -2
  36. package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
  37. package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
  38. package/dist/index.js +1 -1
  39. package/dist/{messages-Dow9EOoJ.js → messages-Czn8lNEh.js} +154 -5
  40. package/dist/{monitor-DBB47wTy.js → monitor-DouG43FJ.js} +200 -156
  41. package/dist/outbound-Co_tJyE6.js +220 -0
  42. package/dist/plugin-entry.handlers.runtime.js +1 -1
  43. package/dist/probe.runtime-B1YPxG9x.js +2 -0
  44. package/dist/{profile-update-C61NR24_.js → profile-update-CAl8nZNG.js} +5 -4
  45. package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
  46. package/dist/{reaction-events-BZUgLIZI.js → reaction-events-C_7G7bvI.js} +9 -7
  47. package/dist/{resolve-targets-DXzZwsIY.js → resolve-targets-B64O69Nd.js} +1 -1
  48. package/dist/{resolver.runtime-p5qJ3Kst.js → resolver.runtime-TRmePJDV.js} +1 -1
  49. package/dist/{room-info-BXQA7y10.js → room-info-6viLR3NH.js} +55 -1
  50. package/dist/runtime-api.js +2 -2
  51. package/dist/{sdk-CljOKEvc.js → sdk-C1yfda1L.js} +534 -26
  52. package/dist/{send-BKu9Ghi4.js → send-B5XChnvB.js} +31 -33
  53. package/dist/session-binding-contract-api.js +1 -1
  54. package/dist/{setup-bootstrap-CpE6C3qV.js → setup-bootstrap-S_loyUyM.js} +3 -3
  55. package/dist/{setup-core-CyvaCOOr.js → setup-core-XkIfQ65J.js} +8 -7
  56. package/dist/setup-plugin-api.js +1 -1
  57. package/dist/{setup-surface-DtRvRcCT.js → setup-surface-B2yZ8KGc.js} +84 -79
  58. package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
  59. package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
  60. package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
  61. package/dist/subagent-hooks-api.js +1 -1
  62. package/dist/sync-cache-state-d-A_OhbU.js +234 -0
  63. package/dist/{thread-bindings-BvyU66kE.js → thread-bindings-BkBnn4te.js} +4 -4
  64. package/dist/{tool-actions.runtime-DD6jUxFK.js → tool-actions.runtime-a5L5xGSP.js} +226 -215
  65. package/dist/{verification-BP-3-XYn.js → verification-XJtTc5DI.js} +2 -2
  66. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs +216 -183
  67. package/node_modules/markdown-it/dist/browser/markdown-it.esm.min.mjs.map +1 -1
  68. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js +7 -7
  69. package/node_modules/markdown-it/dist/browser/markdown-it.umd.min.js.map +1 -1
  70. package/node_modules/markdown-it/dist/markdown-it.cjs.js +98 -106
  71. package/node_modules/markdown-it/dist/markdown-it.cjs.js.map +1 -1
  72. package/node_modules/markdown-it/dist/markdown-it.d.mts +42 -71
  73. package/node_modules/markdown-it/dist/markdown-it.mjs +98 -106
  74. package/node_modules/markdown-it/dist/markdown-it.mjs.map +1 -1
  75. package/node_modules/markdown-it/package.json +1 -2
  76. package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
  77. package/node_modules/matrix-js-sdk/lib/client.js +6 -2
  78. package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
  79. package/node_modules/matrix-js-sdk/src/client.ts +7 -3
  80. package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
  81. package/node_modules/typebox/build/format/email.mjs +1 -1
  82. package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
  83. package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
  84. package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
  85. package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
  86. package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
  87. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  88. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  89. package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
  90. package/node_modules/typebox/build/system/memory/create.mjs +3 -4
  91. package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
  92. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  93. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  94. package/node_modules/typebox/build/system/memory/update.mjs +3 -2
  95. package/node_modules/typebox/package.json +1 -1
  96. package/openclaw.plugin.json +17 -3
  97. package/package.json +8 -7
  98. package/dist/channel.runtime-CiDl9deX.js +0 -276
  99. package/dist/env-auth-MVS-Vv41.js +0 -64
  100. package/dist/file-sync-store-DjskBX2o.js +0 -436
  101. package/dist/media-text-OR9uoC4W.js +0 -153
  102. package/dist/probe.runtime-CRM7RIrB.js +0 -2
  103. package/dist/recovery-key-store-CognuDys.js +0 -276
@@ -1,23 +1,24 @@
1
- import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig } from "./account-config-BZWN9tGS.js";
2
- import { i as resolveMatrixAccount } from "./accounts-BCzyubQt.js";
3
- import { l as resolveMatrixRoomConfig } from "./channel-CBEvelTE.js";
1
+ import { a as resolveMatrixAccountConfig, o as resolveMatrixBaseConfig } from "./account-config-CRsKoMqJ.js";
2
+ import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
3
+ import { l as resolveMatrixRoomConfig } from "./channel-Bs8VLb6q.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 { g as parsePollStart, h as isPollStartType, n as reactMatrixMessage, u as buildPollResponseContent, x as resolveMatrixRoomId } from "./send-BKu9Ghi4.js";
6
+ import { b as resolveMatrixRoomId, h as parsePollStart, l as buildPollResponseContent, m as isPollStartType, n as reactMatrixMessage } from "./send-B5XChnvB.js";
7
7
  import { i as isStrictDirectMembership, n as hasDirectMatrixMemberFlag, o as readJoinedMatrixMembers } from "./direct-room-RinHjtqX.js";
8
- import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-BUtHbzib.js";
9
- import { a as fetchEventSummary, c as resolveMatrixActionLimit, i as sendMatrixMessage, n as editMatrixMessage, o as readPinnedEvents, r as readMatrixMessages, s as EventType, t as deleteMatrixMessage } from "./messages-Dow9EOoJ.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-Czn8lNEh.js";
9
+ import { n as withResolvedActionClient, r as withResolvedRoomAction } from "./client-oNOlldJI.js";
10
10
  import { r as parseMxc } from "./event-helpers-XRfAbOIh.js";
11
- import { t as applyMatrixProfileUpdate } from "./profile-update-C61NR24_.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-BP-3-XYn.js";
13
- import { t as createMatrixRoomInfoResolver } from "./room-info-BXQA7y10.js";
11
+ import { t as applyMatrixProfileUpdate } from "./profile-update-CAl8nZNG.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-XJtTc5DI.js";
13
+ import { n as getMatrixMemberInfo, r as getMatrixRoomInfo, t as createMatrixRoomInfoResolver } from "./room-info-6viLR3NH.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";
17
17
  import { resolveAllowlistProviderRuntimeGroupPolicy, resolveDefaultGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
18
18
  //#region extensions/matrix/src/matrix/actions/polls.ts
19
19
  function normalizeOptionIndexes(indexes) {
20
- return uniqueValues(indexes.map((index) => Math.trunc(index)).filter((index) => Number.isFinite(index) && index > 0));
20
+ const normalized = indexes.map((index) => Math.trunc(index)).filter((index) => Number.isFinite(index) && index > 0);
21
+ return uniqueValues(normalized);
21
22
  }
22
23
  function normalizeOptionIds(optionIds) {
23
24
  return uniqueStrings(optionIds.map((optionId) => optionId.trim()).filter((optionId) => optionId.length > 0));
@@ -48,7 +49,8 @@ function resolveSelectedAnswerIds(params) {
48
49
  async function voteMatrixPoll(roomId, pollId, opts = {}) {
49
50
  return await withResolvedRoomAction(roomId, opts, async (client, resolvedRoom) => {
50
51
  const pollEvent = await client.getEvent(resolvedRoom, pollId);
51
- if (!isPollStartType(typeof pollEvent.type === "string" ? pollEvent.type : "")) throw new Error(`Event ${pollId} is not a Matrix poll start event.`);
52
+ const eventType = typeof pollEvent.type === "string" ? pollEvent.type : "";
53
+ if (!isPollStartType(eventType)) throw new Error(`Event ${pollId} is not a Matrix poll start event.`);
52
54
  const { answerIds, labels, maxSelections } = resolveSelectedAnswerIds({
53
55
  optionIds: [...opts.optionIds ?? [], ...opts.optionId ? [opts.optionId] : []],
54
56
  optionIndexes: [...opts.optionIndexes ?? [], ...opts.optionIndex !== void 0 ? [opts.optionIndex] : []],
@@ -113,7 +115,8 @@ async function listMatrixReactionEvents(client, roomId, messageId, limit, opts =
113
115
  }
114
116
  async function listMatrixReactions(roomId, messageId, opts = {}) {
115
117
  return await withResolvedRoomAction(roomId, opts, async (client, resolvedRoom) => {
116
- return summarizeMatrixReactionEvents(await listMatrixReactionEvents(client, resolvedRoom, messageId, resolveMatrixActionLimit(opts.limit, 100)));
118
+ const chunk = await listMatrixReactionEvents(client, resolvedRoom, messageId, resolveMatrixActionLimit(opts.limit, 100));
119
+ return summarizeMatrixReactionEvents(chunk);
117
120
  });
118
121
  }
119
122
  async function removeMatrixReactions(roomId, messageId, opts = {}) {
@@ -159,57 +162,6 @@ async function listMatrixPins(roomId, opts = {}) {
159
162
  });
160
163
  }
161
164
  //#endregion
162
- //#region extensions/matrix/src/matrix/actions/room.ts
163
- async function getMatrixMemberInfo(userId, opts) {
164
- return await withResolvedActionClient(opts, async (client) => {
165
- const roomId = await resolveMatrixRoomId(client, opts.roomId);
166
- if (!(await client.getJoinedRoomMembers(roomId)).includes(userId)) throw new Error(`User ${userId} is not a member of room ${roomId}`);
167
- const profile = await client.getUserProfile(userId);
168
- return {
169
- userId,
170
- profile: {
171
- displayName: profile?.displayname ?? null,
172
- avatarUrl: profile?.avatar_url ?? null
173
- },
174
- membership: null,
175
- powerLevel: null,
176
- displayName: profile?.displayname ?? null,
177
- roomId
178
- };
179
- });
180
- }
181
- async function getMatrixRoomInfo(roomId, opts = {}) {
182
- return await withResolvedRoomAction(roomId, opts, async (client, resolvedRoom) => {
183
- let name = null;
184
- let topic = null;
185
- let canonicalAlias = null;
186
- let memberCount = null;
187
- try {
188
- const nameState = await client.getRoomStateEvent(resolvedRoom, "m.room.name", "");
189
- name = typeof nameState?.name === "string" ? nameState.name : null;
190
- } catch {}
191
- try {
192
- const topicState = await client.getRoomStateEvent(resolvedRoom, EventType.RoomTopic, "");
193
- topic = typeof topicState?.topic === "string" ? topicState.topic : null;
194
- } catch {}
195
- try {
196
- const aliasState = await client.getRoomStateEvent(resolvedRoom, "m.room.canonical_alias", "");
197
- canonicalAlias = typeof aliasState?.alias === "string" ? aliasState.alias : null;
198
- } catch {}
199
- try {
200
- memberCount = (await client.getJoinedRoomMembers(resolvedRoom)).length;
201
- } catch {}
202
- return {
203
- roomId: resolvedRoom,
204
- name,
205
- topic,
206
- canonicalAlias,
207
- altAliases: [],
208
- memberCount
209
- };
210
- });
211
- }
212
- //#endregion
213
165
  //#region extensions/matrix/src/matrix/read-policy.ts
214
166
  function normalizeRoomId(raw) {
215
167
  return raw?.trim().replace(/^room:/i, "") ?? "";
@@ -228,8 +180,9 @@ function hasWildcardEntry(entries) {
228
180
  return (entries ?? []).some((entry) => String(entry).replace(/^matrix:/i, "").trim() === "*");
229
181
  }
230
182
  function resolveMatrixReadRoomPolicy(params) {
183
+ const configuredRooms = params.account.config.groups ?? params.account.config.rooms;
231
184
  const room = resolveMatrixRoomConfig({
232
- rooms: params.account.config.groups ?? params.account.config.rooms,
185
+ rooms: configuredRooms,
233
186
  roomId: params.roomId,
234
187
  aliases: params.aliases
235
188
  });
@@ -438,28 +391,32 @@ async function handleMatrixAction(params, cfg, opts = {}) {
438
391
  const roomId = readRoomId(params);
439
392
  if (action === "emoji-list") {
440
393
  const limit = readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." });
394
+ const emojis = await withReadTarget(roomId, async (target) => listMatrixEmojis(target.roomId, {
395
+ ...clientOpts,
396
+ client: target.client,
397
+ limit
398
+ }));
441
399
  return jsonResult({
442
400
  ok: true,
443
- emojis: await withReadTarget(roomId, async (target) => listMatrixEmojis(target.roomId, {
444
- ...clientOpts,
445
- client: target.client,
446
- limit
447
- }))
401
+ emojis
448
402
  });
449
403
  }
450
404
  const messageId = readStringParam(params, "messageId", { required: true });
451
405
  if (action === "react") {
452
406
  const { emoji, remove, isEmpty } = readReactionParams(params, { removeErrorMessage: "Emoji is required to remove a Matrix reaction." });
453
- if (remove || isEmpty) return jsonResult({
454
- ok: true,
455
- removed: (await withReadTarget(roomId, async (target) => {
407
+ if (remove || isEmpty) {
408
+ const result = await withReadTarget(roomId, async (target) => {
456
409
  return await removeMatrixReactions(target.roomId, messageId, {
457
410
  ...clientOpts,
458
411
  client: target.client,
459
412
  emoji: remove ? emoji : void 0
460
413
  });
461
- })).removed
462
- });
414
+ });
415
+ return jsonResult({
416
+ ok: true,
417
+ removed: result.removed
418
+ });
419
+ }
463
420
  await withReadTarget(roomId, async (target) => {
464
421
  await reactMatrixMessage(target.roomId, messageId, emoji, {
465
422
  ...clientOpts,
@@ -472,15 +429,16 @@ async function handleMatrixAction(params, cfg, opts = {}) {
472
429
  });
473
430
  }
474
431
  const limit = readPositiveIntegerParam(params, "limit", { message: "limit must be a positive integer." });
432
+ const reactions = await withReadTarget(roomId, async (target) => {
433
+ return await listMatrixReactions(target.roomId, messageId, {
434
+ ...clientOpts,
435
+ client: target.client,
436
+ limit: limit ?? void 0
437
+ });
438
+ });
475
439
  return jsonResult({
476
440
  ok: true,
477
- reactions: await withReadTarget(roomId, async (target) => {
478
- return await listMatrixReactions(target.roomId, messageId, {
479
- ...clientOpts,
480
- client: target.client,
481
- limit: limit ?? void 0
482
- });
483
- })
441
+ reactions
484
442
  });
485
443
  }
486
444
  if (pollActions.has(action)) {
@@ -491,16 +449,17 @@ async function handleMatrixAction(params, cfg, opts = {}) {
491
449
  const optionIndex = readPositiveIntegerParam(params, "pollOptionIndex", { message: "pollOptionIndex must be a positive integer." });
492
450
  const optionIds = [...readStringArrayParam(params, "pollOptionIds") ?? [], ...optionId ? [optionId] : []];
493
451
  const optionIndexes = [...readPositiveIntegerArrayParam(params, "pollOptionIndexes"), ...optionIndex !== void 0 ? [optionIndex] : []];
452
+ const result = await withReadTarget(roomId, async (target) => {
453
+ return await voteMatrixPoll(target.roomId, pollId, {
454
+ ...clientOpts,
455
+ client: target.client,
456
+ optionIds,
457
+ optionIndexes
458
+ });
459
+ });
494
460
  return jsonResult({
495
461
  ok: true,
496
- result: await withReadTarget(roomId, async (target) => {
497
- return await voteMatrixPoll(target.roomId, pollId, {
498
- ...clientOpts,
499
- client: target.client,
500
- optionIds,
501
- optionIndexes
502
- });
503
- })
462
+ result
504
463
  });
505
464
  }
506
465
  if (messageActions.has(action)) {
@@ -517,17 +476,18 @@ async function handleMatrixAction(params, cfg, opts = {}) {
517
476
  const replyToId = readStringParam(params, "replyToId") ?? readStringParam(params, "replyTo");
518
477
  const threadId = readStringParam(params, "threadId");
519
478
  const audioAsVoice = typeof readRawParam(params, "audioAsVoice") === "boolean" ? readRawParam(params, "audioAsVoice") : typeof readRawParam(params, "asVoice") === "boolean" ? readRawParam(params, "asVoice") : void 0;
479
+ const result = await sendMatrixMessage(to, content, {
480
+ mediaUrl: mediaUrl ?? void 0,
481
+ ...opts.mediaAccess ? { mediaAccess: opts.mediaAccess } : {},
482
+ mediaLocalRoots: opts.mediaLocalRoots,
483
+ replyToId: replyToId ?? void 0,
484
+ threadId: threadId ?? void 0,
485
+ audioAsVoice,
486
+ ...clientOpts
487
+ });
520
488
  return jsonResult({
521
489
  ok: true,
522
- result: await sendMatrixMessage(to, content, {
523
- mediaUrl: mediaUrl ?? void 0,
524
- ...opts.mediaAccess ? { mediaAccess: opts.mediaAccess } : {},
525
- mediaLocalRoots: opts.mediaLocalRoots,
526
- replyToId: replyToId ?? void 0,
527
- threadId: threadId ?? void 0,
528
- audioAsVoice,
529
- ...clientOpts
530
- })
490
+ result
531
491
  });
532
492
  }
533
493
  case "editMessage": {
@@ -537,14 +497,15 @@ async function handleMatrixAction(params, cfg, opts = {}) {
537
497
  required: true,
538
498
  trim: false
539
499
  });
500
+ const result = await withReadTarget(roomId, async (target) => {
501
+ return await editMatrixMessage(target.roomId, messageId, content, {
502
+ ...clientOpts,
503
+ client: target.client
504
+ });
505
+ });
540
506
  return jsonResult({
541
507
  ok: true,
542
- result: await withReadTarget(roomId, async (target) => {
543
- return await editMatrixMessage(target.roomId, messageId, content, {
544
- ...clientOpts,
545
- client: target.client
546
- });
547
- })
508
+ result
548
509
  });
549
510
  }
550
511
  case "deleteMessage": {
@@ -569,27 +530,27 @@ async function handleMatrixAction(params, cfg, opts = {}) {
569
530
  const before = readStringParam(params, "before");
570
531
  const after = readStringParam(params, "after");
571
532
  const threadId = readStringParam(params, "threadId");
533
+ const result = await withReadTarget(roomId, async (target) => {
534
+ const messages = await readMatrixMessages(target.roomId, {
535
+ limit: limit ?? void 0,
536
+ before: before ?? void 0,
537
+ after: after ?? void 0,
538
+ threadId: threadId ?? void 0,
539
+ ...clientOpts,
540
+ client: target.client
541
+ });
542
+ return {
543
+ ...messages,
544
+ messages: projectMatrixMessagesForDisplay(messages.messages),
545
+ roomId: target.roomId,
546
+ ...threadId ? { threadId } : {}
547
+ };
548
+ });
572
549
  return jsonResult({
573
550
  ok: true,
574
- ...await withReadTarget(roomId, async (target) => {
575
- const messages = await readMatrixMessages(target.roomId, {
576
- limit: limit ?? void 0,
577
- before: before ?? void 0,
578
- after: after ?? void 0,
579
- threadId: threadId ?? void 0,
580
- ...clientOpts,
581
- client: target.client
582
- });
583
- return {
584
- ...messages,
585
- messages: projectMatrixMessagesForDisplay(messages.messages),
586
- roomId: target.roomId,
587
- ...threadId ? { threadId } : {}
588
- };
589
- })
551
+ ...result
590
552
  });
591
553
  }
592
- default: break;
593
554
  }
594
555
  }
595
556
  if (pinActions.has(action)) {
@@ -607,14 +568,20 @@ async function handleMatrixAction(params, cfg, opts = {}) {
607
568
  ...clientOpts,
608
569
  client: target.client
609
570
  };
610
- if (request.kind === "pin") return jsonResult({
611
- ok: true,
612
- pinned: (await pinMatrixMessage(target.roomId, request.messageId, actionOpts)).pinned
613
- });
614
- if (request.kind === "unpin") return jsonResult({
615
- ok: true,
616
- pinned: (await unpinMatrixMessage(target.roomId, request.messageId, actionOpts)).pinned
617
- });
571
+ if (request.kind === "pin") {
572
+ const result = await pinMatrixMessage(target.roomId, request.messageId, actionOpts);
573
+ return jsonResult({
574
+ ok: true,
575
+ pinned: result.pinned
576
+ });
577
+ }
578
+ if (request.kind === "unpin") {
579
+ const result = await unpinMatrixMessage(target.roomId, request.messageId, actionOpts);
580
+ return jsonResult({
581
+ ok: true,
582
+ pinned: result.pinned
583
+ });
584
+ }
618
585
  const result = await listMatrixPins(target.roomId, actionOpts);
619
586
  return jsonResult({
620
587
  ok: true,
@@ -627,64 +594,76 @@ async function handleMatrixAction(params, cfg, opts = {}) {
627
594
  if (profileActions.has(action)) {
628
595
  if (!isActionEnabled("profile")) throw new Error("Matrix profile updates are disabled.");
629
596
  const avatarPath = readStringParam(params, "avatarPath") ?? readStringParam(params, "path") ?? readStringParam(params, "filePath");
597
+ const result = await applyMatrixProfileUpdate({
598
+ cfg,
599
+ account: accountId,
600
+ displayName: readStringParam(params, "displayName") ?? readStringParam(params, "name"),
601
+ avatarUrl: readStringParam(params, "avatarUrl"),
602
+ avatarPath,
603
+ mediaLocalRoots: opts.mediaLocalRoots
604
+ });
630
605
  return jsonResult({
631
606
  ok: true,
632
- ...await applyMatrixProfileUpdate({
633
- cfg,
634
- account: accountId,
635
- displayName: readStringParam(params, "displayName") ?? readStringParam(params, "name"),
636
- avatarUrl: readStringParam(params, "avatarUrl"),
637
- avatarPath,
638
- mediaLocalRoots: opts.mediaLocalRoots
639
- })
607
+ ...result
640
608
  });
641
609
  }
642
610
  if (action === "memberInfo") {
643
611
  if (!isActionEnabled("memberInfo")) throw new Error("Matrix member info is disabled.");
644
612
  const userId = readStringParam(params, "userId", { required: true });
613
+ const result = await withReadTarget(readRoomId(params), async (target) => {
614
+ return await getMatrixMemberInfo(userId, {
615
+ roomId: target.roomId,
616
+ ...clientOpts,
617
+ client: target.client
618
+ });
619
+ });
645
620
  return jsonResult({
646
621
  ok: true,
647
- member: await withReadTarget(readRoomId(params), async (target) => {
648
- return await getMatrixMemberInfo(userId, {
649
- roomId: target.roomId,
650
- ...clientOpts,
651
- client: target.client
652
- });
653
- })
622
+ member: result
654
623
  });
655
624
  }
656
625
  if (action === "channelInfo") {
657
626
  if (!isActionEnabled("channelInfo")) throw new Error("Matrix room info is disabled.");
627
+ const result = await withReadTarget(readRoomId(params), async (target) => {
628
+ return await getMatrixRoomInfo(target.roomId, {
629
+ ...clientOpts,
630
+ client: target.client
631
+ });
632
+ });
658
633
  return jsonResult({
659
634
  ok: true,
660
- room: await withReadTarget(readRoomId(params), async (target) => {
661
- return await getMatrixRoomInfo(target.roomId, {
662
- ...clientOpts,
663
- client: target.client
664
- });
665
- })
635
+ room: result
666
636
  });
667
637
  }
668
638
  if (verificationActions.has(action)) {
669
639
  if (!isActionEnabled("verification")) throw new Error("Matrix verification actions are disabled.");
670
640
  const requestId = readStringParam(params, "requestId") ?? readStringParam(params, "verificationId") ?? readStringParam(params, "id");
671
- if (action === "encryptionStatus") return jsonResult({
672
- ok: true,
673
- status: await getMatrixEncryptionStatus({
674
- includeRecoveryKey: params.includeRecoveryKey === true,
641
+ if (action === "encryptionStatus") {
642
+ const includeRecoveryKey = params.includeRecoveryKey === true;
643
+ const status = await getMatrixEncryptionStatus({
644
+ includeRecoveryKey,
675
645
  ...clientOpts
676
- })
677
- });
678
- if (action === "verificationStatus") return jsonResult({
679
- ok: true,
680
- status: await getMatrixVerificationStatus({
681
- includeRecoveryKey: params.includeRecoveryKey === true,
646
+ });
647
+ return jsonResult({
648
+ ok: true,
649
+ status
650
+ });
651
+ }
652
+ if (action === "verificationStatus") {
653
+ const includeRecoveryKey = params.includeRecoveryKey === true;
654
+ const status = await getMatrixVerificationStatus({
655
+ includeRecoveryKey,
682
656
  ...clientOpts
683
- })
684
- });
657
+ });
658
+ return jsonResult({
659
+ ok: true,
660
+ status
661
+ });
662
+ }
685
663
  if (action === "verificationBootstrap") {
664
+ const recoveryKey = readStringParam(params, "recoveryKey", { trim: false }) ?? readStringParam(params, "key", { trim: false });
686
665
  const result = await bootstrapMatrixVerification({
687
- recoveryKey: readStringParam(params, "recoveryKey", { trim: false }) ?? readStringParam(params, "key", { trim: false }) ?? void 0,
666
+ recoveryKey: recoveryKey ?? void 0,
688
667
  forceResetCrossSigning: params.forceResetCrossSigning === true,
689
668
  ...clientOpts
690
669
  });
@@ -694,7 +673,8 @@ async function handleMatrixAction(params, cfg, opts = {}) {
694
673
  });
695
674
  }
696
675
  if (action === "verificationRecoveryKey") {
697
- const result = await verifyMatrixRecoveryKey(readStringParam({ recoveryKey: readStringParam(params, "recoveryKey", { trim: false }) ?? readStringParam(params, "key", { trim: false }) }, "recoveryKey", {
676
+ const recoveryKey = readStringParam(params, "recoveryKey", { trim: false }) ?? readStringParam(params, "key", { trim: false });
677
+ const result = await verifyMatrixRecoveryKey(readStringParam({ recoveryKey }, "recoveryKey", {
698
678
  required: true,
699
679
  trim: false
700
680
  }), clientOpts);
@@ -703,13 +683,17 @@ async function handleMatrixAction(params, cfg, opts = {}) {
703
683
  result
704
684
  });
705
685
  }
706
- if (action === "verificationBackupStatus") return jsonResult({
707
- ok: true,
708
- status: await getMatrixRoomKeyBackupStatus(clientOpts)
709
- });
686
+ if (action === "verificationBackupStatus") {
687
+ const status = await getMatrixRoomKeyBackupStatus(clientOpts);
688
+ return jsonResult({
689
+ ok: true,
690
+ status
691
+ });
692
+ }
710
693
  if (action === "verificationBackupRestore") {
694
+ const recoveryKey = readStringParam(params, "recoveryKey", { trim: false }) ?? readStringParam(params, "key", { trim: false });
711
695
  const result = await restoreMatrixRoomKeyBackup({
712
- recoveryKey: readStringParam(params, "recoveryKey", { trim: false }) ?? readStringParam(params, "key", { trim: false }) ?? void 0,
696
+ recoveryKey: recoveryKey ?? void 0,
713
697
  ...clientOpts
714
698
  });
715
699
  return jsonResult({
@@ -717,79 +701,106 @@ async function handleMatrixAction(params, cfg, opts = {}) {
717
701
  result
718
702
  });
719
703
  }
720
- if (action === "verificationList") return jsonResult({
721
- ok: true,
722
- verifications: await listMatrixVerifications(clientOpts)
723
- });
704
+ if (action === "verificationList") {
705
+ const verifications = await listMatrixVerifications(clientOpts);
706
+ return jsonResult({
707
+ ok: true,
708
+ verifications
709
+ });
710
+ }
724
711
  if (action === "verificationRequest") {
725
712
  const userId = readStringParam(params, "userId");
726
713
  const deviceId = readStringParam(params, "deviceId");
727
714
  const roomId = readStringParam(params, "roomId") ?? readStringParam(params, "channelId");
715
+ const ownUser = typeof params.ownUser === "boolean" ? params.ownUser : void 0;
716
+ const verification = await requestMatrixVerification({
717
+ ownUser,
718
+ userId: userId ?? void 0,
719
+ deviceId: deviceId ?? void 0,
720
+ roomId: roomId ?? void 0,
721
+ ...clientOpts
722
+ });
728
723
  return jsonResult({
729
724
  ok: true,
730
- verification: await requestMatrixVerification({
731
- ownUser: typeof params.ownUser === "boolean" ? params.ownUser : void 0,
732
- userId: userId ?? void 0,
733
- deviceId: deviceId ?? void 0,
734
- roomId: roomId ?? void 0,
735
- ...clientOpts
736
- })
725
+ verification
726
+ });
727
+ }
728
+ if (action === "verificationAccept") {
729
+ const verification = await acceptMatrixVerification(readStringParam({ requestId }, "requestId", { required: true }), clientOpts);
730
+ return jsonResult({
731
+ ok: true,
732
+ verification
737
733
  });
738
734
  }
739
- if (action === "verificationAccept") return jsonResult({
740
- ok: true,
741
- verification: await acceptMatrixVerification(readStringParam({ requestId }, "requestId", { required: true }), clientOpts)
742
- });
743
735
  if (action === "verificationCancel") {
744
736
  const reason = readStringParam(params, "reason");
745
737
  const code = readStringParam(params, "code");
738
+ const verification = await cancelMatrixVerification(readStringParam({ requestId }, "requestId", { required: true }), {
739
+ reason: reason ?? void 0,
740
+ code: code ?? void 0,
741
+ ...clientOpts
742
+ });
746
743
  return jsonResult({
747
744
  ok: true,
748
- verification: await cancelMatrixVerification(readStringParam({ requestId }, "requestId", { required: true }), {
749
- reason: reason ?? void 0,
750
- code: code ?? void 0,
751
- ...clientOpts
752
- })
745
+ verification
753
746
  });
754
747
  }
755
748
  if (action === "verificationStart") {
756
- const method = normalizeOptionalLowercaseString(readStringParam(params, "method"));
749
+ const methodRaw = readStringParam(params, "method");
750
+ const method = normalizeOptionalLowercaseString(methodRaw);
757
751
  if (method && method !== "sas") throw new Error("Matrix verificationStart only supports method=sas; use verificationGenerateQr/verificationScanQr for QR flows.");
752
+ const verification = await startMatrixVerification(readStringParam({ requestId }, "requestId", { required: true }), {
753
+ method: "sas",
754
+ ...clientOpts
755
+ });
758
756
  return jsonResult({
759
757
  ok: true,
760
- verification: await startMatrixVerification(readStringParam({ requestId }, "requestId", { required: true }), {
761
- method: "sas",
762
- ...clientOpts
763
- })
758
+ verification
759
+ });
760
+ }
761
+ if (action === "verificationGenerateQr") {
762
+ const qr = await generateMatrixVerificationQr(readStringParam({ requestId }, "requestId", { required: true }), clientOpts);
763
+ return jsonResult({
764
+ ok: true,
765
+ ...qr
764
766
  });
765
767
  }
766
- if (action === "verificationGenerateQr") return jsonResult({
767
- ok: true,
768
- ...await generateMatrixVerificationQr(readStringParam({ requestId }, "requestId", { required: true }), clientOpts)
769
- });
770
768
  if (action === "verificationScanQr") {
771
769
  const qrDataBase64 = readStringParam(params, "qrDataBase64") ?? readStringParam(params, "qrData") ?? readStringParam(params, "qr");
770
+ const verification = await scanMatrixVerificationQr(readStringParam({ requestId }, "requestId", { required: true }), readStringParam({ qrDataBase64 }, "qrDataBase64", { required: true }), clientOpts);
772
771
  return jsonResult({
773
772
  ok: true,
774
- verification: await scanMatrixVerificationQr(readStringParam({ requestId }, "requestId", { required: true }), readStringParam({ qrDataBase64 }, "qrDataBase64", { required: true }), clientOpts)
773
+ verification
774
+ });
775
+ }
776
+ if (action === "verificationSas") {
777
+ const sas = await getMatrixVerificationSas(readStringParam({ requestId }, "requestId", { required: true }), clientOpts);
778
+ return jsonResult({
779
+ ok: true,
780
+ sas
781
+ });
782
+ }
783
+ if (action === "verificationConfirm") {
784
+ const verification = await confirmMatrixVerificationSas(readStringParam({ requestId }, "requestId", { required: true }), clientOpts);
785
+ return jsonResult({
786
+ ok: true,
787
+ verification
788
+ });
789
+ }
790
+ if (action === "verificationMismatch") {
791
+ const verification = await mismatchMatrixVerificationSas(readStringParam({ requestId }, "requestId", { required: true }), clientOpts);
792
+ return jsonResult({
793
+ ok: true,
794
+ verification
795
+ });
796
+ }
797
+ if (action === "verificationConfirmQr") {
798
+ const verification = await confirmMatrixVerificationReciprocateQr(readStringParam({ requestId }, "requestId", { required: true }), clientOpts);
799
+ return jsonResult({
800
+ ok: true,
801
+ verification
775
802
  });
776
803
  }
777
- if (action === "verificationSas") return jsonResult({
778
- ok: true,
779
- sas: await getMatrixVerificationSas(readStringParam({ requestId }, "requestId", { required: true }), clientOpts)
780
- });
781
- if (action === "verificationConfirm") return jsonResult({
782
- ok: true,
783
- verification: await confirmMatrixVerificationSas(readStringParam({ requestId }, "requestId", { required: true }), clientOpts)
784
- });
785
- if (action === "verificationMismatch") return jsonResult({
786
- ok: true,
787
- verification: await mismatchMatrixVerificationSas(readStringParam({ requestId }, "requestId", { required: true }), clientOpts)
788
- });
789
- if (action === "verificationConfirmQr") return jsonResult({
790
- ok: true,
791
- verification: await confirmMatrixVerificationReciprocateQr(readStringParam({ requestId }, "requestId", { required: true }), clientOpts)
792
- });
793
804
  }
794
805
  throw new Error(`Unsupported Matrix action: ${action}`);
795
806
  }
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-BUtHbzib.js";
3
- import { n as formatMatrixEncryptionUnavailableError } from "./encryption-guidance-DmLY8NiO.js";
2
+ import { i as withStartedActionClient, n as withResolvedActionClient } from "./client-oNOlldJI.js";
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";
6
6
  import { setTimeout } from "node:timers/promises";