Files
curriculum-project-hub/docs/architecture/likec4/model.c4
T
2026-06-06 19:22:58 +08:00

127 lines
5.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
model {
teacher = actor 'Teacher' {
description '教研老师。可以同时参与多个项目群,在群里讨论并在需要时 @Claude。'
}
admin = actor 'Admin' {
description '管理员。管理项目、权限、异常锁释放和审计。'
}
feishu = externalSystem 'Feishu / Lark' {
description '项目群、消息、卡片交互和历史消息 API。'
}
claude = externalSystem 'Claude / Claude Code' {
description '执行课程资料生成、修改和问答的 AI agent。'
}
workspace = externalSystem 'Project Workspace' {
description '每个课程项目的文件、素材、课件、教案和生成产物所在工作区。'
}
hub = system 'Curriculum Project Hub' {
description '教研项目工作台。把项目、飞书群、Claude run、锁、上下文和产物管理成一个明确的协作系统。'
web = app 'Project Console' {
description '后台/工作台 UI,用于项目管理、权限、run 审计、异常取消和强制释放锁。'
}
api = service 'Hub API' {
description '对 UI、飞书回调、内部 agent runtime 暴露业务 API。'
}
project = service 'Project Service' {
description '管理 Project、成员、项目群绑定、项目状态和产物引用。'
}
permission = service 'Permission Service' {
description '飞书云文档式权限层。按 resource + principal + role 授权,并用 permission settings 控制分享、评论、下载、协作者管理和 Claude 调用。'
}
im = adapter 'IM Bridge Adapter' {
description '飞书/Lark 适配层。负责事件去重、卡片、消息投递、按钮回调和限流;优先评估复用 Claude-to-IM 的 adapter/delivery 能力。'
}
run = service 'Run Orchestrator' {
description '在 @Claude 时创建 AgentRun,申请项目锁,调度 Claude runtime,处理取消、失败、等待用户和完成。'
}
locks = service 'Project Lock Service' {
description '统一项目级锁。scope = project_idowner = run_idlifetime = 一次 Claude run。'
}
context = service 'Context Service' {
description '提供当前触发消息、回复链、项目记忆、产物上下文和按需历史读取。第一版不长期缓存飞书全文。'
}
mcp = service 'MCP Gateway' {
description 'Claude 可调用的内部工具入口,例如读取当前项目群历史、触发消息、附件和产物上下文。'
}
runtime = runtime 'Claude Runtime' {
description '调用 Claude Code / SDK / wrapper,维护 provider session resume,并执行具体任务。'
}
db = store 'Application Database' {
description '项目、群绑定、AgentSession、AgentRun、锁、审计和轻量索引。'
projectEntity = entity 'Project'
groupEntity = entity 'ProjectGroupChat'
sessionEntity = entity 'AgentSession'
runEntity = entity 'AgentRun'
lockEntity = entity 'ProjectAgentLock'
permissionEntity = entity 'PermissionGrant'
settingsEntity = entity 'PermissionSettings'
memoryEntity = entity 'ProjectMemory / Decisions'
auditEntity = entity 'AuditLog'
}
web -> api 'manage projects, runs and locks'
api -> project 'project commands'
api -> permission 'authorize user actions'
api -> run 'trigger/cancel/admin actions'
api -> db 'read/write application state'
im -> api 'Feishu events and card callbacks'
im -> feishu 'send messages, cards, updates'
im -> project 'bind chat to project'
im -> permission 'check card/action permissions'
im -> run 'create/cancel run on @Claude or card action'
project -> db 'persist projects and group bindings'
permission -> db 'persist grants and settings'
run -> locks 'acquire/release project lock'
run -> permission 'authorize trigger/cancel/force release'
locks -> db 'persist lock owner = run_id'
run -> context 'build seed context'
run -> runtime 'execute Claude turn'
run -> db 'persist AgentRun state'
runtime -> claude 'resume/call Claude'
runtime -> workspace 'read/write project files'
runtime -> mcp 'request project context'
mcp -> context 'resolve run-scoped context'
context -> feishu 'read messages by chat/thread/message id'
context -> db 'read project memory and anchors'
projectEntity -> groupEntity 'has project group'
projectEntity -> permissionEntity 'has collaborators'
projectEntity -> settingsEntity 'has operation settings'
projectEntity -> sessionEntity 'has long-lived Claude session'
projectEntity -> runEntity 'has many runs'
projectEntity -> lockEntity 'has current lock'
permissionEntity -> settingsEntity 'is constrained by'
runEntity -> lockEntity 'owns while running'
sessionEntity -> runEntity 'is reused by runs'
projectEntity -> memoryEntity 'stores summary and decisions'
runEntity -> auditEntity 'records lifecycle events'
}
teacher -> feishu 'discusses in project groups'
teacher -> hub.im '@Claude and card actions'
teacher -> hub.web 'reviews projects and runs'
admin -> hub.web 'administers locks, permissions and audit'
feishu -> hub.im 'message events and callbacks'
}