Add configurable group session scope (default user_in_chat).

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>
This commit is contained in:
oliver 2026-09-05 15:39:28 +08:00
parent d10a941fc8
commit 7f1b9bd480
30 changed files with 798 additions and 282 deletions

View file

@ -0,0 +1,17 @@
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;
}
}