@openclaw/matrix 2026.7.2-beta.2 → 2026.7.2-beta.4
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-selection-Bz00QTmQ.js → account-selection-kqquRzCf.js} +5 -5
- package/dist/api.js +6 -6
- package/dist/{approval-handler.runtime-BQZdg_dJ.js → approval-handler.runtime-AsawryfP.js} +4 -4
- package/dist/{approval-ids-De4IhOSN.js → approval-ids-XAMP8vN9.js} +1 -1
- package/dist/{approval-reaction-auth-BLJKPLku.js → approval-reaction-auth-DButmM13.js} +2 -2
- package/dist/auth-presence.js +13 -21
- package/dist/{channel-B1woOUgk.js → channel-MBtrY36B.js} +19 -13
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.runtime-BvJm9z0w.js → channel.runtime-Bi4Dgy2P.js} +15 -16
- package/dist/{cli-CLWOkMvw.js → cli-CcPuMyCk.js} +15 -12
- package/dist/{cli-metadata-9Naf7in0.js → cli-metadata-DAhDhbYX.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{client-BUai6s29.js → client-BwX6rURh.js} +2 -2
- package/dist/{client-CPuYbNL8.js → client-Dg8dk8NW.js} +2 -2
- package/dist/{client-bootstrap-CNVF73sF.js → client-bootstrap-ZAaO9fZ-.js} +1 -1
- package/dist/{config-schema-BTSatSY3.js → config-schema-CggnuwnJ.js} +4 -5
- package/dist/contract-api.js +2 -2
- package/dist/{create-client-85ttAWDP.js → create-client-Und1YmJ2.js} +4 -4
- package/dist/credentials-W2EmwRhu.js +65 -0
- package/dist/credentials-read-DVmFCm7X.js +77 -0
- package/dist/{credentials-write.runtime-BDtpqvj0.js → credentials-write.runtime-Be9zNSUw.js} +1 -1
- package/dist/{crypto-runtime-DoEB5RpM.js → crypto-runtime-_j7TpS7k.js} +3 -3
- package/dist/{directory-live-0TyS9xep.js → directory-live-B6fbX6jf.js} +3 -3
- package/dist/{doctor-BGTs609f.js → doctor-C0LPJGTz.js} +1 -1
- package/dist/doctor-contract-CWVdlRQR.js +183 -0
- package/dist/doctor-contract-api.js +220 -73
- package/dist/{draft-stream-GOdPZMBm.js → draft-stream-BfibauH1.js} +1 -1
- package/dist/{encryption-guidance-BFfgq7c7.js → encryption-guidance-CbEFe38F.js} +1 -1
- package/dist/{file-sync-store-CUE9WwD2.js → file-sync-store-DUEWCEjb.js} +21 -4
- package/dist/helper-api.js +2 -2
- package/dist/{http-client-Jw5_bwQo.js → http-client-DOyTG9l2.js} +2 -2
- package/dist/{idb-persistence-BiHEEzD7.js → idb-persistence-C6zQfW2w.js} +73 -64
- package/dist/index.js +1 -1
- package/dist/{media-text-DPCtdFjk.js → media-text-Cv1VIHXW.js} +1 -1
- package/dist/{messages-DCRbGLMh.js → messages-ClTgfFl6.js} +3 -3
- package/dist/{monitor-C5EOF9et.js → monitor-2BjKS9RV.js} +93 -92
- package/dist/plugin-entry.handlers.runtime.js +1 -1
- package/dist/probe.runtime-BWkgfbiE.js +3 -0
- package/dist/{profile-update-DompcDyu.js → profile-update-C2My3TML.js} +2 -2
- package/dist/{reaction-events-QUgxkQKQ.js → reaction-events-Cj6thhmc.js} +2 -2
- package/dist/record-shared-CWWx6fvI.js +2 -0
- package/dist/{recovery-key-store-B2RglalK.js → recovery-key-store-0O8ARdT_.js} +1 -1
- package/dist/{resolve-targets-Cx1VVArA.js → resolve-targets-Dn11HT76.js} +1 -1
- package/dist/{resolver.runtime-PPrv3ZHu.js → resolver.runtime-Zguh0hH9.js} +1 -1
- package/dist/runtime-api.js +3 -3
- package/dist/{sdk-1TXuSiXZ.js → sdk-DiRXiRRf.js} +5 -5
- package/dist/{secret-contract-OZoQf0kI.js → secret-contract-M3hRmGO-.js} +21 -5
- package/dist/secret-contract-api.js +1 -1
- package/dist/{send-yre1krm8.js → send-CZCmDQu8.js} +4 -3
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/{setup-bootstrap-DXVRCd4G.js → setup-bootstrap-C9w01xQK.js} +2 -2
- package/dist/{setup-core-CYQRY2oG.js → setup-core-D6gyoyeg.js} +109 -21
- package/dist/setup-plugin-api.js +4 -3
- package/dist/{setup-surface-BjvRQzK6.js → setup-surface-DZIEWtQC.js} +8 -6
- package/dist/{shared-BfW4lxGu.js → shared-C7Vm9RxI.js} +6 -6
- package/dist/{startup-verification-DSiyDKM5.js → startup-verification-D1nscMh8.js} +2 -2
- package/dist/{storage-DD-EnNJE.js → storage-BrkTJZov.js} +11 -44
- package/dist/{thread-bindings-U5ZroBeZ.js → thread-bindings-BcYBELC7.js} +3 -3
- package/dist/{tool-actions.runtime-BlfTr9b0.js → tool-actions.runtime-Dbco_Vwn.js} +7 -7
- package/dist/{verification-CGnI9k1O.js → verification-DhMBWxOJ.js} +2 -2
- package/node_modules/music-metadata/lib/common/Util.d.ts +1 -1
- package/node_modules/music-metadata/lib/common/Util.js +7 -1
- package/node_modules/music-metadata/lib/id3v2/FrameHeader.js +23 -3
- package/node_modules/music-metadata/lib/id3v2/FrameParser.js +2 -2
- package/node_modules/music-metadata/lib/id3v2/ID3v2Token.js +1 -1
- package/node_modules/music-metadata/lib/mp4/AtomToken.js +38 -13
- package/node_modules/music-metadata/lib/mpeg/MpegParser.js +1 -1
- package/node_modules/music-metadata/package.json +6 -6
- package/node_modules/typebox/build/compile/validator.d.mts +1 -4
- package/node_modules/typebox/build/guard/guard.d.mts +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +5 -2
- package/node_modules/typebox/build/guard/string.mjs +16 -4
- package/node_modules/typebox/build/schema/engine/_functions.mjs +34 -15
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +5 -0
- package/node_modules/typebox/build/type/action/readonly_object.mjs +8 -0
- package/node_modules/typebox/build/typebox.d.mts +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +29 -32
- package/npm-shrinkwrap.json +11 -11
- package/openclaw.plugin.json +7 -20
- package/package.json +111 -28
- package/dist/async-lock-BcLS4KOc.js +0 -19
- package/dist/credentials-CncWUieb.js +0 -56
- package/dist/credentials-read-CwNJrmwu.js +0 -112
- package/dist/doctor-contract-D2qTLe-C.js +0 -312
- package/dist/probe.runtime-BBvciVfo.js +0 -3
- package/dist/record-shared-CvzjvHRn.js +0 -2
- package/dist/{deps-DDbghaZH.js → deps-CcVJfvRM.js} +1 -1
- package/dist/{storage-paths-B4_I9iqO.js → storage-paths-gUmSydsW.js} +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as listMatrixEnvAccountIds, t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
|
|
2
|
-
import { t as isRecord } from "./record-shared-
|
|
2
|
+
import { t as isRecord$1 } from "./record-shared-CWWx6fvI.js";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
import { listCombinedAccountIds, listConfiguredAccountIds, resolveListedDefaultAccountId, resolveNormalizedAccountEntry } from "openclaw/plugin-sdk/account-core";
|
|
5
5
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "openclaw/plugin-sdk/account-id";
|
|
@@ -102,20 +102,20 @@ function hasConfiguredDefaultMatrixAccountSource(params) {
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
function resolveMatrixChannelConfig(cfg) {
|
|
105
|
-
return isRecord(cfg.channels?.matrix) ? cfg.channels.matrix : null;
|
|
105
|
+
return isRecord$1(cfg.channels?.matrix) ? cfg.channels.matrix : null;
|
|
106
106
|
}
|
|
107
107
|
function findMatrixAccountEntry(cfg, accountId) {
|
|
108
108
|
const channel = resolveMatrixChannelConfig(cfg);
|
|
109
109
|
if (!channel) return null;
|
|
110
|
-
const accounts = isRecord(channel.accounts) ? channel.accounts : null;
|
|
110
|
+
const accounts = isRecord$1(channel.accounts) ? channel.accounts : null;
|
|
111
111
|
if (!accounts) return null;
|
|
112
112
|
const entry = resolveNormalizedAccountEntry(accounts, accountId, normalizeAccountId);
|
|
113
|
-
return isRecord(entry) ? entry : null;
|
|
113
|
+
return isRecord$1(entry) ? entry : null;
|
|
114
114
|
}
|
|
115
115
|
function resolveConfiguredMatrixAccountIds(cfg, env = process.env) {
|
|
116
116
|
const channel = resolveMatrixChannelConfig(cfg);
|
|
117
117
|
const configuredAccountIds = listConfiguredAccountIds({
|
|
118
|
-
accounts: channel && isRecord(channel.accounts) ? channel.accounts : void 0,
|
|
118
|
+
accounts: channel && isRecord$1(channel.accounts) ? channel.accounts : void 0,
|
|
119
119
|
normalizeAccountId
|
|
120
120
|
});
|
|
121
121
|
if (hasConfiguredDefaultMatrixAccountSource({
|
package/dist/api.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-
|
|
1
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-kqquRzCf.js";
|
|
2
2
|
import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
|
|
3
|
-
import { a as resolveMatrixCredentialsPath, i as resolveMatrixCredentialsFilename, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as sanitizeMatrixPathSegment, t as hashMatrixAccessToken } from "./storage-paths-
|
|
4
|
-
import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-
|
|
5
|
-
import { t as matrixPlugin } from "./channel-
|
|
3
|
+
import { a as resolveMatrixCredentialsPath, i as resolveMatrixCredentialsFilename, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as sanitizeMatrixPathSegment, t as hashMatrixAccessToken } from "./storage-paths-gUmSydsW.js";
|
|
4
|
+
import { n as matrixSetupAdapter, t as createMatrixSetupWizardProxy } from "./setup-core-D6gyoyeg.js";
|
|
5
|
+
import { t as matrixPlugin } from "./channel-MBtrY36B.js";
|
|
6
6
|
import { d as setMatrixThreadBindingIdleTimeoutBySessionKey, n as getMatrixThreadBindingManager, p as setMatrixThreadBindingMaxAgeBySessionKey, s as resetMatrixThreadBindingsForTests } from "./thread-bindings-shared-CKnY4LSd.js";
|
|
7
|
-
import { n as matrixOnboardingAdapter } from "./setup-surface-
|
|
8
|
-
import { t as createMatrixThreadBindingManager } from "./thread-bindings-
|
|
7
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-DZIEWtQC.js";
|
|
8
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-BcYBELC7.js";
|
|
9
9
|
//#region extensions/matrix/api.ts
|
|
10
10
|
const matrixSessionBindingAdapterChannels = ["matrix"];
|
|
11
11
|
//#endregion
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as shouldHandleMatrixApprovalRequest, g as isMatrixAnyApprovalClientEnabled } from "./channel-
|
|
1
|
+
import { _ as resolveMatrixAccount } from "./setup-core-D6gyoyeg.js";
|
|
2
|
+
import { _ as shouldHandleMatrixApprovalRequest, g as isMatrixAnyApprovalClientEnabled } from "./channel-MBtrY36B.js";
|
|
3
3
|
import { a as resolveMatrixTargetIdentity } from "./target-ids-B-5aQxwn.js";
|
|
4
|
-
import { a as sendMessageMatrix, i as reactMatrixMessage, p as repairMatrixDirectRooms, s as sendSingleTextMessageMatrix } from "./send-
|
|
4
|
+
import { a as sendMessageMatrix, i as reactMatrixMessage, p as repairMatrixDirectRooms, s as sendSingleTextMessageMatrix } from "./send-CZCmDQu8.js";
|
|
5
5
|
import { a as unregisterMatrixApprovalReactionTarget, n as listMatrixApprovalReactionBindings, r as registerMatrixApprovalReactionTarget, t as buildMatrixApprovalReactionHint } from "./approval-reactions-D-BxBK_L.js";
|
|
6
|
-
import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-
|
|
6
|
+
import { n as editMatrixMessage, t as deleteMatrixMessage } from "./messages-ClTgfFl6.js";
|
|
7
7
|
import { listMessageReceiptPlatformIds, resolveMessageReceiptPrimaryId } from "openclaw/plugin-sdk/channel-outbound";
|
|
8
8
|
import { normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { buildChannelApprovalNativeTargetKey } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as normalizeMatrixUserId } from "./config-schema-
|
|
1
|
+
import { a as normalizeMatrixUserId } from "./config-schema-CggnuwnJ.js";
|
|
2
2
|
//#region extensions/matrix/src/approval-ids.ts
|
|
3
3
|
function normalizeMatrixApproverId(value) {
|
|
4
4
|
return normalizeMatrixUserId(String(value)) || void 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as normalizeMatrixApproverId } from "./approval-ids-
|
|
1
|
+
import { _ as resolveMatrixAccount } from "./setup-core-D6gyoyeg.js";
|
|
2
|
+
import { t as normalizeMatrixApproverId } from "./approval-ids-XAMP8vN9.js";
|
|
3
3
|
import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
4
4
|
//#region extensions/matrix/src/approval-reaction-auth.ts
|
|
5
5
|
function normalizeMatrixExecApproverId(value) {
|
package/dist/auth-presence.js
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
|
1
|
+
import { c as normalizeMatrixStoredCredentials, t as MATRIX_CREDENTIALS_NAMESPACE } from "./credentials-read-DVmFCm7X.js";
|
|
2
|
+
import { createPluginStateSyncKeyedStore } from "openclaw/plugin-sdk/runtime-doctor";
|
|
6
3
|
//#region extensions/matrix/auth-presence.ts
|
|
7
|
-
function listMatrixCredentialPaths(_cfg, env = process.env) {
|
|
8
|
-
const credentialsDir = resolveMatrixCredentialsDir(resolveStateDir(env, os.homedir));
|
|
9
|
-
const paths = /* @__PURE__ */ new Set([resolveMatrixCredentialsFilename(), resolveMatrixCredentialsFilename("default")]);
|
|
10
|
-
try {
|
|
11
|
-
const entries = fs.readdirSync(credentialsDir, { withFileTypes: true });
|
|
12
|
-
for (const entry of entries) if (entry.isFile() && /^credentials(?:-[a-z0-9._-]+)?\.json$/i.test(entry.name)) paths.add(entry.name);
|
|
13
|
-
} catch {}
|
|
14
|
-
return [...paths].map((filename) => path.join(credentialsDir, filename));
|
|
15
|
-
}
|
|
16
4
|
function hasAnyMatrixAuth(params, env = process.env) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
5
|
+
const resolvedEnv = params && typeof params === "object" && "cfg" in params ? params.env ?? env : env;
|
|
6
|
+
try {
|
|
7
|
+
return createPluginStateSyncKeyedStore("matrix", {
|
|
8
|
+
namespace: MATRIX_CREDENTIALS_NAMESPACE,
|
|
9
|
+
maxEntries: 256,
|
|
10
|
+
overflowPolicy: "reject-new",
|
|
11
|
+
env: resolvedEnv
|
|
12
|
+
}).entries().some((entry) => normalizeMatrixStoredCredentials(entry.value) !== null);
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
24
16
|
}
|
|
25
17
|
//#endregion
|
|
26
18
|
export { hasAnyMatrixAuth };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-
|
|
1
|
+
import { n as requiresExplicitMatrixDefaultAccount } from "./account-selection-kqquRzCf.js";
|
|
2
2
|
import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
|
|
3
|
-
import { d as
|
|
4
|
-
import { a as normalizeMatrixUserId, n as DEFAULT_ACCOUNT_ID$2, r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-
|
|
5
|
-
import { t as normalizeMatrixApproverId } from "./approval-ids-
|
|
3
|
+
import { _ as resolveMatrixAccount, d as namedAccountPromotionKeys, f as resolveSingleAccountPromotionTarget, g as resolveDefaultMatrixAccountId, m as listMatrixAccountIds, n as matrixSetupAdapter, p as singleAccountKeysToMove, r as matrixSetupContract, t as createMatrixSetupWizardProxy } from "./setup-core-D6gyoyeg.js";
|
|
4
|
+
import { a as normalizeMatrixUserId, n as DEFAULT_ACCOUNT_ID$2, r as matrixConfigAdapter, t as MatrixChannelConfigSchema } from "./config-schema-CggnuwnJ.js";
|
|
5
|
+
import { t as normalizeMatrixApproverId } from "./approval-ids-XAMP8vN9.js";
|
|
6
6
|
import { a as resolveMatrixTargetIdentity, i as resolveMatrixDirectUserId, n as normalizeMatrixMessagingTarget, r as normalizeMatrixResolvableTarget, t as isMatrixQualifiedUserId } from "./target-ids-B-5aQxwn.js";
|
|
7
7
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
8
|
-
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-
|
|
8
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-CWVdlRQR.js";
|
|
9
9
|
import { d as setMatrixThreadBindingIdleTimeoutBySessionKey, p as setMatrixThreadBindingMaxAgeBySessionKey } from "./thread-bindings-shared-CKnY4LSd.js";
|
|
10
|
-
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-
|
|
10
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-M3hRmGO-.js";
|
|
11
11
|
import { n as resolveMatrixInboundConversation, t as defaultTopLevelPlacement } from "./thread-binding-api-DRbBZlhS.js";
|
|
12
12
|
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
13
13
|
import { describeAccountSnapshot } from "openclaw/plugin-sdk/account-helpers";
|
|
@@ -127,7 +127,7 @@ const matrixMessageActions = {
|
|
|
127
127
|
return extractToolSend(args, "sendMessage");
|
|
128
128
|
},
|
|
129
129
|
handleAction: async (ctx) => {
|
|
130
|
-
const { handleMatrixAction } = await import("./tool-actions.runtime-
|
|
130
|
+
const { handleMatrixAction } = await import("./tool-actions.runtime-Dbco_Vwn.js");
|
|
131
131
|
const { action, params, cfg, accountId, mediaLocalRoots } = ctx;
|
|
132
132
|
const dispatch = async (actionParams) => await handleMatrixAction({
|
|
133
133
|
...actionParams,
|
|
@@ -601,7 +601,7 @@ const matrixNativeApprovalCapability = createApproverRestrictedNativeApprovalCap
|
|
|
601
601
|
approvalKind,
|
|
602
602
|
request
|
|
603
603
|
}),
|
|
604
|
-
load: async () => (await import("./approval-handler.runtime-
|
|
604
|
+
load: async () => (await import("./approval-handler.runtime-AsawryfP.js")).matrixApprovalNativeRuntime
|
|
605
605
|
})
|
|
606
606
|
});
|
|
607
607
|
const splitMatrixApprovalCapability = splitChannelApprovalCapability(matrixNativeApprovalCapability);
|
|
@@ -780,7 +780,7 @@ function resolveMatrixGroupToolPolicy(params) {
|
|
|
780
780
|
}
|
|
781
781
|
//#endregion
|
|
782
782
|
//#region extensions/matrix/src/resolver.ts
|
|
783
|
-
const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-
|
|
783
|
+
const loadMatrixChannelRuntime$1 = createLazyRuntimeNamedExport(() => import("./resolver.runtime-Zguh0hH9.js"), "matrixResolverRuntime");
|
|
784
784
|
const matrixResolverAdapter = { resolveTargets: async ({ cfg, accountId, inputs, kind, runtime }) => (await loadMatrixChannelRuntime$1()).resolveMatrixTargets({
|
|
785
785
|
cfg,
|
|
786
786
|
accountId,
|
|
@@ -906,9 +906,9 @@ function resolveMatrixOutboundSessionRoute(params) {
|
|
|
906
906
|
//#endregion
|
|
907
907
|
//#region extensions/matrix/src/channel.ts
|
|
908
908
|
let matrixStartupLock = Promise.resolve();
|
|
909
|
-
const loadMatrixSetupWizard = createLazyRuntimeNamedExport(() => import("./setup-surface-
|
|
910
|
-
const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-
|
|
911
|
-
const loadMatrixDoctorModule = createLazyRuntimeModule(() => import("./doctor-
|
|
909
|
+
const loadMatrixSetupWizard = createLazyRuntimeNamedExport(() => import("./setup-surface-DZIEWtQC.js").then((n) => n.t), "matrixSetupWizard");
|
|
910
|
+
const loadMatrixChannelRuntime = createLazyRuntimeNamedExport(() => import("./channel.runtime-Bi4Dgy2P.js"), "matrixChannelRuntime");
|
|
911
|
+
const loadMatrixDoctorModule = createLazyRuntimeModule(() => import("./doctor-C0LPJGTz.js"));
|
|
912
912
|
const meta = {
|
|
913
913
|
id: "matrix",
|
|
914
914
|
label: "Matrix",
|
|
@@ -1225,6 +1225,12 @@ const matrixPlugin = createChatChannelPlugin({
|
|
|
1225
1225
|
namedAccountPromotionKeys,
|
|
1226
1226
|
resolveSingleAccountPromotionTarget
|
|
1227
1227
|
},
|
|
1228
|
+
setupContract: {
|
|
1229
|
+
...matrixSetupContract,
|
|
1230
|
+
singleAccountKeysToMove,
|
|
1231
|
+
namedAccountPromotionKeys,
|
|
1232
|
+
resolveSingleAccountPromotionTarget
|
|
1233
|
+
},
|
|
1228
1234
|
bindings: {
|
|
1229
1235
|
compileConfiguredBinding: ({ conversationId }) => normalizeMatrixAcpConversationId(conversationId),
|
|
1230
1236
|
matchInboundConversation: ({ compiledBinding, conversationId, parentConversationId }) => matchMatrixAcpConversation({
|
|
@@ -1281,7 +1287,7 @@ const matrixPlugin = createChatChannelPlugin({
|
|
|
1281
1287
|
await previousLock;
|
|
1282
1288
|
let monitorMatrixProvider;
|
|
1283
1289
|
try {
|
|
1284
|
-
monitorMatrixProvider = (await import("./monitor-
|
|
1290
|
+
monitorMatrixProvider = (await import("./monitor-2BjKS9RV.js")).monitorMatrixProvider;
|
|
1285
1291
|
} finally {
|
|
1286
1292
|
releaseLock();
|
|
1287
1293
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as matrixPlugin } from "./channel-
|
|
1
|
+
import { t as matrixPlugin } from "./channel-MBtrY36B.js";
|
|
2
2
|
export { matrixPlugin };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { a as sendMessageMatrix, c as sendTypingMatrix, o as sendPollMatrix } from "./send-
|
|
1
|
+
import { a as sendMessageMatrix, c as sendTypingMatrix, o as sendPollMatrix } from "./send-CZCmDQu8.js";
|
|
2
2
|
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
3
|
-
import { f as resolveMatrixAuth } from "./shared-
|
|
4
|
-
import "./client-
|
|
5
|
-
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-
|
|
3
|
+
import { f as resolveMatrixAuth } from "./shared-C7Vm9RxI.js";
|
|
4
|
+
import "./client-Dg8dk8NW.js";
|
|
5
|
+
import { n as listMatrixDirectoryGroupsLive, r as listMatrixDirectoryPeersLive } from "./directory-live-B6fbX6jf.js";
|
|
6
6
|
import { p as resolveOutboundSendDep, r as chunkTextForOutbound } from "./runtime-api-D1xI_cvh.js";
|
|
7
|
-
import { t as resolveMatrixTargets } from "./resolve-targets-
|
|
7
|
+
import { t as resolveMatrixTargets } from "./resolve-targets-Dn11HT76.js";
|
|
8
8
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
9
9
|
import { createReplyToFanout } from "openclaw/plugin-sdk/channel-outbound";
|
|
10
10
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
11
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
12
12
|
import { renderMessagePresentationFallbackText } from "openclaw/plugin-sdk/interactive-runtime";
|
|
13
|
-
import { resolvePayloadMediaUrls } from "openclaw/plugin-sdk/reply-payload";
|
|
13
|
+
import { resolvePayloadMediaUrls, sendPayloadMediaSequence } from "openclaw/plugin-sdk/reply-payload";
|
|
14
14
|
//#region extensions/matrix/src/matrix/probe.ts
|
|
15
|
-
const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-
|
|
15
|
+
const loadMatrixProbeRuntimeDeps = createLazyRuntimeModule(() => import("./probe.runtime-BWkgfbiE.js").then((runtimeModule) => ({ createMatrixClient: runtimeModule.createMatrixClient })));
|
|
16
16
|
async function probeMatrix(params) {
|
|
17
17
|
const started = Date.now();
|
|
18
18
|
const result = {
|
|
@@ -160,12 +160,12 @@ const matrixChannelRuntime = {
|
|
|
160
160
|
const urls = resolvePayloadMediaUrls(payload);
|
|
161
161
|
const payloadText = resolveMatrixPayloadText(payload);
|
|
162
162
|
if (urls.length > 0) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
const lastResult = await sendPayloadMediaSequence({
|
|
164
|
+
text: payloadText,
|
|
165
|
+
mediaUrls: urls,
|
|
166
|
+
send: async ({ text, mediaUrl, isFirst }) => await send(to, text, {
|
|
167
167
|
cfg,
|
|
168
|
-
mediaUrl
|
|
168
|
+
mediaUrl,
|
|
169
169
|
mediaAccess,
|
|
170
170
|
mediaLocalRoots,
|
|
171
171
|
mediaReadFile,
|
|
@@ -175,9 +175,9 @@ const matrixChannelRuntime = {
|
|
|
175
175
|
audioAsVoice: payload.audioAsVoice ?? audioAsVoice,
|
|
176
176
|
extraContent: isFirst ? resolveMatrixExtraContent(payload) : void 0,
|
|
177
177
|
onDeliveryResult: resolveMatrixDeliveryProgress(onDeliveryResult)
|
|
178
|
-
})
|
|
179
|
-
}
|
|
180
|
-
return {
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
if (lastResult !== void 0) return {
|
|
181
181
|
channel: "matrix",
|
|
182
182
|
messageId: lastResult.messageId,
|
|
183
183
|
roomId: lastResult.roomId
|
|
@@ -185,7 +185,6 @@ const matrixChannelRuntime = {
|
|
|
185
185
|
}
|
|
186
186
|
const result = await send(to, payloadText, {
|
|
187
187
|
cfg,
|
|
188
|
-
mediaUrl: payload.mediaUrl,
|
|
189
188
|
mediaAccess,
|
|
190
189
|
mediaLocalRoots,
|
|
191
190
|
mediaReadFile,
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
|
|
2
2
|
import { t as getMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
|
-
import {
|
|
3
|
+
import { _ as resolveMatrixAccount, l as resolveMatrixConfigPath, n as matrixSetupAdapter, u as updateMatrixAccountConfig } from "./setup-core-D6gyoyeg.js";
|
|
4
4
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
5
|
-
import { n as withResolvedActionClient } from "./client-
|
|
6
|
-
import { p as resolveMatrixAuthContext } from "./shared-
|
|
7
|
-
import "./client-
|
|
5
|
+
import { n as withResolvedActionClient } from "./client-BwX6rURh.js";
|
|
6
|
+
import { p as resolveMatrixAuthContext } from "./shared-C7Vm9RxI.js";
|
|
7
|
+
import "./client-Dg8dk8NW.js";
|
|
8
8
|
import { a as formatZonedTimestamp } from "./runtime-api-D1xI_cvh.js";
|
|
9
9
|
import { isOpenClawManagedMatrixDevice, summarizeMatrixDeviceHealth } from "./device-health-D4LBxuPq.js";
|
|
10
|
-
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-
|
|
11
|
-
import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-
|
|
10
|
+
import { n as updateMatrixOwnProfile, t as applyMatrixProfileUpdate } from "./profile-update-C2My3TML.js";
|
|
11
|
+
import { a as confirmMatrixVerificationSas, b as verifyMatrixRecoveryKey, c as getMatrixRoomKeyBackupStatus, d as listMatrixVerifications, f as mismatchMatrixVerificationSas, g as runMatrixSelfVerification, h as restoreMatrixRoomKeyBackup, l as getMatrixVerificationSas, m as resetMatrixRoomKeyBackup, n as bootstrapMatrixVerification, p as requestMatrixVerification, r as cancelMatrixVerification, t as acceptMatrixVerification, u as getMatrixVerificationStatus, v as startMatrixVerification } from "./verification-DhMBWxOJ.js";
|
|
12
12
|
import { t as resolveMatrixRoomKeyBackupIssue } from "./backup-health-Dm_YMVFT.js";
|
|
13
13
|
import { setMatrixSdkConsoleLogging, setMatrixSdkLogMode } from "./logging-QH-48Gr6.js";
|
|
14
14
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
15
15
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
16
16
|
import { parseStrictInteger, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
17
|
+
import { readByteStreamWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
17
18
|
//#region extensions/matrix/src/matrix/actions/devices.ts
|
|
18
19
|
async function listMatrixOwnDevices(opts = {}) {
|
|
19
20
|
return await withResolvedActionClient(opts, async (client) => await client.listOwnDevices());
|
|
@@ -36,8 +37,9 @@ async function pruneMatrixStaleGatewayDevices(opts = {}) {
|
|
|
36
37
|
//#endregion
|
|
37
38
|
//#region extensions/matrix/src/cli.ts
|
|
38
39
|
let matrixCliExitScheduled = false;
|
|
39
|
-
const
|
|
40
|
-
const
|
|
40
|
+
const MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES = 1024 * 1024;
|
|
41
|
+
const loadMatrixActionClientModule = createLazyRuntimeModule(() => import("./client-BwX6rURh.js").then((n) => n.t));
|
|
42
|
+
const loadMatrixDirectManagementModule = createLazyRuntimeModule(() => import("./send-CZCmDQu8.js").then((n) => n.d));
|
|
41
43
|
function scheduleMatrixCliExit() {
|
|
42
44
|
if (matrixCliExitScheduled || process.env.VITEST) return;
|
|
43
45
|
matrixCliExitScheduled = true;
|
|
@@ -53,9 +55,10 @@ function markCliFailure() {
|
|
|
53
55
|
process.exitCode = 1;
|
|
54
56
|
}
|
|
55
57
|
async function readMatrixCliRecoveryKeyFromStdin() {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
const recoveryKey = (await readByteStreamWithLimit(process.stdin, {
|
|
59
|
+
maxBytes: MATRIX_CLI_RECOVERY_KEY_STDIN_MAX_BYTES,
|
|
60
|
+
onOverflow: ({ maxBytes }) => /* @__PURE__ */ new Error(`Matrix recovery key stdin exceeds ${maxBytes} bytes.`)
|
|
61
|
+
})).toString("utf8").trim();
|
|
59
62
|
if (!recoveryKey) throw new Error("Matrix recovery key was requested from stdin, but stdin was empty.");
|
|
60
63
|
return recoveryKey;
|
|
61
64
|
}
|
|
@@ -205,7 +208,7 @@ async function addMatrixAccount(params) {
|
|
|
205
208
|
backupVersion: null
|
|
206
209
|
};
|
|
207
210
|
if (accountConfig.encryption === true) {
|
|
208
|
-
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-
|
|
211
|
+
const { maybeBootstrapNewEncryptedMatrixAccount } = await import("./setup-bootstrap-C9w01xQK.js");
|
|
209
212
|
verificationBootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
|
|
210
213
|
previousCfg: cfg,
|
|
211
214
|
cfg: updated,
|
|
@@ -2,7 +2,7 @@ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
|
2
2
|
//#region extensions/matrix/src/cli-metadata.ts
|
|
3
3
|
function registerMatrixCliMetadata(api) {
|
|
4
4
|
api.registerCli(async ({ program }) => {
|
|
5
|
-
const { registerMatrixCli } = await import("./cli-
|
|
5
|
+
const { registerMatrixCli } = await import("./cli-CcPuMyCk.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-DAhDhbYX.js";
|
|
2
2
|
export { cli_metadata_default as default, registerMatrixCliMetadata };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { u as resolveMatrixRoomId } from "./send-
|
|
3
|
-
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-
|
|
2
|
+
import { u as resolveMatrixRoomId } from "./send-CZCmDQu8.js";
|
|
3
|
+
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-ZAaO9fZ-.js";
|
|
4
4
|
//#region extensions/matrix/src/matrix/actions/client.ts
|
|
5
5
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
withResolvedActionClient: () => withResolvedActionClient,
|
|
@@ -3,8 +3,8 @@ import { t as getMatrixScopedEnvVarNames } from "./env-vars-B0NxQnPk.js";
|
|
|
3
3
|
import { i as resolveScopedMatrixEnvConfig, r as resolveMatrixEnvAuthReadiness, t as hasReadyMatrixEnvAuth } from "./env-auth-CQsYbz-p.js";
|
|
4
4
|
import { n as validateMatrixHomeserverUrl, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
5
5
|
import { t as isBunRuntime } from "./runtime-BefyhPWv.js";
|
|
6
|
-
import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, m as resolveMatrixConfigForAccount, n as releaseSharedClientInstance, o as stopSharedClientForAccount, p as resolveMatrixAuthContext, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient } from "./shared-
|
|
7
|
-
import { t as createMatrixClient } from "./create-client-
|
|
6
|
+
import { d as backfillMatrixAuthDeviceIdAfterStartup, f as resolveMatrixAuth, i as resolveSharedMatrixClient, m as resolveMatrixConfigForAccount, n as releaseSharedClientInstance, o as stopSharedClientForAccount, p as resolveMatrixAuthContext, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient } from "./shared-C7Vm9RxI.js";
|
|
7
|
+
import { t as createMatrixClient } from "./create-client-Und1YmJ2.js";
|
|
8
8
|
//#region extensions/matrix/src/matrix/client.ts
|
|
9
9
|
var client_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
acquireSharedMatrixClient: () => acquireSharedMatrixClient,
|
|
@@ -8,7 +8,7 @@ var client_bootstrap_exports = /* @__PURE__ */ __exportAll({
|
|
|
8
8
|
resolveRuntimeMatrixClientWithReadiness: () => resolveRuntimeMatrixClientWithReadiness,
|
|
9
9
|
withResolvedRuntimeMatrixClient: () => withResolvedRuntimeMatrixClient
|
|
10
10
|
});
|
|
11
|
-
const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./client-
|
|
11
|
+
const loadMatrixSharedClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./client-Dg8dk8NW.js").then((n) => n.t), import("./shared-C7Vm9RxI.js").then((n) => n.a)]).then(([clientModule, sharedModule]) => ({
|
|
12
12
|
acquireSharedMatrixClient: clientModule.acquireSharedMatrixClient,
|
|
13
13
|
resolveMatrixAuthContext: clientModule.resolveMatrixAuthContext,
|
|
14
14
|
releaseSharedClientInstance: sharedModule.releaseSharedClientInstance
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as resolveMatrixAccountConfig } from "./account-config-BZWN9tGS.js";
|
|
2
|
-
import {
|
|
2
|
+
import { _ as resolveMatrixAccount, g as resolveDefaultMatrixAccountId, m as listMatrixAccountIds } from "./setup-core-D6gyoyeg.js";
|
|
3
3
|
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "openclaw/plugin-sdk/channel-config-helpers";
|
|
4
4
|
import { createChannelConfigUiHints } from "openclaw/plugin-sdk/channel-core";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -159,9 +159,7 @@ const matrixThreadBindingsSchema = z.object({
|
|
|
159
159
|
idleHours: z.number().nonnegative().optional(),
|
|
160
160
|
maxAgeHours: z.number().nonnegative().optional(),
|
|
161
161
|
spawnSessions: z.boolean().optional(),
|
|
162
|
-
defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
|
|
163
|
-
spawnSubagentSessions: z.boolean().optional(),
|
|
164
|
-
spawnAcpSessions: z.boolean().optional()
|
|
162
|
+
defaultSpawnContext: z.enum(["isolated", "fork"]).optional()
|
|
165
163
|
}).optional();
|
|
166
164
|
const matrixExecApprovalsSchema = z.object({
|
|
167
165
|
enabled: z.boolean().optional(),
|
|
@@ -208,7 +206,8 @@ const matrixStreamingSchema = z.object({
|
|
|
208
206
|
labels: z.array(z.string()).optional(),
|
|
209
207
|
maxLines: z.number().int().positive().optional(),
|
|
210
208
|
maxLineChars: z.number().int().positive().optional(),
|
|
211
|
-
toolProgress: z.boolean().optional()
|
|
209
|
+
toolProgress: z.boolean().optional(),
|
|
210
|
+
commandText: z.enum(["raw", "status"]).optional()
|
|
212
211
|
}).strict().optional(),
|
|
213
212
|
preview: z.object({ toolProgress: z.boolean().optional() }).strict().optional()
|
|
214
213
|
}).strict();
|
package/dist/contract-api.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import { n as matrixOnboardingAdapter } from "./setup-surface-
|
|
1
|
+
import { d as namedAccountPromotionKeys, f as resolveSingleAccountPromotionTarget, n as matrixSetupAdapter, p as singleAccountKeysToMove } from "./setup-core-D6gyoyeg.js";
|
|
2
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-DZIEWtQC.js";
|
|
3
3
|
export { matrixSetupAdapter, matrixOnboardingAdapter as matrixSetupWizard, namedAccountPromotionKeys, resolveSingleAccountPromotionTarget, singleAccountKeysToMove };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-GRHde6lq.js";
|
|
3
|
-
import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage } from "./storage-
|
|
4
|
-
import "./shared-
|
|
3
|
+
import { d as writeStorageMeta, l as resolveMatrixStoragePaths, r as maybeMigrateLegacyStorage } from "./storage-BrkTJZov.js";
|
|
4
|
+
import "./shared-C7Vm9RxI.js";
|
|
5
5
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
6
6
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
-
import fs from "node:fs";
|
|
8
7
|
import { ssrfPolicyFromDangerouslyAllowPrivateNetwork } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
8
|
+
import fs from "node:fs";
|
|
9
9
|
//#region extensions/matrix/src/matrix/client/create-client.ts
|
|
10
10
|
var create_client_exports = /* @__PURE__ */ __exportAll({ createMatrixClient: () => createMatrixClient });
|
|
11
|
-
const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-
|
|
11
|
+
const loadMatrixCreateClientRuntimeDeps = createLazyRuntimeModule(() => Promise.all([import("./sdk-DiRXiRRf.js"), import("./logging-QH-48Gr6.js")]).then(([sdkModule, loggingModule]) => ({
|
|
12
12
|
MatrixClient: sdkModule.MatrixClient,
|
|
13
13
|
ensureMatrixSdkLoggingConfigured: loggingModule.ensureMatrixSdkLoggingConfigured
|
|
14
14
|
})));
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { a as resolveMatrixCredentialsPath, r as resolveMatrixCredentialsDir } from "./storage-paths-gUmSydsW.js";
|
|
2
|
+
import { a as isMatrixCredentialRevocation, c as normalizeMatrixStoredCredentials, l as openMatrixCredentialsStore, n as clearMatrixCredentials, o as loadMatrixCredentials, r as credentialsMatchConfig, s as matrixCredentialsStoreKey } from "./credentials-read-DVmFCm7X.js";
|
|
3
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
4
|
+
//#region extensions/matrix/src/matrix/credentials.ts
|
|
5
|
+
function requireCredentialStoreUpdate(store) {
|
|
6
|
+
if (!store.update) throw new Error("Matrix credentials require atomic plugin-state updates");
|
|
7
|
+
return store.update;
|
|
8
|
+
}
|
|
9
|
+
async function saveMatrixCredentials(credentials, env = process.env, accountId) {
|
|
10
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
11
|
+
const store = openMatrixCredentialsStore(env);
|
|
12
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
13
|
+
requireCredentialStoreUpdate(store)(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
|
|
14
|
+
const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
|
|
15
|
+
return {
|
|
16
|
+
accountId: normalizedAccountId,
|
|
17
|
+
homeserver: credentials.homeserver,
|
|
18
|
+
userId: credentials.userId,
|
|
19
|
+
accessToken: credentials.accessToken,
|
|
20
|
+
...typeof credentials.deviceId === "string" ? { deviceId: credentials.deviceId } : {},
|
|
21
|
+
createdAt: existing?.createdAt ?? now,
|
|
22
|
+
lastUsedAt: now
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async function saveBackfilledMatrixDeviceId(credentials, env = process.env, accountId) {
|
|
27
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
28
|
+
const store = openMatrixCredentialsStore(env);
|
|
29
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
30
|
+
let result = "saved";
|
|
31
|
+
requireCredentialStoreUpdate(store)(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
|
|
32
|
+
if (isMatrixCredentialRevocation(current, normalizedAccountId)) {
|
|
33
|
+
result = "skipped";
|
|
34
|
+
return current;
|
|
35
|
+
}
|
|
36
|
+
const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
|
|
37
|
+
if (existing && (existing.homeserver !== credentials.homeserver || existing.userId !== credentials.userId || existing.accessToken !== credentials.accessToken)) {
|
|
38
|
+
result = "skipped";
|
|
39
|
+
return existing;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
accountId: normalizedAccountId,
|
|
43
|
+
homeserver: credentials.homeserver,
|
|
44
|
+
userId: credentials.userId,
|
|
45
|
+
accessToken: credentials.accessToken,
|
|
46
|
+
...typeof credentials.deviceId === "string" ? { deviceId: credentials.deviceId } : {},
|
|
47
|
+
createdAt: existing?.createdAt ?? now,
|
|
48
|
+
lastUsedAt: now
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
async function touchMatrixCredentials(env = process.env, accountId) {
|
|
54
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
55
|
+
requireCredentialStoreUpdate(openMatrixCredentialsStore(env))(matrixCredentialsStoreKey(normalizedAccountId), (current) => {
|
|
56
|
+
if (isMatrixCredentialRevocation(current, normalizedAccountId)) return current;
|
|
57
|
+
const existing = normalizeMatrixStoredCredentials(current, normalizedAccountId);
|
|
58
|
+
return existing ? {
|
|
59
|
+
...existing,
|
|
60
|
+
lastUsedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
61
|
+
} : void 0;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { clearMatrixCredentials, credentialsMatchConfig, loadMatrixCredentials, resolveMatrixCredentialsDir, resolveMatrixCredentialsPath, saveBackfilledMatrixDeviceId, saveMatrixCredentials, touchMatrixCredentials };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
+
import { n as getOptionalMatrixRuntime } from "./runtime-6S3DNFNv.js";
|
|
3
|
+
import "./storage-paths-gUmSydsW.js";
|
|
4
|
+
import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
5
|
+
import { createPluginStateSyncKeyedStore } from "openclaw/plugin-sdk/runtime-doctor";
|
|
6
|
+
//#region extensions/matrix/src/matrix/credentials-read.ts
|
|
7
|
+
var credentials_read_exports = /* @__PURE__ */ __exportAll({
|
|
8
|
+
MATRIX_CREDENTIALS_MAX_ENTRIES: () => 256,
|
|
9
|
+
MATRIX_CREDENTIALS_NAMESPACE: () => MATRIX_CREDENTIALS_NAMESPACE,
|
|
10
|
+
clearMatrixCredentials: () => clearMatrixCredentials,
|
|
11
|
+
credentialsMatchConfig: () => credentialsMatchConfig,
|
|
12
|
+
isMatrixCredentialRevocation: () => isMatrixCredentialRevocation,
|
|
13
|
+
loadMatrixCredentials: () => loadMatrixCredentials,
|
|
14
|
+
matrixCredentialsStoreKey: () => matrixCredentialsStoreKey,
|
|
15
|
+
normalizeMatrixStoredCredentials: () => normalizeMatrixStoredCredentials,
|
|
16
|
+
openMatrixCredentialsStore: () => openMatrixCredentialsStore
|
|
17
|
+
});
|
|
18
|
+
const MATRIX_CREDENTIALS_NAMESPACE = "credentials";
|
|
19
|
+
function matrixCredentialsStoreKey(accountId) {
|
|
20
|
+
return `account:${normalizeAccountId(accountId)}`;
|
|
21
|
+
}
|
|
22
|
+
function normalizeMatrixStoredCredentials(value, accountId) {
|
|
23
|
+
if (!value || typeof value !== "object") return null;
|
|
24
|
+
const parsed = value;
|
|
25
|
+
if (typeof parsed.homeserver !== "string" || !parsed.homeserver || typeof parsed.userId !== "string" || !parsed.userId || typeof parsed.accessToken !== "string" || !parsed.accessToken || typeof parsed.createdAt !== "string" || !parsed.createdAt) return null;
|
|
26
|
+
return {
|
|
27
|
+
accountId: normalizeAccountId(accountId ?? parsed.accountId),
|
|
28
|
+
homeserver: parsed.homeserver,
|
|
29
|
+
userId: parsed.userId,
|
|
30
|
+
accessToken: parsed.accessToken,
|
|
31
|
+
...typeof parsed.deviceId === "string" ? { deviceId: parsed.deviceId } : {},
|
|
32
|
+
createdAt: parsed.createdAt,
|
|
33
|
+
...typeof parsed.lastUsedAt === "string" ? { lastUsedAt: parsed.lastUsedAt } : {}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function isMatrixCredentialRevocation(value, accountId) {
|
|
37
|
+
if (!value || typeof value !== "object") return false;
|
|
38
|
+
const parsed = value;
|
|
39
|
+
return parsed.kind === "revoked" && typeof parsed.revokedAt === "string" && parsed.revokedAt.length > 0 && normalizeAccountId(parsed.accountId) === normalizeAccountId(accountId ?? parsed.accountId);
|
|
40
|
+
}
|
|
41
|
+
function openMatrixCredentialsStore(env = process.env) {
|
|
42
|
+
const runtime = getOptionalMatrixRuntime();
|
|
43
|
+
const resolvedEnv = env.OPENCLAW_STATE_DIR?.trim() || !runtime ? env : {
|
|
44
|
+
...env,
|
|
45
|
+
OPENCLAW_STATE_DIR: runtime.state.resolveStateDir(env)
|
|
46
|
+
};
|
|
47
|
+
return createPluginStateSyncKeyedStore("matrix", {
|
|
48
|
+
namespace: MATRIX_CREDENTIALS_NAMESPACE,
|
|
49
|
+
maxEntries: 256,
|
|
50
|
+
overflowPolicy: "reject-new",
|
|
51
|
+
env: resolvedEnv
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function loadMatrixCredentials(env = process.env, accountId) {
|
|
55
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
56
|
+
const parsed = normalizeMatrixStoredCredentials(openMatrixCredentialsStore(env).lookup(matrixCredentialsStoreKey(accountId)), normalizedAccountId);
|
|
57
|
+
if (!parsed || parsed.accountId !== normalizedAccountId) return null;
|
|
58
|
+
const { accountId: _accountId, ...credentials } = parsed;
|
|
59
|
+
return credentials;
|
|
60
|
+
}
|
|
61
|
+
function clearMatrixCredentials(env = process.env, accountId) {
|
|
62
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
63
|
+
openMatrixCredentialsStore(env).register(matrixCredentialsStoreKey(normalizedAccountId), {
|
|
64
|
+
accountId: normalizedAccountId,
|
|
65
|
+
kind: "revoked",
|
|
66
|
+
revokedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function credentialsMatchConfig(stored, config) {
|
|
70
|
+
if (!config.userId) {
|
|
71
|
+
if (!config.accessToken) return false;
|
|
72
|
+
return stored.homeserver === config.homeserver && stored.accessToken === config.accessToken;
|
|
73
|
+
}
|
|
74
|
+
return stored.homeserver === config.homeserver && stored.userId === config.userId;
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { isMatrixCredentialRevocation as a, normalizeMatrixStoredCredentials as c, credentials_read_exports as i, openMatrixCredentialsStore as l, clearMatrixCredentials as n, loadMatrixCredentials as o, credentialsMatchConfig as r, matrixCredentialsStoreKey as s, MATRIX_CREDENTIALS_NAMESPACE as t };
|
package/dist/{credentials-write.runtime-BDtpqvj0.js → credentials-write.runtime-Be9zNSUw.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
2
2
|
//#region extensions/matrix/src/matrix/credentials-write.runtime.ts
|
|
3
|
-
const loadMatrixCredentialsRuntime = createLazyRuntimeModule(() => import("./credentials-
|
|
3
|
+
const loadMatrixCredentialsRuntime = createLazyRuntimeModule(() => import("./credentials-W2EmwRhu.js"));
|
|
4
4
|
async function saveMatrixCredentials(...args) {
|
|
5
5
|
return (await loadMatrixCredentialsRuntime()).saveMatrixCredentials(...args);
|
|
6
6
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as formatMatrixErrorMessage } from "./errors-C47hvAF8.js";
|
|
2
|
-
import { t as ensureMatrixCryptoRuntime } from "./deps-
|
|
2
|
+
import { t as ensureMatrixCryptoRuntime } from "./deps-CcVJfvRM.js";
|
|
3
3
|
import { n as LogService, r as noop } from "./logger-D0GCSDQq.js";
|
|
4
|
-
import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-
|
|
5
|
-
import { n as isRepairableSecretStorageAccessError } from "./recovery-key-store-
|
|
4
|
+
import { i as restoreIdbFromDisk, n as persistIdbToDisk } from "./idb-persistence-C6zQfW2w.js";
|
|
5
|
+
import { n as isRepairableSecretStorageAccessError } from "./recovery-key-store-0O8ARdT_.js";
|
|
6
6
|
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
7
7
|
import { resolveDateTimestampMs, resolveTimestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
8
8
|
import { MatrixEventEvent } from "matrix-js-sdk/lib/matrix.js";
|