Skip to content

feat(dashboard): add live MemOS backend - #4

Open
majh3 wants to merge 2 commits into
hugegraph:dashboardfrom
majh3:feat/dashboard-live-backend
Open

majh3 wants to merge 2 commits into
hugegraph:dashboardfrom
majh3:feat/dashboard-live-backend

Conversation

@majh3

@majh3 majh3 commented Oct 25, 2026

Copy link
Copy Markdown

Purpose of the PR

Refs #1

为 MemOS Dashboard 提供真实数据后端,完成 Issue #1 中记忆管理、调用日志、工作区和用量统计的服务端接入,并保持原版前端源代码。

Main Changes

P0:记忆管理、调用日志与运行信息

  • 从 MemOS REST 读取真实记忆,集中处理六个标签页与四类原生记忆的映射、分页、关键词及时间/主体筛选、详情和统计。默认统计 activated 记忆,列表通过白名单投影控制响应体积。
  • 提供指定记忆 ID 的软删除,保留图节点、关系和向量,并同步删除状态。
  • 从 MCP 网关审计 JSONL 提供日志列表、筛选、分页及详情,兼容历史缺字段记录;按记录中的工作区和密钥归属隔离数据。
  • /api/meta 返回 mode: live、上游健康状态和运行信息。

P1:工作区与用量

  • 提供工作区管理、选择状态持久化,以及 Dashboard 项目、原生用户和记忆空间之间的显式映射。
  • 从同一份审计 JSONL 按天聚合调用量,提供工作区/API Key 维度及全事件计数;按 Issue 约定将 token 计数字段设为 0。

接口契约与架构

  • 对齐原 37 条接口的统一响应、四种列表键、pageNum/pageSize 及日志详情 JSON 字符串格式。知识库、额度/订阅、技能共 11 条接口按 Issue 约定提供占位响应。
  • 新增与 server/mock/ 并列的 TypeScript BFF server/live/,前端通过 VITE_API_BASE 接入。
  • 配套原生 Python 扩展,提供指定 ID 软删除、工作区 Prompt 和运行时模型清单;网关扩展负责密钥配置热加载及可信审计归属。
  • BFF、Node 测试和部署辅助工具使用 TypeScript,运行环境为 Node 22.18+。部署文档包含配套镜像、配置和卷挂载要求,管理端访问控制由私网或外部鉴权网关提供。

P2/P3 与页面兼容

  • 实现工作区 Prompt 的读取、保存、生成、调试,以及同步文本精细抽取中的生效。
  • 实现 API Key 列表、创建、复制、撤销和网关鉴权;提供工作区范围的属性树模板管理接口。
  • 为当前模型页面补充运行时模型清单接口,展示已初始化组件的模型、用途和类型。

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, including memory mapping, workspace isolation, audit aggregation, keys, Prompt and contract regression tests.
  • Need tests and can be verified as follows:
    • 类型检查、lint、格式及生产构建:pnpm verify。
    • 前端源文件一致性:node scripts/issue-acceptance/verify-frontend-unchanged.ts。
    • BFF、契约和安全回归:pnpm test:live、pnpm test:issue、pnpm test:issue:safety。
    • OpenAPI 校验:npx --yes @redocly/cli@2.67.1 lint openapi.json。
    • 原生扩展单测覆盖鉴权、软删除、运行时模型清单及安装补丁。

真实服务验收覆盖了原生写入与页面 ID/内容比对、工作区切换、软删除后的存储状态、MCP 调用与原始 JSONL 对照、密钥与 Prompt 生效,以及模型页面内容。性能和健壮性检查覆盖单页记忆响应体积、万行日志首屏响应、上游故障提示及历史日志缺字段。复现命令、环境配置和测试范围见 测试文档及真实服务验收说明。

Remaining frontend limitations

以下 Issue #1 验收项仍需前端接入:

验收项 当前页面实现与阻塞原因 所需前端接入
记忆的时间、主体筛选 Memories.tsx 的请求包含工作区、记忆类型、分页和关键词,尚无时间范围、主体类型/ID的控件及参数绑定。 增加筛选控件,将条件传给已有记忆查询接口。
用量分页、搜索 Usage.tsx 按日期范围获取 dailyStats 后直接渲染全部日记录,缺少分页、搜索控件及对应状态逻辑。 为日统计列表增加分页与搜索交互;现有日期范围切换可继续使用。
全事件调用总数展示 页面仍按 addMessage.calls + searchMemory.calls 计算总数,尚未读取后端的 totalCalls 和 callsByEvent,其他事件未计入展示。 使用全事件计数更新总量及事件分类展示。
模板列表与详情(加分项) ProfileTemplates.tsx 当前渲染 ComingSoon,尚无模板列表、详情视图及接口调用。 接入模板管理接口并补齐列表和详情页面。

这些页面能力补齐后,可复验对应的 Issue 验收项。

Does this PR potentially affect the following parts?

  • Dependencies:新增 ajv、ajv-formats,均为 MIT;许可证及运行镜像保留方式见 依赖说明。
  • Modify configurations:BFF 环境变量、原生扩展开关与令牌、网关配置及 Docker 卷挂载。
  • The public API:Dashboard 接口实现、审计/用量扩展字段及模型清单接口。
  • Other affects:Node 最低版本提升至 22.18,BFF 与原生扩展需配套部署。
  • Nope

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

Documentation files in this PR:

majh3 and others added 2 commits October 22, 2026 17:31
Connect the unchanged dashboard to real MemOS data through an independent BFF, with scoped native extensions and explicit acceptance boundaries.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
- Run the live backend and acceptance tools as TypeScript on Node 22.18+.
- Expose authenticated runtime model inventory for the Dashboard.
- Align browser checks and deployment guidance with the Issue 1 contract.

Refs hugegraph#1

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>
@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f7767030-cefd-40dc-8968-49195f7c0cae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant