@kodelyth/matrix 2026.5.39 → 2026.5.42
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/CHANGELOG.md +321 -0
- package/SPEC-SUPPORT.md +116 -0
- package/api.ts +38 -0
- package/auth-presence.ts +56 -0
- package/channel-plugin-api.ts +3 -0
- package/cli-metadata.ts +11 -0
- package/contract-api.ts +17 -0
- package/dist/account-selection-Y50DNJ2l.js +158 -0
- package/dist/active-client-CmFdvPdO.js +20 -0
- package/dist/api.js +12 -0
- package/dist/approval-handler.runtime-BIi4fL0R.js +377 -0
- package/dist/approval-ids-BGHK7PnZ.js +7 -0
- package/dist/approval-reaction-auth-CL0-nCNV.js +27 -0
- package/dist/approval-reactions-nDm2x-K5.js +162 -0
- package/dist/async-lock-SsmtFXtt.js +19 -0
- package/dist/auth-presence.js +26 -0
- package/dist/backup-health-3BHbHxyd.js +60 -0
- package/dist/channel-C0kCyTNB.js +1380 -0
- package/dist/channel-plugin-api.js +2 -0
- package/dist/channel.runtime-CdrdEN-0.js +250 -0
- package/dist/cli-FtY6Nuzw.js +1338 -0
- package/dist/cli-metadata-Dkwua7CB.js +22 -0
- package/dist/cli-metadata.js +2 -0
- package/dist/client-BnohYygh.js +25 -0
- package/dist/client-PhrTwuC4.js +30 -0
- package/dist/client-bootstrap-Mcj8ChJ5.js +114 -0
- package/dist/config-paths-DVvt6vM3.js +114 -0
- package/dist/config-schema-BMGOlhdI.js +308 -0
- package/dist/config-secret-input.runtime-Dv_4Br_f.js +2 -0
- package/dist/contract-api.js +8 -0
- package/dist/create-client-J0htTaRj.js +64 -0
- package/dist/credentials-B7GsBbgQ.js +56 -0
- package/dist/credentials-read-8fE4qoWs.js +112 -0
- package/dist/credentials-write.runtime-BibplB4Y.js +17 -0
- package/dist/crypto-node.runtime-D9qxgRPa.js +12 -0
- package/dist/crypto-runtime-1pKW4O2F.js +1214 -0
- package/dist/deps-DVpDS81G.js +208 -0
- package/dist/device-health-Ct2wDSPG.js +16 -0
- package/dist/directory-live-i3T8uORc.js +150 -0
- package/dist/doctor-contract-BLzYHl_9.js +246 -0
- package/dist/doctor-contract-api.js +2 -0
- package/dist/doctor-diR5gE7D.js +153 -0
- package/dist/draft-stream-HpPJ_VJt.js +143 -0
- package/dist/encryption-guidance-BNEgckrZ.js +15 -0
- package/dist/env-auth-UFiTGkDM.js +63 -0
- package/dist/env-vars-EQKQv-FE.js +63 -0
- package/dist/errors-BETj3zr9.js +17 -0
- package/dist/exec-approval-resolver-BxPorU_t.js +15 -0
- package/dist/helper-api.js +4 -0
- package/dist/http-client-DoQgbQsU.js +331 -0
- package/dist/index.js +46 -0
- package/dist/legacy-crypto-inspector-zK0hDCbt.js +41 -0
- package/dist/legacy-crypto-restore-DSFIXuDo.js +85 -0
- package/dist/logging-Df7aPD1z.js +99 -0
- package/dist/matrix-migration.runtime-BNoT1Prt.js +525 -0
- package/dist/media-text-ZhGA8Pcs.js +146 -0
- package/dist/messages-CRA9WGg0.js +140 -0
- package/dist/migration-snapshot-backup-BR-xD7Ew.js +69 -0
- package/dist/migration-snapshot.runtime-BLcy_Nvw.js +2 -0
- package/dist/monitor-DQm7_13y.js +4331 -0
- package/dist/plugin-entry.handlers.runtime.js +51 -0
- package/dist/probe.runtime-CjJS53Kz.js +3 -0
- package/dist/profile-update-DqkPgZ1P.js +68 -0
- package/dist/reaction-common-CmVLzP-u.js +71 -0
- package/dist/reaction-events-D0nUJuZV.js +121 -0
- package/dist/record-shared-DGvSFn5M.js +2 -0
- package/dist/resolve-targets-ChECUzD2.js +140 -0
- package/dist/resolver.runtime-hdY3n0GO.js +5 -0
- package/dist/rolldown-runtime-DUslC3ob.js +14 -0
- package/dist/route-xRKj_ESW.js +161 -0
- package/dist/runtime-B-Fyrmxo.js +8 -0
- package/dist/runtime-api-BYXXkxq2.js +24 -0
- package/dist/runtime-api.js +25 -0
- package/dist/runtime-heavy-api.js +3 -0
- package/dist/runtime-lwTSy9Yt.js +6 -0
- package/dist/runtime-setter-api.js +2 -0
- package/dist/sdk-Jhq7mLtD.js +1704 -0
- package/dist/secret-contract-DEMcDsjl.js +120 -0
- package/dist/secret-contract-api.js +2 -0
- package/dist/send-CJunc6QM.js +1517 -0
- package/dist/setup-bootstrap-rJ0qZWPe.js +62 -0
- package/dist/setup-core-BEYoXF3J.js +677 -0
- package/dist/setup-entry.js +19 -0
- package/dist/setup-plugin-api.js +43 -0
- package/dist/setup-surface-c28ON6jq.js +537 -0
- package/dist/shared-D6MFMnpG.js +642 -0
- package/dist/startup-abort-B2J3MU_h.js +109 -0
- package/dist/startup-verification-CkD4Cwce.js +132 -0
- package/dist/storage-nyO0DOFE.js +281 -0
- package/dist/storage-paths-BTAketfg.js +52 -0
- package/dist/subagent-hooks-api-Dr_xnMRG.js +170 -0
- package/dist/subagent-hooks-api.js +2 -0
- package/dist/sync-state-Bx0gPaGA.js +12 -0
- package/dist/target-ids-Bsazo8si.js +77 -0
- package/dist/test-api.js +4 -0
- package/dist/thread-binding-api-IGU0-L70.js +17 -0
- package/dist/thread-binding-api.js +2 -0
- package/dist/thread-bindings-FjAZmDUP.js +352 -0
- package/dist/thread-bindings-runtime.js +2 -0
- package/dist/thread-bindings-shared-fvfP7jVs.js +97 -0
- package/dist/timeout-abort-signal-DpSHDHhR.js +2 -0
- package/dist/tool-actions.runtime-Cbo7YcYZ.js +532 -0
- package/dist/url-validation-DlrXNjAE.js +36 -0
- package/dist/verification-7tDPRpJU.js +345 -0
- package/doctor-contract-api.ts +1 -0
- package/helper-api.ts +3 -0
- package/index.ts +55 -0
- package/klaw.plugin.json +3 -891
- package/package.json +4 -4
- package/plugin-entry.handlers.runtime.ts +1 -0
- package/runtime-api.ts +72 -0
- package/runtime-heavy-api.ts +1 -0
- package/runtime-setter-api.ts +3 -0
- package/secret-contract-api.ts +5 -0
- package/setup-entry.ts +17 -0
- package/setup-plugin-api.ts +3 -0
- package/src/account-selection.ts +223 -0
- package/src/actions.ts +346 -0
- package/src/approval-auth.ts +25 -0
- package/src/approval-handler.runtime.ts +592 -0
- package/src/approval-ids.ts +6 -0
- package/src/approval-native.ts +345 -0
- package/src/approval-reaction-auth.ts +45 -0
- package/src/approval-reactions.ts +313 -0
- package/src/auth-precedence.ts +61 -0
- package/src/channel-account-paths.ts +97 -0
- package/src/channel.runtime.ts +17 -0
- package/src/channel.setup.ts +48 -0
- package/src/channel.ts +667 -0
- package/src/cli-metadata.ts +19 -0
- package/src/cli.ts +2298 -0
- package/src/config-adapter.ts +41 -0
- package/src/config-schema.ts +159 -0
- package/src/config-ui-hints.ts +56 -0
- package/src/directory-live.ts +238 -0
- package/src/doctor-contract.ts +287 -0
- package/src/doctor.ts +262 -0
- package/src/env-vars.ts +92 -0
- package/src/exec-approval-resolver.ts +23 -0
- package/src/exec-approvals.ts +287 -0
- package/src/group-mentions.ts +41 -0
- package/src/legacy-crypto-inspector-availability.ts +60 -0
- package/src/legacy-crypto.ts +531 -0
- package/src/legacy-state.ts +156 -0
- package/src/matrix/account-config.ts +175 -0
- package/src/matrix/accounts.ts +194 -0
- package/src/matrix/actions/client.ts +31 -0
- package/src/matrix/actions/devices.ts +34 -0
- package/src/matrix/actions/limits.ts +6 -0
- package/src/matrix/actions/messages.ts +129 -0
- package/src/matrix/actions/pins.ts +63 -0
- package/src/matrix/actions/polls.ts +109 -0
- package/src/matrix/actions/profile.ts +37 -0
- package/src/matrix/actions/reactions.ts +59 -0
- package/src/matrix/actions/room.ts +71 -0
- package/src/matrix/actions/summary.ts +88 -0
- package/src/matrix/actions/types.ts +63 -0
- package/src/matrix/actions/verification.ts +589 -0
- package/src/matrix/actions.ts +37 -0
- package/src/matrix/active-client.ts +26 -0
- package/src/matrix/async-lock.ts +18 -0
- package/src/matrix/backup-health.ts +124 -0
- package/src/matrix/client/config-runtime-api.ts +9 -0
- package/src/matrix/client/config-secret-input.runtime.ts +1 -0
- package/src/matrix/client/config.ts +853 -0
- package/src/matrix/client/create-client.ts +105 -0
- package/src/matrix/client/env-auth.ts +95 -0
- package/src/matrix/client/file-sync-store.ts +289 -0
- package/src/matrix/client/logging.ts +140 -0
- package/src/matrix/client/migration-snapshot.runtime.ts +1 -0
- package/src/matrix/client/private-network-host.ts +1 -0
- package/src/matrix/client/runtime.ts +4 -0
- package/src/matrix/client/shared.ts +316 -0
- package/src/matrix/client/storage.ts +543 -0
- package/src/matrix/client/types.ts +50 -0
- package/src/matrix/client/url-validation.ts +73 -0
- package/src/matrix/client-bootstrap.ts +173 -0
- package/src/matrix/client.ts +23 -0
- package/src/matrix/config-paths.ts +31 -0
- package/src/matrix/config-update.ts +292 -0
- package/src/matrix/credentials-read.ts +208 -0
- package/src/matrix/credentials-write.runtime.ts +35 -0
- package/src/matrix/credentials.ts +95 -0
- package/src/matrix/deps.ts +309 -0
- package/src/matrix/device-health.ts +29 -0
- package/src/matrix/direct-management.ts +349 -0
- package/src/matrix/direct-room.ts +128 -0
- package/src/matrix/draft-stream.ts +225 -0
- package/src/matrix/encryption-guidance.ts +24 -0
- package/src/matrix/errors.ts +21 -0
- package/src/matrix/format.ts +426 -0
- package/src/matrix/legacy-crypto-inspector.ts +95 -0
- package/src/matrix/media-errors.ts +20 -0
- package/src/matrix/media-text.ts +162 -0
- package/src/matrix/monitor/access-state.ts +145 -0
- package/src/matrix/monitor/ack-config.ts +27 -0
- package/src/matrix/monitor/allowlist.ts +89 -0
- package/src/matrix/monitor/auto-join.ts +86 -0
- package/src/matrix/monitor/config.ts +569 -0
- package/src/matrix/monitor/context-summary.ts +43 -0
- package/src/matrix/monitor/direct.ts +296 -0
- package/src/matrix/monitor/events.ts +397 -0
- package/src/matrix/monitor/handler.ts +2266 -0
- package/src/matrix/monitor/inbound-dedupe.ts +267 -0
- package/src/matrix/monitor/index.ts +540 -0
- package/src/matrix/monitor/legacy-crypto-restore.ts +139 -0
- package/src/matrix/monitor/location.ts +108 -0
- package/src/matrix/monitor/media.ts +119 -0
- package/src/matrix/monitor/mentions.ts +256 -0
- package/src/matrix/monitor/reaction-events.ts +197 -0
- package/src/matrix/monitor/recent-invite.ts +30 -0
- package/src/matrix/monitor/replies.ts +136 -0
- package/src/matrix/monitor/reply-context.ts +92 -0
- package/src/matrix/monitor/room-history.ts +301 -0
- package/src/matrix/monitor/room-info.ts +126 -0
- package/src/matrix/monitor/rooms.ts +52 -0
- package/src/matrix/monitor/route.ts +179 -0
- package/src/matrix/monitor/runtime-api.ts +28 -0
- package/src/matrix/monitor/startup-verification.ts +237 -0
- package/src/matrix/monitor/startup.ts +218 -0
- package/src/matrix/monitor/status.ts +120 -0
- package/src/matrix/monitor/sync-lifecycle.ts +91 -0
- package/src/matrix/monitor/task-runner.ts +38 -0
- package/src/matrix/monitor/test-events.ts +21 -0
- package/src/matrix/monitor/thread-context.ts +108 -0
- package/src/matrix/monitor/threads.ts +85 -0
- package/src/matrix/monitor/types.ts +30 -0
- package/src/matrix/monitor/verification-events.ts +643 -0
- package/src/matrix/monitor/verification-utils.ts +46 -0
- package/src/matrix/outbound-media-runtime.ts +1 -0
- package/src/matrix/poll-summary.ts +110 -0
- package/src/matrix/poll-types.ts +429 -0
- package/src/matrix/probe.runtime.ts +4 -0
- package/src/matrix/probe.ts +97 -0
- package/src/matrix/profile.ts +184 -0
- package/src/matrix/reaction-common.ts +147 -0
- package/src/matrix/sdk/crypto-bootstrap.ts +438 -0
- package/src/matrix/sdk/crypto-facade.ts +242 -0
- package/src/matrix/sdk/crypto-node.runtime.ts +17 -0
- package/src/matrix/sdk/crypto-runtime.ts +14 -0
- package/src/matrix/sdk/decrypt-bridge.ts +410 -0
- package/src/matrix/sdk/event-helpers.ts +83 -0
- package/src/matrix/sdk/http-client.ts +87 -0
- package/src/matrix/sdk/idb-persistence-lock.ts +51 -0
- package/src/matrix/sdk/idb-persistence.ts +288 -0
- package/src/matrix/sdk/logger.ts +108 -0
- package/src/matrix/sdk/read-response-with-limit.ts +19 -0
- package/src/matrix/sdk/recovery-key-store.ts +453 -0
- package/src/matrix/sdk/timeout-abort-signal.ts +1 -0
- package/src/matrix/sdk/transport-runtime-api.ts +18 -0
- package/src/matrix/sdk/transport.ts +352 -0
- package/src/matrix/sdk/types.ts +245 -0
- package/src/matrix/sdk/verification-manager.ts +795 -0
- package/src/matrix/sdk/verification-status.ts +23 -0
- package/src/matrix/sdk.ts +2152 -0
- package/src/matrix/send/client.ts +93 -0
- package/src/matrix/send/formatting.ts +189 -0
- package/src/matrix/send/media.ts +244 -0
- package/src/matrix/send/targets.ts +104 -0
- package/src/matrix/send/types.ts +131 -0
- package/src/matrix/send.ts +660 -0
- package/src/matrix/session-store-metadata.ts +108 -0
- package/src/matrix/startup-abort.ts +44 -0
- package/src/matrix/subagent-hooks.ts +308 -0
- package/src/matrix/sync-state.ts +27 -0
- package/src/matrix/target-ids.ts +79 -0
- package/src/matrix/thread-bindings-shared.ts +206 -0
- package/src/matrix/thread-bindings.ts +580 -0
- package/src/matrix-migration.runtime.ts +9 -0
- package/src/migration-config.ts +243 -0
- package/src/migration-snapshot-backup.ts +116 -0
- package/src/migration-snapshot.ts +53 -0
- package/src/onboarding.ts +775 -0
- package/src/outbound.ts +248 -0
- package/src/plugin-entry.runtime.js +115 -0
- package/src/plugin-entry.runtime.ts +70 -0
- package/src/profile-update.ts +71 -0
- package/src/record-shared.ts +3 -0
- package/src/resolve-targets.ts +175 -0
- package/src/resolver.runtime.ts +5 -0
- package/src/resolver.ts +21 -0
- package/src/runtime-api.ts +106 -0
- package/src/runtime.ts +13 -0
- package/src/secret-contract.ts +174 -0
- package/src/session-route.ts +126 -0
- package/src/setup-bootstrap.ts +102 -0
- package/src/setup-config.ts +222 -0
- package/src/setup-contract.ts +90 -0
- package/src/setup-core.ts +146 -0
- package/src/setup-dm-policy.ts +15 -0
- package/src/setup-surface.ts +4 -0
- package/src/startup-maintenance.ts +114 -0
- package/src/storage-paths.ts +92 -0
- package/src/thread-binding-api.ts +23 -0
- package/src/tool-actions.runtime.ts +1 -0
- package/src/tool-actions.ts +498 -0
- package/src/types.ts +257 -0
- package/subagent-hooks-api.ts +31 -0
- package/test-api.ts +21 -0
- package/thread-binding-api.ts +4 -0
- package/thread-bindings-runtime.ts +4 -0
- package/tsconfig.json +16 -0
- package/api.js +0 -7
- package/auth-presence.js +0 -7
- package/channel-plugin-api.js +0 -7
- package/cli-metadata.js +0 -7
- package/contract-api.js +0 -7
- package/doctor-contract-api.js +0 -7
- package/helper-api.js +0 -7
- package/index.js +0 -7
- package/plugin-entry.handlers.runtime.js +0 -7
- package/runtime-api.js +0 -7
- package/runtime-heavy-api.js +0 -7
- package/runtime-setter-api.js +0 -7
- package/secret-contract-api.js +0 -7
- package/setup-entry.js +0 -7
- package/setup-plugin-api.js +0 -7
- package/subagent-hooks-api.js +0 -7
- package/test-api.js +0 -7
- package/thread-binding-api.js +0 -7
- package/thread-bindings-runtime.js +0 -7
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { definePluginEntry } from "klaw/plugin-sdk/plugin-entry";
|
|
2
|
+
//#region extensions/matrix/src/cli-metadata.ts
|
|
3
|
+
function registerMatrixCliMetadata(api) {
|
|
4
|
+
api.registerCli(async ({ program }) => {
|
|
5
|
+
const { registerMatrixCli } = await import("./cli-FtY6Nuzw.js");
|
|
6
|
+
registerMatrixCli({ program });
|
|
7
|
+
}, { descriptors: [{
|
|
8
|
+
name: "matrix",
|
|
9
|
+
description: "Manage Matrix accounts, verification, devices, and profile state",
|
|
10
|
+
hasSubcommands: true
|
|
11
|
+
}] });
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region extensions/matrix/cli-metadata.ts
|
|
15
|
+
var cli_metadata_default = definePluginEntry({
|
|
16
|
+
id: "matrix",
|
|
17
|
+
name: "Matrix",
|
|
18
|
+
description: "Matrix channel plugin (matrix-js-sdk)",
|
|
19
|
+
register: registerMatrixCliMetadata
|
|
20
|
+
});
|
|
21
|
+
//#endregion
|
|
22
|
+
export { registerMatrixCliMetadata as n, cli_metadata_default as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
+
import { u as resolveMatrixRoomId } from "./send-CJunc6QM.js";
|
|
3
|
+
import { n as withResolvedRuntimeMatrixClient } from "./client-bootstrap-Mcj8ChJ5.js";
|
|
4
|
+
//#region extensions/matrix/src/matrix/actions/client.ts
|
|
5
|
+
var client_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
withResolvedActionClient: () => withResolvedActionClient,
|
|
7
|
+
withResolvedRoomAction: () => withResolvedRoomAction,
|
|
8
|
+
withStartedActionClient: () => withStartedActionClient
|
|
9
|
+
});
|
|
10
|
+
async function withResolvedActionClient(opts, run, mode = "stop") {
|
|
11
|
+
return await withResolvedRuntimeMatrixClient(opts, run, mode);
|
|
12
|
+
}
|
|
13
|
+
async function withStartedActionClient(opts, run) {
|
|
14
|
+
return await withResolvedActionClient({
|
|
15
|
+
...opts,
|
|
16
|
+
readiness: "started"
|
|
17
|
+
}, run, "persist");
|
|
18
|
+
}
|
|
19
|
+
async function withResolvedRoomAction(roomId, opts, run) {
|
|
20
|
+
return await withResolvedActionClient(opts, async (client) => {
|
|
21
|
+
return await run(client, await resolveMatrixRoomId(client, roomId));
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { withStartedActionClient as i, withResolvedActionClient as n, withResolvedRoomAction as r, client_exports as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
+
import { t as getMatrixScopedEnvVarNames } from "./env-vars-EQKQv-FE.js";
|
|
3
|
+
import { i as resolveScopedMatrixEnvConfig, r as resolveMatrixEnvAuthReadiness, t as hasReadyMatrixEnvAuth } from "./env-auth-UFiTGkDM.js";
|
|
4
|
+
import { n as validateMatrixHomeserverUrl, t as resolveValidatedMatrixHomeserverUrl } from "./url-validation-DlrXNjAE.js";
|
|
5
|
+
import { t as isBunRuntime } from "./runtime-lwTSy9Yt.js";
|
|
6
|
+
import { c as backfillMatrixAuthDeviceIdAfterStartup, d as resolveMatrixConfigForAccount, i as resolveSharedMatrixClient, l as resolveMatrixAuth, n as releaseSharedClientInstance, o as stopSharedClientForAccount, r as removeSharedClientInstance, s as stopSharedClientInstance, t as acquireSharedMatrixClient, u as resolveMatrixAuthContext } from "./shared-D6MFMnpG.js";
|
|
7
|
+
import { t as createMatrixClient } from "./create-client-J0htTaRj.js";
|
|
8
|
+
//#region extensions/matrix/src/matrix/client.ts
|
|
9
|
+
var client_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
acquireSharedMatrixClient: () => acquireSharedMatrixClient,
|
|
11
|
+
backfillMatrixAuthDeviceIdAfterStartup: () => backfillMatrixAuthDeviceIdAfterStartup,
|
|
12
|
+
createMatrixClient: () => createMatrixClient,
|
|
13
|
+
getMatrixScopedEnvVarNames: () => getMatrixScopedEnvVarNames,
|
|
14
|
+
hasReadyMatrixEnvAuth: () => hasReadyMatrixEnvAuth,
|
|
15
|
+
isBunRuntime: () => isBunRuntime,
|
|
16
|
+
releaseSharedClientInstance: () => releaseSharedClientInstance,
|
|
17
|
+
removeSharedClientInstance: () => removeSharedClientInstance,
|
|
18
|
+
resolveMatrixAuth: () => resolveMatrixAuth,
|
|
19
|
+
resolveMatrixAuthContext: () => resolveMatrixAuthContext,
|
|
20
|
+
resolveMatrixConfigForAccount: () => resolveMatrixConfigForAccount,
|
|
21
|
+
resolveMatrixEnvAuthReadiness: () => resolveMatrixEnvAuthReadiness,
|
|
22
|
+
resolveScopedMatrixEnvConfig: () => resolveScopedMatrixEnvConfig,
|
|
23
|
+
resolveSharedMatrixClient: () => resolveSharedMatrixClient,
|
|
24
|
+
resolveValidatedMatrixHomeserverUrl: () => resolveValidatedMatrixHomeserverUrl,
|
|
25
|
+
stopSharedClientForAccount: () => stopSharedClientForAccount,
|
|
26
|
+
stopSharedClientInstance: () => stopSharedClientInstance,
|
|
27
|
+
validateMatrixHomeserverUrl: () => validateMatrixHomeserverUrl
|
|
28
|
+
});
|
|
29
|
+
//#endregion
|
|
30
|
+
export { client_exports as t };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
+
import { t as getActiveMatrixClient } from "./active-client-CmFdvPdO.js";
|
|
3
|
+
import { t as isBunRuntime } from "./runtime-lwTSy9Yt.js";
|
|
4
|
+
import { requireRuntimeConfig } from "klaw/plugin-sdk/plugin-config-runtime";
|
|
5
|
+
//#region extensions/matrix/src/matrix/client-bootstrap.ts
|
|
6
|
+
var client_bootstrap_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
resolveRuntimeMatrixClientWithReadiness: () => resolveRuntimeMatrixClientWithReadiness,
|
|
8
|
+
stopResolvedRuntimeMatrixClient: () => stopResolvedRuntimeMatrixClient,
|
|
9
|
+
withResolvedRuntimeMatrixClient: () => withResolvedRuntimeMatrixClient
|
|
10
|
+
});
|
|
11
|
+
let matrixSharedClientRuntimeDepsPromise;
|
|
12
|
+
async function loadMatrixSharedClientRuntimeDeps() {
|
|
13
|
+
matrixSharedClientRuntimeDepsPromise ??= Promise.all([import("./client-PhrTwuC4.js").then((n) => n.t), import("./shared-D6MFMnpG.js").then((n) => n.a)]).then(([clientModule, sharedModule]) => ({
|
|
14
|
+
acquireSharedMatrixClient: clientModule.acquireSharedMatrixClient,
|
|
15
|
+
resolveMatrixAuthContext: clientModule.resolveMatrixAuthContext,
|
|
16
|
+
releaseSharedClientInstance: sharedModule.releaseSharedClientInstance
|
|
17
|
+
}));
|
|
18
|
+
return await matrixSharedClientRuntimeDepsPromise;
|
|
19
|
+
}
|
|
20
|
+
async function ensureResolvedClientReadiness(params) {
|
|
21
|
+
if (params.readiness === "started") {
|
|
22
|
+
await params.client.start();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (params.readiness === "prepared" || !params.readiness && params.preparedByDefault) await params.client.prepareForOneOff();
|
|
26
|
+
}
|
|
27
|
+
function ensureMatrixNodeRuntime() {
|
|
28
|
+
if (isBunRuntime()) throw new Error("Matrix support requires Node (bun runtime not supported)");
|
|
29
|
+
}
|
|
30
|
+
async function resolveRuntimeMatrixClient(opts) {
|
|
31
|
+
ensureMatrixNodeRuntime();
|
|
32
|
+
if (opts.client) {
|
|
33
|
+
await opts.onResolved?.(opts.client, { preparedByDefault: false });
|
|
34
|
+
return {
|
|
35
|
+
client: opts.client,
|
|
36
|
+
stopOnDone: false
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (!opts.cfg) throw new Error("Matrix runtime client requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
|
|
40
|
+
const cfg = requireRuntimeConfig(opts.cfg, "Matrix runtime client");
|
|
41
|
+
const { acquireSharedMatrixClient, releaseSharedClientInstance, resolveMatrixAuthContext } = await loadMatrixSharedClientRuntimeDeps();
|
|
42
|
+
const authContext = resolveMatrixAuthContext({
|
|
43
|
+
cfg,
|
|
44
|
+
accountId: opts.accountId
|
|
45
|
+
});
|
|
46
|
+
const active = getActiveMatrixClient(authContext.accountId);
|
|
47
|
+
if (active) {
|
|
48
|
+
await opts.onResolved?.(active, { preparedByDefault: false });
|
|
49
|
+
return {
|
|
50
|
+
client: active,
|
|
51
|
+
stopOnDone: false
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const client = await acquireSharedMatrixClient({
|
|
55
|
+
cfg,
|
|
56
|
+
timeoutMs: opts.timeoutMs,
|
|
57
|
+
accountId: authContext.accountId,
|
|
58
|
+
startClient: false
|
|
59
|
+
});
|
|
60
|
+
try {
|
|
61
|
+
await opts.onResolved?.(client, { preparedByDefault: true });
|
|
62
|
+
} catch (err) {
|
|
63
|
+
await releaseSharedClientInstance(client, "stop");
|
|
64
|
+
throw err;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
client,
|
|
68
|
+
stopOnDone: true,
|
|
69
|
+
cleanup: async (mode) => {
|
|
70
|
+
await releaseSharedClientInstance(client, mode);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
async function resolveRuntimeMatrixClientWithReadiness(opts) {
|
|
75
|
+
return await resolveRuntimeMatrixClient({
|
|
76
|
+
client: opts.client,
|
|
77
|
+
cfg: opts.cfg,
|
|
78
|
+
timeoutMs: opts.timeoutMs,
|
|
79
|
+
accountId: opts.accountId,
|
|
80
|
+
onResolved: async (client, context) => {
|
|
81
|
+
await ensureResolvedClientReadiness({
|
|
82
|
+
client,
|
|
83
|
+
readiness: opts.readiness,
|
|
84
|
+
preparedByDefault: context.preparedByDefault
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
async function stopResolvedRuntimeMatrixClient(resolved, mode = "stop") {
|
|
90
|
+
if (!resolved.stopOnDone) return;
|
|
91
|
+
if (resolved.cleanup) {
|
|
92
|
+
await resolved.cleanup(mode);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (mode === "persist") {
|
|
96
|
+
await resolved.client.stopAndPersist();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (mode === "discard") {
|
|
100
|
+
resolved.client.stopWithoutPersist();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
resolved.client.stop();
|
|
104
|
+
}
|
|
105
|
+
async function withResolvedRuntimeMatrixClient(opts, run, stopMode = "stop") {
|
|
106
|
+
const resolved = await resolveRuntimeMatrixClientWithReadiness(opts);
|
|
107
|
+
try {
|
|
108
|
+
return await run(resolved.client);
|
|
109
|
+
} finally {
|
|
110
|
+
await stopResolvedRuntimeMatrixClient(resolved, stopMode);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { withResolvedRuntimeMatrixClient as n, client_bootstrap_exports as t };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "klaw/plugin-sdk/account-id";
|
|
2
|
+
import { hasConfiguredSecretInput } from "klaw/plugin-sdk/secret-input-runtime";
|
|
3
|
+
import { listConfiguredAccountIds, resolveMergedAccountConfig, resolveNormalizedAccountEntry } from "klaw/plugin-sdk/account-resolution-runtime";
|
|
4
|
+
//#region extensions/matrix/src/matrix/account-config.ts
|
|
5
|
+
function resolveMatrixBaseConfig(cfg) {
|
|
6
|
+
return cfg.channels?.matrix ?? {};
|
|
7
|
+
}
|
|
8
|
+
function resolveMatrixAccountsMap(cfg) {
|
|
9
|
+
const accounts = resolveMatrixBaseConfig(cfg).accounts;
|
|
10
|
+
if (!accounts || typeof accounts !== "object") return {};
|
|
11
|
+
return accounts;
|
|
12
|
+
}
|
|
13
|
+
function selectInheritedMatrixRoomEntries(params) {
|
|
14
|
+
const entries = params.entries;
|
|
15
|
+
if (!entries) return;
|
|
16
|
+
const selected = Object.fromEntries(Object.entries(entries).filter(([, value]) => {
|
|
17
|
+
const scopedAccount = typeof value?.account === "string" ? normalizeAccountId(value.account) : void 0;
|
|
18
|
+
return scopedAccount === void 0 || scopedAccount === params.accountId;
|
|
19
|
+
}));
|
|
20
|
+
return Object.keys(selected).length > 0 ? selected : void 0;
|
|
21
|
+
}
|
|
22
|
+
function mergeMatrixRoomEntries(inherited, accountEntries, hasAccountOverride) {
|
|
23
|
+
if (!inherited && !accountEntries) return;
|
|
24
|
+
if (hasAccountOverride && Object.keys(accountEntries ?? {}).length === 0) return;
|
|
25
|
+
const merged = { ...inherited };
|
|
26
|
+
for (const [key, value] of Object.entries(accountEntries ?? {})) {
|
|
27
|
+
const inheritedValue = merged[key];
|
|
28
|
+
merged[key] = inheritedValue && value ? {
|
|
29
|
+
...inheritedValue,
|
|
30
|
+
...value
|
|
31
|
+
} : value ?? inheritedValue;
|
|
32
|
+
}
|
|
33
|
+
return Object.keys(merged).length > 0 ? merged : void 0;
|
|
34
|
+
}
|
|
35
|
+
function listNormalizedMatrixAccountIds(cfg) {
|
|
36
|
+
return listConfiguredAccountIds({
|
|
37
|
+
accounts: resolveMatrixAccountsMap(cfg),
|
|
38
|
+
normalizeAccountId
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function findMatrixAccountConfig(cfg, accountId) {
|
|
42
|
+
return resolveNormalizedAccountEntry(resolveMatrixAccountsMap(cfg), accountId, normalizeAccountId);
|
|
43
|
+
}
|
|
44
|
+
function hasExplicitMatrixAccountConfig(cfg, accountId) {
|
|
45
|
+
const normalized = normalizeAccountId(accountId);
|
|
46
|
+
if (findMatrixAccountConfig(cfg, normalized)) return true;
|
|
47
|
+
if (normalized !== DEFAULT_ACCOUNT_ID) return false;
|
|
48
|
+
const matrix = resolveMatrixBaseConfig(cfg);
|
|
49
|
+
return typeof matrix.enabled === "boolean" || typeof matrix.name === "string" || typeof matrix.homeserver === "string" || typeof matrix.userId === "string" || hasConfiguredSecretInput(matrix.accessToken) || hasConfiguredSecretInput(matrix.password) || typeof matrix.deviceId === "string" || typeof matrix.deviceName === "string" || typeof matrix.avatarUrl === "string";
|
|
50
|
+
}
|
|
51
|
+
function resolveMatrixAccountConfig(params) {
|
|
52
|
+
const accountId = normalizeAccountId(params.accountId);
|
|
53
|
+
const base = resolveMatrixBaseConfig(params.cfg);
|
|
54
|
+
const merged = resolveMergedAccountConfig({
|
|
55
|
+
channelConfig: base,
|
|
56
|
+
accounts: params.cfg.channels?.matrix?.accounts,
|
|
57
|
+
accountId,
|
|
58
|
+
normalizeAccountId,
|
|
59
|
+
nestedObjectKeys: [
|
|
60
|
+
"dm",
|
|
61
|
+
"actions",
|
|
62
|
+
"execApprovals",
|
|
63
|
+
"botLoopProtection"
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
const accountConfig = findMatrixAccountConfig(params.cfg, accountId);
|
|
67
|
+
const groups = mergeMatrixRoomEntries(selectInheritedMatrixRoomEntries({
|
|
68
|
+
entries: base.groups,
|
|
69
|
+
accountId
|
|
70
|
+
}), accountConfig?.groups, Boolean(accountConfig && Object.hasOwn(accountConfig, "groups")));
|
|
71
|
+
const rooms = mergeMatrixRoomEntries(selectInheritedMatrixRoomEntries({
|
|
72
|
+
entries: base.rooms,
|
|
73
|
+
accountId
|
|
74
|
+
}), accountConfig?.rooms, Boolean(accountConfig && Object.hasOwn(accountConfig, "rooms")));
|
|
75
|
+
const { groups: _ignoredGroups, rooms: _ignoredRooms, ...rest } = merged;
|
|
76
|
+
return {
|
|
77
|
+
...rest,
|
|
78
|
+
...groups ? { groups } : {},
|
|
79
|
+
...rooms ? { rooms } : {}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function resolveMatrixAccountAllowlistConfig(params) {
|
|
83
|
+
const accountId = normalizeAccountId(params.accountId);
|
|
84
|
+
const base = resolveMatrixBaseConfig(params.cfg);
|
|
85
|
+
const accountConfig = findMatrixAccountConfig(params.cfg, accountId);
|
|
86
|
+
const accountDm = accountConfig?.dm;
|
|
87
|
+
let dmAllowFrom = base.dm?.allowFrom;
|
|
88
|
+
if (accountDm && Object.hasOwn(accountDm, "allowFrom")) dmAllowFrom = accountDm.allowFrom;
|
|
89
|
+
let groupAllowFrom = base.groupAllowFrom;
|
|
90
|
+
if (accountConfig && Object.hasOwn(accountConfig, "groupAllowFrom")) groupAllowFrom = accountConfig.groupAllowFrom;
|
|
91
|
+
return {
|
|
92
|
+
dmAllowFrom,
|
|
93
|
+
groupAllowFrom
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region extensions/matrix/src/matrix/config-paths.ts
|
|
98
|
+
function shouldStoreMatrixAccountAtTopLevel(cfg, accountId) {
|
|
99
|
+
if (normalizeAccountId(accountId) !== DEFAULT_ACCOUNT_ID) return false;
|
|
100
|
+
const accounts = cfg.channels?.matrix?.accounts;
|
|
101
|
+
return !accounts || Object.keys(accounts).length === 0;
|
|
102
|
+
}
|
|
103
|
+
function resolveMatrixConfigPath(cfg, accountId) {
|
|
104
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
105
|
+
if (shouldStoreMatrixAccountAtTopLevel(cfg, normalizedAccountId)) return "channels.matrix";
|
|
106
|
+
return `channels.matrix.accounts.${normalizedAccountId}`;
|
|
107
|
+
}
|
|
108
|
+
function resolveMatrixConfigFieldPath(cfg, accountId, fieldPath) {
|
|
109
|
+
const suffix = fieldPath.trim().replace(/^\.+/, "");
|
|
110
|
+
if (!suffix) return resolveMatrixConfigPath(cfg, accountId);
|
|
111
|
+
return `${resolveMatrixConfigPath(cfg, accountId)}.${suffix}`;
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { hasExplicitMatrixAccountConfig as a, resolveMatrixAccountConfig as c, findMatrixAccountConfig as i, resolveMatrixBaseConfig as l, resolveMatrixConfigPath as n, listNormalizedMatrixAccountIds as o, shouldStoreMatrixAccountAtTopLevel as r, resolveMatrixAccountAllowlistConfig as s, resolveMatrixConfigFieldPath as t };
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { c as resolveMatrixAccountConfig } from "./config-paths-DVvt6vM3.js";
|
|
2
|
+
import { g as resolveMatrixAccount, h as resolveDefaultMatrixAccountId, p as listMatrixAccountIds } from "./setup-core-BEYoXF3J.js";
|
|
3
|
+
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "klaw/plugin-sdk/account-id";
|
|
4
|
+
import { normalizeLowercaseStringOrEmpty } from "klaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
import { adaptScopedAccountAccessor, createScopedChannelConfigAdapter } from "klaw/plugin-sdk/channel-config-helpers";
|
|
6
|
+
import { resolveAllowlistMatchByCandidates } from "klaw/plugin-sdk/allow-from";
|
|
7
|
+
import { normalizeStringEntries } from "klaw/plugin-sdk/string-normalization-runtime";
|
|
8
|
+
import { buildChannelConfigSchema } from "klaw/plugin-sdk/channel-config-primitives";
|
|
9
|
+
import { AllowFromListSchema, ContextVisibilityModeSchema, GroupPolicySchema, MarkdownConfigSchema, ToolPolicySchema, buildNestedDmConfigSchema } from "klaw/plugin-sdk/channel-config-schema";
|
|
10
|
+
import { buildSecretInputSchema } from "klaw/plugin-sdk/secret-input";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
//#region extensions/matrix/src/matrix/monitor/allowlist.ts
|
|
13
|
+
function normalizeAllowList(list) {
|
|
14
|
+
return normalizeStringEntries(list);
|
|
15
|
+
}
|
|
16
|
+
function normalizeMatrixUser(raw) {
|
|
17
|
+
const value = (raw ?? "").trim();
|
|
18
|
+
if (!value) return "";
|
|
19
|
+
if (!value.startsWith("@") || !value.includes(":")) return normalizeLowercaseStringOrEmpty(value);
|
|
20
|
+
const withoutAt = value.slice(1);
|
|
21
|
+
const splitIndex = withoutAt.indexOf(":");
|
|
22
|
+
if (splitIndex === -1) return normalizeLowercaseStringOrEmpty(value);
|
|
23
|
+
const localpart = normalizeLowercaseStringOrEmpty(withoutAt.slice(0, splitIndex));
|
|
24
|
+
const server = normalizeLowercaseStringOrEmpty(withoutAt.slice(splitIndex + 1));
|
|
25
|
+
if (!server) return normalizeLowercaseStringOrEmpty(value);
|
|
26
|
+
return `@${localpart}:${server}`;
|
|
27
|
+
}
|
|
28
|
+
function normalizeMatrixUserId(raw) {
|
|
29
|
+
const trimmed = (raw ?? "").trim();
|
|
30
|
+
if (!trimmed) return "";
|
|
31
|
+
const lowered = normalizeLowercaseStringOrEmpty(trimmed);
|
|
32
|
+
if (lowered.startsWith("matrix:")) return normalizeMatrixUser(trimmed.slice(7));
|
|
33
|
+
if (lowered.startsWith("user:")) return normalizeMatrixUser(trimmed.slice(5));
|
|
34
|
+
return normalizeMatrixUser(trimmed);
|
|
35
|
+
}
|
|
36
|
+
function normalizeMatrixAllowListEntry(raw) {
|
|
37
|
+
const trimmed = raw.trim();
|
|
38
|
+
if (!trimmed) return "";
|
|
39
|
+
if (trimmed === "*") return trimmed;
|
|
40
|
+
const lowered = normalizeLowercaseStringOrEmpty(trimmed);
|
|
41
|
+
if (lowered.startsWith("matrix:")) return `matrix:${normalizeMatrixUser(trimmed.slice(7))}`;
|
|
42
|
+
if (lowered.startsWith("user:")) return `user:${normalizeMatrixUser(trimmed.slice(5))}`;
|
|
43
|
+
return normalizeMatrixUser(trimmed);
|
|
44
|
+
}
|
|
45
|
+
function normalizeMatrixAllowList(list) {
|
|
46
|
+
return normalizeAllowList(list).map((entry) => normalizeMatrixAllowListEntry(entry));
|
|
47
|
+
}
|
|
48
|
+
function resolveMatrixAllowListMatch(params) {
|
|
49
|
+
const allowList = params.allowList;
|
|
50
|
+
if (allowList.length === 0) return { allowed: false };
|
|
51
|
+
if (allowList.includes("*")) return {
|
|
52
|
+
allowed: true,
|
|
53
|
+
matchKey: "*",
|
|
54
|
+
matchSource: "wildcard"
|
|
55
|
+
};
|
|
56
|
+
const userId = normalizeMatrixUser(params.userId);
|
|
57
|
+
return resolveAllowlistMatchByCandidates({
|
|
58
|
+
allowList,
|
|
59
|
+
candidates: [
|
|
60
|
+
{
|
|
61
|
+
value: userId,
|
|
62
|
+
source: "id"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
value: userId ? `matrix:${userId}` : "",
|
|
66
|
+
source: "prefixed-id"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: userId ? `user:${userId}` : "",
|
|
70
|
+
source: "prefixed-user"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region extensions/matrix/src/config-adapter.ts
|
|
77
|
+
const matrixConfigAdapter = createScopedChannelConfigAdapter({
|
|
78
|
+
sectionKey: "matrix",
|
|
79
|
+
listAccountIds: listMatrixAccountIds,
|
|
80
|
+
resolveAccount: adaptScopedAccountAccessor(resolveMatrixAccount),
|
|
81
|
+
resolveAccessorAccount: ({ cfg, accountId }) => resolveMatrixAccountConfig({
|
|
82
|
+
cfg,
|
|
83
|
+
accountId
|
|
84
|
+
}),
|
|
85
|
+
defaultAccountId: resolveDefaultMatrixAccountId,
|
|
86
|
+
clearBaseFields: [
|
|
87
|
+
"name",
|
|
88
|
+
"homeserver",
|
|
89
|
+
"network",
|
|
90
|
+
"proxy",
|
|
91
|
+
"userId",
|
|
92
|
+
"accessToken",
|
|
93
|
+
"password",
|
|
94
|
+
"deviceId",
|
|
95
|
+
"deviceName",
|
|
96
|
+
"avatarUrl",
|
|
97
|
+
"initialSyncLimit"
|
|
98
|
+
],
|
|
99
|
+
resolveAllowFrom: (account) => account.dm?.allowFrom,
|
|
100
|
+
formatAllowFrom: (allowFrom) => normalizeMatrixAllowList(allowFrom)
|
|
101
|
+
});
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region extensions/matrix/src/config-ui-hints.ts
|
|
104
|
+
const matrixChannelConfigUiHints = {
|
|
105
|
+
allowBots: {
|
|
106
|
+
label: "Matrix Allow Bot Messages",
|
|
107
|
+
help: "Allow messages from other configured Matrix bot accounts to trigger replies (default: false). Set \"mentions\" to require a visible room mention."
|
|
108
|
+
},
|
|
109
|
+
botLoopProtection: {
|
|
110
|
+
label: "Matrix Bot Loop Protection",
|
|
111
|
+
help: "Sliding-window guard for accepted Matrix configured-bot loops. Default is enabled whenever allowBots lets configured bot messages reach dispatch."
|
|
112
|
+
},
|
|
113
|
+
"botLoopProtection.enabled": {
|
|
114
|
+
label: "Matrix Bot Loop Protection Enabled",
|
|
115
|
+
help: "Enable the bot-pair loop guard. Defaults to true when allowBots is true or \"mentions\", and false when configured bot messages are ignored."
|
|
116
|
+
},
|
|
117
|
+
"botLoopProtection.maxEventsPerWindow": {
|
|
118
|
+
label: "Matrix Bot Loop Events per Window",
|
|
119
|
+
help: "Maximum accepted bot-pair messages within the sliding window before suppression starts. Default: 20."
|
|
120
|
+
},
|
|
121
|
+
"botLoopProtection.windowSeconds": {
|
|
122
|
+
label: "Matrix Bot Loop Window Seconds",
|
|
123
|
+
help: "Sliding window length for counting bot-pair messages. Default: 60."
|
|
124
|
+
},
|
|
125
|
+
"botLoopProtection.cooldownSeconds": {
|
|
126
|
+
label: "Matrix Bot Loop Cooldown Seconds",
|
|
127
|
+
help: "How long to suppress the bot pair after it exceeds the budget. Default: 60."
|
|
128
|
+
},
|
|
129
|
+
dangerouslyAllowNameMatching: {
|
|
130
|
+
label: "Matrix Display Name Matching",
|
|
131
|
+
help: "Compatibility opt-in for resolving Matrix display names and joined room names in allowlists. Prefer full @user:server IDs and room IDs or aliases because names are mutable."
|
|
132
|
+
},
|
|
133
|
+
"streaming.progress.label": {
|
|
134
|
+
label: "Matrix Progress Label",
|
|
135
|
+
help: "Initial progress draft title. Use \"auto\" for built-in single-word labels, a custom string, or false to hide the title."
|
|
136
|
+
},
|
|
137
|
+
"streaming.progress.labels": {
|
|
138
|
+
label: "Matrix Progress Label Pool",
|
|
139
|
+
help: "Candidate labels for streaming.progress.label=\"auto\". Leave unset to use Klaw built-in progress labels."
|
|
140
|
+
},
|
|
141
|
+
"streaming.progress.maxLines": {
|
|
142
|
+
label: "Matrix Progress Max Lines",
|
|
143
|
+
help: "Maximum number of compact progress lines to keep below the draft label (default: 8)."
|
|
144
|
+
},
|
|
145
|
+
"streaming.progress.maxLineChars": {
|
|
146
|
+
label: "Matrix Progress Max Line Chars",
|
|
147
|
+
help: "Maximum characters per compact progress line before truncation (default: 120). Prose cuts at word boundaries; commands and paths keep useful suffixes."
|
|
148
|
+
},
|
|
149
|
+
"streaming.progress.toolProgress": {
|
|
150
|
+
label: "Matrix Progress Tool Lines",
|
|
151
|
+
help: "Show compact tool/progress lines in progress draft mode (default: true). Set false to keep only the label until final delivery."
|
|
152
|
+
},
|
|
153
|
+
"streaming.progress.commandText": {
|
|
154
|
+
label: "Matrix Progress Command Text",
|
|
155
|
+
help: "Command/exec detail in progress draft lines: \"raw\" preserves released behavior; \"status\" shows only the tool label."
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region extensions/matrix/src/config-schema.ts
|
|
160
|
+
const matrixActionSchema = z.object({
|
|
161
|
+
reactions: z.boolean().optional(),
|
|
162
|
+
messages: z.boolean().optional(),
|
|
163
|
+
pins: z.boolean().optional(),
|
|
164
|
+
profile: z.boolean().optional(),
|
|
165
|
+
memberInfo: z.boolean().optional(),
|
|
166
|
+
channelInfo: z.boolean().optional(),
|
|
167
|
+
verification: z.boolean().optional()
|
|
168
|
+
}).optional();
|
|
169
|
+
const matrixThreadBindingsSchema = z.object({
|
|
170
|
+
enabled: z.boolean().optional(),
|
|
171
|
+
idleHours: z.number().nonnegative().optional(),
|
|
172
|
+
maxAgeHours: z.number().nonnegative().optional(),
|
|
173
|
+
spawnSessions: z.boolean().optional(),
|
|
174
|
+
defaultSpawnContext: z.enum(["isolated", "fork"]).optional(),
|
|
175
|
+
spawnSubagentSessions: z.boolean().optional(),
|
|
176
|
+
spawnAcpSessions: z.boolean().optional()
|
|
177
|
+
}).optional();
|
|
178
|
+
const matrixExecApprovalsSchema = z.object({
|
|
179
|
+
enabled: z.boolean().optional(),
|
|
180
|
+
approvers: AllowFromListSchema,
|
|
181
|
+
agentFilter: z.array(z.string()).optional(),
|
|
182
|
+
sessionFilter: z.array(z.string()).optional(),
|
|
183
|
+
target: z.enum([
|
|
184
|
+
"dm",
|
|
185
|
+
"channel",
|
|
186
|
+
"both"
|
|
187
|
+
]).optional()
|
|
188
|
+
}).optional();
|
|
189
|
+
const botLoopProtectionSchema = z.object({
|
|
190
|
+
enabled: z.boolean().optional(),
|
|
191
|
+
maxEventsPerWindow: z.number().int().positive().optional(),
|
|
192
|
+
windowSeconds: z.number().int().positive().optional(),
|
|
193
|
+
cooldownSeconds: z.number().int().positive().optional()
|
|
194
|
+
}).strict().optional();
|
|
195
|
+
const matrixRoomSchema = z.object({
|
|
196
|
+
account: z.string().optional(),
|
|
197
|
+
enabled: z.boolean().optional(),
|
|
198
|
+
requireMention: z.boolean().optional(),
|
|
199
|
+
allowBots: z.union([z.boolean(), z.literal("mentions")]).optional(),
|
|
200
|
+
botLoopProtection: botLoopProtectionSchema,
|
|
201
|
+
tools: ToolPolicySchema,
|
|
202
|
+
autoReply: z.boolean().optional(),
|
|
203
|
+
users: AllowFromListSchema,
|
|
204
|
+
skills: z.array(z.string()).optional(),
|
|
205
|
+
systemPrompt: z.string().optional()
|
|
206
|
+
}).optional();
|
|
207
|
+
const matrixNetworkSchema = z.object({ dangerouslyAllowPrivateNetwork: z.boolean().optional() }).strict().optional();
|
|
208
|
+
const matrixStreamingSchema = z.object({
|
|
209
|
+
mode: z.enum([
|
|
210
|
+
"partial",
|
|
211
|
+
"quiet",
|
|
212
|
+
"progress",
|
|
213
|
+
"off"
|
|
214
|
+
]).optional(),
|
|
215
|
+
progress: z.object({
|
|
216
|
+
label: z.union([z.string(), z.literal(false)]).optional(),
|
|
217
|
+
labels: z.array(z.string()).optional(),
|
|
218
|
+
maxLines: z.number().int().positive().optional(),
|
|
219
|
+
maxLineChars: z.number().int().positive().optional(),
|
|
220
|
+
toolProgress: z.boolean().optional()
|
|
221
|
+
}).strict().optional(),
|
|
222
|
+
preview: z.object({ toolProgress: z.boolean().optional() }).strict().optional()
|
|
223
|
+
}).strict();
|
|
224
|
+
const MatrixChannelConfigSchema = buildChannelConfigSchema(z.object({
|
|
225
|
+
name: z.string().optional(),
|
|
226
|
+
enabled: z.boolean().optional(),
|
|
227
|
+
defaultAccount: z.string().optional(),
|
|
228
|
+
accounts: z.record(z.string(), z.unknown()).optional(),
|
|
229
|
+
markdown: MarkdownConfigSchema,
|
|
230
|
+
homeserver: z.string().optional(),
|
|
231
|
+
network: matrixNetworkSchema,
|
|
232
|
+
proxy: z.string().optional(),
|
|
233
|
+
userId: z.string().optional(),
|
|
234
|
+
accessToken: buildSecretInputSchema().optional(),
|
|
235
|
+
password: buildSecretInputSchema().optional(),
|
|
236
|
+
deviceId: z.string().optional(),
|
|
237
|
+
deviceName: z.string().optional(),
|
|
238
|
+
avatarUrl: z.string().optional(),
|
|
239
|
+
initialSyncLimit: z.number().optional(),
|
|
240
|
+
encryption: z.boolean().optional(),
|
|
241
|
+
allowlistOnly: z.boolean().optional(),
|
|
242
|
+
dangerouslyAllowNameMatching: z.boolean().optional(),
|
|
243
|
+
allowBots: z.union([z.boolean(), z.literal("mentions")]).optional(),
|
|
244
|
+
botLoopProtection: botLoopProtectionSchema,
|
|
245
|
+
groupPolicy: GroupPolicySchema.optional(),
|
|
246
|
+
contextVisibility: ContextVisibilityModeSchema.optional(),
|
|
247
|
+
blockStreaming: z.boolean().optional(),
|
|
248
|
+
streaming: z.union([
|
|
249
|
+
z.enum([
|
|
250
|
+
"partial",
|
|
251
|
+
"quiet",
|
|
252
|
+
"progress",
|
|
253
|
+
"off"
|
|
254
|
+
]),
|
|
255
|
+
z.boolean(),
|
|
256
|
+
matrixStreamingSchema
|
|
257
|
+
]).optional(),
|
|
258
|
+
replyToMode: z.enum([
|
|
259
|
+
"off",
|
|
260
|
+
"first",
|
|
261
|
+
"all",
|
|
262
|
+
"batched"
|
|
263
|
+
]).optional(),
|
|
264
|
+
threadReplies: z.enum([
|
|
265
|
+
"off",
|
|
266
|
+
"inbound",
|
|
267
|
+
"always"
|
|
268
|
+
]).optional(),
|
|
269
|
+
textChunkLimit: z.number().optional(),
|
|
270
|
+
chunkMode: z.enum(["length", "newline"]).optional(),
|
|
271
|
+
responsePrefix: z.string().optional(),
|
|
272
|
+
ackReaction: z.string().optional(),
|
|
273
|
+
ackReactionScope: z.enum([
|
|
274
|
+
"group-mentions",
|
|
275
|
+
"group-all",
|
|
276
|
+
"direct",
|
|
277
|
+
"all",
|
|
278
|
+
"none",
|
|
279
|
+
"off"
|
|
280
|
+
]).optional(),
|
|
281
|
+
reactionNotifications: z.enum(["off", "own"]).optional(),
|
|
282
|
+
threadBindings: matrixThreadBindingsSchema,
|
|
283
|
+
startupVerification: z.enum(["off", "if-unverified"]).optional(),
|
|
284
|
+
startupVerificationCooldownHours: z.number().optional(),
|
|
285
|
+
mediaMaxMb: z.number().optional(),
|
|
286
|
+
historyLimit: z.number().int().min(0).optional(),
|
|
287
|
+
autoJoin: z.enum([
|
|
288
|
+
"always",
|
|
289
|
+
"allowlist",
|
|
290
|
+
"off"
|
|
291
|
+
]).optional(),
|
|
292
|
+
autoJoinAllowlist: AllowFromListSchema,
|
|
293
|
+
groupAllowFrom: AllowFromListSchema,
|
|
294
|
+
dm: buildNestedDmConfigSchema({
|
|
295
|
+
sessionScope: z.enum(["per-user", "per-room"]).optional(),
|
|
296
|
+
threadReplies: z.enum([
|
|
297
|
+
"off",
|
|
298
|
+
"inbound",
|
|
299
|
+
"always"
|
|
300
|
+
]).optional()
|
|
301
|
+
}),
|
|
302
|
+
execApprovals: matrixExecApprovalsSchema,
|
|
303
|
+
groups: z.object({}).catchall(matrixRoomSchema).optional(),
|
|
304
|
+
rooms: z.object({}).catchall(matrixRoomSchema).optional(),
|
|
305
|
+
actions: matrixActionSchema
|
|
306
|
+
}), { uiHints: matrixChannelConfigUiHints });
|
|
307
|
+
//#endregion
|
|
308
|
+
export { normalizeMatrixUserId as a, normalizeMatrixAllowList as i, DEFAULT_ACCOUNT_ID$1 as n, resolveMatrixAllowListMatch as o, matrixConfigAdapter as r, MatrixChannelConfigSchema as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { s as resetMatrixThreadBindingsForTests } from "./thread-bindings-shared-fvfP7jVs.js";
|
|
2
|
+
import { r as setMatrixRuntime } from "./runtime-B-Fyrmxo.js";
|
|
3
|
+
import { d as resolveSingleAccountPromotionTarget, f as singleAccountKeysToMove, n as matrixSetupAdapter, u as namedAccountPromotionKeys } from "./setup-core-BEYoXF3J.js";
|
|
4
|
+
import { n as normalizeCompatibilityConfig, t as legacyConfigRules } from "./doctor-contract-BLzYHl_9.js";
|
|
5
|
+
import { n as collectRuntimeConfigAssignments, r as secretTargetRegistryEntries } from "./secret-contract-DEMcDsjl.js";
|
|
6
|
+
import { n as matrixOnboardingAdapter } from "./setup-surface-c28ON6jq.js";
|
|
7
|
+
import { t as createMatrixThreadBindingManager } from "./thread-bindings-FjAZmDUP.js";
|
|
8
|
+
export { collectRuntimeConfigAssignments, createMatrixThreadBindingManager, legacyConfigRules, matrixSetupAdapter, matrixOnboardingAdapter as matrixSetupWizard, namedAccountPromotionKeys, normalizeCompatibilityConfig, resetMatrixThreadBindingsForTests, resolveSingleAccountPromotionTarget, secretTargetRegistryEntries, setMatrixRuntime, singleAccountKeysToMove };
|