1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! The shared/group session gate for memory results (#1051, ADR-003;
//! internal surfaces joined via #1957).
//!
//! The gate must know whether the current session is a shared/group chat
//! (several people can read the reply) or the owner's own session. Channel
//! handlers know that when they resolve a session (they see the chat type)
//! so they mark it here; `memory_search` checks it before returning external
//! content, and since #1957 the internal surfaces (brain/memory scopes,
//! personal brain files through `load_brain_file`, per-turn MEMORY.md
//! recall) consult the same decision through `internal_content_blocked`.
//! Process-local by design: on restart the set is
//! empty and each channel re-marks its group sessions on first use, which is
//! harmless because the gate only ever denies until then.
use HashSet;
use ;
use Uuid;
/// Session IDs of shared/group channel sessions.
static SHARED_SESSIONS: =
new;
/// Mark a session as a shared/group channel session (#1051). Called by the
/// channel handlers when they resolve a session for a group chat.
/// Whether a session is a shared/group channel session (#1051). Consulted by
/// the `memory_search` external gate.
/// Whether a brain file carries the owner's personal context and is therefore
/// main-session-only in shared/group sessions (#1957).
///
/// The boundary comes from the brain-file ownership docs themselves: generic
/// files (SOUL/AGENTS/CODE/TOOLS/SECURITY/BOOT) ship the same for everyone
/// and shared sessions legitimately consult them for conventions;
/// USER/MEMORY accumulate per user and stay private; HEARTBEAT is the owner's
/// standing checklist; everything else under the home dir is user-created
/// content, private by default. Anything path-like (memory/... daily logs)
/// is personal too.