agent_mcp: отдельный MCP для рутин Claude, роль khb_agent (миграция 004), деплой, документация
All checks were successful
ci / test (push) Successful in 14s
ci / deploy (push) Successful in 1m18s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-11 14:34:26 +03:00
parent dd735bef04
commit e203d2cc1e
22 changed files with 1210 additions and 28 deletions

View File

@@ -0,0 +1,27 @@
-- Права роли khb_agent (рутины Claude через MCP agent_mcp). Роль создаётся отдельно администратором БД
-- (create role khb_agent login ...), поэтому миграция выполняется только если роль существует.
-- Белый список объектов: чтение - v_agent_input, reminder_history, active_task_list, active_task;
-- запись (insert/update, без delete) - active_task_list, active_task.
do $$
begin
if exists (select 1 from pg_roles where rolname = 'khb_agent') then
grant usage on schema public to khb_agent;
grant select on v_agent_input, reminder_history, active_task_list, active_task to khb_agent;
grant insert, update on active_task_list, active_task to khb_agent;
drop policy if exists khb_agent_read on reminder_history;
create policy khb_agent_read on reminder_history for select to khb_agent using (true);
drop policy if exists khb_agent_read on active_task_list;
create policy khb_agent_read on active_task_list for select to khb_agent using (true);
drop policy if exists khb_agent_write on active_task_list;
create policy khb_agent_write on active_task_list for insert to khb_agent with check (true);
drop policy if exists khb_agent_update on active_task_list;
create policy khb_agent_update on active_task_list for update to khb_agent using (true) with check (true);
drop policy if exists khb_agent_read on active_task;
create policy khb_agent_read on active_task for select to khb_agent using (true);
drop policy if exists khb_agent_write on active_task;
create policy khb_agent_write on active_task for insert to khb_agent with check (true);
drop policy if exists khb_agent_update on active_task;
create policy khb_agent_update on active_task for update to khb_agent using (true) with check (true);
end if;
end $$;