mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 04:13:17 +08:00
Ops bots now isolate per-speaker Harness sessions in groups, with a settings/RPC toggle to restore shared chat sessions when needed. Co-authored-by: Cursor <cursoragent@cursor.com>
17 lines
676 B
JavaScript
17 lines
676 B
JavaScript
import { validateGroupSessionScope } from '../../../../src/channels/shared/session-scope.mjs';
|
|
|
|
export const SET_GROUP_SESSION_SCOPE_ENDPOINT = 'bot.group-session-scope.set';
|
|
|
|
export function validGroupSessionScopePayload(payload) {
|
|
try {
|
|
if (!payload || typeof payload !== 'object' || Array.isArray(payload)
|
|
|| Reflect.ownKeys(payload).length !== 2
|
|
|| !Object.hasOwn(payload, 'botId') || !Object.hasOwn(payload, 'groupSessionScope')
|
|
|| typeof payload.botId !== 'string'
|
|
|| !/^[A-Za-z0-9_-]{1,128}$/.test(payload.botId)) return false;
|
|
validateGroupSessionScope(payload.groupSessionScope);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|