feat(ui)!: read memory from Mnemon in the Brain panel
Overview and the memory tab now pull from /dsh-brain/mnemon/* through a thin src-client/mnemon.ts adapter; page structure and styles are unchanged. Fields Mnemon does not provide (id, category, conversation source, last recall) are shown as unverified rather than guessed, and delete stays disabled while the bridge is read-only.
This commit is contained in:
parent
b7f763460b
commit
48d135aff9
|
|
@ -15,6 +15,41 @@ export function formatIso(value) {
|
||||||
return formatTime(stamp)
|
return formatTime(stamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// "11-27 18:33" — the short stamp used in readable source labels.
|
||||||
|
export function formatShort(value) {
|
||||||
|
if (typeof value !== 'number' || value <= 0) return '—'
|
||||||
|
var date = new Date(value)
|
||||||
|
var pad = function (n) {
|
||||||
|
return n < 10 ? '0' + String(n) : String(n)
|
||||||
|
}
|
||||||
|
return pad(date.getMonth() + 1) + '-' + pad(date.getDate()) + ' ' + pad(date.getHours()) + ':' + pad(date.getMinutes())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Readable category label shared by the overview mix and the memory rows.
|
||||||
|
export function memoryCategoryLabel(category) {
|
||||||
|
if (typeof category !== 'string' || category === '') return '无分类'
|
||||||
|
var map = { rule: '规则', preference: '偏好', identity: '身份' }
|
||||||
|
return map[category] === undefined ? '其他' : map[category]
|
||||||
|
}
|
||||||
|
|
||||||
|
// Readable memory source. Session ids are never shown in full: a conversation
|
||||||
|
// source renders as "11-27 18:33 的对话" when the creation time is verifiable,
|
||||||
|
// and as a plain "来自对话" when it is not (no guessed timestamps).
|
||||||
|
export function memorySourceLabel(source, createdAt) {
|
||||||
|
if (typeof source !== 'string' || source === '') return '本地记录'
|
||||||
|
if (source.indexOf('session:') === 0) {
|
||||||
|
var stamp = typeof createdAt === 'string' ? Date.parse(createdAt) : NaN
|
||||||
|
return Number.isFinite(stamp) ? formatShort(stamp) + ' 的对话' : '对话 · 时间不可查'
|
||||||
|
}
|
||||||
|
if (source === 'mnemon') return 'Mnemon · 来源待核实'
|
||||||
|
if (source === 'memory_tool') return '助手写入'
|
||||||
|
if (source === 'mnemon-native') return 'Mnemon 写入'
|
||||||
|
if (source.indexOf('legacy:') === 0) return '旧数据导入'
|
||||||
|
if (source.indexOf('department:') === 0) return '部门空间'
|
||||||
|
if (source === 'local') return '本地手动'
|
||||||
|
return '其他来源'
|
||||||
|
}
|
||||||
|
|
||||||
export function formatBytes(value) {
|
export function formatBytes(value) {
|
||||||
if (typeof value !== 'number' || value < 0) return '—'
|
if (typeof value !== 'number' || value < 0) return '—'
|
||||||
if (value < 1024) return String(value) + ' B'
|
if (value < 1024) return String(value) + ' B'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,114 @@
|
||||||
|
// Read-only Mnemon data source.
|
||||||
|
//
|
||||||
|
// dsh-brain no longer stores memory itself: Mnemon is the single source of
|
||||||
|
// truth, read through the /dsh-brain/mnemon/* bridge (which forwards Mnemon's
|
||||||
|
// own RPC envelope {ok,value}). This module normalizes those responses into
|
||||||
|
// the {ok,total,items} shape the panel already consumes, so the page structure
|
||||||
|
// and styles stay put — only the data binding moves.
|
||||||
|
//
|
||||||
|
// Honesty rules (agreed with the secretary): runtime entries carry no id,
|
||||||
|
// category, session source or revision. The id falls back to the index; the
|
||||||
|
// missing fields stay undefined so the UI marks them 「待核实」. Nothing is
|
||||||
|
// fabricated to make the screen look fuller.
|
||||||
|
import { request, bodyError } from './api'
|
||||||
|
|
||||||
|
export const MNEMON = {
|
||||||
|
runtime: '/dsh-brain/mnemon/runtime',
|
||||||
|
list: '/dsh-brain/mnemon/list',
|
||||||
|
status: '/dsh-brain/mnemon/status',
|
||||||
|
search: '/dsh-brain/mnemon/search',
|
||||||
|
documents: '/dsh-brain/mnemon/documents',
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The bridge keeps Mnemon's {ok:false,error:{code,message}} envelope. */
|
||||||
|
function envelopeError(result: any, fallback: string): string {
|
||||||
|
const err = result.body?.error
|
||||||
|
if (err !== null && typeof err === 'object' && typeof err.message === 'string' && err.message !== '') return err.message
|
||||||
|
if (result.status === 503) return 'Mnemon 读服务未接入:当前宿主没有 Mnemon,界面暂不显示记忆。'
|
||||||
|
return bodyError(result, fallback)
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface NormalizedItem {
|
||||||
|
id: string
|
||||||
|
scope: string
|
||||||
|
content: string
|
||||||
|
category?: string
|
||||||
|
tags: string[]
|
||||||
|
source: string
|
||||||
|
revision?: number
|
||||||
|
createdAt?: string
|
||||||
|
updatedAt?: string
|
||||||
|
target?: string
|
||||||
|
importance?: string
|
||||||
|
mnemon: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Runtime snapshot → newest-created-first list. No id/category/source exists. */
|
||||||
|
export function runtimeEntriesToList(value: any): NormalizedItem[] {
|
||||||
|
const entries: any[] = Array.isArray(value?.entries) ? value.entries : []
|
||||||
|
const items = entries.map((entry, index): NormalizedItem => ({
|
||||||
|
id: 'mnemon_rt_' + String(index),
|
||||||
|
scope: 'global',
|
||||||
|
content: String(entry?.content ?? ''),
|
||||||
|
category: undefined,
|
||||||
|
tags: [],
|
||||||
|
source: 'mnemon',
|
||||||
|
revision: undefined,
|
||||||
|
createdAt: typeof entry?.created_at === 'string' ? entry.created_at : undefined,
|
||||||
|
updatedAt: typeof entry?.updated_at === 'string' ? entry.updated_at : undefined,
|
||||||
|
target: typeof entry?.target === 'string' ? entry.target : undefined,
|
||||||
|
importance: typeof entry?.importance === 'string' ? entry.importance : undefined,
|
||||||
|
mnemon: true,
|
||||||
|
}))
|
||||||
|
items.sort((a, b) => String(b.createdAt ?? '').localeCompare(String(a.createdAt ?? '')))
|
||||||
|
return items
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Memory list for the panel. Global = Mnemon runtime (the real store on this
|
||||||
|
* host); project = Memory Spaces `list`. Runtime has no offset, so paging is a
|
||||||
|
* client-side slice over the full fetched set. `categoriesAvailable` tells the
|
||||||
|
* overview whether a category mix can be computed at all.
|
||||||
|
*/
|
||||||
|
export async function mnemonMemories(scope: string, offset: number, limit: number): Promise<{ ok: true; total: number; items: NormalizedItem[]; categoriesAvailable: boolean }> {
|
||||||
|
if (scope === 'project') {
|
||||||
|
const result = await request(MNEMON.list + '?limit=1000')
|
||||||
|
if (result.status !== 200 || result.body === null || result.body.ok !== true) throw new Error(envelopeError(result, '读取 Mnemon 项目记忆失败'))
|
||||||
|
const value = result.body.value ?? {}
|
||||||
|
const raw: any[] = Array.isArray(value.items) ? value.items : []
|
||||||
|
const items = raw.map((it, index): NormalizedItem => ({
|
||||||
|
id: typeof it?.id === 'string' && it.id !== '' ? it.id : 'mnemon_sp_' + String(index),
|
||||||
|
scope: 'project',
|
||||||
|
content: String(it?.content ?? ''),
|
||||||
|
category: typeof it?.category === 'string' ? it.category : undefined,
|
||||||
|
tags: Array.isArray(it?.tags) ? it.tags.filter((t: unknown): t is string => typeof t === 'string') : [],
|
||||||
|
source: 'mnemon',
|
||||||
|
revision: typeof it?.revision === 'number' ? it.revision : undefined,
|
||||||
|
createdAt: typeof it?.created_at === 'string' ? it.created_at : typeof it?.createdAt === 'string' ? it.createdAt : undefined,
|
||||||
|
updatedAt: typeof it?.updated_at === 'string' ? it.updated_at : typeof it?.updatedAt === 'string' ? it.updatedAt : undefined,
|
||||||
|
mnemon: true,
|
||||||
|
}))
|
||||||
|
items.sort((a, b) => String(b.createdAt ?? '').localeCompare(String(a.createdAt ?? '')))
|
||||||
|
const total = typeof value.total === 'number' ? value.total : items.length
|
||||||
|
return { ok: true, total, items: items.slice(offset, offset + limit), categoriesAvailable: items.some((it) => it.category !== undefined) }
|
||||||
|
}
|
||||||
|
const result = await request(MNEMON.runtime)
|
||||||
|
if (result.status !== 200 || result.body === null || result.body.ok !== true) throw new Error(envelopeError(result, '读取 Mnemon 记忆失败'))
|
||||||
|
const items = runtimeEntriesToList(result.body.value)
|
||||||
|
return { ok: true, total: items.length, items: items.slice(offset, offset + limit), categoriesAvailable: false }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Full runtime list (no paging) for the overview's totals and 7-day trend. */
|
||||||
|
export async function mnemonRuntimeAll(): Promise<{ ok: true; total: number; items: NormalizedItem[]; categoriesAvailable: false }> {
|
||||||
|
const result = await request(MNEMON.runtime)
|
||||||
|
if (result.status !== 200 || result.body === null || result.body.ok !== true) throw new Error(envelopeError(result, '读取 Mnemon 记忆失败'))
|
||||||
|
const items = runtimeEntriesToList(result.body.value)
|
||||||
|
return { ok: true, total: items.length, items, categoriesAvailable: false }
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Mnemon status snapshot (storage root, sources, workspace mode). */
|
||||||
|
export async function mnemonStatus(): Promise<any> {
|
||||||
|
const result = await request(MNEMON.status)
|
||||||
|
if (result.status !== 200 || result.body === null || result.body.ok !== true) throw new Error(envelopeError(result, '读取 Mnemon 状态失败'))
|
||||||
|
return result.body.value ?? {}
|
||||||
|
}
|
||||||
|
|
@ -117,20 +117,6 @@
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cardHead {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 10px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cardTitle {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 13.5px;
|
|
||||||
font-weight: 650;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pills {
|
.pills {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
|
@ -181,28 +167,389 @@
|
||||||
font-size: 12.5px;
|
font-size: 12.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statRow {
|
/* ---- Overview v3 (artifacts/preview-overview-v3.html) ------------------- */
|
||||||
|
/* Surfaces and text ride the host theme tokens; only translucent state tints
|
||||||
|
(green/amber) are fixed, the same convention as .ok/.warn above, so both
|
||||||
|
light and dark hosts stay readable. */
|
||||||
|
|
||||||
|
.ovHeader {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: baseline;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 10px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat {
|
.ovTitle {
|
||||||
display: inline-flex;
|
margin: 0;
|
||||||
align-items: baseline;
|
font-size: 15px;
|
||||||
gap: 6px;
|
|
||||||
padding-right: 18px;
|
|
||||||
margin-right: 18px;
|
|
||||||
border-right: 1px solid var(--dsw-alias-border-subtle, rgba(127,127,127,0.20));
|
|
||||||
}
|
|
||||||
|
|
||||||
.statLast {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: baseline;
|
|
||||||
gap: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.statNum {
|
|
||||||
font-size: 17px;
|
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ovHeadRight {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovCardTitle {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 13.5px;
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovSummary {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
|
||||||
|
gap: 0;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
background: var(--dsw-alias-bg-subtle, rgba(127,127,127,0.06));
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovTotal {
|
||||||
|
padding: 16px 18px;
|
||||||
|
min-width: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovBig {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 40px;
|
||||||
|
line-height: 1.05;
|
||||||
|
font-weight: 720;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovBig small {
|
||||||
|
margin-left: 6px;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovMeta {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 12.5px;
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovMeta strong {
|
||||||
|
color: rgba(22,163,74,0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovMetaBlock {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovMix {
|
||||||
|
padding: 16px 18px;
|
||||||
|
min-width: 0;
|
||||||
|
border-left: 1px solid var(--dsw-alias-border-subtle, rgba(127,127,127,0.22));
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovMixBody {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mixBar {
|
||||||
|
height: 9px;
|
||||||
|
display: flex;
|
||||||
|
overflow: hidden;
|
||||||
|
gap: 3px;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mixBar span {
|
||||||
|
min-width: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mixA { background: rgba(22,163,74,0.85); }
|
||||||
|
.mixB { background: rgba(22,163,74,0.45); }
|
||||||
|
.mixC { background: rgba(127,127,127,0.45); }
|
||||||
|
|
||||||
|
.mixKeys {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px 18px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
font-size: 12.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mixKeys span {
|
||||||
|
display: inline-block;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
margin-right: 6px;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovGrid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovGrid > * {
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovTrend, .ovChecks {
|
||||||
|
padding: 16px 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovPlaceholder {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 22px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovPlaceholderTitle {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 650;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovChart {
|
||||||
|
margin: 10px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plot {
|
||||||
|
position: relative;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(7, minmax(0, 1fr));
|
||||||
|
gap: 4px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plot::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
pointer-events: none;
|
||||||
|
inset: 0 0 27px;
|
||||||
|
border-bottom: 1px solid var(--dsw-alias-border-subtle, rgba(127,127,127,0.30));
|
||||||
|
background: repeating-linear-gradient(to top, transparent 0 calc(33.333% - 1px), var(--dsw-alias-border-subtle, rgba(127,127,127,0.14)) calc(33.333% - 1px) 33.333%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.plot li {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plotSlot {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 121px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plotBar {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
width: min(54%, 28px);
|
||||||
|
height: var(--height);
|
||||||
|
border-radius: 5px 5px 0 0;
|
||||||
|
background: rgba(22,163,74,0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
.plot li:last-child .plotBar {
|
||||||
|
background: rgba(22,163,74,0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
.plotAmount {
|
||||||
|
position: absolute;
|
||||||
|
bottom: calc(var(--height) + 3px);
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
font-weight: 650;
|
||||||
|
font-size: 12px;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plotZero .plotAmount {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plotDay {
|
||||||
|
display: grid;
|
||||||
|
place-items: center;
|
||||||
|
height: 27px;
|
||||||
|
font-size: 11px;
|
||||||
|
white-space: nowrap;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plot li:last-child .plotDay {
|
||||||
|
opacity: 1;
|
||||||
|
color: rgba(22,163,74,0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rows {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rows li {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 8px minmax(0, 1fr);
|
||||||
|
gap: 9px;
|
||||||
|
padding: 9px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rows li + li {
|
||||||
|
border-top: 1px solid var(--dsw-alias-border-subtle, rgba(127,127,127,0.22));
|
||||||
|
}
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
width: 7px;
|
||||||
|
height: 7px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: rgba(22,163,74,0.75);
|
||||||
|
margin-top: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dotWarn { background: rgba(217,119,6,0.9); }
|
||||||
|
.dotMuted { background: rgba(127,127,127,0.55); }
|
||||||
|
|
||||||
|
.rowName {
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rowNameWarn { color: rgba(217,119,6,0.95); }
|
||||||
|
|
||||||
|
.ovRecall {
|
||||||
|
padding: 16px 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovRecallHead {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 6px 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovRecallState {
|
||||||
|
margin: 0;
|
||||||
|
color: rgba(217,119,6,0.95);
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 650;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recallMetrics {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(min(96px, 100%), 1fr));
|
||||||
|
margin: 12px 0 9px;
|
||||||
|
gap: 8px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recallMetrics div {
|
||||||
|
padding: 3px 12px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recallMetrics div:first-child {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recallMetrics div + div {
|
||||||
|
border-left: 1px solid var(--dsw-alias-border-subtle, rgba(127,127,127,0.22));
|
||||||
|
}
|
||||||
|
|
||||||
|
.recallMetrics dt {
|
||||||
|
font-size: 12px;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recallMetrics dd {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 650;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
|
|
||||||
|
.recallMissing {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovDiag {
|
||||||
|
padding: 0 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovDiagSummary {
|
||||||
|
padding: 12px 0;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ovDiagSummary:focus-visible {
|
||||||
|
outline: 2px solid rgba(22,163,74,0.8);
|
||||||
|
outline-offset: 3px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diagGrid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: auto minmax(0, 1fr);
|
||||||
|
gap: 7px 18px;
|
||||||
|
margin: 0 0 14px;
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 1px solid var(--dsw-alias-border-subtle, rgba(127,127,127,0.22));
|
||||||
|
font-size: 12.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diagGrid dt {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diagGrid dd {
|
||||||
|
margin: 0;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.srOnly {
|
||||||
|
position: absolute;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
margin: -1px;
|
||||||
|
overflow: hidden;
|
||||||
|
clip: rect(0, 0, 0, 0);
|
||||||
|
white-space: nowrap;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.ovMix {
|
||||||
|
border-left: 0;
|
||||||
|
border-top: 1px solid var(--dsw-alias-border-subtle, rgba(127,127,127,0.22));
|
||||||
|
}
|
||||||
|
.recallMetrics div:nth-child(4) {
|
||||||
|
padding-left: 0;
|
||||||
|
border-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
// Memory tab: local-memory spaces, paged memory list, read-only documents, forget.
|
// Memory tab: reads Mnemon (the single source of truth) through the read-only
|
||||||
|
// bridge. Global = runtime store, project = Memory Spaces. Mnemon entries have
|
||||||
|
// no id/category/session-source/revision, so those degrade to 「待核实」; write
|
||||||
|
// and delete are not exposed this round, so the delete affordance is disabled.
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { request, postJson, bodyError, messageOf } from '../api'
|
import { request, postJson, bodyError, messageOf } from '../api'
|
||||||
import { formatIso } from '../format'
|
import { formatIso, memorySourceLabel, memoryCategoryLabel } from '../format'
|
||||||
import { styles } from '../styles'
|
import { styles } from '../styles'
|
||||||
import { Banner, Btn, Field, Pill, Section } from '../components'
|
import { Banner, Btn, IconBtn, Pill, Section } from '../components'
|
||||||
import { useApi } from './useApi'
|
import { useApi } from './useApi'
|
||||||
|
import { mnemonMemories, mnemonStatus, MNEMON } from '../mnemon'
|
||||||
import { scopeParams, type BrainScope } from './workspace'
|
import { scopeParams, type BrainScope } from './workspace'
|
||||||
|
|
||||||
const h = React.createElement
|
const h = React.createElement
|
||||||
|
|
@ -17,26 +21,30 @@ export function MemoryTab(props: BrainScope & { active?: boolean }): any {
|
||||||
const scopeLabel = project ? '项目' : '全局'
|
const scopeLabel = project ? '项目' : '全局'
|
||||||
const [offset, setOffset] = React.useState(0)
|
const [offset, setOffset] = React.useState(0)
|
||||||
const [search, setSearch] = React.useState('')
|
const [search, setSearch] = React.useState('')
|
||||||
|
const [searchOpen, setSearchOpen] = React.useState(false)
|
||||||
const [notice, setNotice] = React.useState<any>(null)
|
const [notice, setNotice] = React.useState<any>(null)
|
||||||
const [pendingForget, setPendingForget] = React.useState<any>(null)
|
const [pendingForget, setPendingForget] = React.useState<any>(null)
|
||||||
const [busy, setBusy] = React.useState('')
|
const [busy, setBusy] = React.useState('')
|
||||||
|
|
||||||
const status = useApi(async () => {
|
// Icon-expand search: collapsed shows only a magnifier in the section head.
|
||||||
const result = await request('/dsh-brain/local-memory/status' + '?' + scope.toString())
|
// It stays expanded while a query is present so the filter is never hidden.
|
||||||
if (result.status !== 200 || result.body === null || result.body.ok !== true) throw new Error(bodyError(result, '读取本地记忆状态失败'))
|
const searchExpanded = searchOpen || search !== ''
|
||||||
return result.body
|
const searchRef = React.useRef<any>(null)
|
||||||
}, { visible: active, pollMs: 15000 })
|
React.useEffect(() => {
|
||||||
|
const node = searchRef.current
|
||||||
|
if (searchExpanded && node !== null && typeof node.focus === 'function') node.focus()
|
||||||
|
}, [searchExpanded])
|
||||||
|
|
||||||
const memories = useApi(async () => {
|
const status = useApi(async () => mnemonStatus(), { visible: active, pollMs: 15000 })
|
||||||
const result = await request('/dsh-brain/local-memory/memories?limit=' + String(PAGE_SIZE) + '&offset=' + String(offset) + '&' + scope.toString())
|
|
||||||
if (result.status !== 200 || result.body === null || result.body.ok !== true) throw new Error(bodyError(result, '读取记忆列表失败'))
|
const memories = useApi(async () => mnemonMemories(props.scope, offset, PAGE_SIZE),
|
||||||
return result.body
|
{ visible: active, pollMs: project ? 30000 : undefined, deps: [offset] })
|
||||||
}, { visible: active, pollMs: project ? 30000 : undefined, deps: [offset] })
|
|
||||||
|
|
||||||
const documents = useApi(async () => {
|
const documents = useApi(async () => {
|
||||||
const result = await request('/dsh-brain/local-memory/documents' + '?' + scope.toString())
|
const result = await request(MNEMON.documents + '?' + scope.toString())
|
||||||
if (result.status !== 200 || result.body === null || result.body.ok !== true) throw new Error(bodyError(result, '读取文档列表失败'))
|
if (result.status !== 200 || result.body === null || result.body.ok !== true) throw new Error(bodyError(result, '读取 Mnemon 文档失败'))
|
||||||
return result.body
|
const value = result.body.value ?? {}
|
||||||
|
return { documents: Array.isArray(value.items) ? value.items : Array.isArray(value.documents) ? value.documents : [] }
|
||||||
}, { visible: active && project })
|
}, { visible: active && project })
|
||||||
|
|
||||||
const items: any[] = Array.isArray(memories.data?.items) ? memories.data!.items : []
|
const items: any[] = Array.isArray(memories.data?.items) ? memories.data!.items : []
|
||||||
|
|
@ -65,36 +73,64 @@ export function MemoryTab(props: BrainScope & { active?: boolean }): any {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const space = status.data?.spaces?.[props.scope]
|
const storageRoot = status.data?.storage?.activeRoot
|
||||||
const root = project ? status.data?.projectRoot : status.data?.globalRoot
|
const workspaceMode = status.data?.workspaceContext?.mode
|
||||||
|
|
||||||
return h('div', { style: { display: 'flex', flexDirection: 'column', gap: '12px' } },
|
return h('div', { style: { display: 'flex', flexDirection: 'column', gap: '12px' } },
|
||||||
status.error === null ? null : h(Banner, { tone: 'bad' }, status.error),
|
status.error === null ? null : h(Banner, { tone: 'bad' }, status.error),
|
||||||
h(Section, { title: scopeLabel + '记忆空间', aside: h(Btn, { label: '刷新', variant: 'small', onClick: () => { status.reload(); memories.reload(); if (project) documents.reload() } }) },
|
h(Section, { title: scopeLabel + '记忆空间', aside: h(Btn, { label: '刷新', variant: 'small', onClick: () => { status.reload(); memories.reload(); if (project) documents.reload() } }) },
|
||||||
h(Pill, { label: '空间状态', value: status.status === 'loading' ? '读取中' : space?.name ?? (space ? '就绪' : '未创建'), tone: space ? 'ok' : 'muted' }),
|
h(Pill, { label: '数据源', value: status.status === 'loading' ? '读取中' : status.error !== null ? 'Mnemon 未接入' : 'Mnemon 已接入', tone: status.error !== null ? 'warn' : 'ok' }),
|
||||||
root === undefined ? null : h('p', { style: styles.hint }, String(root)),
|
typeof storageRoot === 'string' && storageRoot !== '' ? h('p', { style: styles.hint }, String(storageRoot)) : null,
|
||||||
|
// Report the live storage mode; do not assume global vs per-workspace.
|
||||||
|
typeof workspaceMode === 'string' && workspaceMode !== '' ? h('p', { style: styles.hint }, '存储范围:' + String(workspaceMode)) : null,
|
||||||
),
|
),
|
||||||
h(Section, { title: '记忆条目(' + String(total) + ')', hint: '只显示当前页;搜索只在当前页内过滤。删除需要二次确认并带 revision 校验。', aside: h('div', { style: styles.actions },
|
h(Section, { title: '记忆条目(' + String(total) + ')', hint: '数据来自 Mnemon(本轮只读);搜索在当前页内过滤,暂不开放删除。', aside: h('div', { style: styles.actions },
|
||||||
h(Field, { label: '搜索当前页', value: search, onChange: setSearch }),
|
searchExpanded
|
||||||
|
? h('input', {
|
||||||
|
ref: searchRef,
|
||||||
|
style: Object.assign({}, styles.input, { width: '200px', flex: '0 1 auto' }),
|
||||||
|
type: 'text',
|
||||||
|
value: search,
|
||||||
|
placeholder: '搜索当前页',
|
||||||
|
spellCheck: false,
|
||||||
|
autoComplete: 'off',
|
||||||
|
'aria-label': '搜索当前页',
|
||||||
|
onChange: (event: any) => setSearch(event.target.value),
|
||||||
|
onKeyDown: (event: any) => { if (event.key === 'Escape' && search === '') setSearchOpen(false) },
|
||||||
|
onBlur: () => { if (search === '') setSearchOpen(false) },
|
||||||
|
})
|
||||||
|
: h(IconBtn, { glyph: '🔍', ariaLabel: '搜索当前页', onClick: () => setSearchOpen(true) }),
|
||||||
h(Btn, { label: '刷新', variant: 'small', onClick: () => memories.reload() }),
|
h(Btn, { label: '刷新', variant: 'small', onClick: () => memories.reload() }),
|
||||||
) },
|
) },
|
||||||
notice === null ? null : h(Banner, { tone: notice.tone }, notice.text),
|
notice === null ? null : h(Banner, { tone: notice.tone }, notice.text),
|
||||||
memories.error === null ? null : h(Banner, { tone: 'bad' }, memories.error),
|
memories.error === null ? null : h(Banner, { tone: 'bad' }, memories.error),
|
||||||
memories.status === 'loading' && items.length === 0 ? h('p', { style: styles.hint }, '正在读取记忆…') : null,
|
memories.status === 'loading' && items.length === 0 ? h('p', { style: styles.hint }, '正在读取记忆…') : null,
|
||||||
filtered.length === 0 ? h('p', { style: styles.hint }, total === 0 && needle === '' ? '还没有记忆条目。对话中让助手记住,或用 memory_add 写入。' : '当前页没有匹配的记忆条目。') : h('div', { style: { display: 'flex', flexDirection: 'column', gap: '8px' } },
|
filtered.length === 0 ? h('p', { style: styles.hint }, total === 0 && needle === '' ? 'Mnemon 里还没有记忆条目。' : '当前页没有匹配的记忆条目。') : h('div', { style: { display: 'flex', flexDirection: 'column', gap: '8px' } },
|
||||||
filtered.map((item) => h('div', { key: item.id, style: styles.row },
|
filtered.map((item) => h('div', { key: item.id, style: styles.row },
|
||||||
h('div', { style: styles.rowHead },
|
h('div', { style: styles.rowHead },
|
||||||
h('div', { style: styles.pills },
|
h('div', { style: styles.pills },
|
||||||
h(Pill, { label: 'scope', value: item.scope ?? '—', tone: 'muted' }),
|
// Attribution: the response carries scope (global/project). The
|
||||||
item.category === undefined ? null : h(Pill, { label: '分类', value: item.category, tone: 'muted' }),
|
// project name is not in this payload, so project rows say 项目记忆
|
||||||
|
// rather than guessing a name.
|
||||||
|
h(Pill, { label: '归属', value: item.scope === 'global' ? '全局' : item.scope === 'project' ? '项目记忆' : '—', tone: 'muted' }),
|
||||||
|
// Mnemon runtime has no category field: mark 待核实, never invent one.
|
||||||
|
h(Pill, { label: '分类', value: item.category === undefined ? (item.mnemon === true ? '待核实' : '无分类') : memoryCategoryLabel(item.category), tone: 'muted' }),
|
||||||
h(Pill, { label: 'rev', value: item.revision ?? '—', tone: 'muted' }),
|
h(Pill, { label: 'rev', value: item.revision ?? '—', tone: 'muted' }),
|
||||||
h(Pill, { label: '更新', value: formatIso(item.updatedAt), tone: 'muted' }),
|
// Show the creation time when the backend provides it; otherwise
|
||||||
|
// fall back to the update time, clearly labelled, never guessed.
|
||||||
|
typeof item.createdAt === 'string' && item.createdAt !== ''
|
||||||
|
? h(Pill, { label: '创建', value: formatIso(item.createdAt), tone: 'muted' })
|
||||||
|
: h(Pill, { label: '更新', value: formatIso(item.updatedAt), tone: 'muted' }),
|
||||||
),
|
),
|
||||||
h('div', { style: styles.actions },
|
h('div', { style: styles.actions },
|
||||||
pendingForget === item.id ? null : h(Btn, { label: '删除…', variant: 'small', onClick: () => { setPendingForget(item.id); setNotice(null) } }),
|
// Mnemon write/delete is not exposed this round: disable, don't fake.
|
||||||
|
pendingForget === item.id ? null : h(Btn, { label: '删除…', variant: 'small', disabled: item.mnemon === true, ariaLabel: item.mnemon === true ? '本轮只读,暂不支持删除 Mnemon 记忆' : undefined, onClick: () => { setPendingForget(item.id); setNotice(null) } }),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
h('div', { style: styles.clamp2 }, String(item.content ?? '')),
|
h('div', { style: styles.clamp2 }, String(item.content ?? '')),
|
||||||
|
// Readable source: a conversation renders as "11-27 18:33 的对话" when
|
||||||
|
// the creation time is verifiable; the full session id is never shown.
|
||||||
|
h('p', { style: styles.hint }, '来源:' + memorySourceLabel(item.source, item.createdAt)),
|
||||||
Array.isArray(item.tags) && item.tags.length > 0 ? h('p', { style: styles.hint }, '标签:' + item.tags.join('、')) : null,
|
Array.isArray(item.tags) && item.tags.length > 0 ? h('p', { style: styles.hint }, '标签:' + item.tags.join('、')) : null,
|
||||||
pendingForget === item.id ? h('div', { style: styles.nested },
|
pendingForget === item.id ? h('div', { style: styles.nested },
|
||||||
h('p', { style: styles.hint }, '确认删除这条记忆?此操作不可撤销。'),
|
h('p', { style: styles.hint }, '确认删除这条记忆?此操作不可撤销。'),
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
// Overview tab: status + capabilities aggregation.
|
// Overview tab — v3 design (artifacts/preview-overview-v3.html):
|
||||||
|
// totals + category mix, 7-day trend, processing checks, last recall, and a
|
||||||
|
// collapsed diagnostics area. Memory numbers come from Mnemon (the single
|
||||||
|
// source of truth) via the read-only bridge; anything Mnemon cannot verify
|
||||||
|
// (category mix, last recall) renders as 「待核实」 instead of a guessed value.
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import { API, request, messageOf } from '../api'
|
import { API, request, messageOf } from '../api'
|
||||||
import { formatTime } from '../format'
|
import { formatTime, formatIso, formatBytes, memoryCategoryLabel } from '../format'
|
||||||
|
import { Btn } from '../components'
|
||||||
|
import { mnemonRuntimeAll, mnemonStatus } from '../mnemon'
|
||||||
import styles from './BrainPanel.module.css'
|
import styles from './BrainPanel.module.css'
|
||||||
|
|
||||||
const h = React.createElement
|
const h = React.createElement
|
||||||
|
|
@ -13,8 +19,12 @@ const BUNDLE_LABELS: Record<string, string> = {
|
||||||
mcp: 'MCP',
|
mcp: 'MCP',
|
||||||
'settings-ui': '设置 UI',
|
'settings-ui': '设置 UI',
|
||||||
ui: '设置 UI',
|
ui: '设置 UI',
|
||||||
|
raw: '原话记录',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const pad2 = (n: number): string => (n < 10 ? '0' + String(n) : String(n))
|
||||||
|
const dayKeyOf = (d: Date): string => String(d.getFullYear()) + '-' + pad2(d.getMonth() + 1) + '-' + pad2(d.getDate())
|
||||||
|
|
||||||
function Pill(props: { label: string; value: any; tone?: 'ok' | 'bad' | 'warn' | 'muted' }): any {
|
function Pill(props: { label: string; value: any; tone?: 'ok' | 'bad' | 'warn' | 'muted' }): any {
|
||||||
const tone = props.tone === undefined ? styles.muted : props.tone === 'ok' ? styles.ok : props.tone === 'bad' ? styles.bad : props.tone === 'warn' ? styles.warn : styles.muted
|
const tone = props.tone === undefined ? styles.muted : props.tone === 'ok' ? styles.ok : props.tone === 'bad' ? styles.bad : props.tone === 'warn' ? styles.warn : styles.muted
|
||||||
return h('span', { className: styles.pill + ' ' + tone },
|
return h('span', { className: styles.pill + ' ' + tone },
|
||||||
|
|
@ -23,37 +33,44 @@ function Pill(props: { label: string; value: any; tone?: 'ok' | 'bad' | 'warn' |
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Card(props: { title: string; children?: any }): any {
|
interface TrendDay { key: string; label: string; full: string; count: number }
|
||||||
return h('div', { className: styles.card },
|
interface CheckRow { tone: 'ok' | 'warn' | 'muted'; name: string; meta: string }
|
||||||
h('div', { className: styles.cardHead }, h('h4', { className: styles.cardTitle }, props.title)),
|
|
||||||
props.children,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Overview(props: { active?: boolean }): any {
|
export function Overview(props: { active?: boolean }): any {
|
||||||
const active = props.active !== false
|
const active = props.active !== false
|
||||||
const [status, setStatus] = React.useState<any>(null)
|
const [status, setStatus] = React.useState<any>(null)
|
||||||
const [capabilities, setCapabilities] = React.useState<any>(null)
|
const [capabilities, setCapabilities] = React.useState<any>(null)
|
||||||
const [memory, setMemory] = React.useState<any>(null)
|
const [memory, setMemory] = React.useState<any>(null)
|
||||||
|
const [raw, setRaw] = React.useState<any>(null)
|
||||||
|
const [list, setList] = React.useState<any>(null)
|
||||||
const [error, setError] = React.useState<string | null>(null)
|
const [error, setError] = React.useState<string | null>(null)
|
||||||
|
const [rawError, setRawError] = React.useState<string | null>(null)
|
||||||
|
const [listError, setListError] = React.useState<string | null>(null)
|
||||||
|
const [loadedAt, setLoadedAt] = React.useState<number | null>(null)
|
||||||
|
const [tick, setTick] = React.useState(0)
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!active) return
|
if (!active) return
|
||||||
let cancelled = false
|
let cancelled = false
|
||||||
const load = async (): Promise<void> => {
|
const load = async (): Promise<void> => {
|
||||||
// Each endpoint settles on its own: a failing auxiliary endpoint must not
|
// Each endpoint settles on its own: a failing auxiliary endpoint must not
|
||||||
// discard the primary status payload or blank the whole overview.
|
// discard the primary status payload or blank the whole overview. A
|
||||||
const [statusSettled, capabilitiesSettled, memorySettled] = await Promise.allSettled([
|
// failed fetch keeps the last successful snapshot; loadedAt marks it.
|
||||||
|
const [statusSettled, capabilitiesSettled, memorySettled, rawSettled, listSettled] = await Promise.allSettled([
|
||||||
request(API.status),
|
request(API.status),
|
||||||
request(API.capabilities),
|
request(API.capabilities),
|
||||||
request('/dsh-brain/local-memory/status?scope=global'),
|
mnemonStatus(),
|
||||||
|
request('/dsh-brain/raw/status'),
|
||||||
|
mnemonRuntimeAll(),
|
||||||
])
|
])
|
||||||
if (cancelled) return
|
if (cancelled) return
|
||||||
|
let anyOk = false
|
||||||
if (statusSettled.status === 'fulfilled') {
|
if (statusSettled.status === 'fulfilled') {
|
||||||
const result = statusSettled.value
|
const result = statusSettled.value
|
||||||
if (result.status === 200 && result.body !== null && result.body.ok === true) {
|
if (result.status === 200 && result.body !== null && result.body.ok === true) {
|
||||||
setStatus(result.body)
|
setStatus(result.body)
|
||||||
setError(null)
|
setError(null)
|
||||||
|
anyOk = true
|
||||||
} else {
|
} else {
|
||||||
setError('读取插件状态失败(HTTP ' + String(result.status) + ')')
|
setError('读取插件状态失败(HTTP ' + String(result.status) + ')')
|
||||||
}
|
}
|
||||||
|
|
@ -62,10 +79,26 @@ export function Overview(props: { active?: boolean }): any {
|
||||||
}
|
}
|
||||||
if (capabilitiesSettled.status === 'fulfilled') {
|
if (capabilitiesSettled.status === 'fulfilled') {
|
||||||
const result = capabilitiesSettled.value
|
const result = capabilitiesSettled.value
|
||||||
if (result.status === 200 && result.body !== null && result.body.ok === true) setCapabilities(result.body)
|
if (result.status === 200 && result.body !== null && result.body.ok === true) { setCapabilities(result.body); anyOk = true }
|
||||||
}
|
}
|
||||||
if (memorySettled.status === 'fulfilled' && memorySettled.value.status === 200 && memorySettled.value.body !== null && memorySettled.value.body.ok === true) setMemory(memorySettled.value.body)
|
if (memorySettled.status === 'fulfilled') {
|
||||||
else setMemory(null)
|
setMemory(memorySettled.value); anyOk = true
|
||||||
|
}
|
||||||
|
if (rawSettled.status === 'fulfilled') {
|
||||||
|
const result = rawSettled.value
|
||||||
|
if (result.status === 200 && result.body !== null && result.body.ok === true) { setRaw(result.body); setRawError(null); anyOk = true }
|
||||||
|
else setRawError('HTTP ' + String(result.status))
|
||||||
|
} else {
|
||||||
|
setRawError(messageOf(rawSettled.reason))
|
||||||
|
}
|
||||||
|
if (listSettled.status === 'fulfilled') {
|
||||||
|
setList(listSettled.value)
|
||||||
|
setListError(null)
|
||||||
|
anyOk = true
|
||||||
|
} else {
|
||||||
|
setListError(messageOf(listSettled.reason))
|
||||||
|
}
|
||||||
|
if (anyOk) setLoadedAt(Date.now())
|
||||||
}
|
}
|
||||||
void load()
|
void load()
|
||||||
const timer = setInterval(() => { void load() }, 15000)
|
const timer = setInterval(() => { void load() }, 15000)
|
||||||
|
|
@ -73,50 +106,241 @@ export function Overview(props: { active?: boolean }): any {
|
||||||
cancelled = true
|
cancelled = true
|
||||||
clearInterval(timer)
|
clearInterval(timer)
|
||||||
}
|
}
|
||||||
}, [active])
|
}, [active, tick])
|
||||||
|
|
||||||
|
const refresh = (): void => { setTick((value) => value + 1) }
|
||||||
|
|
||||||
const bundles: Record<string, boolean> = status?.bundles ?? {}
|
|
||||||
const bundleKeys = Object.keys(bundles).length === 0 ? ['cloudsync', 'memory', 'skills', 'mcp', 'settings-ui'] : Object.keys(bundles)
|
|
||||||
const settings = status?.settings ?? {}
|
const settings = status?.settings ?? {}
|
||||||
const reporter = status?.reporter ?? {}
|
const reporter = status?.reporter ?? {}
|
||||||
const skills = status?.skills ?? {}
|
const skills = status?.skills
|
||||||
const memorySpaces = memory?.spaces ?? {}
|
const bundles: Record<string, boolean> = status?.bundles ?? {}
|
||||||
|
const bundleKeys = Object.keys(bundles).length === 0 ? ['cloudsync', 'memory', 'skills', 'mcp', 'settings-ui'] : Object.keys(bundles)
|
||||||
const version = capabilities?.version ?? status?.capabilities?.version ?? '—'
|
const version = capabilities?.version ?? status?.capabilities?.version ?? '—'
|
||||||
|
|
||||||
|
// ---- totals / mix / trend, from Mnemon runtime --------------------------
|
||||||
|
const items: any[] = Array.isArray(list?.items) ? list.items : []
|
||||||
|
const total: number | null = list !== null && typeof list.total === 'number' ? list.total : null
|
||||||
|
const fullCoverage = list !== null && total !== null && items.length === total
|
||||||
|
// Mnemon runtime carries created_at, so the trend is real. It has no category
|
||||||
|
// field, so the mix stays 「待核实」 (categoriesAvailable false) — never invented.
|
||||||
|
const hasCreated = items.length > 0 && items.every((item) => typeof item.createdAt === 'string' && item.createdAt !== '')
|
||||||
|
const categoriesAvailable = list?.categoriesAvailable === true
|
||||||
|
|
||||||
|
let mix: { label: string; count: number }[] | null = null
|
||||||
|
if (fullCoverage && categoriesAvailable) {
|
||||||
|
const counts: Record<string, number> = {}
|
||||||
|
for (const item of items) {
|
||||||
|
const label = memoryCategoryLabel(item.category)
|
||||||
|
counts[label] = (counts[label] ?? 0) + 1
|
||||||
|
}
|
||||||
|
mix = Object.keys(counts).map((label) => ({ label, count: counts[label] })).sort((a, b) => b.count - a.count)
|
||||||
|
}
|
||||||
|
|
||||||
|
let trend: TrendDay[] | null = null
|
||||||
|
let todayAdded: number | null = null
|
||||||
|
let latestCreated: number | null = null
|
||||||
|
if (fullCoverage && (hasCreated || total === 0)) {
|
||||||
|
const counts: Record<string, number> = {}
|
||||||
|
let latest = 0
|
||||||
|
for (const item of items) {
|
||||||
|
const stamp = Date.parse(item.createdAt)
|
||||||
|
if (!Number.isFinite(stamp)) continue
|
||||||
|
if (stamp > latest) latest = stamp
|
||||||
|
const key = dayKeyOf(new Date(stamp))
|
||||||
|
counts[key] = (counts[key] ?? 0) + 1
|
||||||
|
}
|
||||||
|
latestCreated = latest > 0 ? latest : null
|
||||||
|
const now = new Date()
|
||||||
|
trend = []
|
||||||
|
for (let i = 6; i >= 0; i -= 1) {
|
||||||
|
const day = new Date(now.getFullYear(), now.getMonth(), now.getDate() - i)
|
||||||
|
const key = dayKeyOf(day)
|
||||||
|
trend.push({
|
||||||
|
key,
|
||||||
|
label: i === 6 ? pad2(day.getMonth() + 1) + '/' + pad2(day.getDate()) : pad2(day.getDate()),
|
||||||
|
full: String(day.getMonth() + 1) + ' 月 ' + String(day.getDate()) + ' 日',
|
||||||
|
count: counts[key] ?? 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
todayAdded = trend[6].count
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- processing checks -------------------------------------------------
|
||||||
|
const rows: CheckRow[] = []
|
||||||
|
if (rawError !== null) {
|
||||||
|
rows.push({ tone: 'warn', name: '读取原话档案失败', meta: '可点右上「刷新」重试;详情见「原始记录」页签。' })
|
||||||
|
} else if (raw === null) {
|
||||||
|
rows.push({ tone: 'muted', name: '原话归档待核实', meta: '宿主未返回原话档案状态。' })
|
||||||
|
} else if (raw.enabled === false) {
|
||||||
|
rows.push({ tone: 'muted', name: '原话采集已关闭', meta: '在设置中开启后,对话原话会自动归档。' })
|
||||||
|
} else if ((raw.records ?? 0) === 0) {
|
||||||
|
rows.push({ tone: 'muted', name: '还没有原话记录', meta: '开启采集后,新的对话会自动归档到这里。' })
|
||||||
|
} else {
|
||||||
|
rows.push({ tone: 'ok', name: '原话已归档', meta: String(raw.sessions ?? 0) + ' 个会话 · ' + String(raw.records ?? 0) + ' 条记录 · 最近 ' + formatIso(raw.newestAt) })
|
||||||
|
}
|
||||||
|
if (status === null) {
|
||||||
|
rows.push({ tone: 'muted', name: '自动摘要待核实', meta: '宿主未返回设置,无法确认摘要开关。' })
|
||||||
|
} else if (settings.autoSummaryEnabled === false) {
|
||||||
|
rows.push({ tone: 'muted', name: '自动摘要已关闭', meta: '在设置中开启后,会自动提炼对话要点。' })
|
||||||
|
} else {
|
||||||
|
rows.push({ tone: 'muted', name: '摘要处理进度待核实', meta: '累计会话与轮数需检查点统计,接口补齐后显示。' })
|
||||||
|
}
|
||||||
const lastChecks: any[] = Array.isArray(status?.lastCheck?.checks) ? status.lastCheck.checks : []
|
const lastChecks: any[] = Array.isArray(status?.lastCheck?.checks) ? status.lastCheck.checks : []
|
||||||
const lastFailed = lastChecks.filter((check) => check.state !== 'ok' && check.state !== 'unconfigured').length
|
const lastFailed = lastChecks.filter((check) => check.state !== 'ok' && check.state !== 'unconfigured').length
|
||||||
|
if (error !== null) {
|
||||||
|
rows.push({ tone: 'warn', name: '实时状态待核实', meta: '当前宿主未返回 Brain 状态。在目标宿主打开 Brain 后刷新,查看采集与召回状态。' })
|
||||||
|
} else if (status?.lastCheck === null || status?.lastCheck === undefined) {
|
||||||
|
rows.push({ tone: 'muted', name: '尚未检查', meta: '在「连接与上报」设置里运行一次连接检查,结果会显示在这里。' })
|
||||||
|
} else if (lastFailed === 0) {
|
||||||
|
rows.push({ tone: 'ok', name: '暂无已知异常', meta: '最近检查 ' + formatTime(status.lastCheck.at) + (lastChecks.length === 0 ? '' : ' · 全部通过') })
|
||||||
|
} else {
|
||||||
|
rows.push({ tone: 'warn', name: String(lastFailed) + ' 项检查异常', meta: '最近检查 ' + formatTime(status.lastCheck.at) + ' · 详情见「连接与上报」设置。' })
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- diagnostics -------------------------------------------------------
|
||||||
|
const tokenText = status === null ? '暂不可读取' : (() => {
|
||||||
|
const entries: [string, any][] = [['上报', status.tokens?.activity], ['记忆', status.tokens?.memory], ['摘要', status.tokens?.summary]]
|
||||||
|
if (entries.every(([, token]) => token?.configured === true)) return '上报、记忆、摘要均已配置'
|
||||||
|
return entries.map(([name, token]) => name + (token?.configured === true ? '已配置' : '未配置')).join(' · ')
|
||||||
|
})()
|
||||||
|
const rawDetail = rawError !== null ? '暂不可读取'
|
||||||
|
: raw === null ? '待核实'
|
||||||
|
: raw.enabled === false ? '采集已关闭'
|
||||||
|
: formatBytes(raw.bytes) + ' · ' + formatIso(raw.oldestAt) + ' 至 ' + formatIso(raw.newestAt)
|
||||||
|
const skillReceipt = skills === undefined || skills === null ? '暂无回执'
|
||||||
|
: '下发 ' + String(skills.downloaded?.length ?? 0) + ' 条 · 上传 ' + String(skills.uploaded?.length ?? 0) + ' 条'
|
||||||
|
+ ((skills.conflicts?.length ?? 0) > 0 ? ' · 待处理冲突 ' + String(skills.conflicts.length) + ' 条' : '')
|
||||||
|
const localMemoryText = memory === null ? 'Mnemon 未接入'
|
||||||
|
: (typeof memory.storage?.activeRoot === 'string' ? String(memory.storage.activeRoot) : '已接入')
|
||||||
|
+ (typeof memory.workspaceContext?.mode === 'string' ? ' · 存储范围 ' + String(memory.workspaceContext.mode) : '')
|
||||||
|
|
||||||
|
const diag: [string, any][] = [
|
||||||
|
['插件版本', version],
|
||||||
|
['原话档案', rawDetail],
|
||||||
|
['服务地址', status === null ? '暂不可读取' : settings.baseUrlConfigured === false ? '未配置' : (settings.baseUrlOrigin || '已配置')],
|
||||||
|
['磁盘令牌配置', tokenText],
|
||||||
|
['服务默认召回条数', status === null ? '暂不可读取' : String(settings.defaultK ?? '—')],
|
||||||
|
['本地记忆召回条数', status === null ? '暂不可读取' : String(settings.localMemoryK ?? '未配置')],
|
||||||
|
['技能同步回执', skillReceipt],
|
||||||
|
['已上报回合', status === null ? '待核实' : String(reporter.recorded ?? 0)],
|
||||||
|
['Mnemon 存储', localMemoryText],
|
||||||
|
['bundle 开关', h('div', { className: styles.pills },
|
||||||
|
bundleKeys.map((key) => h(Pill, { key, label: BUNDLE_LABELS[key] ?? key, value: bundles[key] === true ? '启用' : bundles[key] === false ? '停用' : '未知', tone: bundles[key] === true ? 'ok' : bundles[key] === false ? 'bad' : 'muted' })),
|
||||||
|
)],
|
||||||
|
]
|
||||||
|
|
||||||
|
const trendMax = trend === null ? 1 : Math.max(1, ...trend.map((day) => day.count))
|
||||||
|
|
||||||
return h('div', { className: styles.overviewGrid },
|
return h('div', { className: styles.overviewGrid },
|
||||||
|
h('div', { className: styles.ovHeader },
|
||||||
|
h('h4', { className: styles.ovTitle }, '记忆概览'),
|
||||||
|
h('div', { className: styles.ovHeadRight },
|
||||||
|
loadedAt === null ? null : h('p', { className: styles.hint }, '本机数据快照 ' + formatTime(loadedAt)),
|
||||||
|
h(Btn, { label: '刷新', variant: 'small', onClick: refresh }),
|
||||||
|
),
|
||||||
|
),
|
||||||
error === null ? null : h('div', { className: styles.error }, error),
|
error === null ? null : h('div', { className: styles.error }, error),
|
||||||
h(Card, { title: '版本与构建' },
|
|
||||||
h('div', { className: styles.pills },
|
h('section', { className: styles.card + ' ' + styles.ovSummary, 'aria-labelledby': 'ov-total-title' },
|
||||||
h(Pill, { label: '版本', value: version }),
|
h('div', { className: styles.ovTotal },
|
||||||
h(Pill, { label: '服务', value: settings.baseUrlConfigured === false ? '未配置' : (settings.baseUrlOrigin || '已配置'), tone: settings.baseUrlConfigured === false ? 'warn' : 'muted' }),
|
h('h4', { id: 'ov-total-title', className: styles.ovCardTitle }, '全局记忆'),
|
||||||
h(Pill, { label: '上报', value: settings.activityEnabled === true ? '开' : '关', tone: settings.activityEnabled === true ? 'ok' : 'muted' }),
|
list !== null
|
||||||
h(Pill, { label: '记忆', value: settings.memoryEnabled === true ? '开' : '关', tone: settings.memoryEnabled === true ? 'ok' : 'muted' }),
|
? h('p', { className: styles.ovBig }, String(total ?? '—'), h('small', {}, '条'))
|
||||||
h(Pill, { label: '诊断日志', value: settings.diagnosticsEnabled === false ? '关' : '开', tone: settings.diagnosticsEnabled === false ? 'muted' : 'ok' }),
|
: h('p', { className: styles.ovBig }, '—'),
|
||||||
|
list === null && listError !== null
|
||||||
|
? h('div', { className: styles.ovMetaBlock },
|
||||||
|
h('p', { className: styles.hint }, '全局记忆暂不可读(' + listError + ')'),
|
||||||
|
h(Btn, { label: '重试', variant: 'small', onClick: refresh }),
|
||||||
|
)
|
||||||
|
: total === 0
|
||||||
|
? h('p', { className: styles.ovMeta }, 'Mnemon 里还没有记忆条目。')
|
||||||
|
: h('p', { className: styles.ovMeta },
|
||||||
|
todayAdded === null ? '今日新增待核实' : h('strong', {}, '今日新增 ' + String(todayAdded) + ' 条'),
|
||||||
|
latestCreated === null ? '' : ' · 最近一条 ' + formatTime(latestCreated).slice(6, 11),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
h('p', { className: styles.hint }, '全局诊断日志:$DSH_HOME/brain/logs'),
|
h('div', { className: styles.ovMix },
|
||||||
status?.lastCheck === null || status?.lastCheck === undefined ? null : h('p', { className: styles.hint }, '最近检查:' + formatTime(status.lastCheck.at) + (lastChecks.length === 0 ? '' : lastFailed === 0 ? ' · 全部通过' : ' · ' + String(lastFailed) + ' 项异常')),
|
h('h4', { className: styles.ovCardTitle }, '记忆分类'),
|
||||||
),
|
mix === null
|
||||||
h(Card, { title: '五个 bundle 开关态' },
|
? h('p', { className: styles.hint }, list === null ? '分类统计暂不可读。' : !categoriesAvailable ? '分类待核实:Mnemon 记忆没有分类字段。' : '分类统计待核实。')
|
||||||
h('div', { className: styles.pills },
|
: mix.length === 0
|
||||||
bundleKeys.map((key) => h(Pill, { key, label: BUNDLE_LABELS[key] ?? key, value: bundles[key] === true ? '启用' : bundles[key] === false ? '停用' : '未知', tone: bundles[key] === true ? 'ok' : bundles[key] === false ? 'bad' : 'muted' })),
|
? h('p', { className: styles.hint }, '暂无分类可显示。')
|
||||||
|
: h('div', { className: styles.ovMixBody },
|
||||||
|
h('div', { className: styles.mixBar, 'aria-hidden': 'true' },
|
||||||
|
mix.map((entry, index) => h('span', { key: entry.label, className: index === 0 ? styles.mixA : index === 1 ? styles.mixB : styles.mixC, style: { flex: String(entry.count) } })),
|
||||||
|
),
|
||||||
|
h('ul', { className: styles.mixKeys },
|
||||||
|
mix.map((entry, index) => h('li', { key: entry.label },
|
||||||
|
h('span', { 'aria-hidden': 'true', className: index === 0 ? styles.mixA : index === 1 ? styles.mixB : styles.mixC }),
|
||||||
|
entry.label + ' ' + String(entry.count) + ' 条',
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
h(Card, { title: '本地记忆' },
|
|
||||||
h('div', { className: styles.pills },
|
h('div', { className: styles.ovGrid },
|
||||||
h(Pill, { label: '状态', value: memory === null ? '不可用' : '已启用', tone: memory === null ? 'warn' : 'ok' }),
|
h('section', { className: styles.card + ' ' + styles.ovTrend, 'aria-labelledby': 'ov-trend-title' },
|
||||||
h(Pill, { label: '全局空间', value: memorySpaces.global === null || memorySpaces.global === undefined ? '未创建' : '就绪', tone: memorySpaces.global === null || memorySpaces.global === undefined ? 'muted' : 'ok' }),
|
h('h4', { id: 'ov-trend-title', className: styles.ovCardTitle }, '最近 7 天新增'),
|
||||||
h(Pill, { label: '云同步', value: memory?.cloudSyncEnabled === true ? '开' : '关', tone: memory?.cloudSyncEnabled === true ? 'ok' : 'muted' }),
|
trend === null
|
||||||
|
? h('div', { className: styles.ovPlaceholder },
|
||||||
|
h('p', { className: styles.ovPlaceholderTitle }, '待核实'),
|
||||||
|
h('p', { className: styles.hint }, listError !== null ? '暂时无法统计新增记忆。' : 'Mnemon 记忆带创建时间后,这里显示每日新增。'),
|
||||||
|
)
|
||||||
|
: h('figure', { className: styles.ovChart },
|
||||||
|
h('ul', { className: styles.plot, 'aria-label': '每日新增的全局记忆条数' },
|
||||||
|
trend.map((day) => h('li', {
|
||||||
|
key: day.key,
|
||||||
|
className: day.count === 0 ? styles.plotZero : '',
|
||||||
|
style: { '--height': (day.count === 0 ? 0 : Math.max(3, (day.count / trendMax) * 100)) + '%' },
|
||||||
|
},
|
||||||
|
h('span', { className: styles.srOnly }, day.full + ',' + String(day.count) + ' 条'),
|
||||||
|
h('span', { className: styles.plotSlot, 'aria-hidden': 'true' },
|
||||||
|
day.count === 0 ? null : h('span', { className: styles.plotBar }),
|
||||||
|
h('span', { className: styles.plotAmount }, String(day.count)),
|
||||||
|
),
|
||||||
|
h('time', { className: styles.plotDay, 'aria-hidden': 'true', dateTime: day.key }, day.label),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
h('figcaption', { className: styles.hint }, total === 0 ? '近 7 天没有新增。' : '按现存记忆的创建日期统计,今天截至快照时间。'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
h('section', { className: styles.card + ' ' + styles.ovChecks, 'aria-labelledby': 'ov-checks-title' },
|
||||||
|
h('h4', { id: 'ov-checks-title', className: styles.ovCardTitle }, '记录与处理'),
|
||||||
|
h('ul', { className: styles.rows },
|
||||||
|
rows.map((row) => h('li', { key: row.name, className: row.tone === 'warn' ? styles.rowAttention : '' },
|
||||||
|
h('span', { className: styles.dot + (row.tone === 'warn' ? ' ' + styles.dotWarn : row.tone === 'muted' ? ' ' + styles.dotMuted : ''), 'aria-hidden': 'true' }),
|
||||||
|
h('div', {},
|
||||||
|
h('p', { className: styles.rowName + (row.tone === 'warn' ? ' ' + styles.rowNameWarn : '') }, row.name),
|
||||||
|
h('p', { className: styles.hint }, row.meta),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
memory === null ? h('p', { className: styles.hint }, '本地记忆状态路由不可用;启用「本地记忆」后此处会显示空间状态。') : null,
|
|
||||||
),
|
),
|
||||||
h(Card, { title: '同步统计' },
|
|
||||||
h('div', { className: styles.statRow },
|
h('section', { className: styles.card + ' ' + styles.ovRecall, 'aria-labelledby': 'ov-recall-title' },
|
||||||
h('span', { className: styles.stat }, h('span', { className: styles.statNum }, String(reporter.recorded ?? 0)), h('span', { className: styles.hint }, '已上报回合')),
|
h('div', { className: styles.ovRecallHead },
|
||||||
h('span', { className: styles.stat }, h('span', { className: styles.statNum }, String(skills.downloaded?.length ?? 0)), h('span', { className: styles.hint }, '技能下载')),
|
h('h4', { id: 'ov-recall-title', className: styles.ovCardTitle }, '最近一次召回'),
|
||||||
h('span', { className: styles.stat }, h('span', { className: styles.statNum }, String(skills.uploaded?.length ?? 0)), h('span', { className: styles.hint }, '技能上传')),
|
h('p', { className: styles.ovRecallState }, '待核实'),
|
||||||
h('span', { className: styles.statLast }, h('span', { className: styles.statNum }, String(skills.conflicts?.length ?? 0)), h('span', { className: styles.hint }, '待处理冲突')),
|
),
|
||||||
|
h('dl', { className: styles.recallMetrics },
|
||||||
|
['命中条数', '高', '中', '未知分档', '召回时间'].map((label) => h('div', { key: label },
|
||||||
|
h('dt', {}, label),
|
||||||
|
h('dd', { className: styles.recallMissing }, h('span', { 'aria-hidden': 'true' }, '—'), h('span', { className: styles.srOnly }, '待核实')),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
h('p', { className: styles.hint }, '当前未能取得 Mnemon 的最近一次召回结果。'),
|
||||||
|
),
|
||||||
|
|
||||||
|
h('details', { className: styles.card + ' ' + styles.ovDiag },
|
||||||
|
h('summary', { className: styles.ovDiagSummary }, '诊断详情'),
|
||||||
|
h('dl', { className: styles.diagGrid },
|
||||||
|
diag.map(([term, value]) => [
|
||||||
|
h('dt', { key: term + '-t' }, term),
|
||||||
|
h('dd', { key: term + '-d' }, value),
|
||||||
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -423,7 +423,7 @@ function loadBundle() {
|
||||||
loadBundle()
|
loadBundle()
|
||||||
const panelText = render(React.createElement(mainPanel))
|
const panelText = render(React.createElement(mainPanel))
|
||||||
check('the main slot renders the Brain overview without accessing the layout service',
|
check('the main slot renders the Brain overview without accessing the layout service',
|
||||||
panelText.includes('概览') && panelText.includes('版本与构建') && panelText.includes('部门'))
|
panelText.includes('概览') && panelText.includes('全局记忆') && panelText.includes('诊断详情') && panelText.includes('部门'))
|
||||||
hooks = []
|
hooks = []
|
||||||
cursor = 0
|
cursor = 0
|
||||||
pendingEffects = []
|
pendingEffects = []
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@ for (const label of ['连接与上报', '技能管理', 'MCP 管理', '概览',
|
||||||
}
|
}
|
||||||
check('client bundle keeps the panel semantic anchor', bundle.includes('data-dsh-panel-entry') && bundle.includes('data-dsh-plugin'))
|
check('client bundle keeps the panel semantic anchor', bundle.includes('data-dsh-panel-entry') && bundle.includes('data-dsh-plugin'))
|
||||||
check('Brain does not bundle a replacement for the Mnemon right tab', !bundle.includes('dsh-brain:memory'))
|
check('Brain does not bundle a replacement for the Mnemon right tab', !bundle.includes('dsh-brain:memory'))
|
||||||
for (const apiPath of ['/dsh-brain/local-memory/status', '/dsh-brain/local-memory/memories', '/dsh-brain/local-memory/documents', '/dsh-brain/local-memory/forget', '/dsh-brain/departments/list', '/dsh-brain/departments/create', '/dsh-brain/departments/update', '/dsh-brain/departments/disable', '/dsh-brain/departments/checkpoint', '/dsh-brain/departments/recall']) {
|
// Memory reads moved to the Mnemon bridge (single source of truth); the local
|
||||||
|
// forget path stays for the future write round. Departments are unchanged.
|
||||||
|
for (const apiPath of ['/dsh-brain/mnemon/runtime', '/dsh-brain/mnemon/list', '/dsh-brain/mnemon/status', '/dsh-brain/mnemon/documents', '/dsh-brain/local-memory/forget', '/dsh-brain/departments/list', '/dsh-brain/departments/create', '/dsh-brain/departments/update', '/dsh-brain/departments/disable', '/dsh-brain/departments/checkpoint', '/dsh-brain/departments/recall']) {
|
||||||
check('client bundle consumes ' + apiPath, bundle.includes(apiPath))
|
check('client bundle consumes ' + apiPath, bundle.includes(apiPath))
|
||||||
}
|
}
|
||||||
for (const label of ['记忆条目', '部门列表', '部门召回', '数据已变化,请刷新']) {
|
for (const label of ['记忆条目', '部门列表', '部门召回', '数据已变化,请刷新']) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue