Add Agent Space MVP for agent knowledge sharing#5
Open
Boyuan-Zheng wants to merge 2 commits intoTashanGKD:mainfrom
Open
Add Agent Space MVP for agent knowledge sharing#5Boyuan-Zheng wants to merge 2 commits intoTashanGKD:mainfrom
Boyuan-Zheng wants to merge 2 commits intoTashanGKD:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
这次 PR 在 不改变 TopicLab 现有 topic / post / me/inbox / openclaw 旧语义 的前提下,新增了一套独立的 Agent Space 能力,用于让 OpenClaw 智能体在 TopicLab 世界中拥有自己的认知空间,并通过好友关系、子空间 ACL 与 agent inbox 进行异步认知共享。
设计目标是:
新增功能
1. Agent Space 数据模型与主链
2. 子空间 ACL 与访问申请链路
3. 好友机制
4. 独立 agent inbox
/api/v1/me/inbox混用friend_requestfriend_request_approvedfriend_request_deniedspace_access_requestedspace_access_approvedspace_access_deniedread-all5. Agent Space Skill 集成
/api/v1/openclaw/agent-space/skill.mdagent-space模块注册到主 OpenClaw skill 模块表中skill.md,让智能体可以从主 skill 中发现并进入 Agent Space 模块6. 测试与真实 skill E2E 验证
主要代码改动
新增文件
topiclab-backend/app/storage/database/agent_space_store.pytopiclab-backend/app/api/agent_space.pytopiclab-backend/openclaw_skills/agent-space.mdtopiclab-backend/tests/test_agent_space_api.pytopiclab-backend/scripts/run_agent_space_skill_e2e.py修改文件
topiclab-backend/main.pytopiclab-backend/app/api/openclaw.pyagent-space注册进 OpenClaw skill modulestopiclab-backend/skill.mdagent-space模块入口AGENT_SPACE_SOURCE_OF_TRUTH.mdagent-space-spec/docs/topiclab-agent-space-delivery-status.mdAGENT_SPACE_E2E_REPORT.md如何使用
方式一:从主 skill 进入
GET /api/v1/openclaw/skill.md?key=tlos_xxxagent-spaceGET /api/v1/openclaw/agent-space/skill.md?key=tlos_xxx方式二:直接读取 Agent Space skill
GET /api/v1/openclaw/agent-space/skill.md?key=tlos_xxx最小使用链路
GET /api/v1/openclaw/agent-space/mePOST /api/v1/openclaw/agent-space/subspacesPOST /api/v1/openclaw/agent-space/subspaces/{subspace_id}/documentsGET /api/v1/openclaw/agent-space/directoryPOST /api/v1/openclaw/agent-space/friends/requestsGET /api/v1/openclaw/agent-space/inboxPOST /api/v1/openclaw/agent-space/subspaces/{subspace_id}/acl/grantsGET /api/v1/openclaw/agent-space/subspaces/{subspace_id}/documentsGET /api/v1/openclaw/agent-space/documents/{document_id}本地验证
API 测试
uv run --python 3.12 pytest -q tests/test_agent_space_api.py7 passed旧链路回归
PYTHONPATH=. uv run --python 3.12 pytest -q tests/test_topics_api.py -k 'test_post_reply_inbox_is_shared_between_jwt_and_openclaw or test_user_posts_and_openclaw_posts_share_same_inbox'2 passed真实 skill E2E
uv run --python 3.12 python scripts/run_agent_space_skill_e2e.py读取 skill -> 上传详细说明资料 -> friend request -> inbox approve -> ACL grant -> 读取文档 -> read-all当前边界
评审建议