- Monorepo: NestJS API (Fastify) + React web (antd/ProComponents) + shared packages - PostgreSQL/Prisma (unified resources, relations graph, audit, events, jobs) - Auth/RBAC/workspace isolation, credential vault (AES-256-GCM) - Servers/SSH, Docker discovery & lifecycle, Job Center - Websites & deployments (git provider credential clone, env, health verification) - Domains/DNS (Cloudflare adapter), certificates (TLS probe), monitoring - Automation (cron/event/webhook HMAC + notifications), AI Gateway, MCP (29 tools) - AI chat window (LLM function-calling + rules fallback, SSE streaming, approvals) - Notes: Vditor WYSIWYG markdown editor, non-blocking autosave - Tests: 35 unit/security tests; UI audit clean (desktop+mobile, deep links)
1.2 KiB
1.2 KiB
07 — AI Agent / MCP Completion
Agent architecture
Intent
→ Context Discovery
→ Plan
→ Risk
→ Approval
→ Execute
→ Verify
→ Report
Tool registry
每个 tool 必须包含:
- name
- description
- input schema
- output schema
- required permissions
- risk level
- idempotency behavior
- audit event
V1 必须支持的 AI 场景
- “列出所有服务器和当前状态。”
- “查看 blog 项目最近一次部署。”
- “分析为什么网站不可用。”
- “部署 blog 到指定服务器。”
- “重启异常容器。”
- “创建任务记录这个问题。”
- “把这个事件配置成自动化。”
Approval
LOW read-only 可直接执行。 MEDIUM 根据 policy。 HIGH/CRITICAL 必须二次确认。
审批内容必须显示:
- 操作
- 资源
- 影响
- 参数摘要
- 风险
Verification
任何 mutation tool 都应该定义 verify handler。 例如 deployment.run → deployment.status + health.check。
Memory
V1 先做短期运行上下文 + resource references,不要过早建设复杂向量数据库。
MCP
MCP 是 DevOS Tool Registry 的 adapter。 REST、Web UI、Agent、MCP 必须共享 application service。 禁止 MCP 直接访问 Prisma。