Some checks are pending
CI / install-check (push) Waiting to run
CI / checks (bunx tsc -p tsconfig.json --noEmit false, bun, build) (push) Waiting to run
CI / checks (pnpm build && pnpm lint, node, lint) (push) Waiting to run
CI / checks (pnpm canvas:a2ui:bundle && bunx vitest run, bun, test) (push) Waiting to run
CI / checks (pnpm canvas:a2ui:bundle && pnpm test, node, test) (push) Waiting to run
CI / checks (pnpm format, node, format) (push) Waiting to run
CI / checks (pnpm protocol:check, node, protocol) (push) Waiting to run
CI / checks (pnpm tsgo, node, tsgo) (push) Waiting to run
CI / secrets (push) Waiting to run
CI / checks-windows (pnpm build && pnpm lint, node, build & lint) (push) Waiting to run
CI / checks-windows (pnpm canvas:a2ui:bundle && pnpm test, node, test) (push) Waiting to run
CI / checks-windows (pnpm protocol:check, node, protocol) (push) Waiting to run
CI / checks-macos (pnpm test, test) (push) Waiting to run
CI / macos-app (set -euo pipefail
for attempt in 1 2 3; do
if swift build --package-path apps/macos --configuration release; then
exit 0
fi
echo "swift build failed (attempt $attempt/3). Retrying…"
sleep $((attempt * 20))
done
exit 1
, build) (push) Waiting to run
CI / macos-app (set -euo pipefail
for attempt in 1 2 3; do
if swift test --package-path apps/macos --parallel --enable-code-coverage --show-codecov-path; then
exit 0
fi
echo "swift test failed (attempt $attempt/3). Retrying…"
sleep $((attempt … (push) Waiting to run
CI / macos-app (swiftlint --config .swiftlint.yml
swiftformat --lint apps/macos/Sources --config .swiftformat
, lint) (push) Waiting to run
CI / ios (push) Waiting to run
CI / android (./gradlew --no-daemon :app:assembleDebug, build) (push) Waiting to run
CI / android (./gradlew --no-daemon :app:testDebugUnitTest, test) (push) Waiting to run
Workflow Sanity / no-tabs (push) Waiting to run
- Multi-account support via sharedClients Map - Account-specific client connections - Proper account isolation for Matrix bindings - EventStore multi-agent config support (agents property) Consolidates separate matrix extension into main repo.
61 lines
2.1 KiB
TypeScript
61 lines
2.1 KiB
TypeScript
import type { ChannelGroupContext, GroupToolPolicyConfig } from "openclaw/plugin-sdk";
|
|
|
|
import { resolveMatrixRoomConfig } from "./matrix/monitor/rooms.js";
|
|
import type { CoreConfig } from "./types.js";
|
|
|
|
export function resolveMatrixGroupRequireMention(params: ChannelGroupContext): boolean {
|
|
const rawGroupId = params.groupId?.trim() ?? "";
|
|
let roomId = rawGroupId;
|
|
const lower = roomId.toLowerCase();
|
|
if (lower.startsWith("matrix:")) {
|
|
roomId = roomId.slice("matrix:".length).trim();
|
|
}
|
|
if (roomId.toLowerCase().startsWith("channel:")) {
|
|
roomId = roomId.slice("channel:".length).trim();
|
|
}
|
|
if (roomId.toLowerCase().startsWith("room:")) {
|
|
roomId = roomId.slice("room:".length).trim();
|
|
}
|
|
const groupChannel = params.groupChannel?.trim() ?? "";
|
|
const aliases = groupChannel ? [groupChannel] : [];
|
|
const cfg = params.cfg as CoreConfig;
|
|
const resolved = resolveMatrixRoomConfig({
|
|
rooms: cfg.channels?.matrix?.groups ?? cfg.channels?.matrix?.rooms,
|
|
roomId,
|
|
aliases,
|
|
name: groupChannel || undefined,
|
|
}).config;
|
|
if (resolved) {
|
|
if (resolved.autoReply === true) return false;
|
|
if (resolved.autoReply === false) return true;
|
|
if (typeof resolved.requireMention === "boolean") return resolved.requireMention;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
export function resolveMatrixGroupToolPolicy(
|
|
params: ChannelGroupContext,
|
|
): GroupToolPolicyConfig | undefined {
|
|
const rawGroupId = params.groupId?.trim() ?? "";
|
|
let roomId = rawGroupId;
|
|
const lower = roomId.toLowerCase();
|
|
if (lower.startsWith("matrix:")) {
|
|
roomId = roomId.slice("matrix:".length).trim();
|
|
}
|
|
if (roomId.toLowerCase().startsWith("channel:")) {
|
|
roomId = roomId.slice("channel:".length).trim();
|
|
}
|
|
if (roomId.toLowerCase().startsWith("room:")) {
|
|
roomId = roomId.slice("room:".length).trim();
|
|
}
|
|
const groupChannel = params.groupChannel?.trim() ?? "";
|
|
const aliases = groupChannel ? [groupChannel] : [];
|
|
const cfg = params.cfg as CoreConfig;
|
|
const resolved = resolveMatrixRoomConfig({
|
|
rooms: cfg.channels?.matrix?.groups ?? cfg.channels?.matrix?.rooms,
|
|
roomId,
|
|
aliases,
|
|
name: groupChannel || undefined,
|
|
}).config;
|
|
return resolved?.tools;
|
|
}
|