ACP / MCP

This commit is contained in:
2026-06-12 11:44:19 +08:00
parent 2a9661a6ef
commit 4ea4adfd8e
47 changed files with 2558 additions and 240 deletions
@@ -0,0 +1,3 @@
DROP TABLE IF EXISTS acp_agent_kind_config_files;
ALTER TABLE acp_agent_kinds DROP CONSTRAINT IF EXISTS acp_agent_kinds_client_type_check;
ALTER TABLE acp_agent_kinds DROP COLUMN IF EXISTS client_type;
+23
View File
@@ -0,0 +1,23 @@
-- ============ AgentKind client_type ============
-- client_type 决定 spawn 时注入哪个配置目录重定向变量(CLAUDE_CONFIG_DIR /
-- CODEX_HOME / GEMINI_CLI_HOME)以及前端渲染哪套配置表单。generic 仅注入 HOME。
ALTER TABLE acp_agent_kinds ADD COLUMN client_type TEXT NOT NULL DEFAULT 'generic';
ALTER TABLE acp_agent_kinds
ADD CONSTRAINT acp_agent_kinds_client_type_check
CHECK (client_type IN ('claude_code', 'codex', 'gemini', 'generic'));
-- ============ AgentKind 配置文件 ============
-- rel_path 相对受管 home 目录(如 .claude/settings.json、.codex/config.toml)。
-- encrypted_content 是 AES-GCM 密文(内容可能含 auth token / API key)。
-- spawn 前全量物化到 <data_dir>/agent-homes/<agent_kind_id>/。
CREATE TABLE acp_agent_kind_config_files (
id UUID PRIMARY KEY,
agent_kind_id UUID NOT NULL REFERENCES acp_agent_kinds(id) ON DELETE CASCADE,
rel_path TEXT NOT NULL,
encrypted_content BYTEA NOT NULL,
updated_by UUID NOT NULL REFERENCES users(id) ON DELETE RESTRICT,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
CONSTRAINT acp_agent_kind_config_files_unique UNIQUE (agent_kind_id, rel_path)
);
CREATE INDEX idx_acp_agent_kind_config_files_kind ON acp_agent_kind_config_files(agent_kind_id);
@@ -0,0 +1 @@
ALTER TABLE acp_agent_kinds DROP COLUMN IF EXISTS encrypted_mcp_servers;
@@ -0,0 +1,6 @@
-- ============ AgentKind 第三方 MCP servers ============
-- encrypted_mcp_servers 是 AES-GCM 密文,明文为 McpServerSpec JSON 数组
-- (条目可能含 auth header / stdio env 密钥)。session/new 握手时与 ACW 自家
-- MCP(per-session token)一并下发给 agent;http/sse 条目按 agent 能力过滤。
-- 与 encrypted_env 的差异:内容明文返回给 admin 供编辑(同配置文件先例)。
ALTER TABLE acp_agent_kinds ADD COLUMN encrypted_mcp_servers BYTEA;