feat(cognition): finish multi-character knowledge and monitor workflow

This commit is contained in:
Youzini-afk
2026-04-08 18:21:27 +08:00
parent 5818562145
commit a4fed87e6e
20 changed files with 3451 additions and 19 deletions

View File

@@ -226,12 +226,16 @@ export function classifyNodeScopeBucket(
activeCharacterPovOwner = "",
activeUserPovOwner = "",
activeRegion = "",
adjacentRegions = [],
enablePovMemory = true,
enableRegionScopedObjective = true,
} = {},
) {
const scope = normalizeMemoryScope(node?.scope);
const normalizedActiveRegion = normalizeKey(activeRegion);
const normalizedAdjacentRegions = new Set(
normalizeStringArray(adjacentRegions).map((value) => normalizeKey(value)),
);
if (scope.layer === MEMORY_SCOPE_LAYER.POV) {
if (!enablePovMemory) {
@@ -272,9 +276,15 @@ export function classifyNodeScopeBucket(
if (regionPrimary && regionPrimary === normalizedActiveRegion) {
return MEMORY_SCOPE_BUCKETS.OBJECTIVE_CURRENT_REGION;
}
if (regionPrimary && normalizedAdjacentRegions.has(regionPrimary)) {
return MEMORY_SCOPE_BUCKETS.OBJECTIVE_ADJACENT_REGION;
}
const tokens = getScopeRegionTokens(scope).map((value) => normalizeKey(value));
if (tokens.includes(normalizedActiveRegion)) {
if (
tokens.includes(normalizedActiveRegion) ||
tokens.some((token) => normalizedAdjacentRegions.has(token))
) {
return MEMORY_SCOPE_BUCKETS.OBJECTIVE_ADJACENT_REGION;
}