perf: optimize persist delta gating and diagnostics

This commit is contained in:
Youzini-afk
2026-04-13 16:11:22 +08:00
parent 8f7572b615
commit b16785e56f
30 changed files with 4495 additions and 47 deletions

View File

@@ -28,6 +28,8 @@ const runtimeDebugState = {
taskLlmRequests: {},
injections: {},
taskTimeline: [],
graphPersistence: null,
graphLayout: null,
updatedAt: "",
};
@@ -41,6 +43,8 @@ export function resetRuntimeDebugSnapshot() {
runtimeDebugState.taskLlmRequests = {};
runtimeDebugState.injections = {};
runtimeDebugState.taskTimeline = [];
runtimeDebugState.graphPersistence = null;
runtimeDebugState.graphLayout = null;
runtimeDebugState.updatedAt = nowIso();
}
@@ -76,6 +80,26 @@ export function recordInjectionSnapshot(kind, snapshot = {}) {
touchRuntimeDebugState();
}
export function recordGraphPersistenceSnapshot(snapshot = null) {
runtimeDebugState.graphPersistence = snapshot
? {
updatedAt: nowIso(),
...safeClone(snapshot, {}),
}
: null;
touchRuntimeDebugState();
}
export function recordGraphLayoutSnapshot(snapshot = null) {
runtimeDebugState.graphLayout = snapshot
? {
updatedAt: nowIso(),
...safeClone(snapshot, {}),
}
: null;
touchRuntimeDebugState();
}
export function getRuntimeDebugSnapshot() {
return safeClone(
{
@@ -84,6 +108,8 @@ export function getRuntimeDebugSnapshot() {
taskLlmRequests: runtimeDebugState.taskLlmRequests,
injections: runtimeDebugState.injections,
taskTimeline: runtimeDebugState.taskTimeline,
graphPersistence: runtimeDebugState.graphPersistence,
graphLayout: runtimeDebugState.graphLayout,
updatedAt: runtimeDebugState.updatedAt,
},
{
@@ -92,6 +118,8 @@ export function getRuntimeDebugSnapshot() {
taskLlmRequests: {},
injections: {},
taskTimeline: [],
graphPersistence: null,
graphLayout: null,
updatedAt: "",
},
);

View File

@@ -112,6 +112,18 @@ export const defaultSettings = {
embeddingBackendApiUrl: "",
embeddingAutoSuffix: true,
// Native 性能加速(灰度)
graphUseNativeLayout: false,
graphNativeLayoutThresholdNodes: 280,
graphNativeLayoutThresholdEdges: 1600,
graphNativeLayoutWorkerTimeoutMs: 260,
persistUseNativeDelta: false,
persistNativeDeltaThresholdRecords: 20000,
persistNativeDeltaThresholdStructuralDelta: 600,
persistNativeDeltaThresholdSerializedChars: 4000000,
nativeEngineFailOpen: true,
graphNativeForceDisable: false,
// Schema
nodeTypeSchema: null,