Files
khb_microservices/packages/khb_common/migrations/006_cli_agents.sql
Yuri Yaryshev 27b9842894
All checks were successful
ci / test (push) Successful in 14s
ci / deploy (push) Successful in 3m7s
Консольные агенты claude -p вместо рутин: шаги 2-4, Slack Socket Mode, миграция 006, удаление agent_mcp
- khbuild_assistant_prep: agents (cli-runner, сессии, проверка и повторы формата, шаг 2), slack (Socket Mode, приём, шаг 4, Drive/rclone), промты в promts/
- миграция 006: память менеджера, списки дня, журналы проблем/сообщений/запусков; удалены active_task*, ap_agent_invocation
- удалён package agent_mcp; Dockerfile с claude/ffmpeg/exiftool/whisper/rclone; compose-шаблон сервиса агентов
- docs: структура approved/proposed (modules, data_objects, roles), скрипт сводок

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-11 23:24:23 +03:00

71 lines
3.1 KiB
SQL

-- Консольные агенты Claude (шаги 2-4 спецификации): память менеджера, итоговые списки, журналы; удаление объектов рутин
alter table construction_manager add column slack_user_id text;
alter table construction_manager add column slack_channel_id text;
create table agent_manager_memory (
manager_person_id uuid primary key references construction_manager(person_id),
memory_text text not null default '',
claude_session_id uuid,
updated_at timestamptz not null default now()
);
create table manager_day_list (
id uuid primary key default gen_random_uuid(),
manager_person_id uuid not null references construction_manager(person_id),
list_date date not null,
package_ids uuid[] not null default '{}',
list_text text not null,
is_current boolean not null default true,
created_at timestamptz not null default now()
);
create index manager_day_list_cur_idx on manager_day_list (manager_person_id, list_date) where is_current;
create table agent_problem_log (
id uuid primary key default gen_random_uuid(),
manager_person_id uuid references construction_manager(person_id),
step text not null check (step in ('step2','step4')),
severity text not null check (severity in ('log','it_request')),
body text not null,
created_at timestamptz not null default now()
);
create table slack_message_log (
channel_id text not null,
message_ts text not null,
manager_person_id uuid references construction_manager(person_id),
has_files boolean not null default false,
status text not null check (status in ('received','processing','done','failed','ignored')),
received_at timestamptz not null default now(),
processed_at timestamptz,
primary key (channel_id, message_ts)
);
-- журнал запусков консольных агентов (замена вызовов рутин в ap_agent_invocation)
create table agent_run (
id uuid primary key default gen_random_uuid(),
manager_person_id uuid references construction_manager(person_id),
step text not null check (step in ('step2','step4')),
attempt int not null default 1,
session_id uuid,
resumed boolean not null default false,
status text not null check (status in ('running','ok','failed')),
started_at timestamptz not null default now(),
finished_at timestamptz,
duration_ms int,
cost_usd numeric,
changes text,
error text
);
alter table agent_manager_memory enable row level security;
alter table manager_day_list enable row level security;
alter table agent_problem_log enable row level security;
alter table slack_message_log enable row level security;
alter table agent_run enable row level security;
-- объекты рутин Claude больше не используются
drop table active_task;
drop table active_task_list;
drop table ap_agent_invocation;