From 83d563cce1d7f52bcaabe11bd869b5bf368cd7fe Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 20 Mar 2026 13:16:42 +0530 Subject: [PATCH 1/2] fix: resolve duplicate property definition in Matrix plugin --- extensions/matrix/src/runtime-api.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/extensions/matrix/src/runtime-api.ts b/extensions/matrix/src/runtime-api.ts index 79a283ac39a..c0b79ee6b71 100644 --- a/extensions/matrix/src/runtime-api.ts +++ b/extensions/matrix/src/runtime-api.ts @@ -1,4 +1,28 @@ -export * from "../../../src/plugin-sdk/matrix.js"; +// Re-export helper-api symbols from their local source to break the circular +// re-export path: openclaw/plugin-sdk/matrix re-exports from +// extensions/matrix/helper-api.js, so importing plugin-sdk/matrix here would +// cause Jiti to define these properties twice (once via the local module graph +// and once via the alias round-trip), triggering "Cannot redefine property". +export { + requiresExplicitMatrixDefaultAccount, + resolveMatrixDefaultOrOnlyAccountId, +} from "./account-selection.js"; +export { getMatrixScopedEnvVarNames } from "./env-vars.js"; +export { + resolveMatrixAccountStorageRoot, + resolveMatrixCredentialsDir, + resolveMatrixCredentialsPath, + resolveMatrixLegacyFlatStoragePaths, +} from "./storage-paths.js"; +// Thread-binding helpers that plugin-sdk/matrix re-exports from extensions/matrix. +export { + setMatrixThreadBindingIdleTimeoutBySessionKey, + setMatrixThreadBindingMaxAgeBySessionKey, +} from "./matrix/thread-bindings-shared.js"; +// Star re-export for the remaining (non-extension) symbols in plugin-sdk/matrix. +// Properties already defined above are skipped by the CJS interop guard, so the +// circular helper-api path is never reached for those symbols. +export * from "openclaw/plugin-sdk/matrix"; export { assertHttpUrlTargetsPrivateNetwork, closeDispatcher, From c21fa92700d901c2ebdb79bb9b0379f1a1c2d8be Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 20 Mar 2026 13:44:23 +0530 Subject: [PATCH 2/2] fix: trim pre-exports to only the 9 circular-path symbols --- extensions/matrix/src/runtime-api.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/extensions/matrix/src/runtime-api.ts b/extensions/matrix/src/runtime-api.ts index c0b79ee6b71..6f6e1d13865 100644 --- a/extensions/matrix/src/runtime-api.ts +++ b/extensions/matrix/src/runtime-api.ts @@ -1,8 +1,8 @@ -// Re-export helper-api symbols from their local source to break the circular -// re-export path: openclaw/plugin-sdk/matrix re-exports from -// extensions/matrix/helper-api.js, so importing plugin-sdk/matrix here would -// cause Jiti to define these properties twice (once via the local module graph -// and once via the alias round-trip), triggering "Cannot redefine property". +// Pre-export only the symbols that plugin-sdk/matrix re-exports from this +// extension via helper-api.js and thread-bindings-runtime.js. These must be +// defined before the star re-export so Jiti's CJS interop guard +// (hasOwnProperty check) skips the duplicate definition that would otherwise +// come through the circular alias round-trip. export { requiresExplicitMatrixDefaultAccount, resolveMatrixDefaultOrOnlyAccountId, @@ -14,7 +14,6 @@ export { resolveMatrixCredentialsPath, resolveMatrixLegacyFlatStoragePaths, } from "./storage-paths.js"; -// Thread-binding helpers that plugin-sdk/matrix re-exports from extensions/matrix. export { setMatrixThreadBindingIdleTimeoutBySessionKey, setMatrixThreadBindingMaxAgeBySessionKey,