@openclaw/matrix 2026.9.1-beta.1 → 2026.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{account-config-BZWN9tGS.js → account-config-CRsKoMqJ.js} +1 -1
- package/dist/{account-selection-CWuhuFn1.js → account-selection-DA-jfx22.js} +74 -36
- package/dist/{accounts-BCzyubQt.js → accounts-DR1c4xF_.js} +4 -5
- package/dist/api.js +5 -5
- package/dist/{approval-handler.runtime-G9fLHUWe.js → approval-handler.runtime-B_6ytY5I.js} +34 -11
- package/dist/{approval-ids-C6FD3pVY.js → approval-ids-CfHtZ9d1.js} +1 -1
- package/dist/{approval-reaction-auth-60xHiDtQ.js → approval-reaction-auth-BpDvJqfy.js} +2 -2
- package/dist/{approval-reactions-tXh9KYrW.js → approval-reactions-1fwEhoK9.js} +1 -1
- package/dist/{channel-CBEvelTE.js → channel-b-jES-oi.js} +63 -58
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel.runtime-BkqjwEDU.js +76 -0
- package/dist/{channel.setup-sWPOGyQG.js → channel.setup-BY42QaL7.js} +28 -21
- package/dist/{cli-DrTD2a_q.js → cli-CtYeU7ol.js} +42 -32
- package/dist/{cli-metadata-DrYVwQ_r.js → cli-metadata-B7MQjR5S.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-BUtHbzib.js → client-D2utPQ1E.js} +2 -2
- package/dist/{client-hs1ePy2O.js → client-Dj4mcf-s.js} +73 -22
- package/dist/{client-bootstrap-BxdxjCwA.js → client-bootstrap-n1Rqc8Go.js} +1 -1
- package/dist/{config-update-Bor_Pjsv.js → config-update-BnX26jCO.js} +48 -31
- package/dist/contract-api.js +2 -2
- package/dist/{credentials-BdAaWuiR.js → credentials-DJj2xs3q.js} +4 -8
- package/dist/{credentials-read-B37cQknZ.js → credentials-read-mexhw-Ur.js} +7 -5
- package/dist/{credentials-write.runtime-nAV2-5uR.js → credentials-write.runtime-DQt-kgJq.js} +1 -1
- package/dist/{crypto-runtime-C4WDYxlP.js → crypto-runtime-m1eplj3b.js} +7 -7
- package/dist/crypto-snapshot-doctor.runtime-D0v841D_.js +91 -0
- package/dist/{deps-CcVJfvRM.js → deps-mtxF2mHI.js} +1 -1
- package/dist/{directory-live-D0KfJlby.js → directory-live-DLUgWBhA.js} +8 -6
- package/dist/{doctor-EWf9CDso.js → doctor-CJE8wO6y.js} +1 -1
- package/dist/{doctor-contract-DEt4O4Zt.js → doctor-contract-HyWFZQVG.js} +5 -4
- package/dist/doctor-contract-api.js +89 -109
- package/dist/{draft-stream-B_m79Ynb.js → draft-stream-DPYdv4fE.js} +1 -1
- package/dist/{encryption-guidance-DmLY8NiO.js → encryption-guidance-BNcZNQZI.js} +3 -2
- package/dist/helper-api.js +1 -1
- package/dist/{http-client-D8o8b9u6.js → http-client-DOmFvKvB.js} +10 -7
- package/dist/{idb-persistence-DfgW720p.js → idb-persistence-CU7CNLlX.js} +2 -2
- package/dist/{idb-persistence-lock-DAJ49nZX.js → idb-persistence-lock-B3fZXyF_.js} +1 -1
- package/dist/{inbound-dedupe-RvSLqdsz.js → inbound-dedupe-Ch33GU06.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{messages-Dow9EOoJ.js → messages-C1U3b1oN.js} +154 -5
- package/dist/{monitor-DBB47wTy.js → monitor-SNnu-0bp.js} +177 -130
- package/dist/outbound-CeCEtF_q.js +220 -0
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-B1YPxG9x.js +2 -0
- package/dist/{profile-update-C61NR24_.js → profile-update-Cd1p8ABr.js} +5 -4
- package/dist/{profile-D-Wubo0A.js → profile-vmjsmhh4.js} +1 -1
- package/dist/{reaction-events-BZUgLIZI.js → reaction-events-DveJRUaX.js} +9 -7
- package/dist/{resolve-targets-DXzZwsIY.js → resolve-targets-B64O69Nd.js} +1 -1
- package/dist/{resolver.runtime-p5qJ3Kst.js → resolver.runtime-TRmePJDV.js} +1 -1
- package/dist/{room-info-BXQA7y10.js → room-info-DVkKDscD.js} +55 -1
- package/dist/runtime-api.js +2 -2
- package/dist/{sdk-CljOKEvc.js → sdk-C1yfda1L.js} +534 -26
- package/dist/{send-BKu9Ghi4.js → send-DG7Bnj7_.js} +26 -24
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-CpE6C3qV.js → setup-bootstrap-Co985F63.js} +3 -3
- package/dist/{setup-core-CyvaCOOr.js → setup-core-CEF6exLW.js} +8 -7
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-DtRvRcCT.js → setup-surface-BSlj1vnL.js} +84 -79
- package/dist/{startup-verification-Cs08ca8u.js → startup-verification-1Ney1mmI.js} +2 -2
- package/dist/{storage-BsGuHngK.js → storage-BVf4uucD.js} +5 -4
- package/dist/{subagent-hooks-CMoZaARG.js → subagent-hooks-DeICLbU5.js} +5 -1
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/sync-cache-state-d-A_OhbU.js +234 -0
- package/dist/{thread-bindings-BvyU66kE.js → thread-bindings-DgxQEB99.js} +4 -4
- package/dist/{tool-actions.runtime-DD6jUxFK.js → tool-actions.runtime-vbkQgU7D.js} +226 -215
- package/dist/{verification-BP-3-XYn.js → verification-D-iOebn4.js} +2 -2
- package/node_modules/matrix-js-sdk/lib/client.d.ts +2 -1
- package/node_modules/matrix-js-sdk/lib/client.js +6 -2
- package/node_modules/matrix-js-sdk/lib/sync.js +8 -8
- package/node_modules/matrix-js-sdk/src/client.ts +7 -3
- package/node_modules/matrix-js-sdk/src/sync.ts +8 -8
- package/node_modules/typebox/build/format/email.mjs +1 -1
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +19 -1
- package/node_modules/typebox/package.json +1 -1
- package/openclaw.plugin.json +16 -1
- package/package.json +7 -6
- package/dist/channel.runtime-CiDl9deX.js +0 -276
- package/dist/env-auth-MVS-Vv41.js +0 -64
- package/dist/file-sync-store-DjskBX2o.js +0 -436
- package/dist/media-text-OR9uoC4W.js +0 -153
- package/dist/probe.runtime-CRM7RIrB.js +0 -2
- package/dist/recovery-key-store-CognuDys.js +0 -276
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { o as sendTypingMatrix, r as sendMessageMatrix, v as cleanupMatrixDeliveryPlans, y as reconcileMatrixUnknownSend } from "./send-DG7Bnj7_.js";
|
|
2
|
+
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
3
|
+
import { l as resolveMatrixAuth } from "./client-Dj4mcf-s.js";
|
|
4
|
+
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-DLUgWBhA.js";
|
|
5
|
+
import { t as matrixOutbound } from "./outbound-CeCEtF_q.js";
|
|
6
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-B64O69Nd.js";
|
|
7
|
+
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
8
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
|
+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
10
|
+
import { runChannelProbe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
11
|
+
//#region extensions/matrix/src/matrix/probe.ts
|
|
12
|
+
const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-B1YPxG9x.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient })));
|
|
13
|
+
async function probeMatrix(params) {
|
|
14
|
+
return await runChannelProbe(void 0, async () => {
|
|
15
|
+
const result = {
|
|
16
|
+
ok: false,
|
|
17
|
+
status: null,
|
|
18
|
+
error: null
|
|
19
|
+
};
|
|
20
|
+
if (isBunRuntime()) return {
|
|
21
|
+
...result,
|
|
22
|
+
error: "Matrix probe requires Node (bun runtime not supported)"
|
|
23
|
+
};
|
|
24
|
+
if (!params.homeserver?.trim()) return {
|
|
25
|
+
...result,
|
|
26
|
+
error: "missing homeserver"
|
|
27
|
+
};
|
|
28
|
+
if (!params.accessToken?.trim()) return {
|
|
29
|
+
...result,
|
|
30
|
+
error: "missing access token"
|
|
31
|
+
};
|
|
32
|
+
const { createMatrixClient } = await loadMatrixProbeRuntimeDeps();
|
|
33
|
+
const inputUserId = normalizeOptionalString(params.userId);
|
|
34
|
+
const userId = await (await createMatrixClient({
|
|
35
|
+
homeserver: params.homeserver,
|
|
36
|
+
userId: void 0,
|
|
37
|
+
accessToken: params.accessToken,
|
|
38
|
+
deviceId: params.deviceId,
|
|
39
|
+
persistStorage: false,
|
|
40
|
+
localTimeoutMs: params.timeoutMs,
|
|
41
|
+
accountId: params.accountId,
|
|
42
|
+
allowPrivateNetwork: params.allowPrivateNetwork,
|
|
43
|
+
ssrfPolicy: params.ssrfPolicy,
|
|
44
|
+
dispatcherPolicy: params.dispatcherPolicy
|
|
45
|
+
})).getUserId();
|
|
46
|
+
if (inputUserId && inputUserId !== userId) return {
|
|
47
|
+
...result,
|
|
48
|
+
error: "Matrix access token user does not match configured userId"
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
...result,
|
|
52
|
+
ok: true,
|
|
53
|
+
userId
|
|
54
|
+
};
|
|
55
|
+
}, (error) => ({
|
|
56
|
+
ok: false,
|
|
57
|
+
status: typeof error === "object" && error && "statusCode" in error ? Number(error.statusCode) : null,
|
|
58
|
+
error: formatErrorMessage(error)
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region extensions/matrix/src/channel.runtime.ts
|
|
63
|
+
const matrixChannelRuntime = {
|
|
64
|
+
cleanupMatrixDeliveryPlans,
|
|
65
|
+
listMatrixDirectoryGroupsLive,
|
|
66
|
+
listMatrixDirectoryPeersLive,
|
|
67
|
+
matrixOutbound,
|
|
68
|
+
probeMatrix,
|
|
69
|
+
resolveMatrixAuth,
|
|
70
|
+
resolveMatrixTargets,
|
|
71
|
+
reconcileMatrixUnknownSend,
|
|
72
|
+
sendMessageMatrix,
|
|
73
|
+
sendTypingMatrix
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { matrixChannelRuntime };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as resolveMatrixAccountConfig } from "./account-config-
|
|
2
|
-
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-
|
|
3
|
-
import { r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-
|
|
1
|
+
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
|
+
import { i as resolveMatrixAccount, r as resolveDefaultMatrixAccountId, t as listMatrixAccountIds } from "./accounts-DR1c4xF_.js";
|
|
3
|
+
import { r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-CEF6exLW.js";
|
|
4
4
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
5
5
|
import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
|
|
6
6
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -50,22 +50,23 @@ function resolveMatrixAllowListMatch(params) {
|
|
|
50
50
|
matchSource: "wildcard"
|
|
51
51
|
};
|
|
52
52
|
const userId = normalizeMatrixUser(params.userId);
|
|
53
|
+
const candidates = [
|
|
54
|
+
{
|
|
55
|
+
value: userId,
|
|
56
|
+
source: "id"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: userId ? `matrix:${userId}` : "",
|
|
60
|
+
source: "prefixed-id"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: userId ? `user:${userId}` : "",
|
|
64
|
+
source: "prefixed-user"
|
|
65
|
+
}
|
|
66
|
+
];
|
|
53
67
|
return resolveAllowlistMatchByCandidates({
|
|
54
68
|
allowList,
|
|
55
|
-
candidates
|
|
56
|
-
{
|
|
57
|
-
value: userId,
|
|
58
|
-
source: "id"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
value: userId ? `matrix:${userId}` : "",
|
|
62
|
-
source: "prefixed-id"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
value: userId ? `user:${userId}` : "",
|
|
66
|
-
source: "prefixed-user"
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
+
candidates
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
//#endregion
|
|
@@ -98,6 +99,10 @@ const matrixConfigAdapter = createScopedChannelConfigAdapter({
|
|
|
98
99
|
//#endregion
|
|
99
100
|
//#region extensions/matrix/src/config-ui-hints.ts
|
|
100
101
|
const matrixChannelConfigUiHints = {
|
|
102
|
+
joinIntro: {
|
|
103
|
+
label: "Matrix Group Join Introduction",
|
|
104
|
+
help: "Post one brief introduction when the bot joins an allowed group room (default: true). Account settings override the channel-wide setting."
|
|
105
|
+
},
|
|
101
106
|
...createChannelConfigUiHints({
|
|
102
107
|
channelLabel: "Matrix",
|
|
103
108
|
mentionPatterns: {
|
|
@@ -221,12 +226,13 @@ function hasCanonicalMatrixAccountStreaming(account) {
|
|
|
221
226
|
const streaming = account.streaming;
|
|
222
227
|
return typeof streaming === "object" && streaming !== null && !Array.isArray(streaming);
|
|
223
228
|
}
|
|
224
|
-
const
|
|
229
|
+
const MatrixConfigSchema = z.object({
|
|
225
230
|
name: z.string().optional(),
|
|
226
231
|
enabled: z.boolean().optional(),
|
|
227
232
|
configWrites: z.boolean().optional(),
|
|
233
|
+
joinIntro: z.boolean().optional(),
|
|
228
234
|
defaultAccount: z.string().optional(),
|
|
229
|
-
accounts: z.record(z.string(), z.
|
|
235
|
+
accounts: z.record(z.string(), z.object({ joinIntro: z.boolean().optional() }).passthrough().refine(hasCanonicalMatrixAccountStreaming, { message: "flat or scalar streaming values are no longer supported; use streaming.* and run \"openclaw doctor --fix\"" })).optional(),
|
|
230
236
|
markdown: MarkdownConfigSchema,
|
|
231
237
|
homeserver: z.string().optional(),
|
|
232
238
|
network: matrixNetworkSchema,
|
|
@@ -294,7 +300,8 @@ const MatrixChannelConfigSchema = buildChannelConfigSchema(z.object({
|
|
|
294
300
|
groups: z.object({}).catchall(matrixRoomSchema).optional(),
|
|
295
301
|
rooms: z.object({}).catchall(matrixRoomSchema).optional(),
|
|
296
302
|
actions: matrixActionSchema
|
|
297
|
-
})
|
|
303
|
+
});
|
|
304
|
+
const MatrixChannelConfigSchema = buildChannelConfigSchema(MatrixConfigSchema, { uiHints: matrixChannelConfigUiHints });
|
|
298
305
|
const matrixPluginBase = {
|
|
299
306
|
id: "matrix",
|
|
300
307
|
meta: {
|
|
@@ -307,7 +314,7 @@ const matrixPluginBase = {
|
|
|
307
314
|
order: 70,
|
|
308
315
|
quickstartAllowFrom: true
|
|
309
316
|
},
|
|
310
|
-
setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-
|
|
317
|
+
setupWizard: createMatrixSetupWizardProxy(async () => ({ matrixSetupWizard: (await import("./setup-surface-BSlj1vnL.js").then((n) => n.t)).matrixSetupWizard })),
|
|
311
318
|
setupContract: matrixSetupContract,
|
|
312
319
|
capabilities: {
|
|
313
320
|
chatTypes: [
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as resolveMatrixAccountConfig } from "./account-config-
|
|
1
|
+
import { a as resolveMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
2
2
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
|
-
import { i as resolveMatrixAccount } from "./accounts-
|
|
4
|
-
import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-
|
|
5
|
-
import { n as matrixSetupAdapter } from "./setup-core-
|
|
6
|
-
import { n as withResolvedActionClient } from "./client-
|
|
7
|
-
import {
|
|
3
|
+
import { i as resolveMatrixAccount } from "./accounts-DR1c4xF_.js";
|
|
4
|
+
import { n as resolveMatrixConfigPath, r as updateMatrixAccountConfig } from "./config-update-BnX26jCO.js";
|
|
5
|
+
import { n as matrixSetupAdapter } from "./setup-core-CEF6exLW.js";
|
|
6
|
+
import { n as withResolvedActionClient } from "./client-D2utPQ1E.js";
|
|
7
|
+
import { u as resolveMatrixAuthContext } from "./client-Dj4mcf-s.js";
|
|
8
8
|
import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.js";
|
|
9
9
|
import { i as setMatrixSdkLogMode, r as setMatrixSdkConsoleLogging } from "./logging-DRjvUOIh.js";
|
|
10
10
|
import { n as isOpenClawManagedMatrixDevice, r as summarizeMatrixDeviceHealth } from "./device-health-B4-YXtJR.js";
|
|
11
|
-
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-
|
|
12
|
-
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-
|
|
11
|
+
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-Cd1p8ABr.js";
|
|
12
|
+
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-D-iOebn4.js";
|
|
13
13
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
14
14
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
15
15
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
@@ -18,7 +18,7 @@ import { formatZonedTimestamp } from "openclaw/plugin-sdk/time-runtime";
|
|
|
18
18
|
import { readByteStreamWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
19
19
|
//#region extensions/matrix/src/cli-shared.ts
|
|
20
20
|
let matrixCliExitScheduled = false;
|
|
21
|
-
const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES =
|
|
21
|
+
const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES = 1048576;
|
|
22
22
|
function scheduleMatrixCliExit() {
|
|
23
23
|
if (matrixCliExitScheduled || process.env.VITEST) return;
|
|
24
24
|
matrixCliExitScheduled = true;
|
|
@@ -292,10 +292,12 @@ function printBackupSummary(backup) {
|
|
|
292
292
|
function buildVerificationGuidance(status, accountId) {
|
|
293
293
|
const backup = resolveBackupStatus(status);
|
|
294
294
|
const nextSteps = /* @__PURE__ */ new Set();
|
|
295
|
-
if (!status.verified)
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
295
|
+
if (!status.verified) {
|
|
296
|
+
if (status.recoveryKeyAccepted === true && status.backupUsable === true) {
|
|
297
|
+
nextSteps.add(`Recovery key can unlock the room-key backup, but full Matrix identity trust is still incomplete. Run ${formatMatrixCliCommand("verify self", accountId)}, accept the request in another verified Matrix client, and confirm the SAS only if it matches.`);
|
|
298
|
+
nextSteps.add(`If you intend to replace the current cross-signing identity, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify bootstrap --recovery-key-stdin --force-reset-cross-signing", accountId)}.`);
|
|
299
|
+
} else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify device --recovery-key-stdin", accountId)}. If you do not have the recovery key but still have another verified Matrix client, run ${formatMatrixCliCommand("verify self", accountId)} instead.`);
|
|
300
|
+
}
|
|
299
301
|
if (status.serverDeviceKnown === false) nextSteps.add(`This Matrix device is no longer listed on the homeserver. Create a new OpenClaw Matrix device with ${formatMatrixCliCommand("account add --homeserver <url> --user-id <@user:server> --password <password> --device-name OpenClaw-Gateway", accountId)}. If you use token auth, create a fresh Matrix access token in your Matrix client or admin UI, then run ${formatMatrixCliCommand("account add --homeserver <url> --access-token <token>", accountId)}.`);
|
|
300
302
|
for (const step of buildBackupGuidance(backup, accountId, { recoveryKeyStored: status.recoveryKeyStored })) nextSteps.add(step);
|
|
301
303
|
if (status.pendingVerifications > 0) nextSteps.add(`Review pending verification requests with ${formatMatrixCliCommand("verify list", accountId)}. Complete each active request with ${formatMatrixCliCommand("verify sas <id>", accountId)} and ${formatMatrixCliCommand("verify confirm-sas <id>", accountId)}, or cancel stale requests with ${formatMatrixCliCommand("verify cancel <id>", accountId)}.`);
|
|
@@ -305,9 +307,10 @@ function buildBackupGuidance(backup, accountId, options = {}) {
|
|
|
305
307
|
const backupIssue = resolveMatrixRoomKeyBackupIssue(backup);
|
|
306
308
|
const nextSteps = /* @__PURE__ */ new Set();
|
|
307
309
|
if (backupIssue.code === "missing-server-backup") nextSteps.add(`Run ${formatMatrixCliCommand("verify bootstrap", accountId)} to create a room key backup.`);
|
|
308
|
-
else if (backupIssue.code === "key-load-failed" || backupIssue.code === "key-not-loaded" || backupIssue.code === "inactive")
|
|
309
|
-
|
|
310
|
-
|
|
310
|
+
else if (backupIssue.code === "key-load-failed" || backupIssue.code === "key-not-loaded" || backupIssue.code === "inactive") {
|
|
311
|
+
if (options.recoveryKeyStored) nextSteps.add(`Backup key is not loaded on this device. Run ${formatMatrixCliCommand("verify backup restore", accountId)} to load it and restore old room keys. If restore still cannot load the key, run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
|
|
312
|
+
else nextSteps.add(`Run the shown printf pipeline with the Matrix recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)} to load the server backup and store the key for future restores.`);
|
|
313
|
+
} else if (backupIssue.code === "key-mismatch") {
|
|
311
314
|
nextSteps.add(`Backup key mismatch on this device. Run the shown printf pipeline with the active server backup recovery key env var for this account: ${formatMatrixCliRecoveryKeyStdinCommand("verify backup restore --recovery-key-stdin", accountId)}.`);
|
|
312
315
|
nextSteps.add(`If you want a fresh backup baseline and accept losing unrecoverable history, run ${formatMatrixCliCommand("verify backup reset --yes", accountId)}. Add --rotate-recovery-key only when the old recovery key should stop unlocking the fresh backup.`);
|
|
313
316
|
} else if (backupIssue.code === "untrusted-signature") {
|
|
@@ -325,19 +328,21 @@ function printGuidance(lines) {
|
|
|
325
328
|
function printVerificationStatus(status, verbose = false, accountId) {
|
|
326
329
|
console.log(`Verified by owner: ${status.verified ? "yes" : "no"}`);
|
|
327
330
|
if (status.serverDeviceKnown === false) console.log("Device issue: current Matrix device is missing from the homeserver device list");
|
|
328
|
-
const
|
|
331
|
+
const backup = resolveBackupStatus(status);
|
|
332
|
+
const backupIssue = resolveMatrixRoomKeyBackupIssue(backup);
|
|
329
333
|
printVerificationBackupSummary(status);
|
|
330
334
|
if (backupIssue.message) console.log(`Backup issue: ${backupIssue.message}`);
|
|
335
|
+
console.log(`Recovery key stored: ${status.recoveryKeyStored ? "yes" : "no"}`);
|
|
336
|
+
if (status.recoveryKey) console.log("Recovery key: available (re-run with --json to include the raw key value in output)");
|
|
331
337
|
if (verbose) {
|
|
332
338
|
console.log("Diagnostics:");
|
|
333
339
|
printVerificationIdentity(status);
|
|
334
340
|
if (status.serverDeviceKnown !== void 0) console.log(`Device present on server: ${yesNoUnknown(status.serverDeviceKnown ?? null)}`);
|
|
335
341
|
printVerificationTrustDiagnostics(status);
|
|
336
342
|
printVerificationBackupStatus(status);
|
|
337
|
-
console.log(`Recovery key stored: ${status.recoveryKeyStored ? "yes" : "no"}`);
|
|
338
343
|
printTimestamp("Recovery key created at", status.recoveryKeyCreatedAt);
|
|
339
344
|
console.log(`Pending verifications: ${status.pendingVerifications}`);
|
|
340
|
-
}
|
|
345
|
+
}
|
|
341
346
|
printVerificationGuidance(status, accountId);
|
|
342
347
|
}
|
|
343
348
|
//#endregion
|
|
@@ -412,7 +417,7 @@ async function addMatrixAccount(params) {
|
|
|
412
417
|
backupVersion: null
|
|
413
418
|
};
|
|
414
419
|
if (accountConfig.encryption === true) {
|
|
415
|
-
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-
|
|
420
|
+
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-Co985F63.js");
|
|
416
421
|
verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
|
|
417
422
|
previousCfg: cfg,
|
|
418
423
|
cfg: updated,
|
|
@@ -437,7 +442,8 @@ async function addMatrixAccount(params) {
|
|
|
437
442
|
});
|
|
438
443
|
let resolvedAvatarUrl = synced.resolvedAvatarUrl;
|
|
439
444
|
if (synced.convertedAvatarFromHttp && synced.resolvedAvatarUrl) {
|
|
440
|
-
const
|
|
445
|
+
const latestCfg = runtime.config.current();
|
|
446
|
+
const withAvatar = updateMatrixAccountConfig(latestCfg, accountId, { avatarUrl: synced.resolvedAvatarUrl });
|
|
441
447
|
await runtime.config.replaceConfigFile({
|
|
442
448
|
nextConfig: withAvatar,
|
|
443
449
|
afterWrite: { mode: "auto" }
|
|
@@ -513,20 +519,24 @@ function registerMatrixAccountCommands(root) {
|
|
|
513
519
|
console.log(`Config path: ${formatMatrixCliText(result.configPath)}`);
|
|
514
520
|
console.log(`Credentials source: ${result.useEnv ? "MATRIX_* / MATRIX_<ACCOUNT_ID>_* env vars" : "inline config"}`);
|
|
515
521
|
console.log(`Encryption: ${result.encryptionEnabled ? "enabled" : "disabled"}`);
|
|
516
|
-
if (result.verificationBootstrap.attempted)
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
522
|
+
if (result.verificationBootstrap.attempted) {
|
|
523
|
+
if (result.verificationBootstrap.success) {
|
|
524
|
+
console.log("Matrix verification bootstrap: complete");
|
|
525
|
+
printTimestamp("Recovery key created at", result.verificationBootstrap.recoveryKeyCreatedAt);
|
|
526
|
+
if (result.verificationBootstrap.backupVersion) console.log(`Backup version: ${formatMatrixCliText(result.verificationBootstrap.backupVersion)}`);
|
|
527
|
+
} else console.error(`Matrix verification bootstrap warning: ${formatMatrixCliText(result.verificationBootstrap.error)}`);
|
|
528
|
+
}
|
|
521
529
|
if (result.deviceHealth.error) console.error(`Matrix device health warning: ${formatMatrixCliText(result.deviceHealth.error)}`);
|
|
522
530
|
else if (result.deviceHealth.staleOpenClawDeviceIds.length > 0) {
|
|
523
531
|
const staleDeviceIds = result.deviceHealth.staleOpenClawDeviceIds.map((deviceId) => formatMatrixCliText(deviceId)).join(", ");
|
|
524
532
|
console.log(`Matrix device hygiene warning: stale OpenClaw devices detected (${staleDeviceIds}). Run ${formatMatrixCliCommand("devices prune-stale", result.accountId)}.`);
|
|
525
533
|
}
|
|
526
|
-
if (result.profile.attempted)
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
534
|
+
if (result.profile.attempted) {
|
|
535
|
+
if (result.profile.error) console.error(`Profile sync warning: ${formatMatrixCliText(result.profile.error)}`);
|
|
536
|
+
else {
|
|
537
|
+
console.log(`Profile sync: name ${result.profile.displayNameUpdated ? "updated" : "unchanged"}, avatar ${result.profile.avatarUpdated ? "updated" : "unchanged"}`);
|
|
538
|
+
if (result.profile.convertedAvatarFromHttp && result.profile.resolvedAvatarUrl) console.log(`Avatar converted and saved as: ${formatMatrixCliText(result.profile.resolvedAvatarUrl)}`);
|
|
539
|
+
}
|
|
530
540
|
}
|
|
531
541
|
const bindHint = `openclaw agents bind --agent <id> --bind matrix:${result.accountId}`;
|
|
532
542
|
console.log(`Bind this account to an agent: ${bindHint}`);
|
|
@@ -595,8 +605,8 @@ function registerMatrixDeviceCommands(root) {
|
|
|
595
605
|
}
|
|
596
606
|
//#endregion
|
|
597
607
|
//#region extensions/matrix/src/cli-direct.ts
|
|
598
|
-
const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-
|
|
599
|
-
const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-
|
|
608
|
+
const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-D2utPQ1E.js").then((n) => n.t));
|
|
609
|
+
const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-DG7Bnj7_.js").then((n) => n.x));
|
|
600
610
|
function printDirectRoomCandidate(room) {
|
|
601
611
|
const members = room.joinedMembers === null ? "unavailable" : room.joinedMembers.map((member) => formatMatrixCliText(member)).join(", ") || "none";
|
|
602
612
|
console.log(`- ${formatMatrixCliText(room.roomId)} [${room.source}] strict=${room.strict ? "yes" : "no"} joined=${members}`);
|
|
@@ -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-CtYeU7ol.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-B7MQjR5S.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 {
|
|
3
|
-
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-
|
|
2
|
+
import { b as resolveMatrixRoomId } from "./send-DG7Bnj7_.js";
|
|
3
|
+
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-n1Rqc8Go.js";
|
|
4
4
|
//#region extensions/matrix/src/matrix/actions/client.ts
|
|
5
5
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
withResolvedActionClient: () => withResolvedActionClient,
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { a as resolveMatrixDefaultOrOnlyAccountId, n as requiresExplicitMatrixDefaultAccount, o as
|
|
2
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId, c as resolveScopedMatrixEnvConfig, l as resolveMatrixAccountStringValues, n as requiresExplicitMatrixDefaultAccount, o as resolveGlobalMatrixEnvConfig } from "./account-selection-DA-jfx22.js";
|
|
3
3
|
import { t as getMatrixScopedEnvVarNames } from "./env-vars-dGqak9dN.js";
|
|
4
|
-
import { o as resolveMatrixBaseConfig, r as listNormalizedMatrixAccountIds, t as findMatrixAccountConfig } from "./account-config-
|
|
5
|
-
import { r as resolveScopedMatrixEnvConfig, t as resolveGlobalMatrixEnvConfig } from "./env-auth-MVS-Vv41.js";
|
|
4
|
+
import { o as resolveMatrixBaseConfig, r as listNormalizedMatrixAccountIds, t as findMatrixAccountConfig } from "./account-config-CRsKoMqJ.js";
|
|
6
5
|
import { t as resolveMatrixConfigFieldPath } from "./config-paths-CnREYb1Y.js";
|
|
7
6
|
import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
8
|
-
import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage, s as repairCurrentTokenStorageMetaDeviceId } from "./storage-
|
|
7
|
+
import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage, s as repairCurrentTokenStorageMetaDeviceId } from "./storage-BVf4uucD.js";
|
|
9
8
|
import { n as LogService } from "./logger-B_71hN6W.js";
|
|
10
9
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
11
10
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
12
11
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
13
|
-
import { coerceSecretRef, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input
|
|
12
|
+
import { coerceSecretRef, isBuiltInDefaultSecretProviderRef, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
14
13
|
import { formatErrorMessage, toErrorObject, toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
15
14
|
import { resolveOptionalIntegerOption } from "openclaw/plugin-sdk/number-runtime";
|
|
16
15
|
import { isPrivateNetworkOptInEnabled, ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
@@ -19,14 +18,15 @@ import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime"
|
|
|
19
18
|
import { retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
20
19
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
21
20
|
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
21
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
22
22
|
//#region extensions/matrix/src/matrix/client/config.ts
|
|
23
|
-
const loadMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-
|
|
23
|
+
const loadMatrixAuthClientDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-C1yfda1L.js").then((n) => n.t), import("./logging-DRjvUOIh.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
|
|
24
24
|
MatrixClient: sdkModule.MatrixClient,
|
|
25
25
|
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
26
26
|
})));
|
|
27
27
|
const MATRIX_AUTH_REQUEST_RETRY_RE = /\b(fetch failed|econnreset|econnrefused|enotfound|etimedout|ehostunreach|enetunreach|eai_again|und_err_|socket hang up|network|headers timeout|body timeout|connect timeout)\b/i;
|
|
28
|
-
const loadMatrixCredentialsReadDeps = createLazyRuntimeModule(() => import("./credentials-read-
|
|
29
|
-
const loadMatrixCredentialsWriteRuntime = createLazyRuntimeModule(() => import("./credentials-write.runtime-
|
|
28
|
+
const loadMatrixCredentialsReadDeps = createLazyRuntimeModule(() => import("./credentials-read-mexhw-Ur.js").then((n) => n.r));
|
|
29
|
+
const loadMatrixCredentialsWriteRuntime = createLazyRuntimeModule(() => import("./credentials-write.runtime-DQt-kgJq.js"));
|
|
30
30
|
const loadMatrixSecretInputDeps = createLazyRuntimeModule(() => import("./config-secret-input.runtime-CwsP3--c.js"));
|
|
31
31
|
function shouldRetryMatrixAuthRequest(err) {
|
|
32
32
|
return MATRIX_AUTH_REQUEST_RETRY_RE.test(formatErrorMessage(err));
|
|
@@ -70,21 +70,21 @@ const MATRIX_CONFIG_STRING_FIELDS = [
|
|
|
70
70
|
const MATRIX_AUTH_SECRET_FIELDS = ["accessToken", "password"];
|
|
71
71
|
function readMatrixEnvSecretRef(params) {
|
|
72
72
|
const provider = params.cfg.secrets?.providers?.[params.ref.provider];
|
|
73
|
-
if (provider) {
|
|
74
|
-
if (provider.source !== "env") throw new Error(`Secret provider "${params.ref.provider}" has source "${provider.source}" but ref requests "env".`);
|
|
73
|
+
if (provider?.source === "env") {
|
|
75
74
|
if (provider.allowlist && !provider.allowlist.includes(params.ref.id)) throw new Error(`Environment variable "${params.ref.id}" is not allowlisted in secrets.providers.${params.ref.provider}.allowlist.`);
|
|
76
|
-
} else if (params.ref
|
|
75
|
+
} else if (!isBuiltInDefaultSecretProviderRef(params.cfg, params.ref)) throw new Error(provider ? `Secret provider "${params.ref.provider}" has source "${provider.source}" but ref requests "env".` : `Secret provider "${params.ref.provider}" is not configured (ref: env:${params.ref.provider}:${params.ref.id}).`);
|
|
77
76
|
return params.env[params.ref.id]?.trim() || void 0;
|
|
78
77
|
}
|
|
79
78
|
function readMatrixConfigString(params) {
|
|
80
79
|
const ref = coerceSecretRef(params.value, params.cfg.secrets?.defaults);
|
|
81
80
|
if (params.suppressSecretRef && ref) return "";
|
|
81
|
+
const value = params.allowEnvSecretRef ? ref?.source === "env" ? readMatrixEnvSecretRef({
|
|
82
|
+
ref,
|
|
83
|
+
cfg: params.cfg,
|
|
84
|
+
env: params.env
|
|
85
|
+
}) ?? params.value : ref ? "" : params.value : params.value;
|
|
82
86
|
return normalizeResolvedSecretInputString({
|
|
83
|
-
value
|
|
84
|
-
ref,
|
|
85
|
-
cfg: params.cfg,
|
|
86
|
-
env: params.env
|
|
87
|
-
}) ?? params.value : ref ? "" : params.value : params.value,
|
|
87
|
+
value,
|
|
88
88
|
path: params.path,
|
|
89
89
|
defaults: params.cfg.secrets?.defaults
|
|
90
90
|
}) ?? "";
|
|
@@ -416,7 +416,7 @@ async function backfillMatrixAuthDeviceIdAfterStartup(params) {
|
|
|
416
416
|
//#endregion
|
|
417
417
|
//#region extensions/matrix/src/matrix/client/create-client.ts
|
|
418
418
|
var create_client_exports = /* @__PURE__ */ __exportAll({ createMatrixClient: () => createMatrixClient });
|
|
419
|
-
const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-
|
|
419
|
+
const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-C1yfda1L.js").then((n) => n.t), import("./logging-DRjvUOIh.js").then((n) => n.n)]).then(([sdkModule, loggingModule]) => ({
|
|
420
420
|
MatrixClient: sdkModule.MatrixClient,
|
|
421
421
|
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
422
422
|
})));
|
|
@@ -466,6 +466,44 @@ async function createMatrixClient(params) {
|
|
|
466
466
|
});
|
|
467
467
|
}
|
|
468
468
|
//#endregion
|
|
469
|
+
//#region extensions/matrix/src/matrix/monitor/task-runner.ts
|
|
470
|
+
const monitorTaskSignal = new AsyncLocalStorage();
|
|
471
|
+
function getMatrixMonitorTaskSignal() {
|
|
472
|
+
return monitorTaskSignal.getStore();
|
|
473
|
+
}
|
|
474
|
+
function createMatrixMonitorTaskRunner(params) {
|
|
475
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
476
|
+
let closed = false;
|
|
477
|
+
const runDetachedTask = (label, task) => {
|
|
478
|
+
if (closed) return Promise.resolve();
|
|
479
|
+
const controller = new AbortController();
|
|
480
|
+
const trackedTask = monitorTaskSignal.run(controller.signal, () => Promise.resolve().then(task)).catch((error) => {
|
|
481
|
+
const message = String(error);
|
|
482
|
+
params.logVerboseMessage(`matrix: ${label} failed (${message})`);
|
|
483
|
+
params.logger.warn("matrix background task failed", {
|
|
484
|
+
task: label,
|
|
485
|
+
error: message
|
|
486
|
+
});
|
|
487
|
+
}).finally(() => {
|
|
488
|
+
controller.abort();
|
|
489
|
+
inFlight.delete(trackedTask);
|
|
490
|
+
});
|
|
491
|
+
inFlight.set(trackedTask, controller);
|
|
492
|
+
return trackedTask;
|
|
493
|
+
};
|
|
494
|
+
const waitForIdle = async () => {
|
|
495
|
+
while (inFlight.size > 0) await Promise.allSettled(Array.from(inFlight.keys()));
|
|
496
|
+
};
|
|
497
|
+
return {
|
|
498
|
+
close: () => {
|
|
499
|
+
closed = true;
|
|
500
|
+
for (const controller of inFlight.values()) controller.abort();
|
|
501
|
+
},
|
|
502
|
+
runDetachedTask,
|
|
503
|
+
waitForIdle
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
//#endregion
|
|
469
507
|
//#region extensions/matrix/src/matrix/startup-abort.ts
|
|
470
508
|
function createMatrixStartupAbortError() {
|
|
471
509
|
const error = /* @__PURE__ */ new Error("Matrix startup aborted");
|
|
@@ -592,6 +630,7 @@ async function resolveSharedMatrixAuth(params) {
|
|
|
592
630
|
}
|
|
593
631
|
async function resolveOpenSharedMatrixClientState(params) {
|
|
594
632
|
const auth = await resolveSharedMatrixAuth(params);
|
|
633
|
+
throwIfMatrixStartupAborted(params.abortSignal);
|
|
595
634
|
const key = buildSharedClientKey(auth);
|
|
596
635
|
while (true) {
|
|
597
636
|
const existing = sharedClientStates.get(key);
|
|
@@ -775,8 +814,8 @@ function createSharedMatrixClientLease(state, role) {
|
|
|
775
814
|
leaseState.releasePromise = retireMonitorLease(state, leaseState);
|
|
776
815
|
return leaseState.releasePromise;
|
|
777
816
|
}
|
|
778
|
-
if (!(finalMonitor || state.leases.size === 0)) {
|
|
779
|
-
leaseState.releasePromise = Promise.resolve();
|
|
817
|
+
if (!(state.phase === "open" && (finalMonitor || state.leases.size === 0))) {
|
|
818
|
+
leaseState.releasePromise = state.poisonError ? Promise.reject(state.poisonError) : Promise.resolve();
|
|
780
819
|
return leaseState.releasePromise;
|
|
781
820
|
}
|
|
782
821
|
leaseState.releasePromise = beginGenerationRetirement({
|
|
@@ -788,11 +827,23 @@ function createSharedMatrixClientLease(state, role) {
|
|
|
788
827
|
};
|
|
789
828
|
}
|
|
790
829
|
async function acquireSharedMatrixClient(params = {}) {
|
|
830
|
+
const taskSignal = getMatrixMonitorTaskSignal();
|
|
831
|
+
const abortSignal = taskSignal && params.abortSignal ? AbortSignal.any([taskSignal, params.abortSignal]) : taskSignal ?? params.abortSignal;
|
|
832
|
+
const acquisition = {
|
|
833
|
+
...params,
|
|
834
|
+
abortSignal
|
|
835
|
+
};
|
|
791
836
|
while (true) {
|
|
792
|
-
|
|
837
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
838
|
+
const state = await resolveOpenSharedMatrixClientState(acquisition);
|
|
839
|
+
if (abortSignal?.aborted) {
|
|
840
|
+
if (state.phase === "open" && state.leases.size === 0) await beginGenerationRetirement({ state });
|
|
841
|
+
throwIfMatrixStartupAborted(abortSignal);
|
|
842
|
+
}
|
|
843
|
+
const lease = createSharedMatrixClientLease(state, params.role ?? "transient");
|
|
793
844
|
if (!lease) continue;
|
|
794
845
|
if (params.startClient !== false) try {
|
|
795
|
-
await lease.start(
|
|
846
|
+
await lease.start(abortSignal);
|
|
796
847
|
} catch (error) {
|
|
797
848
|
await lease.release({ mode: "stop" }).catch(() => void 0);
|
|
798
849
|
throw error;
|
|
@@ -807,4 +858,4 @@ var client_exports = /* @__PURE__ */ __exportAll({
|
|
|
807
858
|
resolveMatrixAuthContext: () => resolveMatrixAuthContext
|
|
808
859
|
});
|
|
809
860
|
//#endregion
|
|
810
|
-
export { throwIfMatrixStartupAborted as a,
|
|
861
|
+
export { throwIfMatrixStartupAborted as a, backfillMatrixAuthDeviceIdAfterStartup as c, isMatrixStartupAbortError as i, resolveMatrixAuth as l, acquireSharedMatrixClient as n, createMatrixMonitorTaskRunner as o, createMatrixStartupAbortError as r, createMatrixClient as s, client_exports as t, resolveMatrixAuthContext as u };
|
|
@@ -7,7 +7,7 @@ var client_bootstrap_exports = /* @__PURE__ */ __exportAll({
|
|
|
7
7
|
resolveRuntimeMatrixClientWithReadiness: () => resolveRuntimeMatrixClientWithReadiness,
|
|
8
8
|
withResolvedRuntimeMatrixClient: () => withResolvedRuntimeMatrixClient
|
|
9
9
|
});
|
|
10
|
-
const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => import("./client-
|
|
10
|
+
const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => import("./client-Dj4mcf-s.js").then((n) => n.t).then((clientModule) => ({
|
|
11
11
|
acquireSharedMatrixClient: clientModule.acquireSharedMatrixClient,
|
|
12
12
|
resolveMatrixAuthContext: clientModule.resolveMatrixAuthContext
|
|
13
13
|
})));
|