fix(ops): align Memory V2 Runtime Control badge with actual config flags.

The admin page treated every section as enabled via section.enabled, but runtimeControl has no such field; derive status from agent resolve/injection/lifecycle flags and proxy runtime status from Portal.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-01 21:44:01 +08:00
parent 91e140d402
commit 122a25649b
8 changed files with 1634 additions and 136 deletions
+34 -1
View File
@@ -913,6 +913,29 @@ export type MemoryV2RuntimeState = {
overrides: Record<string, string>;
};
export type MemoryV2PersonalMemoryStatus = {
enabled?: boolean;
requestedMode?: string;
effectiveMode?: string;
autoReviewEnabled?: boolean;
pendingCandidates?: number;
health?: {
state?: string;
accepted?: number;
autoReviewed?: number;
rejected?: number;
deduped?: number;
};
};
export type MemoryV2StatusResponse = {
ok?: boolean;
memory?: {
runtimeControl?: Record<string, unknown>;
personalMemory?: MemoryV2PersonalMemoryStatus;
} | null;
};
export async function fetchLlmProviderKeys() {
return adminFetch<{ keys: LlmProviderKeyRow[] }>('/admin-api/llm-providers/keys');
}
@@ -936,6 +959,10 @@ export async function fetchMemoryV2Runtime() {
return adminFetch<MemoryV2RuntimeState>('/admin-api/memory-v2/runtime');
}
export async function fetchMemoryV2Status() {
return adminFetch<MemoryV2StatusResponse>('/admin-api/memory-v2/status');
}
export type MemoryV2ProductMetrics = {
window: { since: string; sinceMs: number; untilMs: number };
userId: string | null;
@@ -996,7 +1023,13 @@ export async function fetchMemoryV2Candidates(params?: {
if (params?.limit != null) query.set('limit', String(params.limit));
if (params?.offset != null) query.set('offset', String(params.offset));
const suffix = query.toString() ? `?${query.toString()}` : '';
return adminFetch<{ items: MemoryV2CandidateRow[]; status: string; limit: number; offset: number }>(
return adminFetch<{
items: MemoryV2CandidateRow[];
status: string;
limit: number;
offset: number;
counts?: Record<string, number>;
}>(
`/admin-api/memory-v2/candidates${suffix}`,
);
}