mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-06-13 18:31:16 +08:00
feat(cognition): finish multi-character knowledge and monitor workflow
This commit is contained in:
@@ -27,6 +27,7 @@ const runtimeDebugState = {
|
||||
taskPromptBuilds: {},
|
||||
taskLlmRequests: {},
|
||||
injections: {},
|
||||
taskTimeline: [],
|
||||
updatedAt: "",
|
||||
};
|
||||
|
||||
@@ -39,6 +40,7 @@ export function resetRuntimeDebugSnapshot() {
|
||||
runtimeDebugState.taskPromptBuilds = {};
|
||||
runtimeDebugState.taskLlmRequests = {};
|
||||
runtimeDebugState.injections = {};
|
||||
runtimeDebugState.taskTimeline = [];
|
||||
runtimeDebugState.updatedAt = nowIso();
|
||||
}
|
||||
|
||||
@@ -81,6 +83,7 @@ export function getRuntimeDebugSnapshot() {
|
||||
taskPromptBuilds: runtimeDebugState.taskPromptBuilds,
|
||||
taskLlmRequests: runtimeDebugState.taskLlmRequests,
|
||||
injections: runtimeDebugState.injections,
|
||||
taskTimeline: runtimeDebugState.taskTimeline,
|
||||
updatedAt: runtimeDebugState.updatedAt,
|
||||
},
|
||||
{
|
||||
@@ -88,6 +91,7 @@ export function getRuntimeDebugSnapshot() {
|
||||
taskPromptBuilds: {},
|
||||
taskLlmRequests: {},
|
||||
injections: {},
|
||||
taskTimeline: [],
|
||||
updatedAt: "",
|
||||
},
|
||||
);
|
||||
|
||||
@@ -3,6 +3,11 @@ import {
|
||||
normalizeEdgeMemoryScope,
|
||||
normalizeNodeMemoryScope,
|
||||
} from "../graph/memory-scope.js";
|
||||
import {
|
||||
createDefaultKnowledgeState,
|
||||
createDefaultRegionState,
|
||||
normalizeGraphCognitiveState,
|
||||
} from "../graph/knowledge-state.js";
|
||||
|
||||
const BATCH_JOURNAL_LIMIT = 96;
|
||||
const MAINTENANCE_JOURNAL_LIMIT = 20;
|
||||
@@ -28,8 +33,11 @@ export function createDefaultHistoryState(chatId = "") {
|
||||
lastBatchStatus: null,
|
||||
lastExtractedRegion: "",
|
||||
activeRegion: "",
|
||||
activeRegionSource: "",
|
||||
activeCharacterPovOwner: "",
|
||||
activeUserPovOwner: "",
|
||||
activeRecallOwnerKey: "",
|
||||
recentRecallOwnerKeys: [],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -113,12 +121,29 @@ export function normalizeGraphRuntimeState(graph, chatId = "") {
|
||||
if (typeof historyState.activeRegion !== "string") {
|
||||
historyState.activeRegion = historyState.lastExtractedRegion || "";
|
||||
}
|
||||
if (typeof historyState.activeRegionSource !== "string") {
|
||||
historyState.activeRegionSource = historyState.activeRegion ? "history" : "";
|
||||
}
|
||||
if (typeof historyState.activeCharacterPovOwner !== "string") {
|
||||
historyState.activeCharacterPovOwner = "";
|
||||
}
|
||||
if (typeof historyState.activeUserPovOwner !== "string") {
|
||||
historyState.activeUserPovOwner = "";
|
||||
}
|
||||
if (typeof historyState.activeRecallOwnerKey !== "string") {
|
||||
historyState.activeRecallOwnerKey = "";
|
||||
}
|
||||
if (!Array.isArray(historyState.recentRecallOwnerKeys)) {
|
||||
historyState.recentRecallOwnerKeys = [];
|
||||
} else {
|
||||
historyState.recentRecallOwnerKeys = [
|
||||
...new Set(
|
||||
historyState.recentRecallOwnerKeys
|
||||
.map((value) => String(value || "").trim())
|
||||
.filter(Boolean),
|
||||
),
|
||||
].slice(0, 8);
|
||||
}
|
||||
|
||||
if (
|
||||
!historyState.processedMessageHashes ||
|
||||
@@ -220,6 +245,9 @@ export function normalizeGraphRuntimeState(graph, chatId = "") {
|
||||
.filter((entry) => entry && typeof entry === "object")
|
||||
.slice(-MAINTENANCE_JOURNAL_LIMIT)
|
||||
: createDefaultMaintenanceJournal();
|
||||
graph.knowledgeState = createDefaultKnowledgeState(graph.knowledgeState);
|
||||
graph.regionState = createDefaultRegionState(graph.regionState);
|
||||
normalizeGraphCognitiveState(graph);
|
||||
graph.lastProcessedSeq = historyState.lastProcessedAssistantFloor;
|
||||
return graph;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ export const defaultSettings = {
|
||||
enableScopedMemory: true,
|
||||
enablePovMemory: true,
|
||||
enableRegionScopedObjective: true,
|
||||
enableCognitiveMemory: true,
|
||||
enableSpatialAdjacency: true,
|
||||
enableAiMonitor: false,
|
||||
injectLowConfidenceObjectiveMemory: false,
|
||||
recallCharacterPovWeight: 1.25,
|
||||
recallUserPovWeight: 1.05,
|
||||
recallObjectiveCurrentRegionWeight: 1.15,
|
||||
|
||||
Reference in New Issue
Block a user