mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Fix message trace user payload source
This commit is contained in:
24
index.js
24
index.js
@@ -270,6 +270,9 @@ function getRuntimeDebugState() {
|
||||
taskPromptBuilds: {},
|
||||
taskLlmRequests: {},
|
||||
injections: {},
|
||||
messageTrace: {
|
||||
lastSentUserMessage: null,
|
||||
},
|
||||
maintenance: {
|
||||
lastAction: null,
|
||||
lastUndoResult: null,
|
||||
@@ -301,6 +304,17 @@ function recordInjectionSnapshot(kind, snapshot = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
function recordMessageTraceSnapshot(patch = {}) {
|
||||
const state = touchRuntimeDebugState();
|
||||
const previous = state.messageTrace || {
|
||||
lastSentUserMessage: null,
|
||||
};
|
||||
state.messageTrace = {
|
||||
...previous,
|
||||
...cloneRuntimeDebugValue(patch, {}),
|
||||
};
|
||||
}
|
||||
|
||||
function recordGraphPersistenceSnapshot(snapshot = null) {
|
||||
const state = touchRuntimeDebugState();
|
||||
state.graphPersistence = cloneRuntimeDebugValue(snapshot, null);
|
||||
@@ -326,6 +340,7 @@ function readRuntimeDebugSnapshot() {
|
||||
taskPromptBuilds: state.taskPromptBuilds,
|
||||
taskLlmRequests: state.taskLlmRequests,
|
||||
injections: state.injections,
|
||||
messageTrace: state.messageTrace,
|
||||
maintenance: state.maintenance,
|
||||
graphPersistence: state.graphPersistence,
|
||||
updatedAt: state.updatedAt,
|
||||
@@ -1308,6 +1323,15 @@ function recordRecallSentUserMessage(messageId, text, source = "message-sent") {
|
||||
source,
|
||||
at: Date.now(),
|
||||
});
|
||||
recordMessageTraceSnapshot({
|
||||
lastSentUserMessage: {
|
||||
text: normalized,
|
||||
hash,
|
||||
messageId: Number.isFinite(messageId) ? messageId : null,
|
||||
source,
|
||||
updatedAt: new Date().toISOString(),
|
||||
},
|
||||
});
|
||||
|
||||
// 注意:不再在 MESSAGE_SENT 阶段清空 pendingRecallSendIntent /
|
||||
// pendingHostGenerationInputSnapshot / transactions。
|
||||
|
||||
Reference in New Issue
Block a user