@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,153 @@
|
|
|
1
|
+
import { t as isRecord } from "./record-shared-DGvSFn5M.js";
|
|
2
|
+
import "./doctor-contract-BLzYHl_9.js";
|
|
3
|
+
import { i as autoPrepareLegacyMatrixCrypto, o as autoMigrateLegacyMatrixState, r as resolveMatrixMigrationStatus } from "./matrix-migration.runtime-BNoT1Prt.js";
|
|
4
|
+
import { t as maybeCreateMatrixMigrationSnapshot } from "./migration-snapshot-backup-BR-xD7Ew.js";
|
|
5
|
+
import { detectPluginInstallPathIssue, formatPluginInstallPathIssue, removePluginFromConfig } from "klaw/plugin-sdk/runtime-doctor";
|
|
6
|
+
//#region extensions/matrix/src/doctor.ts
|
|
7
|
+
function hasConfiguredMatrixChannel(cfg) {
|
|
8
|
+
const channels = cfg.channels;
|
|
9
|
+
return isRecord(channels?.matrix);
|
|
10
|
+
}
|
|
11
|
+
function hasConfiguredMatrixPluginSurface(cfg) {
|
|
12
|
+
return Boolean(cfg.plugins?.installs?.matrix || cfg.plugins?.entries?.matrix || cfg.plugins?.allow?.includes("matrix") || cfg.plugins?.deny?.includes("matrix"));
|
|
13
|
+
}
|
|
14
|
+
function hasConfiguredMatrixEnv(env) {
|
|
15
|
+
return Object.entries(env).some(([key, value]) => key.startsWith("MATRIX_") && typeof value === "string" && value.trim());
|
|
16
|
+
}
|
|
17
|
+
function configMayNeedMatrixDoctorSequence(cfg, env) {
|
|
18
|
+
return hasConfiguredMatrixChannel(cfg) || hasConfiguredMatrixPluginSurface(cfg) || hasConfiguredMatrixEnv(env);
|
|
19
|
+
}
|
|
20
|
+
function formatMatrixLegacyStatePreview(detection) {
|
|
21
|
+
return [
|
|
22
|
+
"- Matrix plugin upgraded in place.",
|
|
23
|
+
`- Legacy sync store: ${detection.legacyStoragePath} -> ${detection.targetStoragePath}`,
|
|
24
|
+
`- Legacy crypto store: ${detection.legacyCryptoPath} -> ${detection.targetCryptoPath}`,
|
|
25
|
+
...detection.selectionNote ? [`- ${detection.selectionNote}`] : [],
|
|
26
|
+
"- Run \"klaw doctor --fix\" to migrate this Matrix state now."
|
|
27
|
+
].join("\n");
|
|
28
|
+
}
|
|
29
|
+
function formatMatrixLegacyCryptoPreview(detection) {
|
|
30
|
+
const notes = [];
|
|
31
|
+
for (const warning of detection.warnings) notes.push(`- ${warning}`);
|
|
32
|
+
for (const plan of detection.plans) notes.push([
|
|
33
|
+
`- Matrix encrypted-state migration is pending for account "${plan.accountId}".`,
|
|
34
|
+
`- Legacy crypto store: ${plan.legacyCryptoPath}`,
|
|
35
|
+
`- New recovery key file: ${plan.recoveryKeyPath}`,
|
|
36
|
+
`- Migration state file: ${plan.statePath}`,
|
|
37
|
+
"- Run \"klaw doctor --fix\" to extract any saved backup key now. Backed-up room keys will restore automatically on next gateway start."
|
|
38
|
+
].join("\n"));
|
|
39
|
+
return notes;
|
|
40
|
+
}
|
|
41
|
+
async function collectMatrixInstallPathWarnings(cfg) {
|
|
42
|
+
const issue = await detectPluginInstallPathIssue({
|
|
43
|
+
pluginId: "matrix",
|
|
44
|
+
install: cfg.plugins?.installs?.matrix
|
|
45
|
+
});
|
|
46
|
+
if (!issue) return [];
|
|
47
|
+
return formatPluginInstallPathIssue({
|
|
48
|
+
issue,
|
|
49
|
+
pluginLabel: "Matrix",
|
|
50
|
+
defaultInstallCommand: "klaw plugins install @kodelyth/matrix"
|
|
51
|
+
}).map((entry) => `- ${entry}`);
|
|
52
|
+
}
|
|
53
|
+
async function cleanStaleMatrixPluginConfig(cfg) {
|
|
54
|
+
const issue = await detectPluginInstallPathIssue({
|
|
55
|
+
pluginId: "matrix",
|
|
56
|
+
install: cfg.plugins?.installs?.matrix
|
|
57
|
+
});
|
|
58
|
+
if (!issue || issue.kind !== "missing-path") return {
|
|
59
|
+
config: cfg,
|
|
60
|
+
changes: []
|
|
61
|
+
};
|
|
62
|
+
const { config, actions } = removePluginFromConfig(cfg, "matrix");
|
|
63
|
+
const removed = [];
|
|
64
|
+
if (actions.install) removed.push("install record");
|
|
65
|
+
if (actions.loadPath) removed.push("load path");
|
|
66
|
+
if (actions.entry) removed.push("plugin entry");
|
|
67
|
+
if (actions.allowlist) removed.push("allowlist entry");
|
|
68
|
+
if (removed.length === 0) return {
|
|
69
|
+
config: cfg,
|
|
70
|
+
changes: []
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
config,
|
|
74
|
+
changes: [`Removed stale Matrix plugin references (${removed.join(", ")}). The previous install path no longer exists: ${issue.path}`]
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async function applyMatrixDoctorRepair(params) {
|
|
78
|
+
const changes = [];
|
|
79
|
+
const warnings = [];
|
|
80
|
+
const migrationStatus = resolveMatrixMigrationStatus({
|
|
81
|
+
cfg: params.cfg,
|
|
82
|
+
env: params.env
|
|
83
|
+
});
|
|
84
|
+
let matrixSnapshotReady = true;
|
|
85
|
+
if (migrationStatus.actionable) try {
|
|
86
|
+
const snapshot = await maybeCreateMatrixMigrationSnapshot({
|
|
87
|
+
trigger: "doctor-fix",
|
|
88
|
+
env: params.env
|
|
89
|
+
});
|
|
90
|
+
changes.push(`Matrix migration snapshot ${snapshot.created ? "created" : "reused"} before applying Matrix upgrades.\n- ${snapshot.archivePath}`);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
matrixSnapshotReady = false;
|
|
93
|
+
warnings.push(`- Failed creating a Matrix migration snapshot before repair: ${String(error)}`);
|
|
94
|
+
warnings.push("- Skipping Matrix migration changes for now. Resolve the snapshot failure, then rerun \"klaw doctor --fix\".");
|
|
95
|
+
}
|
|
96
|
+
else if (migrationStatus.pending) warnings.push("- Matrix migration warnings are present, but no on-disk Matrix mutation is actionable yet. No pre-migration snapshot was needed.");
|
|
97
|
+
if (!matrixSnapshotReady) return {
|
|
98
|
+
changes,
|
|
99
|
+
warnings
|
|
100
|
+
};
|
|
101
|
+
const matrixStateRepair = await autoMigrateLegacyMatrixState({
|
|
102
|
+
cfg: params.cfg,
|
|
103
|
+
env: params.env
|
|
104
|
+
});
|
|
105
|
+
if (matrixStateRepair.changes.length > 0) changes.push([
|
|
106
|
+
"Matrix plugin upgraded in place.",
|
|
107
|
+
...matrixStateRepair.changes.map((entry) => `- ${entry}`),
|
|
108
|
+
"- No user action required."
|
|
109
|
+
].join("\n"));
|
|
110
|
+
if (matrixStateRepair.warnings.length > 0) warnings.push(matrixStateRepair.warnings.map((entry) => `- ${entry}`).join("\n"));
|
|
111
|
+
const matrixCryptoRepair = await autoPrepareLegacyMatrixCrypto({
|
|
112
|
+
cfg: params.cfg,
|
|
113
|
+
env: params.env
|
|
114
|
+
});
|
|
115
|
+
if (matrixCryptoRepair.changes.length > 0) changes.push(["Matrix encrypted-state migration prepared.", ...matrixCryptoRepair.changes.map((entry) => `- ${entry}`)].join("\n"));
|
|
116
|
+
if (matrixCryptoRepair.warnings.length > 0) warnings.push(matrixCryptoRepair.warnings.map((entry) => `- ${entry}`).join("\n"));
|
|
117
|
+
return {
|
|
118
|
+
changes,
|
|
119
|
+
warnings
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async function runMatrixDoctorSequence(params) {
|
|
123
|
+
const warningNotes = [];
|
|
124
|
+
const changeNotes = [];
|
|
125
|
+
const installWarnings = await collectMatrixInstallPathWarnings(params.cfg);
|
|
126
|
+
if (installWarnings.length > 0) warningNotes.push(installWarnings.join("\n"));
|
|
127
|
+
if (!configMayNeedMatrixDoctorSequence(params.cfg, params.env)) return {
|
|
128
|
+
changeNotes,
|
|
129
|
+
warningNotes
|
|
130
|
+
};
|
|
131
|
+
if (params.shouldRepair) {
|
|
132
|
+
const repair = await applyMatrixDoctorRepair({
|
|
133
|
+
cfg: params.cfg,
|
|
134
|
+
env: params.env
|
|
135
|
+
});
|
|
136
|
+
changeNotes.push(...repair.changes);
|
|
137
|
+
warningNotes.push(...repair.warnings);
|
|
138
|
+
} else {
|
|
139
|
+
const migrationStatus = resolveMatrixMigrationStatus({
|
|
140
|
+
cfg: params.cfg,
|
|
141
|
+
env: params.env
|
|
142
|
+
});
|
|
143
|
+
if (migrationStatus.legacyState) if ("warning" in migrationStatus.legacyState) warningNotes.push(`- ${migrationStatus.legacyState.warning}`);
|
|
144
|
+
else warningNotes.push(formatMatrixLegacyStatePreview(migrationStatus.legacyState));
|
|
145
|
+
if (migrationStatus.legacyCrypto.warnings.length > 0 || migrationStatus.legacyCrypto.plans.length > 0) warningNotes.push(...formatMatrixLegacyCryptoPreview(migrationStatus.legacyCrypto));
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
changeNotes,
|
|
149
|
+
warningNotes
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
export { cleanStaleMatrixPluginConfig, runMatrixDoctorSequence };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { n as editMessageMatrix, r as prepareMatrixSingleText, s as sendSingleTextMessageMatrix, y as MsgType } from "./send-CJunc6QM.js";
|
|
2
|
+
import { createDraftStreamLoop } from "klaw/plugin-sdk/channel-lifecycle";
|
|
3
|
+
//#region extensions/matrix/src/matrix/draft-stream.ts
|
|
4
|
+
const DEFAULT_THROTTLE_MS = 1e3;
|
|
5
|
+
function resolveDraftPreviewOptions(mode) {
|
|
6
|
+
if (mode === "quiet") return {
|
|
7
|
+
msgtype: MsgType.Notice,
|
|
8
|
+
includeMentions: false
|
|
9
|
+
};
|
|
10
|
+
return { msgtype: MsgType.Text };
|
|
11
|
+
}
|
|
12
|
+
function createMatrixDraftStream(params) {
|
|
13
|
+
const { roomId, client, cfg, threadId, accountId, log } = params;
|
|
14
|
+
const preview = resolveDraftPreviewOptions(params.mode ?? "partial");
|
|
15
|
+
const useLive = params.mode !== "quiet";
|
|
16
|
+
let currentEventId;
|
|
17
|
+
let lastSentText = "";
|
|
18
|
+
let stopped = false;
|
|
19
|
+
let sendFailed = false;
|
|
20
|
+
let finalizeInPlaceBlocked = false;
|
|
21
|
+
let liveFinalized = false;
|
|
22
|
+
let replyToId = params.replyToId;
|
|
23
|
+
const sendOrEdit = async (text) => {
|
|
24
|
+
const trimmed = text.trimEnd();
|
|
25
|
+
if (!trimmed) return false;
|
|
26
|
+
const preparedText = prepareMatrixSingleText(trimmed, {
|
|
27
|
+
cfg,
|
|
28
|
+
accountId
|
|
29
|
+
});
|
|
30
|
+
if (!preparedText.fitsInSingleEvent) {
|
|
31
|
+
finalizeInPlaceBlocked = true;
|
|
32
|
+
if (!currentEventId) sendFailed = true;
|
|
33
|
+
stopped = true;
|
|
34
|
+
log?.(`draft-stream: preview exceeded single-event limit (${preparedText.convertedText.length} > ${preparedText.singleEventLimit})`);
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
if (sendFailed) return false;
|
|
38
|
+
if (preparedText.trimmedText === lastSentText) return true;
|
|
39
|
+
try {
|
|
40
|
+
if (!currentEventId) {
|
|
41
|
+
currentEventId = (await sendSingleTextMessageMatrix(roomId, preparedText.trimmedText, {
|
|
42
|
+
client,
|
|
43
|
+
cfg,
|
|
44
|
+
replyToId,
|
|
45
|
+
threadId,
|
|
46
|
+
accountId,
|
|
47
|
+
msgtype: preview.msgtype,
|
|
48
|
+
includeMentions: preview.includeMentions,
|
|
49
|
+
live: useLive
|
|
50
|
+
})).messageId;
|
|
51
|
+
lastSentText = preparedText.trimmedText;
|
|
52
|
+
log?.(`draft-stream: created message ${currentEventId}${useLive ? " (MSC4357 live)" : ""}`);
|
|
53
|
+
} else {
|
|
54
|
+
await editMessageMatrix(roomId, currentEventId, preparedText.trimmedText, {
|
|
55
|
+
client,
|
|
56
|
+
cfg,
|
|
57
|
+
threadId,
|
|
58
|
+
accountId,
|
|
59
|
+
msgtype: preview.msgtype,
|
|
60
|
+
includeMentions: preview.includeMentions,
|
|
61
|
+
live: useLive
|
|
62
|
+
});
|
|
63
|
+
lastSentText = preparedText.trimmedText;
|
|
64
|
+
}
|
|
65
|
+
return true;
|
|
66
|
+
} catch (err) {
|
|
67
|
+
log?.(`draft-stream: send/edit failed: ${String(err)}`);
|
|
68
|
+
if (err instanceof Error && err.message.startsWith("Matrix single-message text exceeds limit")) finalizeInPlaceBlocked = true;
|
|
69
|
+
if (!currentEventId) sendFailed = true;
|
|
70
|
+
stopped = true;
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const loop = createDraftStreamLoop({
|
|
75
|
+
throttleMs: DEFAULT_THROTTLE_MS,
|
|
76
|
+
isStopped: () => stopped,
|
|
77
|
+
sendOrEditStreamMessage: sendOrEdit
|
|
78
|
+
});
|
|
79
|
+
log?.(`draft-stream: ready (throttleMs=${DEFAULT_THROTTLE_MS})`);
|
|
80
|
+
const finalizeLive = async () => {
|
|
81
|
+
if (useLive && !liveFinalized && currentEventId && lastSentText) {
|
|
82
|
+
liveFinalized = true;
|
|
83
|
+
try {
|
|
84
|
+
await editMessageMatrix(roomId, currentEventId, lastSentText, {
|
|
85
|
+
client,
|
|
86
|
+
cfg,
|
|
87
|
+
threadId,
|
|
88
|
+
accountId,
|
|
89
|
+
msgtype: preview.msgtype,
|
|
90
|
+
includeMentions: preview.includeMentions,
|
|
91
|
+
live: false
|
|
92
|
+
});
|
|
93
|
+
log?.(`draft-stream: finalized ${currentEventId} (MSC4357 stream ended)`);
|
|
94
|
+
return true;
|
|
95
|
+
} catch (err) {
|
|
96
|
+
log?.(`draft-stream: finalize edit failed: ${String(err)}`);
|
|
97
|
+
finalizeInPlaceBlocked = true;
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
102
|
+
};
|
|
103
|
+
const stop = async () => {
|
|
104
|
+
await loop.flush();
|
|
105
|
+
stopped = true;
|
|
106
|
+
return currentEventId;
|
|
107
|
+
};
|
|
108
|
+
const discardPending = async () => {
|
|
109
|
+
stopped = true;
|
|
110
|
+
loop.stop();
|
|
111
|
+
await loop.waitForInFlight();
|
|
112
|
+
};
|
|
113
|
+
const reset = () => {
|
|
114
|
+
replyToId = params.preserveReplyId ? params.replyToId : void 0;
|
|
115
|
+
currentEventId = void 0;
|
|
116
|
+
lastSentText = "";
|
|
117
|
+
stopped = false;
|
|
118
|
+
sendFailed = false;
|
|
119
|
+
finalizeInPlaceBlocked = false;
|
|
120
|
+
liveFinalized = false;
|
|
121
|
+
loop.resetPending();
|
|
122
|
+
loop.resetThrottleWindow();
|
|
123
|
+
};
|
|
124
|
+
return {
|
|
125
|
+
update: (text) => {
|
|
126
|
+
if (stopped) return;
|
|
127
|
+
loop.update(text);
|
|
128
|
+
},
|
|
129
|
+
flush: loop.flush,
|
|
130
|
+
stop,
|
|
131
|
+
discardPending,
|
|
132
|
+
finalizeLive,
|
|
133
|
+
reset,
|
|
134
|
+
eventId: () => currentEventId,
|
|
135
|
+
matchesPreparedText: (text) => prepareMatrixSingleText(text, {
|
|
136
|
+
cfg,
|
|
137
|
+
accountId
|
|
138
|
+
}).trimmedText === lastSentText,
|
|
139
|
+
mustDeliverFinalNormally: () => sendFailed || finalizeInPlaceBlocked
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//#endregion
|
|
143
|
+
export { createMatrixDraftStream };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId } from "./account-selection-Y50DNJ2l.js";
|
|
2
|
+
import { t as resolveMatrixConfigFieldPath } from "./config-paths-DVvt6vM3.js";
|
|
3
|
+
import { normalizeOptionalAccountId } from "klaw/plugin-sdk/account-id";
|
|
4
|
+
//#region extensions/matrix/src/matrix/encryption-guidance.ts
|
|
5
|
+
function resolveMatrixEncryptionConfigPath(cfg, accountId) {
|
|
6
|
+
return resolveMatrixConfigFieldPath(cfg, normalizeOptionalAccountId(accountId) ?? resolveMatrixDefaultOrOnlyAccountId(cfg), "encryption");
|
|
7
|
+
}
|
|
8
|
+
function formatMatrixEncryptionUnavailableError(cfg, accountId) {
|
|
9
|
+
return `Matrix encryption is not available (enable ${resolveMatrixEncryptionConfigPath(cfg, accountId)}=true)`;
|
|
10
|
+
}
|
|
11
|
+
function formatMatrixEncryptedEventDisabledWarning(cfg, accountId) {
|
|
12
|
+
return `matrix: encrypted event received without encryption enabled; set ${resolveMatrixEncryptionConfigPath(cfg, accountId)}=true and verify the device to decrypt`;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { formatMatrixEncryptionUnavailableError as n, formatMatrixEncryptedEventDisabledWarning as t };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { t as getMatrixScopedEnvVarNames } from "./env-vars-EQKQv-FE.js";
|
|
2
|
+
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "klaw/plugin-sdk/account-id";
|
|
3
|
+
//#region extensions/matrix/src/matrix/client/env-auth.ts
|
|
4
|
+
function cleanEnv(value) {
|
|
5
|
+
return typeof value === "string" ? value.trim() : "";
|
|
6
|
+
}
|
|
7
|
+
function resolveGlobalMatrixEnvConfig(env) {
|
|
8
|
+
return {
|
|
9
|
+
homeserver: cleanEnv(env.MATRIX_HOMESERVER),
|
|
10
|
+
userId: cleanEnv(env.MATRIX_USER_ID),
|
|
11
|
+
accessToken: cleanEnv(env.MATRIX_ACCESS_TOKEN) || void 0,
|
|
12
|
+
password: cleanEnv(env.MATRIX_PASSWORD) || void 0,
|
|
13
|
+
deviceId: cleanEnv(env.MATRIX_DEVICE_ID) || void 0,
|
|
14
|
+
deviceName: cleanEnv(env.MATRIX_DEVICE_NAME) || void 0
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function hasReadyMatrixEnvAuth(config) {
|
|
18
|
+
const homeserver = cleanEnv(config.homeserver);
|
|
19
|
+
const userId = cleanEnv(config.userId);
|
|
20
|
+
const accessToken = cleanEnv(config.accessToken);
|
|
21
|
+
const password = cleanEnv(config.password);
|
|
22
|
+
return Boolean(homeserver && (accessToken || userId && password));
|
|
23
|
+
}
|
|
24
|
+
function resolveScopedMatrixEnvConfig(accountId, env = process.env) {
|
|
25
|
+
const keys = getMatrixScopedEnvVarNames(accountId);
|
|
26
|
+
return {
|
|
27
|
+
homeserver: cleanEnv(env[keys.homeserver]),
|
|
28
|
+
userId: cleanEnv(env[keys.userId]),
|
|
29
|
+
accessToken: cleanEnv(env[keys.accessToken]) || void 0,
|
|
30
|
+
password: cleanEnv(env[keys.password]) || void 0,
|
|
31
|
+
deviceId: cleanEnv(env[keys.deviceId]) || void 0,
|
|
32
|
+
deviceName: cleanEnv(env[keys.deviceName]) || void 0
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function resolveMatrixEnvAuthReadiness(accountId, env = process.env) {
|
|
36
|
+
const normalizedAccountId = normalizeAccountId(accountId);
|
|
37
|
+
const scoped = resolveScopedMatrixEnvConfig(normalizedAccountId, env);
|
|
38
|
+
const scopedReady = hasReadyMatrixEnvAuth(scoped);
|
|
39
|
+
if (normalizedAccountId !== DEFAULT_ACCOUNT_ID) {
|
|
40
|
+
const keys = getMatrixScopedEnvVarNames(normalizedAccountId);
|
|
41
|
+
return {
|
|
42
|
+
ready: scopedReady,
|
|
43
|
+
homeserver: scoped.homeserver || void 0,
|
|
44
|
+
userId: scoped.userId || void 0,
|
|
45
|
+
sourceHint: `${keys.homeserver} (+ auth vars)`,
|
|
46
|
+
missingMessage: `Set per-account env vars for "${normalizedAccountId}" (for example ${keys.homeserver} + ${keys.accessToken} or ${keys.userId} + ${keys.password}).`
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const defaultScoped = resolveScopedMatrixEnvConfig(DEFAULT_ACCOUNT_ID, env);
|
|
50
|
+
const global = resolveGlobalMatrixEnvConfig(env);
|
|
51
|
+
const defaultScopedReady = hasReadyMatrixEnvAuth(defaultScoped);
|
|
52
|
+
const globalReady = hasReadyMatrixEnvAuth(global);
|
|
53
|
+
const defaultKeys = getMatrixScopedEnvVarNames(DEFAULT_ACCOUNT_ID);
|
|
54
|
+
return {
|
|
55
|
+
ready: defaultScopedReady || globalReady,
|
|
56
|
+
homeserver: defaultScoped.homeserver || global.homeserver || void 0,
|
|
57
|
+
userId: defaultScoped.userId || global.userId || void 0,
|
|
58
|
+
sourceHint: "MATRIX_* or MATRIX_DEFAULT_*",
|
|
59
|
+
missingMessage: `Set Matrix env vars for the default account (for example MATRIX_HOMESERVER + MATRIX_ACCESS_TOKEN, MATRIX_USER_ID + MATRIX_PASSWORD, or ${defaultKeys.homeserver} + ${defaultKeys.accessToken}).`
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { resolveScopedMatrixEnvConfig as i, resolveGlobalMatrixEnvConfig as n, resolveMatrixEnvAuthReadiness as r, hasReadyMatrixEnvAuth as t };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { normalizeAccountId, normalizeOptionalAccountId } from "klaw/plugin-sdk/account-id";
|
|
2
|
+
//#region extensions/matrix/src/env-vars.ts
|
|
3
|
+
const MATRIX_SCOPED_ENV_SUFFIXES = [
|
|
4
|
+
"HOMESERVER",
|
|
5
|
+
"USER_ID",
|
|
6
|
+
"ACCESS_TOKEN",
|
|
7
|
+
"PASSWORD",
|
|
8
|
+
"DEVICE_ID",
|
|
9
|
+
"DEVICE_NAME"
|
|
10
|
+
];
|
|
11
|
+
const MATRIX_GLOBAL_ENV_KEYS = MATRIX_SCOPED_ENV_SUFFIXES.map((suffix) => `MATRIX_${suffix}`);
|
|
12
|
+
const MATRIX_SCOPED_ENV_RE = new RegExp(`^MATRIX_(.+)_(${MATRIX_SCOPED_ENV_SUFFIXES.join("|")})$`);
|
|
13
|
+
function resolveMatrixEnvAccountToken(accountId) {
|
|
14
|
+
return Array.from(normalizeAccountId(accountId)).map((char) => /[a-z0-9]/.test(char) ? char.toUpperCase() : `_X${char.codePointAt(0)?.toString(16).toUpperCase() ?? "00"}_`).join("");
|
|
15
|
+
}
|
|
16
|
+
function getMatrixScopedEnvVarNames(accountId) {
|
|
17
|
+
const token = resolveMatrixEnvAccountToken(accountId);
|
|
18
|
+
return {
|
|
19
|
+
homeserver: `MATRIX_${token}_HOMESERVER`,
|
|
20
|
+
userId: `MATRIX_${token}_USER_ID`,
|
|
21
|
+
accessToken: `MATRIX_${token}_ACCESS_TOKEN`,
|
|
22
|
+
password: `MATRIX_${token}_PASSWORD`,
|
|
23
|
+
deviceId: `MATRIX_${token}_DEVICE_ID`,
|
|
24
|
+
deviceName: `MATRIX_${token}_DEVICE_NAME`
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function decodeMatrixEnvAccountToken(token) {
|
|
28
|
+
let decoded = "";
|
|
29
|
+
for (let index = 0; index < token.length;) {
|
|
30
|
+
const hexEscape = /^_X([0-9A-F]+)_/.exec(token.slice(index));
|
|
31
|
+
if (hexEscape) {
|
|
32
|
+
const hex = hexEscape[1];
|
|
33
|
+
const codePoint = hex ? Number.parseInt(hex, 16) : NaN;
|
|
34
|
+
if (!Number.isFinite(codePoint)) return;
|
|
35
|
+
decoded += String.fromCodePoint(codePoint);
|
|
36
|
+
index += hexEscape[0].length;
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const char = token[index];
|
|
40
|
+
if (!char || !/[A-Z0-9]/.test(char)) return;
|
|
41
|
+
decoded += char.toLowerCase();
|
|
42
|
+
index += 1;
|
|
43
|
+
}
|
|
44
|
+
const normalized = normalizeOptionalAccountId(decoded);
|
|
45
|
+
if (!normalized) return;
|
|
46
|
+
return resolveMatrixEnvAccountToken(normalized) === token ? normalized : void 0;
|
|
47
|
+
}
|
|
48
|
+
function listMatrixEnvAccountIds(env = process.env) {
|
|
49
|
+
const ids = /* @__PURE__ */ new Set();
|
|
50
|
+
for (const key of MATRIX_GLOBAL_ENV_KEYS) if (typeof env[key] === "string" && env[key]?.trim()) {
|
|
51
|
+
ids.add(normalizeAccountId("default"));
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
for (const key of Object.keys(env)) {
|
|
55
|
+
const match = MATRIX_SCOPED_ENV_RE.exec(key);
|
|
56
|
+
if (!match) continue;
|
|
57
|
+
const accountId = decodeMatrixEnvAccountToken(match[1]);
|
|
58
|
+
if (accountId) ids.add(accountId);
|
|
59
|
+
}
|
|
60
|
+
return Array.from(ids).toSorted((a, b) => a.localeCompare(b));
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { listMatrixEnvAccountIds as n, resolveMatrixEnvAccountToken as r, getMatrixScopedEnvVarNames as t };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { normalizeLowercaseStringOrEmpty } from "klaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
+
import { formatErrorMessage } from "klaw/plugin-sdk/error-runtime";
|
|
3
|
+
//#region extensions/matrix/src/matrix/errors.ts
|
|
4
|
+
function formatMatrixErrorMessage(err) {
|
|
5
|
+
return formatErrorMessage(err);
|
|
6
|
+
}
|
|
7
|
+
function formatMatrixErrorReason(err) {
|
|
8
|
+
return normalizeLowercaseStringOrEmpty(formatMatrixErrorMessage(err));
|
|
9
|
+
}
|
|
10
|
+
function isMatrixNotFoundError(err) {
|
|
11
|
+
const errObj = err;
|
|
12
|
+
if (errObj?.statusCode === 404 || errObj?.body?.errcode === "M_NOT_FOUND") return true;
|
|
13
|
+
const message = formatMatrixErrorReason(err);
|
|
14
|
+
return message.includes("m_not_found") || message.includes("[404]") || message.includes("not found");
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { formatMatrixErrorReason as n, isMatrixNotFoundError as r, formatMatrixErrorMessage as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isApprovalNotFoundError } from "klaw/plugin-sdk/error-runtime";
|
|
2
|
+
import { resolveApprovalOverGateway } from "klaw/plugin-sdk/approval-gateway-runtime";
|
|
3
|
+
//#region extensions/matrix/src/exec-approval-resolver.ts
|
|
4
|
+
async function resolveMatrixApproval(params) {
|
|
5
|
+
await resolveApprovalOverGateway({
|
|
6
|
+
cfg: params.cfg,
|
|
7
|
+
approvalId: params.approvalId,
|
|
8
|
+
decision: params.decision,
|
|
9
|
+
senderId: params.senderId,
|
|
10
|
+
gatewayUrl: params.gatewayUrl,
|
|
11
|
+
clientDisplayName: `Matrix approval (${params.senderId?.trim() || "unknown"})`
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { isApprovalNotFoundError, resolveMatrixApproval };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { a as resolveMatrixDefaultOrOnlyAccountId, i as resolveMatrixChannelConfig, n as requiresExplicitMatrixDefaultAccount, r as resolveConfiguredMatrixAccountIds, t as findMatrixAccountEntry } from "./account-selection-Y50DNJ2l.js";
|
|
2
|
+
import { n as listMatrixEnvAccountIds, r as resolveMatrixEnvAccountToken, t as getMatrixScopedEnvVarNames } from "./env-vars-EQKQv-FE.js";
|
|
3
|
+
import { a as resolveMatrixCredentialsPath, c as resolveMatrixLegacyFlatStoreRoot, i as resolveMatrixCredentialsFilename, l as sanitizeMatrixPathSegment, n as resolveMatrixAccountStorageRoot, o as resolveMatrixHomeserverKey, r as resolveMatrixCredentialsDir, s as resolveMatrixLegacyFlatStoragePaths, t as hashMatrixAccessToken } from "./storage-paths-BTAketfg.js";
|
|
4
|
+
export { findMatrixAccountEntry, getMatrixScopedEnvVarNames, hashMatrixAccessToken, listMatrixEnvAccountIds, requiresExplicitMatrixDefaultAccount, resolveConfiguredMatrixAccountIds, resolveMatrixAccountStorageRoot, resolveMatrixChannelConfig, resolveMatrixCredentialsDir, resolveMatrixCredentialsFilename, resolveMatrixCredentialsPath, resolveMatrixDefaultOrOnlyAccountId, resolveMatrixEnvAccountToken, resolveMatrixHomeserverKey, resolveMatrixLegacyFlatStoragePaths, resolveMatrixLegacyFlatStoreRoot, sanitizeMatrixPathSegment };
|