Compare commits

..
Author SHA1 Message Date
DenozordecandClaude Sonnet 5.5 5ec95a7c95 chore(docs): пересмотреть D5, контроллер прогона A на VPS
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 10:20:55 +07:00
DenozordecandClaude Sonnet 5.5 c207e6b3a2 chore(docs): зафиксировать решения D5, D7, D9 и D10 прогона A
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 10:15:58 +07:00
DenozordecandClaude Sonnet 5.5 37196d5d54 chore(docs): зафиксировать решение D4 в плане прогона A
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 10:14:59 +07:00
DenozordecandClaude Sonnet 5.5 0fba78147c chore(docs): зафиксировать решение D3 в плане прогона A
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 10:14:38 +07:00
DenozordecandClaude Sonnet 5.5 cd1b67057d chore(docs): зафиксировать решение D2 в плане прогона A
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 10:13:57 +07:00
DenozordecandClaude Sonnet 5.5 e2d97b2ad7 chore(docs): зафиксировать решение D1 в плане прогона A
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 10:12:10 +07:00
DenozordecandClaude Sonnet 5.5 c62a3ae3e3 chore(docs): добавить план стендового прогона A
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 10:11:29 +07:00
DenozordecandClaude Sonnet 5.5 0cbdc282c4 chore(docs): отметить приёмку Inspector по HTTP и OAuth, закрыть этап 2
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 09:19:27 +07:00
DenozordecandClaude Sonnet 5.5 85a5fdb9aa chore(docs): сгруппировать стендовые приёмки этапа 3 в три прогона
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 09:13:50 +07:00
DenozordecandClaude Sonnet 5.5 44c1036942 chore(docs): отметить решение оставить settings.local.json под Git
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 09:10:28 +07:00
DenozordecandClaude Sonnet 5.5 4b92c20cb5 chore(docs): зафиксировать результат сверки tmp-патчей и черновиков
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 09:08:18 +07:00
DenozordecandClaude Sonnet 5.5 91d5535651 chore(docs): оформить причину unknown из CI2713 как неустановленную
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 09:06:41 +07:00
DenozordecandClaude Sonnet 5.5 6f2e88261f chore(docs): перенести RT-3 в этап 4
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 09:03:02 +07:00
DenozordecandClaude Sonnet 5.5 345288ed12 chore(docs): уточнить статус пунктов VRF, dhcp-client и RT-3 в этапе 2
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 09:02:24 +07:00
DenozordecandClaude Sonnet 5.5 420eb372ae chore(docs): оформить NetFlow wildcard как ограничение Node dgram
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 08:59:05 +07:00
DenozordecandClaude Sonnet 5.5 b0e2912c8e chore(docs): перенести нестабильные сценарии Edge и маршрутизации в этап 3
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 08:54:14 +07:00
DenozordecandClaude Sonnet 5.5 8d97388c40 fix(test): не зависать на закрытии мок-сервера после приёмки native CREATE ID
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 05:27:34 +07:00
DenozordecandClaude Sonnet 5.5 a7db013c7b chore(docs): отметить прогресс этапа 1 в плане MCP
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 00:08:05 +07:00
DenozordecandClaude Opus 5.5 77e52f157a fix(test): обновить заглушки standalone-тестов IPsec и восстановления БД
Устаревшие тесты, не дефекты продукта (профили test:ipsec и
test:system-database):
- ipsec-nat и ipsec-group: аудит конфигурации теперь пишется через
  requestAccountingWrite (BEGIN, pg_catalog.pg_try_advisory_xact_lock_shared,
  COMMIT), а SQL-заглушка знала только прежние запросы и падала, превращая
  ожидаемый отказ preflight 409 в 502. Заглушка принимает новые запросы
  блокировки и границы транзакции.
- database-restore-audit: bootstrap.ts теперь импортирует модули карантина и
  контрольной точки восстановления и читает process.env; в карту заглушек
  добавлены значения обычного запуска (без карантина и checkpoint), в
  контекст передан пустой process.env. Проверка порядка (guard → миграции →
  импорт → аудит) не менялась.
Проверено: --all --regression-only для test:ipsec и test:system-database → exit 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 23:38:32 +07:00
DenozordecandClaude Opus 5.5 1094acb5c5 fix(test): совместить перехват аудита с наблюдателем checkpoint и починить сбои purge
Устаревшие тесты, не дефекты продукта.
- Фикстур configuration-audit-commit оборачивал клиента через Proxy; вместе с
  committed-scoped-checkpoint-observer, который подменяет client.query на
  экземпляре, это давало бесконечную рекурсию (RangeError в приёмке scoped
  route community). Теперь фикстур, как и наблюдатель, подменяет query на
  экземпляре и восстанавливает его при release; отключение не затирает более
  поздние обёртки pool.connect.
- Приёмка NetFlow purge внедряла сбой журнала событий через pool.query, а
  событие пишется через withPartitionWrite на клиенте pool.connect(), поэтому
  режим journal-failure не срабатывал. Сбои журнала/обслуживания партиций
  проверяются в обоих перехватчиках; сообщения assert называют режим.
Проверено: node scripts/test-mcp-postgres.mjs --recovery-maintenance → exit 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 23:15:17 +07:00
DenozordecandClaude Opus 5.5 dfb73555a7 fix(test): исправить устаревшие проверки монолита MCP и добавить режим продолжения
Устаревшие тесты, не дефекты продукта:
- Пауза во время списка шаблонов OSPF: план читает список шаблонов один раз
  (затем два print-запроса флагов, перед каждым повторная проверка доступа),
  поэтому второй итерации «пауза во время второго списка» не существует.
  Диагностический прогон подтвердил одну выборку списка; итерация 0 (пауза
  во время единственного списка → отказ UNAUTHORIZED) сохранена.
- Отказ хранилища аудита перед нативной записью: аудит намерения пишется на
  транзакционном клиенте, перехват pool.query заменён hookConfigurationAudits
  с beforeIntent.

Режим MCP_INTEGRATION_CONTINUE=1: помощник soft() оборачивает только
самостоятельные приёмочные вызовы после блока OSPF (каждый восстанавливает
свои фикстуры в finally), записывает ошибку и продолжает; в конце печатается
список и выставляется exitCode=1. Встроенные проверки монолита и служебные
вызовы (scheduler, ingest, refreshScheduler) не обёрнуты: их сбой искажает
общее состояние для последующих шагов. Без переменной поведение прежнее.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 22:37:53 +07:00
DenozordecandClaude Opus 5.5 268640b9f1 fix(test): перевести перехваты аудита WireGuard import и scoped routing на клиент
Устаревшие тесты, не дефект продукта. Как и в предыдущих исправлениях,
configuration.intent пишется через requestAccountingWrite на клиенте из
pool.connect(), поэтому перехваты pool.query в приёмках WireGuard import
(поздняя защита интерфейса/пира после намерения) и scoped route community
(afterIntent) не срабатывали. Они переведены на afterConfigurationIntentCommit
и hookConfigurationAudits; фикстур получил beforeIntent для имитации
недоступного аудита намерения. Перехват wireguard.import.checkpoint остаётся
на pool.query: этот аудит пишется через пул.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 22:37:53 +07:00
DenozordecandClaude Opus 5.5 84e34da4f9 fix(test): отдавать /interface с интерфейсом шаблона в сценарии passive OSPF
Устаревшая фикстура, не дефект продукта. Сценарий mixed passive добавляет
непассивный шаблон OSPF на fixture-loop без Full-соседа, а мок RouterOS в
этой точке отдаёт пустой /interface. resolveOspfInterfaceSelectors
закрыто отказывает (STATE_CONFLICT), если имя интерфейса шаблона нельзя
подтвердить ни соседом, ни инвентарём, — это корректная защита. На реальном
маршрутизаторе интерфейс шаблона есть в /interface, поэтому для этого цикла
мок отдаёт инвентарь с fixture-gre и fixture-loop. Ожидание теста
(шаблон без Full не блокирует и не входит в план) не менялось.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 22:19:14 +07:00
DenozordecandClaude Opus 5.5 73af143a53 fix(test): перевести оставшиеся перехваты аудита на транзакционный клиент
Устаревшие тесты, не дефект продукта. Аудиты configuration.intent и
configuration.acknowledged пишутся через requestAccountingWrite на клиенте
из pool.connect(), поэтому перехваты pool.query в Legacy OSPF, журнале
событий, IPsec peer update, IPsec native write и native conservation не
срабатывали. Фикстур configuration-audit-commit получил общий примитив
hookConfigurationAudits (после COMMIT намерения / перед подтверждением);
afterConfigurationIntentCommit и loseConfigurationAcknowledgement построены
на нём. Ожидаемые итоги (unknown/partial, без записи и повтора) не менялись;
перехват afterVerified в native conservation остаётся на pool.query, так как
runtime обновляет шаги через пул.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 22:10:01 +07:00
DenozordecandClaude Opus 5.5 07aaa40bff fix(test): удалять сервер-фикстуру после приёмок ARP и IPv6 ND
Устаревший тест, не дефект продукта. Приёмки ARP и IPv6 ND оставляли свою
строку servers (только enabled=false), тогда как все соседние приёмки
удаляют фикстуру. После 88e82702 они создаются стабильно, и лишние строки
доходили до Legacy OSPF, который по задокументированному правилу требует
допуск ко всему каталогу (не более 10 серверов, все в scope). Соединение
приёмки OSPF ограничено серверами [1,2], поэтому каталог отклонялся.
Продуктовое правило не ослабляется: фикстуры удаляются в finally (FK на
servers каскадные; на них ничего позже не ссылается).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 22:10:00 +07:00
DenozordecandClaude Sonnet 5.5 64cfb07c22 chore(test): добавить test:changed для регресса только затронутых тестов
Скрипт берёт изменённые файлы из Git и запускает только тесты, которые на них ссылаются. Тесты на PostgreSQL он не запускает, а выводит нужный npm-профиль.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 21:59:48 +07:00
DenozordecandClaude Opus 5.5 d3a347a8ca fix(test): внедрять позднее изменение GRE после COMMIT аудита намерения
Устаревший тест, не дефект продукта. Аудит configuration.intent для
RouterOS-записи пишется на транзакционном клиенте (requestAccountingWrite),
поэтому перехват pool.query не срабатывал: поздняя пауза, защита или
изменение ревизии не внедрялись, и восстановление законно завершалось
applied. Фикстур afterConfigurationIntentCommit принимает предикат по
payload (method), тест GRE использует его; ожидания (unknown, без записи
в RouterOS) не менялись.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:58:29 +07:00
DenozordecandClaude Opus 5.5 95b9d1cd52 fix(test): перехватывать аудит GeoIP на транзакционном клиенте
Устаревший тест, не дефект продукта. Аудиты configuration.intent и
configuration.acknowledged пишутся через requestAccountingWrite на клиенте
из pool.connect(), поэтому перехват pool.query в сценариях поздней отмены
доступа и потерянного подтверждения никогда не срабатывал (revoked=false).
Общий фикстур configuration-audit-commit получил помощник
loseConfigurationAcknowledgement; тест GeoIP использует его и
afterConfigurationIntentCommit. Ожидания продукта (нет повторного запроса,
итог unknown при потере подтверждения) не менялись.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:50:13 +07:00
DenozordecandClaude Opus 5.5 c70e55d5d4 fix(test): внедрять позднее изменение ACME после COMMIT аудита намерения
Устаревший тест, не дефект продукта. Аудит configuration.intent теперь
пишется через requestAccountingWrite (транзакционный клиент), а не через
pool.query, поэтому перехват pool.query в режиме late-intent не срабатывал:
конкурентное изменение не внедрялось и запись законно завершалась applied.
Сценарий переведён на общий фикстур afterConfigurationIntentCommit (как в
mcp-acme-test.ts): изменение updated_at после фиксации намерения ловит
fence перед SQL, запись не отправляется, итог unknown без повтора.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 21:42:45 +07:00
DenozordecandClaude Sonnet 5.5 ad0162d4a2 docs(mcp): отметить lint, сборки, test:mcp и сверку покрытия в плане
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 21:41:42 +07:00
DenozordecandClaude Sonnet 5.5 969d7cd50d fix(test): расширить лимит серверов на план в тесте NetFlow overlay
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 21:33:48 +07:00
DenozordecandClaude Sonnet 5.5 88e82702db fix(test): выбирать свободный id сервера в приёмках IPv6 ND и ARP
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 21:27:36 +07:00
DenozordecandClaude Sonnet 5.5 26cba792a8 fix(test): задать часовой бюджет изменений для OSPF-сценария интеграционного теста
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 21:24:31 +07:00
DenozordecandClaude Sonnet 5.5 44b5066f3a fix(lint): устранить ошибки lint и ожидание host в тесте артефактов логов
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 21:20:17 +07:00
DenozordecandClaude Sonnet 5.5 cf6dcd77fb fix(test): синхронизировать заглушки теста планировщика и правила lint
Тест scheduler-automatic-root отстал от исходников: не хватало заглушек карантина восстановления, общего шлюза БД и проверки активации. ESLint больше не обходит локальные каталоги tmp, сгенерированный .ci/docker и dist-*, ошибки Codex в новых скриптах и тестах устранены.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 21:13:52 +07:00
DenozordecandClaude Sonnet 5.5 eec070d2d6 docs(mcp): записать итог проверки LF/CRLF миграций 0008–0013
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:58:43 +07:00
DenozordecandClaude Sonnet 5.5 c4dc2f95c9 docs(mcp): зафиксировать решение оставить квитанции в docs как есть
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:57:13 +07:00
DenozordecandClaude Sonnet 5.5 98831dcdf4 docs(mcp): отметить копию tmp и итог изучения реорганизации docs
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:56:50 +07:00
DenozordecandClaude Sonnet 5.5 3c78c55c0d fix(docs): сохранить в Git CRLF-байты квитанций, закреплённых SHA-256
28 файлов закреплены хешами по CRLF-байтам рабочего дерева, а в индексе были LF-блобы.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:53:14 +07:00
DenozordecandClaude Sonnet 5.5 d644d0229b docs(mcp): отметить выполнение этапа 0 в плане завершения
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:37:51 +07:00
DenozordecandClaude Sonnet 5.5 42f59f14bf fix(db): сохранить в Git исходные CRLF-байты миграций 0008–0013
Хеши в migration-manifest.ts закреплены за CRLF-байтами; в индексе были LF-блобы из main, и на чистом чекауте проверка манифеста не прошла бы.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:37:27 +07:00
DenozordecandClaude Sonnet 5.5 1d519b1734 docs(mcp): добавить документацию, аудиты вызовов и квитанции приёмки MCP
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:36:15 +07:00
DenozordecandClaude Sonnet 5.5 531d822338 ci: обновить workflow и развёртывание под MCP
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:36:15 +07:00
DenozordecandClaude Sonnet 5.5 6cb550e179 feat(mcp): добавить веб-раздел MCP, клиентский API и e2e-тесты
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:36:14 +07:00
DenozordecandClaude Sonnet 5.5 18c0a52171 feat(mcp): реализовать серверную часть MCP, адаптеры, сервисы и скрипты приёмки
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:36:13 +07:00
DenozordecandClaude Sonnet 5.5 7380f18f15 feat(mcp): добавить контракты, схему БД и миграции MCP
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:36:08 +07:00
DenozordecandClaude Sonnet 5.5 bd4ce59058 chore(git): игнорировать временные артефакты и закрепить байты миграций
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-15 20:36:02 +07:00
Denozordec 5efd0339fb feat(logs): добавить раздел логов с историей и живым потоком
Docker images / publish-release (push) Successful in 10s
Docker images / frontend-image (push) Successful in 3m29s
Docker images / netflow-agent-image (push) Successful in 34s
Docker images / backend-image (push) Successful in 1m44s
Docker images / backend-test (push) Successful in 4m35s
Docker images / updater-image (push) Successful in 41s
Docker images / notify-webhook (push) Successful in 2s
Docker images / prepare-release (push) Successful in 9s
2026-10-16 22:13:48 +07:00
Denozordec e461dc21bd fix(traffic): строить непрерывную историю коротких периодов
Docker images / publish-release (push) Successful in 13s
Docker images / frontend-image (push) Successful in 2m13s
Docker images / netflow-agent-image (push) Successful in 31s
Docker images / backend-image (push) Successful in 1m37s
Docker images / updater-image (push) Successful in 39s
Docker images / notify-webhook (push) Successful in 2s
Docker images / prepare-release (push) Successful in 9s
Docker images / backend-test (push) Successful in 4m3s
2026-10-16 19:27:30 +07:00
Denozordec 2852b11234 test(netflow): зафиксировать приёмку на двух маршрутизаторах
Docker images / publish-release (push) Successful in 10s
Docker images / frontend-image (push) Successful in 2m19s
Docker images / updater-image (push) Successful in 39s
Docker images / netflow-agent-image (push) Successful in 1m6s
Docker images / backend-image (push) Successful in 1m40s
Docker images / backend-test (push) Successful in 4m27s
Docker images / notify-webhook (push) Successful in 2s
Docker images / prepare-release (push) Successful in 12s
2026-10-16 15:47:50 +07:00
Denozordec 0abdac82de fix(netflow): показывать текущие счётчики приёмника 2026-10-16 15:45:10 +07:00
Denozordec db81cf0f97 feat(netflow): автоматизировать настройку туннеля коллектора 2026-10-16 15:03:23 +07:00
Denozordec fcca92706b chore(docs): сохранить проверку защиты от переполнения очереди подключений 2026-10-16 09:58:16 +07:00
Denozordec 4881306f0b chore(docs): сохранить диагностику задержек подключения к серверу 2026-10-16 09:53:53 +07:00
Denozordec ef229ca9c4 chore(docs): сохранить результат отключения небезопасных служб 2026-10-16 01:56:22 +07:00
Denozordec 25ae76dc3f fix(api): уточнить причины отказа входа на маршрутизатор 2026-10-16 01:32:29 +07:00
Denozordec 552d5f831f chore(docs): зафиксировать приёмку обновления в рабочем окружении 2026-10-16 00:53:30 +07:00
Denozordec e6a2e4009d fix(routes): читать рекурсивные маршруты с незаданными свойствами
Docker images / publish-release (push) Successful in 15s
Docker images / frontend-image (push) Successful in 2m46s
Docker images / backend-image (push) Successful in 1m54s
Docker images / updater-image (push) Successful in 42s
Docker images / notify-webhook (push) Successful in 2s
Docker images / prepare-release (push) Successful in 10s
Docker images / backend-test (push) Successful in 5m2s
2026-10-16 00:28:45 +07:00
Denozordec eb24a08981 fix(map): восстановить легенду и убрать лишние рамки фокуса 2026-10-15 23:36:19 +07:00
Denozordec 1c11a133f3 chore(docs): зафиксировать обновление карты в рабочем окружении 2026-10-15 23:24:54 +07:00
Denozordec 0f0d3aa060 fix(filters): восстановить связь рекурсивного шлюза после опроса 2026-10-15 23:17:42 +07:00
Denozordec 042407f03e fix(ci): подключить тесты к базе в сети задания
Docker images / frontend-image (push) Successful in 2m15s
Docker images / publish-release (push) Successful in 10s
Docker images / updater-image (push) Successful in 41s
Docker images / backend-image (push) Successful in 1m41s
Docker images / backend-test (push) Successful in 5m11s
Docker images / notify-webhook (push) Successful in 2s
Docker images / prepare-release (push) Successful in 12s
2026-10-15 22:14:14 +07:00
Denozordec b2cf71fcc7 fix(db): индексировать историю для очистки планировщика
Docker images / publish-release (push) Skipped
Docker images / backend-image (push) Skipped
Docker images / frontend-image (push) Successful in 2m39s
Docker images / backend-test (push) Failing after 2m49s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 42s
Docker images / prepare-release (push) Successful in 14s
2026-10-15 22:04:38 +07:00
Denozordec fda7f353ad fix(map): сохранить узлы при датах опроса из базы данных 2026-10-15 21:51:43 +07:00
Denozordec 72bf648ca8 fix(ci): исправить условие уведомления для новой версии сборщика
Docker images / publish-release (push) Successful in 11s
Docker images / backend-image (push) Successful in 3m2s
Docker images / frontend-image (push) Successful in 3m7s
Docker images / backend-test (push) Successful in 3m58s
Docker images / updater-image (push) Successful in 1m16s
Docker images / notify-webhook (push) Successful in 3s
Docker images / prepare-release (push) Successful in 13s
2026-10-15 20:54:29 +07:00
Denozordec 8613749de1 chore(release)!: подготовить вторую основную версию
docker.yml (push) Invalid workflow file
2026-10-15 20:49:58 +07:00
Denozordec 6210f34740 fix(tests): завершить лабораторную приёмку и обновить фикстуру удаления 2026-10-15 20:30:07 +07:00
Denozordec 481688e72a fix(tests): согласовать полную регрессию с фокусом выбранного сервера 2026-10-15 20:19:07 +07:00
Denozordec c88d31fa45 chore(rest): подтвердить устойчивость повторных параллельных чтений 2026-10-15 14:39:29 +07:00
Denozordec 3d51bba86d fix(ui): сделать сетевые показатели и настройки читаемыми в обеих темах 2026-10-15 14:37:30 +07:00
Denozordec 3c9096804b fix(ui): исправить фокус списка серверов и контраст общих элементов 2026-10-15 14:15:56 +07:00
Denozordec 9b0d7bb6e8 chore(certificates): подтвердить реальное продление и полный откат 2026-10-15 13:47:24 +07:00
Denozordec 8c5cfa0706 fix(certificates): заменять сертификат уникальным поколением 2026-10-15 01:32:21 +07:00
Denozordec c683e1b2c1 fix(routeros): подтверждать импорт сертификата и ограничить REST-сессии 2026-10-15 00:28:23 +07:00
Denozordec 9178ff2ccb fix(certificates): продлевать по подтверждённому сроку и проверить реальный импорт 2026-10-15 00:05:03 +07:00
Denozordec 0e86628d58 fix(certificates): учитывать подтверждённый часовой пояс устройства 2026-10-14 21:50:11 +07:00
Denozordec e78bc2d7cb chore(test): зафиксировать выпуск сертификата и препятствие продлению 2026-10-14 21:43:57 +07:00
Denozordec 37a9c828d3 chore(test): подготовить проверку реального продления сертификата 2026-10-14 21:31:17 +07:00
Denozordec 3d23ae4be4 fix(certificates): подтверждать результат продления и исключить выключенные серверы 2026-10-14 21:01:22 +07:00
Denozordec 0563dd7cbd fix(ui): раскрыть последствия выпуска и исправить доступность мастеров 2026-10-14 20:43:16 +07:00
Denozordec 0374b57a30 chore(test): проверить реальный выпуск сертификата и восстановление стенда 2026-10-14 19:45:24 +07:00
Denozordec dc7b22940a fix(containers): исключить опрос выключенных серверов и ложные пустые данные 2026-10-14 19:25:14 +07:00
Denozordec 74151176d7 fix(containers): подтверждать остановку и удаление контейнера 2026-10-14 19:03:58 +07:00
Denozordec b3d11276dd fix(containers): учитывать фактические состояния контейнеров 2026-10-14 18:35:07 +07:00
Denozordec 0cc8fe5572 chore(test): подготовить пакет из указанного источника 2026-10-14 15:36:44 +07:00
Denozordec 61e6671685 ci(test): включить проверку загрузки баз в общий профиль 2026-10-14 15:33:30 +07:00
Denozordec 4f6de4b08e chore(test): подготовить пакет и процедуру проверки контейнеров 2026-10-14 15:19:16 +07:00
Denozordec 044002e7eb chore(test): уточнить предпосылки внешних задач и проверить релизы 2026-10-14 15:14:51 +07:00
Denozordec 48cc65ec2b fix(geoip): проверить локальный кеш и ограничить загрузку баз 2026-10-14 15:04:20 +07:00
Denozordec 3c3d152c2d chore(test): проверить большую историю со статусами файлов 2026-10-14 14:48:58 +07:00
Denozordec 026a358ca6 chore(test): проверить хранение последних копий и частичное удаление 2026-10-14 14:46:25 +07:00
Denozordec 4b028be241 chore(test): проверить ограниченное восстановление из хранилища через интерфейс 2026-10-14 14:41:26 +07:00
Denozordec 0216415953 chore(test): проверить REST за десятиминутным окном сессий 2026-10-14 14:31:21 +07:00
Denozordec 6617b776bb fix(backups): показать отсутствие файлов и защитить удаление записей 2026-10-14 14:30:33 +07:00
Denozordec e452e528e1 chore(test): сопоставить REST клиенты и проверить сессии RouterOS 2026-10-14 11:35:59 +07:00
Denozordec ab48973eb9 fix(deploy): сохранять локальные резервные копии при пересоздании контейнера 2026-10-14 11:21:48 +07:00
Denozordec 659e658f18 fix(backups): отклонять восстановление старых частичных экспортов 2026-10-14 11:16:29 +07:00
Denozordec faf452d149 fix(backups): защитить подключение S3 и согласовать операции каталога 2026-10-14 11:05:38 +07:00
Denozordec 7cef0cc133 chore(test): проверить сохранение S3 через реальный интерфейс 2026-10-14 10:46:18 +07:00
Denozordec 41a76f1163 fix(backups): читать экспорт RouterOS порциями без потери данных 2026-10-14 10:38:49 +07:00
Denozordec c3fb66dcbf fix(backups): получать нативный экспорт и проверить восстановление из S3 2026-10-14 10:31:14 +07:00
Denozordec 03b0896369 chore(test): проверить Selectel S3 и операции резервных копий 2026-10-14 10:01:35 +07:00
Denozordec 2277a76196 chore(test): подготовить безопасную проверку тестового S3 2026-10-14 09:27:09 +07:00
Denozordec cdb528276b fix(test): сохранять снимки GRE и VXLAN в результатах проверки 2026-10-14 09:22:32 +07:00
Denozordec af07c59ffa chore(test): подтвердить Android IPsec и очистить стенд 2026-10-14 09:06:25 +07:00
Denozordec baf81c0c7d chore(test): подготовить профиль Android для проверки IPsec 2026-10-14 08:56:06 +07:00
Denozordec 0d08c21bb9 chore(test): сопоставить диагностику REST двух тестовых стендов 2026-10-14 08:37:20 +07:00
Denozordec cbb4f9f0fc chore(test): сохранить короткое наблюдение REST тестовых CHR 2026-10-14 03:09:09 +07:00
Denozordec c21deba804 chore(docs): согласовать текущий план и остаток внешней приёмки 2026-10-14 03:00:59 +07:00
Denozordec 19ad294ded fix(netflow): запускать TypeScript worker с собственным загрузчиком 2026-10-14 02:57:24 +07:00
Denozordec 7a38bb36aa fix(gre): отклонять повреждённые и повторяющиеся native идентификаторы 2026-10-14 02:09:13 +07:00
Denozordec 51a579d370 fix(gre): не подменять неизвестные флаги состоянием туннеля 2026-10-14 01:39:35 +07:00
Denozordec 9c4a0992d7 fix(alerts): учитывать ошибки реального источника GRE 2026-10-14 01:16:19 +07:00
Denozordec 8b60ab040a fix(ui): повысить контраст заполненных таблиц BGP и OSPF 2026-10-14 01:05:45 +07:00
Denozordec d91cc77cda fix(api): проверять достоверность WAN и не опрашивать выключенные серверы 2026-10-14 00:47:29 +07:00
Denozordec 4f084222ad fix(api): сохранять ошибки наблюдения BGP для оповещений 2026-10-14 00:40:41 +07:00
Denozordec 5ac5a25dfc fix(api): показывать ошибки опроса старых OSPF и BFD API 2026-10-14 00:31:50 +07:00
Denozordec eaf724d6cc fix(ui): исправить контраст метки IPsec в таблице GRE 2026-10-14 00:19:54 +07:00
Denozordec 0c5d7d3207 fix(network): выбрать IPv6-команду в экспорте GRE 2026-10-13 22:01:46 +07:00
Denozordec 1be4a490b5 fix(network): согласовать GRE PSK с FastPath и экспортом 2026-10-13 21:42:21 +07:00
Denozordec 7d86af7e8b fix(auth): закрыть обход JWT через закодированные URL 2026-10-13 21:23:51 +07:00
Denozordec 727e35f985 fix(network): исправить keepalive GRE и каталог IPsec 2026-10-13 21:15:49 +07:00
Denozordec 3f3f06f147 fix(network): скрыть GRE PSK и сохранить признак IPsec 2026-10-13 20:45:27 +07:00
Denozordec a404da768d fix(network): защитить ключи WireGuard и режим просмотра операций 2026-10-13 20:12:33 +07:00
Denozordec c8f9c83f45 fix(ui): учитывать права и состояние устройства при откате истории 2026-10-13 19:45:39 +07:00
Denozordec 5ce20e8892 chore(tests): проверить клавиатуру и фокус живых панелей 2026-10-13 19:22:54 +07:00
Denozordec b9000b16e4 fix(ui): улучшить контраст трафика и предупреждений целей 2026-10-13 16:50:12 +07:00
Denozordec 6cc0094591 chore(tests): проверить живую навигацию разделов под двумя ролями 2026-10-13 16:37:55 +07:00
Denozordec 7a58f472b3 chore(tests): подтвердить маскирование заполненных секретов интеграций 2026-10-13 16:32:58 +07:00
Denozordec 3c30c5c7cb chore(tests): проверить секреты в ответах административного API 2026-10-13 16:28:10 +07:00
Denozordec bf39b3de18 chore(tests): подтвердить цельную доставку очереди Telegram 2026-10-13 16:24:54 +07:00
Denozordec cbe44e8072 fix(traffic): останавливать сбор при потере соединения блокировки 2026-10-13 16:20:46 +07:00
Denozordec 46de87e213 fix(auth): восстанавливать раздел и фильтры после входа Portal 2026-10-13 16:09:27 +07:00
Denozordec 199910eceb chore(tests): проверить срок JWT и границы выхода Portal 2026-10-13 15:59:20 +07:00
Denozordec f8d2b21cf6 chore(tests): проверить доставку Telegram и сохранить границы повтора 2026-10-13 15:53:06 +07:00
Denozordec 608f743003 fix(auth): скрыть пароли от читателя и согласовать Portal 2026-10-13 15:35:31 +07:00
Denozordec a15917d08b chore(tests): подключить тестовый Portal и подтвердить Telegram 2026-10-13 15:14:45 +07:00
Denozordec efdfc6f224 chore(tests): подтвердить общую регрессию интерфейса и backend 2026-10-13 14:40:20 +07:00
Denozordec b525e70655 fix(traffic): согласовать опрос между процессами backend 2026-10-13 14:35:00 +07:00
Denozordec a68bd61e58 fix(traffic): объединять чтения истории общего сервера 2026-10-13 14:15:44 +07:00
Denozordec 7b88416415 fix(traffic): считать общий пик по совпадающим интервалам 2026-10-13 13:58:56 +07:00
Denozordec dbc3b2c947 chore(docs): обновить дату и состояние матрицы приёмки 2026-10-13 02:17:31 +07:00
Denozordec a9f19e1f4b chore(docs): сохранить пример несовпадающих пиков привязок 2026-10-13 02:16:15 +07:00
Denozordec 7c667f8036 fix(traffic): учитывать пик только подтверждённых измерений 2026-10-13 02:14:03 +07:00
Denozordec 504f62fc0b fix(traffic): прекращать опрос изменённого источника 2026-10-13 02:08:26 +07:00
Denozordec 5d19b6a258 fix(traffic): учитывать состав каждой волны измерений 2026-10-13 01:52:50 +07:00
Denozordec a8b80d9914 chore(tests): проверить архивы с идентичностью счётчиков 2026-10-13 01:31:02 +07:00
Denozordec b57ae316ba fix(traffic): подтверждать идентичность соседних счётчиков 2026-10-13 01:19:22 +07:00
Denozordec 493c30bebc fix(traffic): ограничивать доверие скорости после пропусков 2026-10-13 00:54:42 +07:00
Denozordec 9603048bd8 chore(docs): зафиксировать границу доверия скорости после пропусков 2026-10-12 23:02:31 +07:00
Denozordec a40b26c3c5 fix(traffic): сохранять историю отключённых интерфейсов 2026-10-12 23:00:23 +07:00
Denozordec c69d99ba80 fix(traffic): показывать причину неполного опроса peers 2026-10-12 22:54:35 +07:00
Denozordec d8f8d3c7a4 fix(traffic): принимать измерения peers только полным срезом 2026-10-12 22:41:39 +07:00
Denozordec b4d0733cfa fix(traffic): подтверждать свежесть статусов привязанных интерфейсов 2026-10-12 22:35:17 +07:00
Denozordec 2b3d583e3b fix(traffic): сохранять точность объёмов и обозначать бинарные единицы 2026-10-12 21:59:50 +07:00
Denozordec 2358ecef60 fix(traffic): проверять live-срез и прекращать опрос выключенных устройств 2026-10-12 21:35:55 +07:00
Denozordec 1275dd7b9b fix(traffic): сохранять историю и показывать достоверную свежесть 2026-10-12 20:23:07 +07:00
Denozordec ebe62ae2ef fix(uptime): проверить RTT через SQL и обновить тестовый стенд 2026-10-12 18:21:50 +07:00
Denozordec ca2b634743 fix(uptime): точно разбирать составные длительности RTT 2026-10-12 18:17:10 +07:00
Denozordec 737e04a6a9 fix(traffic): проверить сбор трафика через HTTP и PostgreSQL 2026-10-12 18:13:48 +07:00
Denozordec 4527e5537c fix(traffic): исключить ложные нули из суммы трафика 2026-10-12 18:06:05 +07:00
Denozordec 8fb46b1552 fix(uptime): отличать ошибки опроса от измеренных потерь Ping 2026-10-12 17:55:16 +07:00
Denozordec ca23284486 fix(alerts): исключить неподтверждённые проблемы из журнала мониторинга 2026-10-12 16:45:26 +07:00
Denozordec d3f9a120e6 fix(alerts): объяснить отключённые и неоднозначные цели оповещений 2026-10-12 15:47:16 +07:00
Denozordec db7105119d fix(alerts): учитывать свежесть и настройки источников оповещений 2026-10-12 15:12:15 +07:00
Denozordec 8ffb8b5f00 fix(alerts): исключить неоднозначные и отключённые устройства из сигналов 2026-10-12 14:14:45 +07:00
Denozordec 65d4a17882 chore(ux): зафиксировать аудит свежести и контекста источников оповещений 2026-10-12 12:13:23 +07:00
Denozordec 13618e7efe fix(alerts): не подтверждать события устаревшими GRE BGP снимками 2026-10-12 12:03:11 +07:00
Denozordec 7ad66f178b chore(tests): проверить backend на PostgreSQL и убрать ожидание idle пула 2026-10-12 11:48:44 +07:00
Denozordec fdddc52019 fix(collectors): сохранять частичный результат и актуальные GRE BGP сигналы 2026-10-12 11:09:17 +07:00
Denozordec 9fbe27c1b0 fix(bgp): сохранять неизвестные показатели без вымышленных чисел 2026-10-12 10:38:05 +07:00
Denozordec c557a8c8cb fix(alerts): исключить переходы между неоднозначными BGP peers 2026-10-12 10:27:41 +07:00
Denozordec 22b0e8ae8e chore(ux): подтвердить четырёхбайтовые ASN в IPv6 BGP 2026-10-12 10:19:49 +07:00
Denozordec fef7bc5520 fix(bgp): сохранять неизвестное состояние и достоверную историю оповещений 2026-10-12 10:14:39 +07:00
Denozordec 8cb0fbd195 chore(ux): подтвердить снятие IPv6 BGP маршрутов при потере BFD 2026-10-12 10:01:24 +07:00
Denozordec cf7f4edf78 chore(ux): подтвердить потерю и восстановление BFD для OSPFv3 2026-10-12 09:54:08 +07:00
Denozordec e1617f1472 fix(ospf): сопоставлять IPv6 адреса и исключать неоднозначный BFD 2026-10-12 09:48:06 +07:00
Denozordec 1b63e3ec43 chore(ux): зафиксировать общую регрессию интерфейса и контекста 2026-10-12 09:38:52 +07:00
Denozordec d3d8afaa0c fix(api): сохранять большие идентификаторы серверов без округления 2026-10-11 23:39:02 +07:00
Denozordec 90e6c7be25 chore(ux): подтвердить сессии и маршруты BGP IPv6 2026-10-11 23:16:48 +07:00
Denozordec f6b9c6941d fix(ospf): показывать IPv6 маршруты и фактический шлюз 2026-10-11 23:05:19 +07:00
Denozordec 12ead0b6c2 fix(ospf): показать конфликт состояний OSPF и BFD 2026-10-11 22:42:14 +07:00
Denozordec 4d3cb659c1 fix(wireguard): поддержать IPv6 и исключить выключенные серверы 2026-10-11 22:08:10 +07:00
Denozordec f3cbc32720 fix(gre): сохранять и восстанавливать статические IPv6 адреса 2026-10-11 21:37:12 +07:00
Denozordec 655ea9727f fix(ui): сделать названия колонок потоков понятнее 2026-10-11 18:41:06 +07:00
Denozordec 555bd31596 fix(netflow): проверять месяц и точные календарные границы 2026-10-11 18:27:41 +07:00
Denozordec 0c14da190b fix(netflow): подтверждать выбранный срез перед запросами 2026-10-11 18:16:29 +07:00
Denozordec 64df472202 fix(netflow): проверять ответы аналитики и выбранный месяц 2026-10-11 17:58:18 +07:00
Denozordec 979dc3cfb0 fix(ui): уточнить подписи ICMPv6 и портов IPv6 2026-10-11 17:31:06 +07:00
Denozordec d569932b2a chore(ux): подтвердить настоящий IPv6 IPFIX и восстановление стенда 2026-10-11 17:11:32 +07:00
Denozordec 11813179a7 fix(netflow): сохранить IPv6 в смешанных шаблонах IPFIX 2026-10-11 16:44:00 +07:00
Denozordec c718654bc7 fix(netflow): сохранить неизвестные координаты RIPE без ложных нулей 2026-10-11 16:28:54 +07:00
Denozordec af66faaae4 fix(netflow): исправить классификацию IPv6 и кеш префиксов RIPE 2026-10-11 16:21:43 +07:00
Denozordec 59938118bd fix(traffic): дождаться каталога перед запросами выбранного сервера 2026-10-11 13:10:37 +07:00
Denozordec b619ef208e fix(netflow): исключить специальные IPv4 из внешнего обогащения 2026-10-11 12:59:57 +07:00
Denozordec f3156b44cf chore(test): завершить общую регрессию и сверить production outputs 2026-10-11 12:28:59 +07:00
Denozordec c242b611e2 chore(test): подтвердить цепочку промежуточного CA и повторный IKE 2026-10-11 12:08:39 +07:00
Denozordec c331558e31 chore(test): проверить внешний отзыв сертификата при установленном IKE 2026-10-11 12:02:59 +07:00
Denozordec 8af5c7a080 chore(test): подтвердить отказы IKE с повреждённым и истёкшим CRL 2026-10-11 11:55:44 +07:00
Denozordec 7c0cd50334 chore(test): подтвердить отказ IKE без внешнего CRL и восстановление 2026-10-11 11:51:26 +07:00
Denozordec 07499cd340 chore(test): проверить внешнюю загрузку CRL и отказ HTTP 2026-10-11 11:40:16 +07:00
Denozordec bd023b8aaa fix(terminal): показывать последние записи журнала RouterOS 2026-10-11 11:26:59 +07:00
Denozordec 1e4d3b4678 chore(test): подтвердить изоляцию диагностических буферов RouterOS 2026-10-11 11:15:11 +07:00
Denozordec 3b908a9e4e chore(test): подтвердить ECDSA IPsec и итоговую очистку стенда 2026-10-11 03:31:34 +07:00
Denozordec 63ee8a4549 chore(test): подтвердить сроки сертификатов в отдельных клиентах 2026-10-11 03:27:06 +07:00
Denozordec e17ddfdc20 chore(test): сохранить отказ положительного контроля сертификатов 2026-10-11 03:20:22 +07:00
Denozordec b190412af1 chore(test): зафиксировать тайм-ауты сертификатов с неверными сроками 2026-10-11 03:06:45 +07:00
Denozordec 7867914cbc fix(ipsec): проверять CRL-цепочку до удаления identity 2026-10-11 02:56:09 +07:00
Denozordec a31a65fbe6 chore(test): подтвердить отзыв сертификата при включённом CRL 2026-10-11 02:46:41 +07:00
Denozordec aed1963eef chore(test): зафиксировать поведение IPsec при отключённом CRL 2026-10-11 02:36:47 +07:00
Denozordec 07396d9385 fix(ipsec): пояснить границу онлайн-статуса IKE 2026-10-11 02:35:57 +07:00
Denozordec cad01853e1 chore(test): подтвердить границы аутентификации сертификатов IPsec 2026-10-11 02:24:53 +07:00
Denozordec 67644c50cb chore(test): проверить смену ключей и восстановление IPsec 2026-10-11 02:23:23 +07:00
Denozordec d4f5746325 fix(ipsec): учитывать уникальный DNS SAN в активных сессиях 2026-10-11 02:18:09 +07:00
Denozordec b4e56d1998 chore(test): проверить кодирование DN и FQDN в реальном IPsec 2026-10-11 02:11:34 +07:00
Denozordec d379045d20 chore(test): подтвердить две IKE-сессии одного сертификата 2026-10-10 23:14:37 +07:00
Denozordec 08fcebd549 fix(ipsec): экспортировать сертификат только по прямой привязке 2026-10-10 22:29:51 +07:00
Denozordec 9da5e55367 fix(tests): ждать окончания анимации кнопок резервных копий 2026-10-10 22:00:04 +07:00
Denozordec 057b530364 fix(ipsec): удалять сертификат только по явной привязке 2026-10-10 21:26:48 +07:00
Denozordec d52c48e5ed fix(ipsec): сохранять общий сертификат при удалении identity 2026-10-10 21:11:04 +07:00
Denozordec 58f5c48a97 fix(ipsec): показывать все привязки общего сертификата 2026-10-10 20:59:24 +07:00
Denozordec 60b2e099f0 fix(ipsec): учитывать несколько сессий без ложного офлайн 2026-10-10 20:42:58 +07:00
Denozordec cb6ec09312 fix(ipsec): показывать неопределённый статус при общих Remote ID 2026-10-10 10:33:54 +07:00
Denozordec 7815e00a1c fix(ipsec): исключить чужие сессии при сопоставлении CN 2026-10-10 09:56:21 +07:00
Denozordec 2aa93ad365 fix(ipsec): исправить статус клиента с полным DN сертификата 2026-10-10 09:42:57 +07:00
Denozordec 1d61b50591 chore(test): подтвердить IPv6 в GRE и WireGuard 2026-10-10 09:06:40 +07:00
Denozordec 2a804876b0 chore(test): проверить IPv6 внутри VXLAN на стенде 2026-10-10 09:02:31 +07:00
Denozordec e7aaec926d chore(test): подтвердить мост и обучение MAC в VXLAN 2026-10-10 08:59:20 +07:00
Denozordec a58756c421 chore(docs): зафиксировать готовность внешних интеграций 2026-10-10 03:49:57 +07:00
Denozordec 78b0c07b88 chore(docs): сохранить итоговую сверку стенда и плана 2026-10-10 03:45:04 +07:00
Denozordec beb72ceea1 chore(test): подтвердить таймер BGP без BFD 2026-10-10 03:34:04 +07:00
Denozordec 2d4e8baa13 chore(test): сверить потери Ping на GRE и public пути 2026-10-10 03:25:04 +07:00
Denozordec cd8613fab6 fix(api): отклонять некорректное подтверждение PATCH 2026-10-10 03:15:59 +07:00
Denozordec 89bde27f19 fix(ui): улучшить контраст и доступность прокрутки 2026-10-10 02:50:53 +07:00
Denozordec 94bdb2a8a1 chore(test): сохранить общую регрессию и её границы 2026-10-10 02:47:22 +07:00
Denozordec 7f0c2aad0f fix(api): завершать запрос при обрыве ответа RouterOS 2026-10-10 02:06:56 +07:00
Denozordec 5944e5e751 fix(uptime): объяснить неизвестный результат теста скорости 2026-10-10 01:41:15 +07:00
Denozordec dbe1e7c917 chore(test): проверить обрыв ответа сетевого теста 2026-10-10 01:32:21 +07:00
Denozordec 64bf0b4f6e chore(test): проверить время истории speed в разных поясах 2026-10-10 01:27:05 +07:00
Denozordec 890a5cba09 chore(test): сверить исходники и образ тестового стенда 2026-10-10 01:18:34 +07:00
Denozordec 9d6cd000ef chore(docs): свести оставшуюся внешнюю приёмку 2026-10-10 01:12:59 +07:00
Denozordec e23038d409 chore(test): подтвердить резервный путь BGP на стенде 2026-10-10 01:11:06 +07:00
Denozordec 40f730b5be chore(docs): сохранить итоговый контроль окна UX/UI 2026-10-09 22:45:42 +07:00
Denozordec f319eb947a chore(test): подтвердить обмен и отзыв собственного BGP-префикса 2026-10-09 22:40:30 +07:00
Denozordec c9bf5abe55 fix(ui): сохранить целый CIDR в таблице маршрутов OSPF 2026-10-09 22:26:08 +07:00
Denozordec ee704a86f2 chore(test): подтвердить резервный путь OSPF и сохранить наблюдения потерь 2026-10-09 21:59:46 +07:00
Denozordec 8b7bff165a fix(terminal): запретить выключенные устройства и исправить средний RTT 2026-10-09 21:35:25 +07:00
Denozordec 5b3133ce73 fix(routes): подтвердить применение и восстановление рекурсивных маршрутов 2026-10-09 21:08:10 +07:00
Denozordec 36c6a21ca5 fix(ospf): подтвердить права и результат оптимизации на RouterOS 2026-10-09 20:40:24 +07:00
Denozordec 3bfd4ae6cf chore(test): разделить наблюдения BFD и удаления маршрута OSPF 2026-10-09 20:12:31 +07:00
Denozordec 2e1586e4d4 chore(test): подтвердить BFD и восстановление OSPF на стенде 2026-10-09 18:00:45 +07:00
Denozordec c35272273b chore(test): подтвердить OSPF через GRE на реальном стенде 2026-10-09 17:41:08 +07:00
Denozordec 8795969871 fix(routing): исключить опрос выключенных устройств BGP и OSPF 2026-10-09 17:22:41 +07:00
Denozordec 89de7e134b fix(ipsec): обеспечить NAT и изоляцию политик для передачи данных 2026-10-09 17:10:33 +07:00
Denozordec 43b00e0740 fix(ipsec): различать частичный и неподтверждённый результат операций 2026-10-09 16:06:33 +07:00
Denozordec a83e4734df fix(ipsec): восстановить mode-config с проверкой зависимостей 2026-10-09 15:49:50 +07:00
Denozordec 5d9ef9dcf3 fix(ipsec): подтвердить сертификатный клиент и сообщать сбой истории 2026-10-09 15:32:10 +07:00
Denozordec b9a8615b8b fix(ipsec): показывать подключённых клиентов и адрес mode-config 2026-10-09 15:14:41 +07:00
Denozordec f80d9b7637 fix(ipsec): подтвердить достоверность операций и приёмку раздела 2026-10-09 12:46:22 +07:00
Denozordec e2d81f9657 fix(vxlan): подтвердить достоверность опроса и экспорта раздела 2026-10-09 10:38:24 +07:00
Denozordec 6b068ac39a chore(test): проверить VXLAN на двух реальных CHR 2026-10-09 09:44:54 +07:00
Denozordec 0067c2eeff chore(test): проверить отказ записи ревизии на стенде 2026-10-09 09:36:06 +07:00
Denozordec 8eaf78b686 fix(wireguard): учитывать неподтверждённую ревизию импорта 2026-10-09 09:21:02 +07:00
Denozordec 91ee424b42 chore(test): подтвердить компенсацию импорта на двух CHR 2026-10-09 09:15:48 +07:00
Denozordec e01454b720 fix(wireguard): очищать подтверждённые объекты при отказе импорта 2026-10-09 09:04:05 +07:00
Denozordec f9980d7d7e chore(test): подтвердить безопасный импорт conf на стенде 2026-10-09 08:53:59 +07:00
Denozordec 479f2adc78 fix(wireguard): проверять конфигурацию до импорта 2026-10-09 08:39:36 +07:00
Denozordec 7ce43adc07 chore(test): подтвердить импорт WireGuard на двух CHR 2026-10-09 08:31:09 +07:00
Denozordec d13c773856 chore(test): подтвердить экспорт шаблона WireGuard на стенде 2026-10-09 08:19:26 +07:00
Denozordec c16fc0c5b5 fix(ci): вынести межслойный тест из frontend Docker контекста 2026-10-08 23:28:37 +07:00
Denozordec c82e8fa12b fix(wireguard): исправить endpoint и поля клиентского шаблона 2026-10-08 23:21:45 +07:00
Denozordec 206255b856 chore(test): проверить экспорт WireGuard без приватных ключей 2026-10-08 23:12:43 +07:00
Denozordec a1183f2ec9 chore(test): подтвердить мобильные панели WireGuard на стенде 2026-10-08 23:03:00 +07:00
Denozordec bf43263e43 fix(wireguard): расширить мобильные панели и сохранить видимость кнопок 2026-10-08 22:50:50 +07:00
Denozordec ae0162db53 chore(test): подтвердить полный сценарий WireGuard через интерфейс 2026-10-08 22:45:16 +07:00
Denozordec 6a46fb1e40 fix(wireguard): сохранять меню действий при перерисовке 2026-10-08 22:32:57 +07:00
Denozordec 4c4ba02b44 chore(test): развернуть и подтвердить полное удаление WireGuard 2026-10-08 22:12:33 +07:00
Denozordec 3722fad329 fix(wireguard): удалять связанные пиры и IP вместе с интерфейсом 2026-10-08 21:59:53 +07:00
Denozordec fe0ca3fa46 chore(test): проверить реальную связность WireGuard и интерфейс 2026-10-08 21:48:30 +07:00
Denozordec 02cdfd869a chore(test): развернуть и проверить мобильную форму GRE 2026-10-08 21:36:36 +07:00
Denozordec fd521f6ef8 fix(gre): расширить поля внутренних IP на телефоне 2026-10-08 21:24:44 +07:00
Denozordec ed80aef195 chore(test): развернуть и проверить устойчивость меню GRE 2026-10-08 21:16:37 +07:00
Denozordec 731803bade fix(gre): сохранять меню действий при обновлении таблицы 2026-10-08 16:27:17 +07:00
Denozordec 26e8225815 chore(test): развернуть и проверить сохранение GRE peer IP 2026-10-08 16:18:56 +07:00
Denozordec bd3f996f55 fix(gre): сохранять удалённый внутренний IP туннеля 2026-10-08 15:50:11 +07:00
Denozordec 56f29a60d1 chore(test): проверить реальную GRE пару и очистку туннелей 2026-10-08 15:36:55 +07:00
Denozordec 37bc356ff7 chore(test): зафиксировать сетевую конфигурацию тестовых CHR 2026-10-08 15:14:51 +07:00
Denozordec 2ead73c30a chore(test): свести результаты и ограничения приёмки очереди 2026-10-08 15:07:20 +07:00
Denozordec edc459382b chore(test): проверить доступность очереди на production frontend 2026-10-08 15:04:27 +07:00
Denozordec a4ae10d7f5 chore(test): проверить изоляцию повтора при смене источника 2026-10-08 14:56:39 +07:00
Denozordec bb7b940bfc chore(test): подтвердить права очереди в браузере с JWT 2026-10-08 14:47:49 +07:00
Denozordec 1d6f2d598c chore(test): развернуть и проверить пояснение повтора на стенде 2026-10-08 14:41:40 +07:00
Denozordec b55588f29b fix(ui): объяснить неподтверждённый результат повтора сообщения 2026-10-08 14:30:54 +07:00
Denozordec e80cfeb4a9 chore(test): проверить браузерный повтор при потере подтверждения 2026-10-08 14:28:14 +07:00
Denozordec ca8eafa1ff chore(test): подтвердить права очереди на настоящих JWT 2026-10-08 14:22:03 +07:00
Denozordec 22a4e2f36e chore(test): проверить очередь в браузере на реальной базе 2026-10-08 14:18:28 +07:00
Denozordec 693cce2535 chore(test): проверить задержку и исчерпание попыток отправки 2026-10-08 14:12:40 +07:00
Denozordec ffe44dc938 chore(test): проверить удержание отправок с неизвестным исходом 2026-10-08 14:09:17 +07:00
Denozordec 507c7010ad chore(test): подтвердить обработку ошибок сохранения отправки 2026-10-08 14:06:23 +07:00
Denozordec d44511da8e chore(test): подтвердить конкурентный захват очереди на PostgreSQL 2026-10-08 14:00:45 +07:00
Denozordec 7c4b21be19 chore(test): подтвердить откат некорректного receipt очереди 2026-10-08 10:58:39 +07:00
Denozordec 87fc1be657 chore(test): проверить конкурентное разрешение unknown в PostgreSQL 2026-10-08 10:55:55 +07:00
Denozordec 06d73c50cc chore(test): проверить конкурентную дедупликацию очереди в PostgreSQL 2026-10-08 10:53:03 +07:00
Denozordec 49af17178e chore(test): подтвердить UDP-тест и историю в реальном интерфейсе 2026-10-08 10:49:26 +07:00
Denozordec 800c6f69ae chore(test): проверить receive и both после восстановления CHR2 2026-10-08 10:46:12 +07:00
Denozordec e1457fbc77 chore(test): подтвердить восстановленный доступ CHR2 и дашборд 2026-10-08 10:43:06 +07:00
Denozordec 8a1c36f358 chore(test): сопоставить CLI и REST при отказе доступа CHR2 2026-10-08 10:29:34 +07:00
Denozordec 34096cbfd5 chore(test): сохранить диагностику направленного bandwidth-тайм-аута 2026-10-08 10:19:25 +07:00
Denozordec a178becdcd chore(test): подтвердить новую форму speed и обновить frontend на стенде 2026-10-08 10:09:35 +07:00
Denozordec f194e7269b fix(ui): уточнить интерфейсы speed и исправить CLI-подсказку 2026-10-08 10:00:42 +07:00
Denozordec 47f747586c chore(test): подтвердить исправление proxy timeout на production-стенде 2026-10-08 09:46:25 +07:00
Denozordec aa7dbdf608 fix(web): дождаться ответа backend при длительной speed-команде 2026-10-08 09:38:17 +07:00
Denozordec fc1a60d413 chore(test): проверить отказ bandwidth-аутентификации на реальном CHR 2026-10-08 09:30:52 +07:00
Denozordec c0a32e8ed2 chore(test): подтвердить смену speed-контекста вторым клиентом в браузере 2026-10-08 09:24:45 +07:00
Denozordec 01061b4406 chore(test): проверить конфликты speed и блокировки PostgreSQL на стенде 2026-10-08 09:19:43 +07:00
Denozordec 9ccfc7f2b6 chore(test): подтвердить новые образы и неопределённый исход speed на стенде 2026-10-08 09:10:50 +07:00
Denozordec 8782054078 fix(ui): показывать неопределённый исход speed и сверять историю 2026-10-08 08:57:54 +07:00
Denozordec 96fa910804 fix(ui): сохранить snapshot speed при неизвестном исходе записи 2026-10-08 08:48:58 +07:00
Denozordec f408afba20 fix(api): сохранить неизвестный исход записи speed без ложной ошибки 2026-10-08 00:21:31 +07:00
Denozordec c337fddac9 chore(test): проверить права и восстановление базы в браузере 2026-10-08 00:03:13 +07:00
Denozordec 1adb82c9a2 chore(test): проверить остановку записей и обновить backend стенда 2026-10-07 23:50:18 +07:00
Denozordec 4c12c55c9d fix(api): исключить выключенные серверы из мониторинга 2026-10-07 23:37:06 +07:00
Denozordec f3e205950f fix(api): восстановить разделы PostgreSQL в одной транзакции 2026-10-07 23:28:16 +07:00
Denozordec c24ad7810c chore(test): выявить ошибку восстановления разделов PostgreSQL 2026-10-07 23:20:12 +07:00
Denozordec f1aac49dfc fix(api): сбросить кэши после восстановления базы 2026-10-07 23:12:32 +07:00
Denozordec 2943032462 fix(api): дождаться фоновых записей перед операцией с БД 2026-10-07 23:07:10 +07:00
Denozordec 8682f2a7a5 fix(api): дождаться запросов перед операцией с базой 2026-10-07 23:00:39 +07:00
Denozordec 9264b6636a chore(test): проверить настоящий UDP collector и завершение записи 2026-10-07 22:55:33 +07:00
Denozordec f8da3e08a0 fix(api): подтвердить остановку NetFlow перед операцией с БД 2026-10-07 22:48:19 +07:00
Denozordec 1b89d56ea3 fix(api): дождаться заданий планировщика перед операцией с БД 2026-10-07 22:41:50 +07:00
Denozordec 6720ad3539 chore(test): проверить архив PostgreSQL, права и конфликт операций 2026-10-07 22:36:24 +07:00
Denozordec 66bed28382 chore(test): сохранить реальные тесты скорости на паре CHR 2026-10-07 22:24:59 +07:00
Denozordec 476dbec204 chore(test): зафиксировать подключение второго CHR 2026-10-07 22:10:24 +07:00
Denozordec 83593756ce chore(test): зафиксировать подключение тестового CHR 2026-10-07 21:59:35 +07:00
Denozordec 65d04baf2f chore(deploy): зафиксировать проверенное развёртывание тестового стенда 2026-10-07 21:39:59 +07:00
Denozordec 673e5ba444 fix(api): нормализовать дату сохранённого снимка Internet path 2026-10-07 21:26:23 +07:00
Denozordec 4d88b97d49 chore(deploy): подготовить отдельный тестовый Docker-стенд 2026-10-07 21:04:28 +07:00
Denozordec 6255f44975 chore(ux): сохранить итоговую проверку контекста и точку внешней приёмки 2026-10-07 18:42:00 +07:00
Denozordec 683148d620 chore(ux): сохранить общую регрессию после исправлений скорости 2026-10-07 18:32:17 +07:00
Denozordec 9680a6422b fix(ui): отличать неизвестный RTT от отсутствия ответов Ping 2026-10-07 17:58:11 +07:00
Denozordec 30cc99c68e fix(ui): использовать серверное время и не подменять отсутствующий Ping 2026-10-07 17:52:33 +07:00
Denozordec 7f18fcb6db fix(ui): сбрасывать снимок при изменении параметров speed-пробы 2026-10-07 17:41:14 +07:00
Denozordec 090206c893 fix(api): сохранять результат только в пробу с теми же параметрами 2026-10-07 17:33:48 +07:00
Denozordec b59944b573 fix(api): проверять параметры запуска теста скорости до операции 2026-10-07 17:30:52 +07:00
Denozordec b0e114b56d fix(docs): указать даты выполнения в заголовках этапов 2026-10-07 17:10:51 +07:00
Denozordec a56f555c25 fix(docs): восстановить недостающие записи журнала UX/UI 2026-10-07 17:09:26 +07:00
Denozordec 65c63e2860 fix(ui): убрать неиспользуемый код прежней таблицы мониторинга 2026-10-07 15:57:53 +07:00
Denozordec e4f951175c fix(uptime): сбросить снимок при смене пары и сохранить историю 2026-10-07 15:52:58 +07:00
Denozordec 8627459bfa chore(docs): зафиксировать общую проверку 221 контекста 2026-10-07 15:25:46 +07:00
Denozordec a3fcba0d43 fix(uptime): защитить пару устройств и атомарно сохранить результат 2026-10-07 15:12:41 +07:00
Denozordec 08ea416989 chore(docs): зафиксировать общую регрессию 1176 сценариев 2026-10-07 15:03:54 +07:00
Denozordec 5fedf7ae68 chore(docs): подготовить протокол внешней приёмки UX/UI 2026-10-07 14:37:13 +07:00
Denozordec 579e816bbb fix(ui): показать измерения рядом с закреплённым WAN на телефоне 2026-10-07 14:28:07 +07:00
Denozordec 5919af7f9b fix(ospf): сопоставить направления измерений и модели 2026-10-07 14:19:13 +07:00
Denozordec fb32f87d33 fix(uptime): проверять завершение теста перед записью успеха 2026-10-07 14:17:36 +07:00
Denozordec 9d5959601f fix(uptime): сохранить неизвестную скорость и проверить подтверждение теста 2026-10-07 14:15:56 +07:00
Denozordec 1904c86657 fix(ui): пояснить область скоростных снимков WAN 2026-10-07 13:59:20 +07:00
Denozordec 4ba7f82ccf fix(optimizer): правильно сопоставить направления DL и UL 2026-10-07 13:44:36 +07:00
Denozordec 7d331aff41 chore(ux): зафиксировать аудит скоростных измерений 2026-10-07 13:26:05 +07:00
Denozordec 4fee9e371f fix(optimizer): убрать лишние поиски и расчёты маршрутов 2026-10-07 13:16:12 +07:00
Denozordec 057f0d352a chore(ux): измерить генерацию всех комбинаций маршрутов 2026-10-07 12:48:22 +07:00
Denozordec 53e36f2a03 fix(ui): сделать сводки площадок краткими и достоверными 2026-10-07 12:42:20 +07:00
Denozordec 52d8a05480 fix(optimizer): ускорить точный выбор проб из большого пула 2026-10-07 12:24:07 +07:00
Denozordec c6dfa5267b chore(ux): измерить большой пул проб оптимизатора 2026-10-04 23:47:35 +07:00
Denozordec 8e3b7a65ce fix(ui): сократить сводку большого списка WAN 2026-10-04 23:43:57 +07:00
Denozordec 0355343f9f chore(ux): разделить исторические отчёты контекстных проверок 2026-10-04 23:39:18 +07:00
Denozordec ba27d2ade0 chore(ux): сохранить полную контекстную регрессию 2026-10-04 23:36:52 +07:00
Denozordec b1f8326304 fix(ui): возвращать фокус терминала после включения поля 2026-10-04 23:19:14 +07:00
Denozordec 55df77296a chore(ux): сохранить общую регрессию и сбой фокуса терминала 2026-10-04 23:12:35 +07:00
Denozordec 991f2b3871 fix(ui): учитывать весь каталог Community в оптимизаторе 2026-10-04 22:15:00 +07:00
Denozordec 53603f17c1 chore(ux): зафиксировать скрытый срез Community 2026-10-04 22:09:40 +07:00
Denozordec 833225d169 fix(optimizer): отсечь заведомо худшие назначения проб 2026-10-04 22:08:32 +07:00
Denozordec 1ad6b4a6b6 fix(ui): ограничить отображение матрицы WAN и Jump Host 2026-10-04 21:58:57 +07:00
Denozordec b3da4216e6 chore(ux): измерить матрицу WAN и расчёт назначения проб 2026-10-04 21:52:05 +07:00
Denozordec 28e2d38ee6 chore(ui): уточнить риски матрицы и расчёта оптимизатора 2026-10-04 18:15:22 +07:00
Denozordec a16bfae805 fix(ui): ограничить полные маршруты с сохранением индексов 2026-10-04 18:13:45 +07:00
Denozordec 82f620ac0b chore(ui): зафиксировать профиль полной таблицы маршрутов 2026-10-04 18:05:56 +07:00
Denozordec 059fd93520 fix(ui): ограничить карточки оптимизатора с сохранением URL 2026-10-04 18:03:59 +07:00
Denozordec 7265709b1c chore(ui): зафиксировать профиль тысячи карточек оптимизатора 2026-10-04 17:53:24 +07:00
Denozordec be54666661 fix(ui): ограничить preview OSPF без изменения применения 2026-10-04 17:50:45 +07:00
Denozordec 9f74cfebfe fix(ui): объединить параллельные связи OSPF в читаемый граф 2026-10-04 17:37:42 +07:00
Denozordec 086f118204 fix(ui): ограничить списки деталей OSPF без потери данных 2026-10-04 17:32:01 +07:00
Denozordec 8d86c5cbb0 fix(ui): ограничить граф OSPF с сохранением полного контекста 2026-10-04 17:25:55 +07:00
Denozordec 1a82c1b41f fix(ui): ограничить таблицу соседей OSPF и сохранить URL узла 2026-10-04 17:09:16 +07:00
Denozordec 2554c3572a chore(ui): зафиксировать профиль большой топологии OSPF 2026-10-04 16:58:53 +07:00
Denozordec ab56225a1a fix(ui): сохранить контекст и фокус форм Firewall без эффектов 2026-10-04 16:56:15 +07:00
Denozordec 21dc646553 fix(ui): ограничить трассировку и защитить повторную симуляцию 2026-10-04 16:45:39 +07:00
Denozordec 9231597d88 fix(ui): ограничить редактор сценария без потери правил 2026-10-04 16:38:19 +07:00
Denozordec 2e648dcf1c fix(ui): блокировать операции Firewall после ошибки чтения 2026-10-04 16:29:31 +07:00
Denozordec 1e9889f892 fix(ui): ограничить таблицу Firewall и сохранить порядок правил 2026-10-04 16:23:29 +07:00
Denozordec 4a5ae8baa1 fix(ui): ограничить список Filters с сохранением порядка 2026-10-04 16:12:22 +07:00
Denozordec 06850169ba fix(ui): ограничить форму маршрута без потери конечных точек 2026-10-04 16:01:41 +07:00
Denozordec 9124d451a5 fix(ui): ограничить группы и детали рекурсивных маршрутов 2026-10-04 15:52:07 +07:00
Denozordec f515818254 fix(ui): подтверждать копирование community после записи 2026-10-04 15:45:56 +07:00
Denozordec adfb2fc4c3 fix(ui): ограничить отображение каталога Communities 2026-10-04 15:41:21 +07:00
Denozordec 9d4d9f308f fix(ui): пояснить выборку сессий и исправить перенос вкладок 2026-10-04 13:16:17 +07:00
Denozordec 9bbecfbafe chore(ui): уточнить карту производительности оставшихся таблиц 2026-10-04 13:06:18 +07:00
Denozordec 97936aa81e fix(ui): ограничить отображение каталога GRE-туннелей 2026-10-04 13:03:27 +07:00
Denozordec dcc8550482 fix(ui): ограничить отображение каталога VXLAN-туннелей 2026-10-04 12:57:34 +07:00
Denozordec c7aec1500c fix(ui): защищать чтение WireGuard при смене источника 2026-10-04 12:48:24 +07:00
Denozordec e51964b4d2 fix(ui): восстанавливать фильтры WireGuard из ссылки 2026-10-04 12:30:43 +07:00
Denozordec c6702efcc4 fix(ui): показывать сведения о рукопожатии без ложного статуса 2026-10-04 12:21:53 +07:00
Denozordec 837298a171 fix(ui): ограничить раскрытие большого списка пиров WireGuard 2026-10-04 12:16:34 +07:00
Denozordec 747f544462 fix(ui): ограничить отображение каталога пиров WireGuard 2026-10-04 12:10:38 +07:00
Denozordec a6be18c1d6 fix(ui): ограничить отображение каталога интерфейсов WireGuard 2026-10-04 12:05:08 +07:00
Denozordec 7693b32372 fix(ui): различать нулевые и неизвестные счётчики WireGuard 2026-10-04 11:58:10 +07:00
Denozordec 53c1bfbd3b fix(api): сохранять каталог пинг-проб атомарно 2026-10-04 11:53:48 +07:00
Denozordec 9c22fa8a68 chore(ux): зафиксировать общую регрессию последних изменений 2026-10-04 11:28:54 +07:00
Denozordec 21859be580 chore(ux): зафиксировать повтор контекстной регрессии 2026-10-04 11:00:27 +07:00
Denozordec 5b2a2917c1 fix(ui): ограничить отображение каталога BFD-сессий 2026-10-04 10:51:59 +07:00
Denozordec 586da55c24 fix(ui): ограничить отображение каталога OSPF-маршрутов 2026-10-04 10:48:11 +07:00
Denozordec 908974302e fix(api): сохранять каталог speed-проб атомарно 2026-10-04 10:41:03 +07:00
Denozordec d4f2961f76 fix(api): проверить каталог speed-проб и изолировать источник 2026-10-04 10:31:02 +07:00
Denozordec f30319ac55 chore(test): сохранить проверку контекста пользователей и бэкапов 2026-10-04 05:22:24 +07:00
Denozordec a558412a27 fix(api): сохранить неизвестные значения истории скорости 2026-10-04 05:19:34 +07:00
Denozordec e5ff69e243 fix(ui): сохранить историю скорости при частичном сбое 2026-10-04 05:09:20 +07:00
Denozordec 611e542ea7 fix(ui): ограничить каталог бэкапов и вернуть фокус действий 2026-10-04 05:01:29 +07:00
Denozordec 5d9a6f3757 fix(ui): ограничить каталог пользователей и добавить поиск 2026-10-04 04:48:06 +07:00
Denozordec e0f83bdf42 fix(ui): сохранить имя строки при прокрутке таблицы 2026-10-04 04:38:23 +07:00
Denozordec 5fbfc752fb fix(ui): ограничить каталог сертификатов и сохранить детали 2026-10-04 04:29:30 +07:00
Denozordec 5488d86b12 chore(test): проверить отказ большого каталога проб 2026-10-04 04:22:25 +07:00
Denozordec e5cf05759e fix(ui): ограничить строки истории тестов скорости 2026-10-04 04:19:56 +07:00
Denozordec 488f2fe482 fix(ui): открыть крайние колонки сводной статистики 2026-10-04 04:11:53 +07:00
Denozordec 8d6d82082c chore(test): сохранить общую регрессию смены контекста 2026-10-04 04:04:12 +07:00
Denozordec 91c1194550 fix(test): актуализировать данные общей UX регрессии 2026-10-04 03:55:30 +07:00
Denozordec c4110fa323 fix(ui): сохранять ручную страницу выбранной сессии BGP 2026-10-04 03:27:41 +07:00
Denozordec 1cce712833 fix(ui): ограничить боковой каталог устройств 2026-10-04 03:22:39 +07:00
Denozordec 2bdcc1621f fix(ui): очищать недоступные интерфейсы при загрузке 2026-10-04 03:06:47 +07:00
Denozordec ab334764cf fix(ui): раскрывать предупреждения ресурсов порциями 2026-10-04 03:00:32 +07:00
Denozordec 2762f073a0 fix(ui): ограничить строки ресурсов мониторинга 2026-10-04 02:54:33 +07:00
Denozordec 76a5e81fd4 fix(ui): ограничить строки таблицы проб скорости 2026-10-04 02:44:52 +07:00
Denozordec 057281c246 fix(test): проверить большой каталог проб скорости 2026-10-04 00:56:57 +07:00
Denozordec ef457b471a fix(ui): сохранять страницу компактной таблицы при опросе 2026-10-04 00:53:28 +07:00
Denozordec 160b39186a fix(api): проверять обязательные поля снимка RouterOS 2026-10-04 00:50:42 +07:00
Denozordec b658f7127f fix(test): обновить данные сквозных проверок дашборда 2026-10-04 00:45:30 +07:00
Denozordec 39789765cb fix(ui): ограничить каталог BGP и сохранить страницу при обновлении 2026-10-04 00:38:44 +07:00
Denozordec 604b2b0b51 fix(ui): раскрывать большую очередь проблем порциями 2026-10-04 00:33:25 +07:00
Denozordec 5e5cf70980 fix(ui): ограничить отрисовку больших компактных таблиц 2026-10-04 00:30:09 +07:00
Denozordec 12c376b4c5 fix(ui): ограничить отрисовку большого каталога серверов 2026-10-04 00:24:33 +07:00
Denozordec c3a9c00aed fix(ui): показывать подтверждённые метрики участков пути 2026-10-04 00:18:21 +07:00
Denozordec d4ae1c3127 fix(api): подтверждать полный сбор пути без скрытых ошибок 2026-10-04 00:11:17 +07:00
Denozordec 5fdd6ef58c fix(ui): сохранять подтверждённый снимок пути при ошибке API 2026-10-04 00:07:21 +07:00
Denozordec 55c9349677 fix(ui): учитывать ошибки устройств в сводке туннелей 2026-10-03 23:51:16 +07:00
Denozordec 9d3129372b fix(uptime): показывать реальные наблюдения и пропуски RTT на дашборде 2026-10-03 23:42:45 +07:00
Denozordec 8f65d1620d fix(ui): проверять каталоги дашборда и сохранять неизвестный статус серверов 2026-10-03 23:20:37 +07:00
Denozordec 9e0f695684 fix(traffic): отличать измеренный ноль от отсутствия наблюдений 2026-10-03 23:10:39 +07:00
Denozordec a28f871fd4 fix(ui): проверять данные трафика без подстановки нулей в серии 2026-10-03 23:00:02 +07:00
Denozordec f0eaa94e02 fix(ui): сохранить неизвестные данные и ошибки BGP на дашборде 2026-10-03 22:55:15 +07:00
Denozordec c343ce62c8 fix(ui): исправить доступность оболочки и проверку состояния сервера 2026-10-03 22:49:52 +07:00
Denozordec 1a9966ec95 fix(ui): завершить локальную приёмку администрирования 2026-10-03 22:32:53 +07:00
Denozordec 271291a910 fix(probes): проверять расписание и сохранять подтверждённые данные 2026-10-03 22:12:08 +07:00
Denozordec 1d27127b52 fix(releases): проверять манифест и достоверность сведений о сборке 2026-10-03 21:59:55 +07:00
Denozordec d5edfe5ef6 fix(ui): повысить приоритет правил и исправить мобильные строки 2026-10-03 21:49:05 +07:00
Denozordec c7e1f75e2e fix(alerts): обозначить недоступность событий префиксов 2026-10-03 19:55:31 +07:00
Denozordec f3ec6b31ce fix(alerts): сделать выбор объектов доступным с клавиатуры 2026-10-03 19:50:31 +07:00
Denozordec 1deccf862c fix(ui): не подменять неполные сетевые счётчики нулями 2026-10-03 19:44:13 +07:00
Denozordec 587dd94f82 fix(ui): проверять права каждого источника дашборда 2026-10-03 19:38:30 +07:00
Denozordec 1999e8160e fix(ui): проверять права и сохранять достоверность общей сводки 2026-10-03 19:33:10 +07:00
Denozordec b109532f33 fix(alerts): подтвердить риск ручного повтора сообщения 2026-10-03 19:21:19 +07:00
Denozordec 7d0608bbce fix(alerts): защитить ручной повтор очереди проверкой версии 2026-10-03 19:14:27 +07:00
Denozordec 89c31289bd fix(alerts): показать подтверждённое состояние очереди сообщений 2026-10-03 19:09:42 +07:00
Denozordec b1ad9515fa fix(alerts): удерживать неизвестные отправки без автоматического повтора 2026-10-03 18:56:08 +07:00
Denozordec 46be201d10 fix(alerts): различать отказ и неизвестный результат Telegram 2026-10-03 18:48:22 +07:00
Denozordec 382e318b97 fix(alerts): отклонять запись устаревшего снимка правил 2026-10-03 18:41:48 +07:00
Denozordec c5c1c2812d fix(alerts): читать согласованный снимок и реальные цели проб 2026-10-03 18:27:22 +07:00
Denozordec dc5594ca7c fix(alerts): защитить тест правила общим замком Telegram 2026-10-03 18:20:29 +07:00
Denozordec 9c1d14635a fix(alerts): подтверждать запись правил и сохранять формы при сбое 2026-10-03 18:13:57 +07:00
Denozordec 875819c577 fix(alerts): сохранить черновик Telegram и подтвердить операции 2026-10-03 18:00:01 +07:00
Denozordec a5c8e614bd fix(test): учесть общий опрос в проверке прав каталогов 2026-10-03 17:51:49 +07:00
Denozordec 526f305aa6 fix(alerts): разделить загрузку каталогов целей и правил 2026-10-03 17:50:23 +07:00
Denozordec a8a3eb59fb fix(alerts): проверять каталоги объектов и сохранять частичные сбои 2026-10-03 17:34:33 +07:00
Denozordec 3710fc6aab fix(alerts): отличать неизвестные данные от пустого списка правил 2026-10-03 17:30:46 +07:00
Denozordec 9bc3a5db77 fix(alerts): подтверждать конфигурацию внутри транзакции сохранения 2026-10-03 17:22:41 +07:00
Denozordec 6093442bcf fix(alerts): проверять правила и группы до замены конфигурации 2026-10-03 17:16:21 +07:00
Denozordec 3556a378f2 fix(alerts): проверять доступ и использовать единый источник тестового сообщения 2026-10-03 17:11:39 +07:00
Denozordec 98319c9d50 fix(alerts): сохранять параметры выборочно и проверять результат отправки 2026-10-03 17:06:44 +07:00
Denozordec 0bcac655ea fix(alerts): проверять ответы и подтверждать сохранённые параметры 2026-10-03 17:00:53 +07:00
Denozordec 596fea4814 fix(settings): проверить контекст и завершить локальную приёмку базы 2026-10-03 16:55:41 +07:00
Denozordec 57293479d1 fix(settings): защищать восстановление базы от повторов и смены контекста 2026-10-03 16:52:02 +07:00
Denozordec 92b65a30ce fix(settings): сохранять результат операций базы при вторичных сбоях 2026-10-03 16:43:52 +07:00
Denozordec 738c98b9d3 chore(docs): закрепить актуальную точку продолжения UX/UI плана 2026-10-03 16:39:06 +07:00
Denozordec af5dbb0519 fix(settings): восстанавливать базу транзакционно и сохранять результат операции 2026-10-03 14:45:51 +07:00
Denozordec ff8b04bddf fix(settings): проверять резервные копии и исключить секреты из журнала 2026-10-03 14:36:12 +07:00
Denozordec e5842b415b fix(settings): проверять доступность текущего источника без гонок 2026-10-03 14:30:41 +07:00
Denozordec b6f1b72500 fix(settings): убрать фиктивные операции и подключить реальные параметры 2026-10-03 14:21:17 +07:00
Denozordec 2b6d3ab2e0 fix(evolution): проверить серверный каталог и завершить локальную приёмку 2026-10-03 14:12:06 +07:00
Denozordec d272ef57f0 fix(evolution): исключить моковые данные из живого каталога 2026-10-03 14:08:44 +07:00
Denozordec 118cd31d65 fix(evolution): сохранять черновики и подтверждать операции формы 2026-10-03 13:59:24 +07:00
Denozordec 7e3cb754b0 fix(evolution): проверять каталог и сохранять неизвестные счётчики 2026-10-03 13:51:07 +07:00
Denozordec 9db1471b2c fix(evolution): разделить состояния настроек и каталога и защитить контекст 2026-10-03 13:42:00 +07:00
Denozordec 554dba55ec fix(evolution): подтверждать сохранение ключа и ответ проверки API 2026-10-03 13:16:09 +07:00
Denozordec 2b62e0e956 fix(evolution): проверять настройки и подтверждение сохранённых полей 2026-10-03 13:11:45 +07:00
Denozordec 2215007c91 fix(netflow): завершить локальную приёмку и объединить сценарий сброса 2026-10-03 13:07:39 +07:00
Denozordec d9e09281e8 fix(netflow): генерировать файлы хоста из согласованного снимка настроек 2026-10-03 13:02:34 +07:00
Denozordec b80fa042d5 fix(netflow): согласовать проверку сетевых параметров формы и сервера 2026-10-03 12:59:05 +07:00
Denozordec 32b7812169 fix(netflow): отклонять конкурентный сброс до удаления данных 2026-10-03 12:54:27 +07:00
Denozordec a575795ff5 fix(netflow): проверить смену источника и адаптивность формы 2026-10-03 12:51:40 +07:00
Denozordec fcd8de2a96 fix(netflow): сохранять черновики и показывать подтверждённые результаты 2026-10-03 12:48:56 +07:00
Denozordec c9b0f9266e fix(netflow): выполнять сброс данных одной транзакцией и сохранять результат 2026-10-03 12:37:40 +07:00
Denozordec e2aae3897d fix(netflow): сохранять отдельные поля и защищать созданную пару ключей 2026-10-03 12:33:31 +07:00
Denozordec 8b017bab3f fix(netflow): защитить приватный экспорт и разделить результаты сохранения 2026-10-03 12:31:51 +07:00
Denozordec 4af4fdc544 fix(netflow): проверять ответы настроек и подтверждения операций 2026-10-03 12:29:05 +07:00
Denozordec 52cb93bf24 fix(geoip): проверить смену источника и читаемость на телефоне 2026-10-03 12:19:54 +07:00
Denozordec 57e7dcf990 fix(geoip): сохранять черновик и показывать частичный результат обновления 2026-10-03 12:13:25 +07:00
Denozordec f0d9f488e6 fix(geoip): ограничить изменение баз правами записи трафика 2026-10-03 12:05:48 +07:00
Denozordec 65aeedd3b0 fix(scheduler): завершить локальную приёмку контекста и адаптивности 2026-10-03 12:03:38 +07:00
Denozordec 5df337f6d7 fix(scheduler): подтверждать ручные операции и учитывать частичные ошибки 2026-10-03 11:56:08 +07:00
Denozordec cb377fb60c fix(collectors): сохранять только изменённые настройки с учётом прав 2026-10-03 11:50:23 +07:00
Denozordec 117aa9a21a fix(collectors): проверять параметры и подтверждения сохранения 2026-10-03 11:43:35 +07:00
Denozordec d453f2aec3 fix(collectors): разделить загрузку настроек и сохранить черновики 2026-10-03 11:41:00 +07:00
Denozordec dd387cf379 fix(evobgp): требовать подтверждение проверки соединения 2026-10-01 22:17:42 +07:00
Denozordec 0d2affaf6b fix(evobgp): проверять каталог и сохранять навигацию при ошибках API 2026-10-01 22:11:10 +07:00
Denozordec a0263c22a5 fix(collectors): проверять реальные ответы настроек без подстановки defaults 2026-10-01 21:59:40 +07:00
Denozordec 5d5ea680aa fix(scheduler): показывать подтверждённый статус независимо от настроек uptime 2026-10-01 21:55:03 +07:00
Denozordec 1f75bc5cea fix(scheduler): различать неизвестную историю и подтверждённые запуски 2026-10-01 21:47:10 +07:00
Denozordec 933a4eaf57 fix(scheduler): исключить поздние ответы после смены фильтра и источника 2026-10-01 21:39:04 +07:00
Denozordec 1b51d2af01 fix(geoip): отклонять неполные ответы и проверять подтверждения операций 2026-10-01 21:31:36 +07:00
Denozordec 638c17caef fix(scheduler): проверять подтверждения и контекст API планировщика 2026-10-01 21:24:37 +07:00
Denozordec 92b7399ddb fix(scheduler): читать снимки JSONB и показывать недоступные результаты 2026-10-01 21:19:36 +07:00
Denozordec 63b2f75012 fix(scheduler): отделить результат запуска от сбоев журналирования 2026-10-01 21:09:29 +07:00
Denozordec 49b8a1a19c chore(ui): завершить локальную приёмку резервных копий и этапа 11А 2026-10-01 20:59:42 +07:00
Denozordec 5ce080baf3 fix(backups): сохранить достоверность плановых операций при сбоях 2026-10-01 20:54:18 +07:00
Denozordec 98b4c39a00 fix(backups): показывать частичный результат внутри формы 2026-10-01 20:39:35 +07:00
Denozordec ad457b90a9 fix(backups): показывать ошибки диалогов на узких экранах 2026-10-01 16:48:20 +07:00
Denozordec b74084b67c fix(backups): адаптировать историю и формы к узким экранам 2026-10-01 16:45:41 +07:00
Denozordec 11e357cc94 fix(backups): восстанавливать вкладку и фильтры из ссылки 2026-10-01 16:37:34 +07:00
Denozordec 6f152c8dfe fix(backups): сохранять неизвестный результат восстановления 2026-10-01 16:32:06 +07:00
Denozordec 39570656c9 fix(backups): не повторять импорт после потери ответа 2026-10-01 16:22:06 +07:00
Denozordec 99ff5aebaf fix(backups): сверять сервер и файл подтверждения импорта 2026-10-01 16:18:37 +07:00
Denozordec af86d2c3cd fix(backups): сохранять запись при неполной очистке файлов 2026-10-01 16:14:00 +07:00
Denozordec 4c5604bf87 fix(backups): подтверждать операции в текущем контексте 2026-10-01 16:11:26 +07:00
Denozordec 714af7e872 fix(backups): продолжать наблюдение без повторного создания 2026-10-01 15:58:47 +07:00
Denozordec 4aee2a34f1 fix(backups): сохранить идентичность фоновой задачи 2026-10-01 15:44:02 +07:00
Denozordec 30bd479a6f fix(backups): подтверждать настройки и последнюю проверку S3 2026-10-01 15:37:00 +07:00
Denozordec 8e01666e0e fix(backups): сохранять расписание и хранилище независимо 2026-10-01 15:25:48 +07:00
Denozordec 5ce21e9a47 fix(backups): отделить результат операций от ошибок журнала 2026-10-01 15:11:32 +07:00
Denozordec 3dcc7c9ea6 fix(backups): разделить загрузку каталогов и права действий 2026-10-01 15:06:52 +07:00
Denozordec b460997cbf fix(test): указать хранилище в фикстуре резервных копий 2026-10-01 14:56:21 +07:00
Denozordec 4ae2954f97 fix(backups): проверять ответы и прогресс резервного копирования 2026-10-01 14:55:03 +07:00
Denozordec 46fe38321a fix(certificates): сохранить достоверный результат выпуска 2026-10-01 14:50:44 +07:00
Denozordec 16fa6eb5d8 fix(ui): проверить доступность и адаптивность сертификатов 2026-10-01 14:42:11 +07:00
Denozordec f5a71728ac fix(ui): восстанавливать задачу выпуска без повторной операции 2026-10-01 14:29:56 +07:00
Denozordec 97526bf06f fix(api): исключить повторное создание задачи выпуска 2026-10-01 14:16:10 +07:00
Denozordec 299f1da90b fix(api): проверять цель и отменять наблюдение выпуска 2026-10-01 14:10:33 +07:00
Denozordec 1d50ec8d17 fix(api): согласовать задачу выпуска с контрактом сертификатов 2026-10-01 14:07:03 +07:00
Denozordec 594e60a1f4 fix(ui): сохранять черновики и результат настроек ACME 2026-10-01 14:03:30 +07:00
Denozordec 1c407b77de fix(ui): сохранять подтверждённые настройки автообновления 2026-10-01 13:56:42 +07:00
Denozordec df89e88f4e fix(api): проверять ответы настроек и выпуска сертификатов 2026-10-01 13:48:50 +07:00
Denozordec adb6589816 fix(ui): сохранять контекст и источник сертификатов 2026-10-01 13:46:12 +07:00
Denozordec b184922f61 fix(ui): сохранять достоверные снимки сертификатов 2026-10-01 13:40:32 +07:00
Denozordec 17f03e7af1 fix(ui): показывать неизвестные поля сертификатов явно 2026-10-01 13:32:41 +07:00
Denozordec bb74eae64c fix(ui): убрать недостоверную шкалу срока сертификата 2026-10-01 13:28:19 +07:00
Denozordec f99612f6aa fix(api): изолировать ошибки создания клиента устройства 2026-10-01 11:26:22 +07:00
Denozordec c7b4981dff fix(api): сохранить последние снимки сертификатов 2026-10-01 11:23:45 +07:00
Denozordec 26869632a0 fix(api): передавать наблюдаемые состояния сертификатов 2026-10-01 11:18:32 +07:00
Denozordec 71cc6fa3a7 fix(ui): сохранить контекст и фокус контейнеров 2026-10-01 11:13:29 +07:00
Denozordec 3ceb8c038c fix(ui): показывать достоверный снимок контейнера 2026-10-01 11:02:31 +07:00
Denozordec c419a46955 fix(ui): подтверждать команды контейнеров ответом API 2026-10-01 10:53:07 +07:00
Denozordec 860add8edf fix(ui): сохранить достоверные состояния контейнеров 2026-10-01 10:47:11 +07:00
Denozordec 644ddb64b3 fix(api): показать частичные отказы каталога контейнеров 2026-10-01 10:39:37 +07:00
Denozordec 1e0fc4cd2d fix(ui): завершить доступность формы пользователей 2026-10-01 10:35:34 +07:00
Denozordec 9320c11d58 fix(ui): различать снимок историю и неизвестный каталог пользователей 2026-10-01 10:18:42 +07:00
Denozordec c37498512f fix(api): показывать источник и частичные сбои каталога интерфейсов 2026-10-01 10:10:41 +07:00
Denozordec ecd72d9750 fix(ui): сохранять контекст каталога и выбирать клиента IPsec 2026-10-01 10:01:09 +07:00
Denozordec 4896d8ef6f fix(ui): продолжать частичное сохранение пользователя без дублей 2026-10-01 09:53:23 +07:00
Denozordec 02ca48ef9c fix(ui): подтверждать удаление пользователя и сохранять ошибку 2026-10-01 09:39:39 +07:00
Denozordec 2d5fb3598f fix(ui): показывать подтверждённые каталоги пользователей 2026-10-01 09:34:51 +07:00
Denozordec 0a332ce341 chore(docs): сохранить карту реализации администрирования 2026-10-01 09:33:40 +07:00
Denozordec 517e0bca67 chore(test): зафиксировать локальную приёмку маршрутизации и диагностики 2026-10-01 09:33:02 +07:00
Denozordec 3c41de136e fix(ui): сохранять явный выбор туннеля диагностики 2026-10-01 09:21:05 +07:00
Denozordec d28d7a2cdb fix(ui): улучшить доступность и мобильный вывод диагностики 2026-10-01 09:17:25 +07:00
Denozordec 440e10c646 fix(api): прекращать диагностику при отмене HTTP 2026-10-01 09:00:19 +07:00
Denozordec 9d2101d700 fix(api): сохранять неизвестные показатели диагностики 2026-10-01 08:54:31 +07:00
Denozordec 33185fddae fix(api): проверять параметры и подтверждать результат MTU 2026-10-01 08:49:54 +07:00
Denozordec 68ccc49135 fix(api): отделить отказ диагностики от успешного вывода 2026-10-01 08:42:06 +07:00
Denozordec b60b7ac8e8 fix(ui): проверять источник IPv4 для диагностики 2026-10-01 08:36:31 +07:00
Denozordec d0c715e93c fix(ui): сохранять устройство диагностики в URL 2026-10-01 08:31:50 +07:00
Denozordec 1b91ba4e1d fix(ui): показывать реальный источник и ошибки DNS 2026-10-01 04:24:28 +07:00
Denozordec 155dfc5716 fix(ui): подтверждать GRE перед тестом пропускной способности 2026-10-01 04:20:19 +07:00
Denozordec b856215c03 fix(ui): согласовать права диагностики с API 2026-10-01 04:14:52 +07:00
Denozordec cba3db1508 fix(ui): сохранять каталог устройств диагностики при отказе 2026-10-01 04:11:43 +07:00
Denozordec 6fa8e5bfd1 fix(ui): различать результат и отмену диагностики 2026-10-01 04:07:08 +07:00
Denozordec 8bda85129f fix(ui): проверить терминал и мобильный выбор устройства 2026-10-01 03:59:47 +07:00
Denozordec ea4095d1f1 fix(api): отличать отказ терминала от пустого вывода 2026-10-01 03:43:35 +07:00
Denozordec a2eae189be fix(ui): подтверждать выполнение команд терминала 2026-10-01 03:36:14 +07:00
Denozordec bc20e5b9f4 fix(ui): завершить доступное управление картой сети 2026-10-01 03:26:31 +07:00
Denozordec bc83b8dbbf fix(ui): вписывать топологию в область карты 2026-10-01 03:18:02 +07:00
Denozordec 89e48c2424 fix(ui): адаптировать панели и действия карты сети 2026-10-01 03:06:28 +07:00
Denozordec 8bc4f22af7 fix(ui): сохранять контекст карты сети в ссылке 2026-10-01 02:26:03 +07:00
Denozordec 0cdb43a29d fix(ui): обновлять детали и пояснять модель карты сети 2026-10-01 02:15:52 +07:00
Denozordec 6cb27b2aab chore(test): проверить смену источника карты сети 2026-10-01 02:00:21 +07:00
Denozordec 1bce4e1ea2 fix(ui): показывать ошибки и свежесть NetFlow карты 2026-10-01 01:56:39 +07:00
Denozordec e47e2b4029 fix(ui): убрать выдуманные измерения из карты сети 2026-10-01 01:46:29 +07:00
Denozordec 329d6b82f7 fix(ui): показывать неизвестный статус карты отдельно 2026-10-01 01:39:53 +07:00
Denozordec 1215cbe8ae fix(ui): проверять целостность снимка карты сети 2026-10-01 01:33:50 +07:00
Denozordec 66fde3fc62 fix(ui): завершить локальную приёмку оптимизатора 2026-10-01 01:14:18 +07:00
Denozordec 5a23dfcfe6 fix(ui): согласовать настройки и контекст Community 2026-10-01 01:04:02 +07:00
Denozordec 6e6558bde9 fix(ui): исключить подстановку моковых WAN в live расчёт 2026-10-01 00:58:59 +07:00
Denozordec 338335ddc0 fix(api): проверять однозначность Router ID оптимизатора 2026-10-01 00:53:40 +07:00
Denozordec 7077844655 fix(api): передавать происхождение метрик оптимизатора OSPF 2026-10-01 00:50:17 +07:00
Denozordec 255f272fab fix(ui): отделить измерения цепочек от модели 2026-10-01 00:41:54 +07:00
Denozordec 9404bd5136 fix(ui): пояснить расчётные метрики preview OSPF 2026-09-30 23:40:56 +07:00
Denozordec d68c11e58a chore(test): проверить смену источника оптимизатора 2026-09-30 23:37:17 +07:00
Denozordec c82434c435 fix(ui): сохранять устройство оптимизатора в адресе 2026-09-30 23:34:05 +07:00
Denozordec 2cdfa2cb13 fix(ui): не подменять неизвестный индекс маршрута нулём 2026-09-30 23:27:14 +07:00
Denozordec fb70d80220 fix(ui): завершить адаптивность оптимизатора маршрутов 2026-09-30 23:23:58 +07:00
Denozordec 0ee7f02e87 fix(api): проверять исходные шаблоны и план оптимизации OSPF 2026-09-30 23:03:48 +07:00
Denozordec c88e1400bf fix(ui): подтверждать применение OSPF и согласовать права 2026-09-30 22:56:31 +07:00
Denozordec bf2815b5a4 fix(ui): проверять контекст расчёта OSPF оптимизатора 2026-09-30 22:47:04 +07:00
Denozordec f93dfe34c2 fix(ui): сохранять согласованные данные оптимизатора 2026-09-30 22:38:11 +07:00
Denozordec 59f0f82176 fix(ui): обозначить расчёт и симуляцию оптимизатора 2026-09-30 22:29:46 +07:00
Denozordec e58604c3c0 fix(ui): завершить адаптивность рекурсивных маршрутов 2026-09-30 22:19:21 +07:00
Denozordec 54ef752a5b fix(api): сохранять достоверные параметры рекурсивных маршрутов 2026-09-30 22:08:22 +07:00
Denozordec 50fad3ac80 fix(ui): сохранять контекст и блокировку рекурсивных маршрутов 2026-09-30 21:43:41 +07:00
Denozordec 52493debc2 fix(api): валидировать применение и восстановление маршрутов 2026-09-30 21:15:23 +07:00
Denozordec f5fc9282e2 fix(ui): подтверждать операции рекурсивных маршрутов 2026-09-30 21:08:01 +07:00
Denozordec 79a8d95e7d fix(ui): завершить адаптивность и приёмку OSPF 2026-09-30 20:43:10 +07:00
Denozordec 259c5c3014 fix(ui): связывать OSPF узлы по подтверждённым ID 2026-09-30 20:19:37 +07:00
Denozordec 7a68ae8184 fix(ui): сохранять поиск и выбранный узел OSPF 2026-09-30 20:09:00 +07:00
Denozordec 1d522527b4 fix(ui): восстанавливать контекст OSPF из URL 2026-09-30 19:58:43 +07:00
Denozordec af05ad5cda fix(api): показывать подтверждённые метрики OSPF 2026-09-30 19:49:47 +07:00
Denozordec e3791f3496 fix(api): сохранять неизвестные показатели BFD и OSPF 2026-09-30 19:42:07 +07:00
Denozordec 47dcd89b3c fix(api): закрепить неизвестное состояние BFD в строгом каталоге 2026-09-30 18:13:51 +07:00
Denozordec b1080b0a05 fix(ui): учитывать область в стоимости соседа OSPF 2026-09-30 18:09:10 +07:00
Denozordec 2199950681 fix(ui): проверять диапазон AS в каталоге BGP 2026-09-30 18:06:18 +07:00
Denozordec 748a3c00ad fix(ui): не подставлять выдуманный cost соседа OSPF 2026-09-30 18:04:14 +07:00
Denozordec 3dc25628af fix(ui): сохранять переходные и неизвестные состояния OSPF 2026-09-30 18:02:11 +07:00
Denozordec c18c148a23 fix(ui): разделить время опроса и подтверждения OSPF 2026-09-30 17:50:47 +07:00
Denozordec baa43b7ad4 fix(ui): защищать оптимизацию OSPF и подтверждение результата 2026-09-30 17:46:56 +07:00
Denozordec 4254904c3a fix(ui): сохранять снимки OSPF при отказе устройств 2026-09-30 17:37:23 +07:00
Denozordec a89cefcbf2 fix(api): показывать ошибки строгого OSPF-каталога 2026-09-30 17:27:44 +07:00
Denozordec 72a63b4a4f fix(ui): улучшить мобильную сводку и детали BGP 2026-09-30 17:23:18 +07:00
Denozordec aa678b9d5d fix(ui): восстанавливать поиск и фильтры BGP из URL 2026-09-30 17:15:37 +07:00
Denozordec 5c307a5b6c fix(bgp): сохранять неизвестные AS и тип сессии 2026-09-30 17:09:32 +07:00
Denozordec 2e17cbe926 fix(ui): сохранять контекст и свежесть опроса BGP 2026-09-30 17:05:37 +07:00
Denozordec 8fdc4b917b fix(bgp): отображать только подтверждённые показатели сессий 2026-09-30 16:56:28 +07:00
Denozordec 7046808429 fix(ui): сохранять BGP-сессии при частичных отказах 2026-09-30 16:48:46 +07:00
Denozordec 85e701960e fix(api): показывать ошибки опроса в каталоге BGP 2026-09-30 16:41:45 +07:00
Denozordec f9cfb4e532 chore(docs): сохранить карту маршрутизации и диагностики 2026-09-30 16:38:14 +07:00
Denozordec 919d0c4714 fix(api): проверить контекст GRE и завершить локальную приёмку этапа 9 2026-09-30 16:29:59 +07:00
Denozordec a29ee31052 fix(ui): улучшить мобильные экраны и сводку GRE и VXLAN 2026-09-30 16:27:10 +07:00
Denozordec fc3d588cec fix(ui): убрать неподтверждённые данные и действия GRE-пулов 2026-09-30 16:10:21 +07:00
Denozordec 337d14abdf fix(gre): экспортировать поддерживаемые параметры и очищать PSK 2026-09-30 16:06:32 +07:00
Denozordec a21252fb02 fix(ui): показывать свежесть GRE и закреплять экспорт 2026-09-30 16:00:48 +07:00
Denozordec ceb2113209 fix(ui): изолировать операции GRE и готовность устройств 2026-09-30 15:56:51 +07:00
Denozordec fb009344e1 fix(ui): сохранять подтверждённые данные GRE при отказах 2026-09-30 15:49:26 +07:00
Denozordec 6ea3cdad0e fix(ui): учитывать неизвестный статус устройств VPN 2026-09-30 15:41:45 +07:00
Denozordec 6f00596e33 fix(api): сообщать об отказах общего GRE-каталога 2026-09-30 15:31:09 +07:00
Denozordec d112935c73 fix(api): отклонять несогласованные объекты IPsec и VXLAN 2026-09-30 15:25:29 +07:00
Denozordec 0e0f98e0f4 fix(vxlan): корректно экспортировать параметры RouterOS 2026-09-30 15:21:55 +07:00
Denozordec d200e87e3d fix(ui): показывать достоверное состояние и экспорт VXLAN 2026-09-30 15:15:13 +07:00
Denozordec 6fc342cd2c fix(ui): проверить клавиатуру и адаптивность IPsec 2026-09-30 15:06:31 +07:00
Denozordec ce43b2d762 fix(ui): показывать свежесть опроса и изменений IPsec 2026-09-30 14:58:55 +07:00
Denozordec 921aba3054 fix(ui): изолировать контекст и операции IPsec 2026-09-30 14:55:20 +07:00
Denozordec f0071a495c fix(ui): учитывать готовность устройства в действиях IPsec 2026-09-30 14:48:21 +07:00
Denozordec b8923d075d fix(ui): сохранять данные IPsec при сбоях опроса 2026-09-30 14:43:22 +07:00
Denozordec 8fab2f7fd2 chore(docs): зафиксировать общую регрессию Filters 2026-09-30 12:44:31 +07:00
Denozordec 29a4ea2e5b fix(ui): улучшить клавиатурный ввод Community в Filters 2026-09-30 12:39:45 +07:00
Denozordec 4ae5f2edcd fix(ui): показывать свежесть данных Filters 2026-09-30 12:25:42 +07:00
Denozordec 0ab5a23eb3 fix(ui): сохранять недоступные шлюзы Filters 2026-09-30 12:21:00 +07:00
Denozordec 860e88ed3e fix(ui): читать актуальную цель копирования Filters 2026-09-30 12:10:20 +07:00
Denozordec 365ab2173c fix(ui): изолировать источники данных Filters 2026-09-30 12:05:28 +07:00
Denozordec 24cc66d8d2 fix(ui): отклонять устаревшее чтение Filters 2026-09-30 11:57:22 +07:00
Denozordec 1c7ffa07a8 fix(ui): проверять данные загрузки Filters 2026-09-30 11:50:36 +07:00
Denozordec 1fba16e1f2 fix(ui): изолировать операции восстановления Filters 2026-09-30 11:42:57 +07:00
Denozordec 7554f1804b fix(ui): подтверждать перемещение правил Filters 2026-09-30 11:35:36 +07:00
Denozordec c4011cfaff fix(ui): подтверждать удаление правил Filters 2026-09-30 11:29:54 +07:00
Denozordec 8412ba9bbe fix(ui): подтверждать копирование правил Filters 2026-09-30 11:24:48 +07:00
Denozordec 1cf7297d64 fix(ui): подтверждать сохранение правил Filters 2026-09-30 11:17:32 +07:00
Denozordec 4b01f20558 fix(ui): показывать свежесть срезов Firewall 2026-09-30 11:04:57 +07:00
Denozordec c2159508d5 fix(ui): изолировать операции Firewall по источнику 2026-09-30 10:56:49 +07:00
Denozordec 5e6057842f fix(ui): сохранять недоступные срезы Firewall 2026-09-30 10:46:36 +07:00
Denozordec 59440555cd fix(ui): сохранять данные Firewall при сбоях загрузки 2026-09-30 10:33:54 +07:00
Denozordec 92ba474ca9 fix(ui): исключить конфликты восстановления Firewall 2026-09-30 10:24:35 +07:00
Denozordec 14f8b1ee9a fix(ui): подтверждать перемещение правил Firewall 2026-09-30 10:18:34 +07:00
Denozordec b47c5645d5 fix(ui): подтверждать сохранение форм Firewall 2026-09-30 10:13:11 +07:00
Denozordec 14a9e6d26c fix(ui): подтверждать удаление объектов Firewall 2026-09-30 10:07:07 +07:00
Denozordec 0c460d4767 fix(ui): подтверждать переключение адресов Firewall 2026-09-30 09:59:36 +07:00
Denozordec 131ecb8668 fix(ui): подтверждать переключение правил Firewall 2026-09-30 09:52:29 +07:00
Denozordec 14be83a869 fix(ui): проверять данные VXLAN и гонки загрузки 2026-09-30 09:47:51 +07:00
Denozordec e163a9ed9d fix(ui): показывать частичные сбои опроса VXLAN 2026-09-30 09:42:43 +07:00
Denozordec 4dc2ee2129 fix(ui): различать ошибку и пустые данные VXLAN 2026-09-30 09:37:31 +07:00
Denozordec 3d518ff902 fix(ui): подтверждать сохранение формы GRE 2026-09-30 09:34:12 +07:00
Denozordec 66b439cc2e fix(ui): подтверждать переключение туннелей GRE 2026-09-30 00:42:28 +07:00
Denozordec 780d5e9237 fix(ui): подтверждать удаление туннеля GRE 2026-09-30 00:39:39 +07:00
Denozordec f5b64ea154 fix(ui): подтверждать сохранение peer IPsec 2026-09-29 19:31:55 +07:00
Denozordec 611f31875e fix(ui): подтверждать удаление объектов IPsec 2026-09-29 19:28:26 +07:00
Denozordec 74e7cd257d fix(ui): сохранять контекст экспорта сертификатов IPsec 2026-09-29 19:23:34 +07:00
Denozordec 86ecf764ff fix(ui): подтверждать сохранение пользователей IPsec 2026-09-29 19:15:15 +07:00
Denozordec f9413d5100 fix(ui): подтверждать инициализацию IPsec и сохранять форму 2026-09-29 19:09:22 +07:00
Denozordec 4a8d696e4e fix(ui): проверять ревизии и сохранять ошибки истории 2026-09-29 19:04:00 +07:00
Denozordec 46d62c98b8 fix(ui): сохранять ошибку загрузки истории IPsec 2026-09-29 18:55:46 +07:00
Denozordec 3dd4ad34ee fix(ui): проверять подтверждение восстановления сетевых настроек 2026-09-29 13:58:26 +07:00
Denozordec d0f5649725 fix(ui): различать ошибки и пустую историю WireGuard 2026-09-29 13:42:00 +07:00
Denozordec 1d1de12c58 fix(ui): сохранять подтверждение восстановления при ошибке 2026-09-29 13:37:32 +07:00
Denozordec 221d6db10c fix(ui): проверять подтверждение восстановления WireGuard 2026-09-29 08:43:31 +07:00
Denozordec 425a77a1ca fix(ui): сохранять точный выбор пира при экспорте WireGuard 2026-09-29 08:40:36 +07:00
Denozordec 4aa4726c6b fix(ui): защитить экспорт WireGuard от устаревших ответов 2026-09-29 08:37:53 +07:00
Denozordec d3ae2598fb fix(ui): подтверждать переключение интерфейсов WireGuard 2026-09-29 08:33:10 +07:00
Denozordec 8fff3d7fff fix(ui): подтверждать создание интерфейса и пира WireGuard 2026-09-29 08:30:07 +07:00
Denozordec ec6ec52965 fix(ui): защитить форму импорта WireGuard во время запроса 2026-09-29 08:22:58 +07:00
Denozordec efc6da1249 fix(ui): проверять подтверждение импорта WireGuard 2026-09-28 23:58:59 +07:00
Denozordec f980619046 fix(ui): подтверждать удаление WireGuard и блокировать повторы 2026-09-28 23:52:43 +07:00
Denozordec 165f40acd7 fix(ui): завершить локальную приёмку трафика и статистики 2026-09-28 23:45:48 +07:00
Denozordec 48b7a061c1 fix(ui): обозначить выбранные состояния и поиск трафика 2026-09-28 17:02:16 +07:00
Denozordec 460cf67313 fix(ui): выбирать неактивные серверы для месячного отчёта 2026-09-28 16:59:40 +07:00
Denozordec 7dd377d7c3 fix(ui): выбирать календарный месяц отчёта потоков 2026-09-28 16:54:17 +07:00
Denozordec 7a01e8d545 test(ui): проверить ожидание первого сообщения SSE 2026-09-28 16:49:56 +07:00
Denozordec 88a8b5f02f fix(ui): отображать одиночные измерения на графике трафика 2026-09-28 16:47:17 +07:00
Denozordec ed491c313f fix(ui): распознавать CRLF и комментарии в потоке SSE 2026-09-28 11:38:11 +07:00
Denozordec f50a29f116 fix(ui): снимать статус live при отсутствии обновлений 2026-09-28 11:35:29 +07:00
Denozordec 5734340db2 fix(ui): исключить подмену выбранного среза в сводке трафика 2026-09-28 11:31:24 +07:00
Denozordec c6d146d38f fix(ui): показывать временные отметки трафика серверов 2026-09-28 11:27:20 +07:00
Denozordec 65241c94e9 fix(ui): показывать время получения аналитики потоков 2026-09-28 11:22:20 +07:00
Denozordec 7318c5286b test(ui): проверить поздний фрагмент открытого потока 2026-09-28 11:12:06 +07:00
Denozordec 53bca894bb chore(docs): сохранить общий план реализации UX/UI 2026-09-24 21:13:05 +07:00
Denozordec c3ce626b47 test(ui): проверить разрывы основного графика трафика 2026-09-24 21:10:42 +07:00
Denozordec ee3dcdacf2 test(ui): проверить трафик после смены источника данных 2026-09-24 21:09:39 +07:00
Denozordec 2c2a3ef078 test(ui): проверить отмену потока при смене сервера 2026-09-24 21:07:44 +07:00
Denozordec c563583ccb fix(ui): привязать фильтр интерфейса к серверу потоков 2026-09-24 16:04:08 +07:00
Denozordec 1d98a2a66e fix(ui): сохранять пропуски в мини-графиках измерений 2026-09-24 15:58:23 +07:00
Denozordec f3568d836b fix(ui): корректно отображать историю в карточках трафика 2026-09-24 15:54:53 +07:00
Denozordec ccbc1aa029 fix(ui): пояснять отсутствие отдельного направления трафика 2026-09-24 15:51:32 +07:00
Denozordec ec8e28d15d fix(ui): отличать пустую историю трафика от нулевой 2026-09-24 10:06:46 +07:00
Denozordec 7c6f937cec fix(ui): отличать неизвестные flow-метрики от нулевых 2026-09-24 10:02:50 +07:00
Denozordec a03909e504 fix(ui): отклонять повреждённые данные live-потока 2026-09-24 09:58:32 +07:00
Denozordec 094c812c37 fix(ui): адаптировать длинные данные и пустые списки трафика 2026-09-24 09:53:10 +07:00
Denozordec cb16c03e01 test(ui): проверить период трафика на телефоне 2026-09-24 01:40:34 +07:00
Denozordec 3dc85a22e9 fix(ui): адаптировать панели трафика для телефона 2026-09-24 01:39:32 +07:00
Denozordec 8ac40ba78a fix(ui): показывать подтверждённые данные месячного отчёта 2026-09-24 01:36:36 +07:00
Denozordec 24313340d5 fix(ui): привязать flow-аналитику к контексту запроса 2026-09-24 01:31:43 +07:00
Denozordec 94dd453b33 fix(ui): защитить списки трафика от устаревших ответов 2026-09-24 01:25:20 +07:00
Denozordec 480aa82f78 fix(ui): привязать детали трафика к выбранному контексту 2026-09-24 01:18:13 +07:00
Denozordec 9eb6a3fad1 fix(ui): показывать остановку потока live-трафика 2026-09-24 01:13:11 +07:00
Denozordec e05b3a38c8 fix(ui): сохранять и проверять контекст отчёта статистики 2026-09-23 20:30:11 +07:00
Denozordec 94ad73212b fix(ui): проверять период статистики до запроса 2026-09-23 20:26:23 +07:00
Denozordec 167e19cd91 fix(ui): отделить ошибки статистики от пустых данных 2026-09-23 20:22:18 +07:00
Denozordec 3898881d8a test(ui): завершить локальную приёмку серверов и мониторинга 2026-09-23 20:18:35 +07:00
Denozordec ddb47a0ee4 test(ui): проверить смену режима во время опроса 2026-09-23 20:12:42 +07:00
Denozordec 27f8323624 test(ui): проверить опрос сервера из очереди проблем 2026-09-23 14:50:16 +07:00
Denozordec ca9474ac83 fix(ui): адаптировать формы серверов и прокрутку ресурсов 2026-09-23 14:48:13 +07:00
Denozordec 9cd15528c9 fix(ui): исправить адаптивность форм и вкладок мониторинга 2026-09-23 14:38:52 +07:00
Denozordec a9ed459481 fix(ui): убрать неработающий экспорт серверов 2026-09-23 14:28:39 +07:00
Denozordec 0734679fd6 fix(ui): сохранять фильтры ресурсов в URL 2026-09-23 09:28:03 +07:00
Denozordec fd7a08d5dc fix(ui): сохранять вкладку и фильтры Ping в URL 2026-09-23 09:24:18 +07:00
Denozordec f7e0e20673 fix(ui): сериализовать ручной опрос и ограничить ожидание Speed-test 2026-09-23 09:17:20 +07:00
Denozordec cc40a5e33d fix(ui): блокировать изменение проб во время Speed-test 2026-09-21 21:14:13 +07:00
Denozordec ce14f5de3e fix(ui): подтверждать удаление проб и изменение звезды 2026-09-21 21:08:06 +07:00
Denozordec 4f235058be fix(ui): подтверждать переключение проб через API 2026-09-21 21:03:14 +07:00
Denozordec 2f5b617e8c fix(ui): сохранять формы проб после подтверждения API 2026-09-21 16:24:07 +07:00
Denozordec bb9278fe58 fix(ui): учитывать права на действия мониторинга 2026-09-21 16:16:16 +07:00
Denozordec 61950638bc fix(ui): учитывать права на операции с серверами 2026-09-21 15:00:13 +07:00
Denozordec e9e5030047 fix(ui): адаптировать строки Ping-проб для телефона 2026-09-21 09:58:43 +07:00
Denozordec dfb993e1a3 fix(ui): сохранять фильтры серверов в адресе страницы 2026-09-21 09:50:47 +07:00
Denozordec b64e6834a9 chore(docs): подготовить этап серверов и мониторинга 2026-09-20 22:11:27 +07:00
Denozordec d25afa4b9e fix(ui): завершить переходы к объектам дашборда через VXLAN 2026-09-20 22:08:00 +07:00
Denozordec af84f0135d fix(ui): открывать интерфейс WireGuard с контекстом сервера 2026-09-20 21:59:57 +07:00
Denozordec 67a152b7c8 fix(ui): открывать GRE-туннель с контекстом сервера 2026-09-20 17:09:33 +07:00
Denozordec 6c8e66693b fix(ui): открывать выбранную проверку из очереди проблем 2026-09-20 17:00:30 +07:00
Denozordec 668c7c6823 fix(ui): открывать выбранный сервер из очереди проблем 2026-09-20 16:51:28 +07:00
Denozordec 4ec32765df fix(ui): поднять очередь проблем и уточнить сводку дашборда 2026-09-20 12:04:45 +07:00
Denozordec fe9df167ec fix(ui): объединить навигацию и сделать поиск доступным 2026-09-20 12:04:21 +07:00
Denozordec 9b3196363c fix(ui): адаптировать шапку страницы к узким экранам 2026-09-20 11:49:44 +07:00
Denozordec 6a726b13b4 fix(ui): сохранить данные дашборда при сбоях и гонках запросов 2026-09-20 00:58:58 +07:00
Denozordec 0d418e2e39 chore(ui): завершить миграцию Filters и удалить старый API 2026-09-20 00:47:33 +07:00
Denozordec 4fd844f977 fix(ui): подключить фильтры статистики с проверкой срезов 2026-09-14 22:27:12 +07:00
Denozordec 52af82af42 fix(ui): подготовить проверку срезов статистики для FilterQuery 2026-09-14 22:12:15 +07:00
Denozordec fca42aaa81 fix(ui): перенести фильтры BGP и бэкапов на FilterQuery 2026-09-14 22:09:48 +07:00
Denozordec a475b5c6df chore(ui): удалить старую основу Data Grid и TanStack v8 2026-09-14 22:05:50 +07:00
Denozordec bdba83b2b6 fix(ui): перенести таблицы оптимизатора маршрутов на ReUI v9 2026-09-14 22:01:11 +07:00
Denozordec 1ea07f65b2 fix(ui): перенести таблицу рекурсивных маршрутов на ReUI v9 2026-09-14 13:54:05 +07:00
Denozordec ddf1851e92 fix(ui): перенести таблицы сборщика и проб на ReUI v9 2026-09-14 13:49:54 +07:00
Denozordec f81b35308b fix(ui): перенести таблицы Firewall и проверить порядок правил 2026-09-14 13:39:47 +07:00
Denozordec 45530cdb99 fix(ui): перенести таблицу сетевых фильтров на ReUI v9 2026-09-14 08:43:08 +07:00
Denozordec d47f7ab162 fix(ui): перенести таблицы администрирования и сортировать бэкапы по байтам 2026-09-14 08:38:09 +07:00
Denozordec 583b23ded1 fix(ui): перенести таблицы IPsec и GRE на ReUI v9 2026-09-14 08:31:16 +07:00
Denozordec 8b9b584513 fix(ui): перенести таблицу VXLAN на ReUI v9 2026-09-13 21:30:52 +07:00
Denozordec e7d45d194d fix(ui): перенести таблицы WireGuard на ReUI v9 2026-09-13 21:17:48 +07:00
Denozordec d3db82fd1c fix(ui): перенести таблицы BGP и OSPF на ReUI v9 2026-09-13 21:10:06 +07:00
Denozordec e66762ca2e fix(ui): перенести основные таблицы на ReUI v9 2026-09-13 21:01:23 +07:00
Denozordec 3d3c45e4d2 fix(ui): завершить основу таблиц и фильтров серверов 2026-09-13 14:46:17 +07:00
Denozordec f9a4a07996 fix(ui): исправить зависимости мемоизации таблицы 2026-09-13 09:56:02 +07:00
Denozordec e7755a4d16 chore(ui): сохранить основу поэтапной миграции таблиц 2026-09-13 09:46:41 +07:00
Denozordec c30f817926 fix(servers): исправить сохранение и опрос серверов 2026-09-13 09:32:37 +07:00
Denozordec 88326d9851 chore(ui): зафиксировать исходную базу улучшений интерфейса 2026-09-13 01:48:05 +07:00
DenozordecandCursor f8e7437210 fix(ui): убрать горизонтальный скролл в шторке сертификата
Docker images / publish-release (push) Successful in 11s
Docker images / frontend-image (push) Successful in 3m9s
Docker images / backend-image (push) Successful in 2m46s
Docker images / updater-image (push) Successful in 49s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 5s
Docker images / backend-test (push) Successful in 1m56s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 01:22:36 +07:00
DenozordecandCursor e0364d45df test(ipsec): закрепить отсутствие proposal-ключей в .sswan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 01:22:36 +07:00
DenozordecandCursor bbff586da2 fix(ipsec): убрать невалидный ike-proposal из .sswan-профиля
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 01:22:36 +07:00
DenozordecandCursor fbd1be8952 test(ipsec): покрыть формы ret и print в декодере файла RouterOS
Docker images / publish-release (push) Successful in 9s
Docker images / frontend-image (push) Successful in 3m4s
Docker images / backend-image (push) Successful in 2m25s
Docker images / updater-image (push) Successful in 51s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 8s
Docker images / backend-test (push) Successful in 2m28s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 01:01:42 +07:00
DenozordecandCursor 0bf5d6065c fix(ipsec): читать содержимое .p12 из поля ret ответа /file/get
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 01:01:31 +07:00
DenozordecandCursor 67c3a4fd73 test(ipsec): покрыть декодер содержимого файла RouterOS
Docker images / publish-release (push) Successful in 11s
Docker images / frontend-image (push) Successful in 3m14s
Docker images / backend-image (push) Successful in 3m19s
Docker images / backend-test (push) Successful in 1m53s
Docker images / updater-image (push) Successful in 49s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 6s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 00:44:53 +07:00
DenozordecandCursor 9beb24273b fix(ipsec): скачивать .p12 через /file/get вместо несуществующего REST-пути
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 00:44:44 +07:00
DenozordecandCursor 5cc6128086 fix(ipsec): уточнить подсказку про политику sensitive у группы пользователя
Docker images / publish-release (push) Successful in 7s
Docker images / frontend-image (push) Successful in 3m13s
Docker images / backend-image (push) Successful in 2m44s
Docker images / backend-test (push) Successful in 2m13s
Docker images / updater-image (push) Successful in 44s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 8s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 00:15:33 +07:00
DenozordecandCursor 569b6be2b4 fix(ipsec): не блокироваться на пароле .p12 и подсказать политику sensitive
Docker images / publish-release (push) Successful in 14s
Docker images / frontend-image (push) Successful in 2m54s
Docker images / backend-image (push) Successful in 2m43s
Docker images / backend-test (push) Successful in 2m18s
Docker images / updater-image (push) Successful in 45s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 00:15:05 +07:00
DenozordecandCursor 752256f12e fix(ipsec): требовать пароль .p12 не короче 8 символов
Docker images / publish-release (push) Successful in 11s
Docker images / frontend-image (push) Successful in 2m19s
Docker images / backend-image (push) Successful in 2m40s
Docker images / backend-test (push) Successful in 1m51s
Docker images / updater-image (push) Successful in 39s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 7s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 00:10:10 +07:00
DenozordecandCursor a3502b9755 fix(ipsec): убрать неподдерживаемый параметр при подписи сертификата
Docker images / publish-release (push) Successful in 9s
Docker images / frontend-image (push) Successful in 2m17s
Docker images / backend-image (push) Successful in 2m20s
Docker images / backend-test (push) Successful in 1m37s
Docker images / updater-image (push) Successful in 38s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 6s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 22:21:19 +07:00
DenozordecandCursor 0e1524c600 fix(ipsec): клиенты через общий IKEv2-peer и отдельный клиентский сертификат
Docker images / frontend-image (push) Successful in 2m54s
Docker images / publish-release (push) Successful in 10s
Docker images / updater-image (push) Successful in 40s
Docker images / backend-image (push) Successful in 2m11s
Docker images / backend-test (push) Successful in 1m51s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 7s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 22:06:35 +07:00
DenozordecandCursor 11ae7593f4 fix(ipsec): убрать неподдерживаемый параметр при добавлении сертификата
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 22:06:27 +07:00
Denozordec 3eb75ea0b8 feat(ipsec): add certificate export functionality by name
Docker images / publish-release (push) Successful in 13s
Docker images / frontend-image (push) Successful in 2m57s
Docker images / backend-image (push) Successful in 2m48s
Docker images / backend-test (push) Successful in 2m41s
Docker images / updater-image (push) Successful in 48s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 12s
- Implemented a new backend route for exporting existing client certificates in .p12 format by name.
- Enhanced the frontend to support exporting certificates directly from the IPsec server grid.
- Updated the IPsec page to manage certificate states and handle exports effectively.
- Introduced new utility functions for certificate handling and improved data structures to accommodate the changes.
- Added tests to ensure the reliability of the new certificate export feature.
2026-09-12 21:39:14 +07:00
Denozordec 7365d8d8fb feat(ipsec): enhance IPsec management with peer and certificate handling
Docker images / publish-release (push) Successful in 15s
Docker images / frontend-image (push) Successful in 2m56s
Docker images / backend-image (push) Successful in 2m35s
Docker images / backend-test (push) Successful in 2m39s
Docker images / updater-image (push) Successful in 44s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 8s
- Added support for managing IPsec peers, including editing and deleting functionality.
- Introduced a new UI component for displaying peers and their details within the IPsec server grid.
- Updated the IPsec user creation form to allow binding identities to specific peers.
- Enhanced backend routes and services to handle peer patching and deletion requests.
- Improved data structures to accommodate multiple peers and certificates for each server.
- Added tests to ensure proper functionality of new peer management features.
2026-09-12 21:04:49 +07:00
Denozordec 7755d77340 feat(ipsec): управление IKEv2/IPsec VPN и клиентами из одного окна
Docker images / publish-release (push) Successful in 8s
Docker images / frontend-image (push) Successful in 4m19s
Docker images / backend-image (push) Successful in 2m40s
Docker images / backend-test (push) Successful in 2m32s
Docker images / updater-image (push) Successful in 50s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 15s
- мастер инициализации сервера: CA и серверный сертификаты, peer/profile/proposal, пул, mode-config, policy-template, managed NAT masquerade
- клиенты по сертификату (RSA) и PSK: статический IP или из пула, онлайн-статус по active-peers
- скачивание .p12 и strongSwan .sswan с инструкцией, перекачка с новой passphrase
- история изменений (config_revisions, секция ipsec) и restore только managed-объектов
- привязка IPsec-клиентов к пользователям приложения по Common Name
- страница /ipsec с KPI и вкладками Клиенты/Сервер/CLI, сайдбар, command palette
2026-09-12 20:20:56 +07:00
Denozordec 564aae21f0 fix(statistics): выровнять трафик-данные с картой сети
Docker images / publish-release (push) Successful in 10s
Docker images / frontend-image (push) Successful in 3m28s
Docker images / backend-image (push) Successful in 3m5s
Docker images / backend-test (push) Successful in 2m40s
Docker images / updater-image (push) Successful in 50s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
- Окно периода клампится к текущему моменту: «Сегодня»/«7 д» больше не делят байты на ещё не наступившие часы суток (avgBps/bps были занижены).
- Пресет «24 ч» шлёт точные ISO-границы «сейчас−24ч … сейчас» вместо дат «вчера…сегодня» (~48 ч); подпись диапазона и подсветка пресета сверяются по длительности окна.
- Таксономия сервисов как на карте: DNS/SSH/BGP/WireGuard/GRE и пустые метки сворачиваются в «Прочее» (normalizeFactService) в разбивке сервисов и pivot country×service.
- Тесты: кламп окна, ISO-24ч, будущее «to», невалидный диапазон, нормализация меток.
2026-09-12 13:22:06 +07:00
Denozordec 0fdd2fc1e1 feat(traffic-flow): раскрытие сервисов страны на карте сети
Docker images / frontend-image (push) Successful in 3m14s
Docker images / publish-release (push) Successful in 10s
Docker images / updater-image (push) Successful in 43s
Docker images / backend-image (push) Successful in 2m44s
Docker images / backend-test (push) Successful in 2m11s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 8s
- Контракт: countryServiceGroups (группа сервисов страны) в flowMapHopsDto, тип FlowMapCountryServiceGroup.
- Бэкенд: вложенная агрегация brand×ISO в том же проходе hops; рёбра страна→сервис, пути с реальным EN; cap 8 / min 4, доля от байтов страны.
- Хелпер mapCountryServiceNodeId: id вида cc:us|svc:google, сервисы разных стран не смешиваются.
- Карта сети: клик по стране сдвигает колонку стран и раскрывает столбец её сервисов; остальные страны приглушены; панели страны и вложенного сервиса.
- Тесты: группы US/US+NL, рёбра от страны, cap/min вложенного слоя; mock countryServiceGroups для демо-режима.
2026-09-12 12:47:30 +07:00
DenozordecandCursor f15a7348db feat(traffic-flow): enhance country handling in flow analytics
Docker images / publish-release (push) Successful in 10s
Docker images / frontend-image (push) Successful in 3m26s
Docker images / backend-image (push) Successful in 2m23s
Docker images / updater-image (push) Successful in 47s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 9s
Docker images / backend-test (push) Successful in 2m19s
- Introduced country-specific handling in traffic flow analytics, including new mappings for country nodes and edges.
- Added mock data for countries and their respective service paths to improve visualization in the Network Map.
- Updated the `countryName` function to utilize `Intl.DisplayNames` for better localization of country names.
- Enhanced tests to validate country handling and ensure accurate representation in flow analytics.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:38:37 +07:00
DenozordecandCursor f3c846201c feat(traffic-flow): enhance Instagram service handling and classification
Docker images / publish-release (push) Successful in 13s
Docker images / frontend-image (push) Successful in 3m20s
Docker images / backend-image (push) Successful in 2m25s
Docker images / updater-image (push) Successful in 43s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 9s
Docker images / backend-test (push) Successful in 2m34s
- Added support for Instagram in traffic flow resolution and classification, including new test cases to validate its behavior.
- Introduced `INSTAGRAM` brand handling in the traffic flow logic, ensuring accurate service identification for Instagram-related traffic.
- Updated existing tests to cover various scenarios involving Instagram, including IP resolution and service categorization.
- Enhanced the service brand icon component to include an Instagram icon for better visual representation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:20:16 +07:00
DenozordecandCursor ee9804f1bb feat(traffic-flow): enhance flow analytics and IP handling
Docker images / publish-release (push) Successful in 13s
Docker images / frontend-image (push) Successful in 3m20s
Docker images / backend-image (push) Successful in 2m40s
Docker images / updater-image (push) Successful in 51s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 8s
Docker images / backend-test (push) Successful in 2m29s
- Introduced `canonicalIp` function to standardize IP address formats across the application, improving consistency in flow processing.
- Updated traffic flow analytics to utilize new endpoint resolution logic, enhancing accuracy in traffic classification.
- Enhanced tests for traffic flow analytics and IP handling, ensuring comprehensive coverage for new functionalities.
- Improved traffic flow destination resolution with additional test cases for various internet services, including Google and Fastly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 01:51:23 +07:00
DenozordecandCursor 4ce6169d14 feat(traffic-flow): enhance traffic classification and map display
Docker images / publish-release (push) Successful in 13s
Docker images / frontend-image (push) Successful in 2m42s
Docker images / backend-image (push) Successful in 2m30s
Docker images / backend-test (push) Successful in 2m16s
Docker images / updater-image (push) Successful in 43s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 12s
- Added a new state variable `mapAsnLoaded` to track ASN loading status in the NetworkMapPage.
- Updated the page to conditionally display a message when ASN data is not loaded, improving user feedback.
- Enhanced traffic classification tests to include additional scenarios for Google and YouTube services, ensuring comprehensive coverage.
- Introduced a new function `pickMapInternetDest` to improve destination selection logic in traffic flow processing.
- Updated the traffic flow destination classification to handle new conditions and improve accuracy.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 01:07:26 +07:00
DenozordecandCursor 60a0970d73 feat(traffic-flow): enhance traffic flow analytics and overlay configuration
Docker images / publish-release (push) Successful in 12s
Docker images / frontend-image (push) Successful in 3m22s
Docker images / backend-image (push) Successful in 2m55s
Docker images / backend-test (push) Successful in 2m42s
Docker images / updater-image (push) Successful in 46s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 12s
- Updated the traffic flow analytics to include new state variables for named bytes, total bytes, and window seconds, improving data granularity.
- Modified the NetworkMapPage to display classified traffic data, including a new section for showing classified and total bytes.
- Enhanced the applyFlowOverlay function to support a new option for disabling GRE fast path, allowing for more flexible traffic flow configurations.
- Added a toggle in the FlowOverlaySheet component to enable or disable the GRE fast path setting, improving user control over traffic processing.
- Updated tests to validate the new functionalities and ensure accurate traffic flow analytics.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 00:03:13 +07:00
DenozordecandCursor fc29dcede7 feat(traffic-flow): add NAT fields to flow processing and analytics
Docker images / publish-release (push) Successful in 9s
Docker images / frontend-image (push) Successful in 3m30s
Docker images / backend-image (push) Successful in 2m51s
Docker images / updater-image (push) Successful in 45s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
Docker images / backend-test (push) Successful in 2m22s
- Introduced new fields for NAT source and destination IPs, as well as their respective ports, in the flow data model.
- Updated database schema and migration scripts to accommodate the new NAT fields in the `flow_buckets` table.
- Enhanced flow analytics and processing functions to utilize the new NAT fields, improving accuracy in traffic flow analysis.
- Added tests to validate the handling of NAT data in various scenarios, ensuring robustness in flow processing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 23:01:48 +07:00
DenozordecandCursor 5f774ce26e feat(gre): enhance GRE tunnel status handling and IPsec configuration
Docker images / publish-release (push) Successful in 10s
Docker images / frontend-image (push) Successful in 3m1s
Docker images / backend-image (push) Successful in 2m31s
Docker images / backend-test (push) Successful in 2m18s
Docker images / updater-image (push) Successful in 40s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
- Introduced a new `greStatusMeta` function to streamline status retrieval and default handling.
- Updated GRE tunnel command generation to improve IPsec configuration handling, including optional fields for encryption and authentication algorithms.
- Enhanced the GRE tunnels data grid to display IPsec settings more clearly, including handling cases where certain parameters may be undefined.
- Refactored status display logic in the GRE page to utilize the new status meta function for consistency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:39:32 +07:00
DenozordecandCursor 25b82997b6 feat(config-revisions): implement configuration history for Firewall, GRE, and WireGuard
Docker images / publish-release (push) Successful in 12s
Docker images / frontend-image (push) Successful in 2m51s
Docker images / updater-image (push) Successful in 44s
Docker images / backend-image (push) Successful in 2m49s
Docker images / backend-test (push) Successful in 2m20s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 12s
- Added configuration history management for Firewall, GRE, and WireGuard pages, enabling users to view and restore previous configurations.
- Introduced new components for displaying configuration history and integrated them into the respective pages.
- Enhanced API routes to support fetching and restoring configuration revisions, ensuring data consistency across the application.
- Updated state management to handle loading and restoring states effectively, improving user experience during data operations.
- Enhanced tests to cover new functionalities and ensure reliability.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 14:03:00 +07:00
DenozordecandCursor b4a3c3a925 feat(filters, recursive-routes): enhance configuration history and live data handling
- Introduced configuration history management in Filters and Recursive Routes pages, allowing users to view and restore previous configurations.
- Updated state management to handle live data loading and error states more effectively, improving user experience during data fetching.
- Added new components for displaying configuration history and integrated them into existing pages.
- Enhanced API interactions to support fetching and applying configuration revisions, ensuring data consistency across the application.
- Updated tests to cover new functionalities and ensure reliability.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 12:15:36 +07:00
DenozordecandCursor 9c0ee7940e feat(bgp, vxlan, ospf): enhance server data handling and introduce new routes
Docker images / publish-release (push) Successful in 10s
Docker images / frontend-image (push) Successful in 2m50s
Docker images / backend-image (push) Successful in 2m40s
Docker images / backend-test (push) Successful in 1m40s
Docker images / updater-image (push) Successful in 42s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 7s
- Added support for fetching and displaying server data in BGP, VXLAN, and OSPF pages, improving the overall user experience.
- Introduced new backend routes for OSPF and VXLAN, allowing for better data management and retrieval.
- Implemented mapping functions for backend server data to frontend types, ensuring consistency across components.
- Enhanced the sidebar to display counts for BGP sessions, VXLAN tunnels, and containers, providing users with quick insights into their network status.
- Updated tests to cover new functionalities and ensure reliability.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:18:04 +07:00
DenozordecandCursor 5750590b68 feat(traffic-flow): add rebuild facts endpoint and enhance traffic flow analytics
Docker images / publish-release (push) Successful in 9s
Docker images / frontend-image (push) Successful in 3m15s
Docker images / backend-image (push) Successful in 2m50s
Docker images / backend-test (push) Successful in 2m6s
Docker images / updater-image (push) Successful in 48s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 9s
- Introduced a new endpoint `/traffic/flow/rebuild-facts` to rebuild flow facts from buckets, improving data accuracy and management.
- Updated traffic flow analytics to utilize the new `resolveInternetDest` function for better destination resolution.
- Enhanced tests for traffic flow IP handling and added new utility functions for managing internet destinations.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 10:32:51 +07:00
DenozordecandCursor 3c42c114f5 refactor(statistics): improve component structure and enhance state management
Docker images / publish-release (push) Successful in 8s
Docker images / frontend-image (push) Successful in 4m11s
Docker images / backend-image (push) Successful in 2m18s
Docker images / backend-test (push) Successful in 2m17s
Docker images / updater-image (push) Successful in 48s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 11s
- Introduced Suspense for lazy loading in StatisticsPage to optimize rendering.
- Refactored StatisticsPage to separate inner logic into StatisticsPageInner for better readability.
- Updated PeriodSelector to utilize useCallback for handling state changes, improving performance and clarity.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 09:38:31 +07:00
DenozordecandCursor 5aef419582 fix(statistics): считать уникальный payload без дублей hops
Docker images / publish-release (push) Successful in 10s
Docker images / frontend-image (push) Successful in 3m13s
Docker images / backend-image (push) Successful in 2m52s
Docker images / backend-test (push) Successful in 2m10s
Docker images / updater-image (push) Successful in 46s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 8s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 01:27:40 +07:00
DenozordecandCursor 0c0dfa1df7 fix(statistics): не двоить overlay и транзит в кубе
Docker images / frontend-image (push) Successful in 3m25s
Docker images / publish-release (push) Successful in 14s
Docker images / updater-image (push) Successful in 48s
Docker images / backend-image (push) Successful in 3m9s
Docker images / backend-test (push) Successful in 2m18s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 8s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 00:46:25 +07:00
DenozordecandCursor c162a41bc0 fix(network-map): подписать unbound-пути парой серверов
Docker images / publish-release (push) Successful in 12s
Docker images / frontend-image (push) Successful in 3m29s
Docker images / backend-image (push) Successful in 2m41s
Docker images / backend-test (push) Successful in 2m22s
Docker images / updater-image (push) Successful in 52s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 7s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 22:19:05 +07:00
DenozordecandCursor 97e43b2335 feat(statistics): enhance interface handling and data aggregation
Docker images / publish-release (push) Successful in 15s
Docker images / frontend-image (push) Successful in 3m24s
Docker images / backend-image (push) Successful in 2m39s
Docker images / backend-test (push) Successful in 2m29s
Docker images / updater-image (push) Successful in 44s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 9s
Updated the statistics aggregation service to improve interface resolution and data handling. Introduced new functions for managing interface aliases and collapsing server interface rows, ensuring accurate data representation. Enhanced test coverage for interface resolution and added checks for new functionality.

- Implemented `factIfaceAliases` and `collapseServerIfaceRows` for better interface data management.
- Updated `resolveIfaceName` to handle additional cases for interface indexing.
- Enhanced tests for interface resolution and aggregation logic.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 21:49:50 +07:00
DenozordecandCursor db21e1217c feat(network-map): enhance service selection logic and UI updates
Docker images / publish-release (push) Successful in 11s
Docker images / frontend-image (push) Successful in 2m52s
Docker images / backend-image (push) Successful in 2m20s
Docker images / updater-image (push) Successful in 46s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 9s
Docker images / backend-test (push) Successful in 2m19s
Refactor the service selection mechanism to utilize a live reference for selected services, ensuring accurate display of service details. Update UI components to reflect changes in service selection, including dynamic updates for service metrics and paths. Additionally, introduce new utility functions for deduplicating flow rows across exporters in the backend, improving data handling in traffic flow analysis.

- Updated service selection logic in NetworkMapPage component.
- Enhanced UI to display live service data.
- Added deduplication functions in traffic-flow-dedup module for improved data integrity.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 19:54:16 +07:00
DenozordecandCursor 5bb9066be8 feat(statistics): добавить BI-разрез и сводную матрицу
Docker images / publish-release (push) Successful in 14s
Docker images / frontend-image (push) Successful in 3m30s
Docker images / backend-image (push) Successful in 3m8s
Docker images / backend-test (push) Successful in 2m23s
Docker images / updater-image (push) Successful in 52s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
Сопоставить клиентов с ifIndex как на карте трафика, чтобы KPI пользователей не обнулялся. На экране — разрез остальных измерений и сводная матрица.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 16:07:25 +07:00
DenozordecandCursor b1fd259f10 fix(statistics): убрать параметры хранения с родительских партиций
Docker images / publish-release (push) Successful in 13s
Docker images / frontend-image (push) Successful in 3m26s
Docker images / backend-image (push) Successful in 2m32s
Docker images / backend-test (push) Successful in 2m25s
Docker images / updater-image (push) Successful in 45s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 9s
PostgreSQL 42809: FILLFACTOR и autovacuum нельзя задавать на partitioned parent — только на листьях.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 13:36:35 +07:00
DenozordecandCursor 3687bb8fa2 feat(statistics): добавить раздел статистики трафика
Docker images / publish-release (push) Successful in 13s
Docker images / frontend-image (push) Successful in 4m47s
Docker images / updater-image (push) Successful in 48s
Docker images / backend-image (push) Successful in 2m53s
Docker images / backend-test (push) Successful in 2m19s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
Куб IPFIX час+день с AND-слайсами и экраном отчётности /statistics, живой /traffic не меняем.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 11:57:47 +07:00
Denozordec a80caf5676 feat(netflow): локальные GeoLite2-базы для стран и ASN потоков
Docker images / publish-release (push) Successful in 15s
Docker images / frontend-image (push) Successful in 4m31s
Docker images / backend-image (push) Successful in 3m1s
Docker images / backend-test (push) Successful in 2m13s
Docker images / updater-image (push) Successful in 48s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 13s
Lookup страны/ASN при ingest теперь идёт сначала по локальным mmdb
MaxMind GeoLite2 (Country + ASN, зеркало P3TERX, без ключей), с
мгновенным синхронным ответом для IPv4/IPv6; RIPEstat остаётся
fallback до первой загрузки баз и при промахе.

- backend/src/services/traffic-flow-geoip.ts: ридеры maxmind, фасад
  resolveFlowIp (geoip-first → RIPE-кэш), статус ридеров
- geoip-update-collector.ts: conditional GET по ETag, валидация пробоем
  8.8.8.8 (US / AS15169), атомарная подмена с .prev-откатом
- джоба планировщика geoip_update (по умолчанию раз в 7 дней),
  настройки geoip_settings + миграция 0004, API /api/geoip
  (GET/PUT/update), контракты @mmapp/contracts/geoip
- engine/analytics/map-hops переведены на resolveFlowIp
- секция «GeoIP-базы» в настройках NetFlow, метки джобы на странице
  сбора данных, тесты test:geoip
2026-09-09 23:33:31 +07:00
DenozordecandCursor d39e3454aa feat(network-map): показывать ASN-бренды по доле среди сервисов
Docker images / publish-release (push) Successful in 15s
Docker images / frontend-image (push) Successful in 3m15s
Docker images / backend-image (push) Successful in 2m44s
Docker images / updater-image (push) Successful in 48s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 11s
Docker images / backend-test (push) Successful in 2m5s
Долю считать среди именованных брендов, а не от всего окна. На карте всегда оставлять топ-8 и добавить иконки новых брендов.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:53:06 +07:00
DenozordecandCursor a8f2055c77 feat(netflow): расширить каталог ASN популярных сервисов
Docker images / publish-release (push) Successful in 11s
Docker images / frontend-image (push) Successful in 3m14s
Docker images / backend-image (push) Successful in 4m2s
Docker images / backend-test (push) Successful in 2m5s
Docker images / updater-image (push) Successful in 46s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 11s
В аналитике потока видны сети со своим AS (Apple, Steam, VK, Epic и другие), а не только Cloudflare/AWS. Holder и порты Steam не перебивают Cloudflare CIDR.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 13:18:58 +07:00
DenozordecandCursor cdeb97d841 feat(certificates): добавить отключение автообновления на странице сертификатов
Docker images / publish-release (push) Successful in 15s
Docker images / frontend-image (push) Successful in 3m19s
Docker images / backend-image (push) Successful in 2m45s
Docker images / updater-image (push) Successful in 49s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
Docker images / backend-test (push) Successful in 2m7s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:21:50 +07:00
DenozordecandCursor 36c5305db7 feat(dashboard): собрать ops-дашборд на ReUI Frame с живыми данными
Docker images / publish-release (push) Successful in 14s
Docker images / frontend-image (push) Successful in 3m14s
Docker images / updater-image (push) Successful in 47s
Docker images / backend-image (push) Successful in 2m44s
Docker images / backend-test (push) Successful in 2m13s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 15:13:27 +07:00
Denozordec 5f2b4e2d40 feat(backups): replace button with checkbox for server selection in backup settings
Docker images / publish-release (push) Successful in 10s
Docker images / frontend-image (push) Successful in 3m10s
Docker images / backend-image (push) Successful in 2m29s
Docker images / backend-test (push) Successful in 2m4s
Docker images / updater-image (push) Successful in 42s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 11s
Updated the BackupCreateSheet and BackupsSettings components to use checkboxes for selecting servers instead of buttons. This improves user interaction by allowing for easier selection and toggling of server states. The Checkbox component is now integrated for better accessibility and functionality.
2026-09-08 14:47:44 +07:00
DenozordecandCursor cff26813b9 feat(backups): добавить S3-хранилище и обновить экран бэкапов
Docker images / publish-release (push) Successful in 16s
Docker images / frontend-image (push) Successful in 4m37s
Docker images / backend-image (push) Successful in 3m6s
Docker images / updater-image (push) Successful in 46s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 9s
Docker images / backend-test (push) Successful in 2m18s
Сохранять снимки в S3-compatible бакет, скачивать и удалять их вместе с локальными файлами.
Привести /backups к DNA /servers: Frame, KPI, фильтры и реальное восстановление.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:06:27 +07:00
DenozordecandCursor 39c8ec4a02 fix(netflow): починить live-аналитику и снизить запись в PostgreSQL
Docker images / publish-release (push) Successful in 10s
Docker images / frontend-image (push) Successful in 3m20s
Docker images / updater-image (push) Successful in 49s
Docker images / backend-image (push) Successful in 2m44s
Docker images / backend-test (push) Successful in 2m9s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 11s
Коллектор снова отдаёт назначения в живом потоке. Ошибки записи видны в статусе, лишние перезаписи минутных агрегатов убраны.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 12:46:37 +07:00
DenozordecandCursor c6c859a495 perf(db): сжать схему PostgreSQL 18 и повторно загрузить SQLite
Docker images / publish-release (push) Successful in 11s
Docker images / frontend-image (push) Successful in 3m23s
Docker images / backend-image (push) Successful in 2m47s
Docker images / updater-image (push) Successful in 44s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
Docker images / backend-test (push) Successful in 2m2s
При первом рестарте wipe всех таблиц и импорт из SQLite в компактную схему. Retention через DROP PARTITION, lz4 и AIO worker.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:54:36 +07:00
DenozordecandCursor bf5cfff12c ci(backend): убрать конфликт контейнера PostgreSQL в тестах
Docker images / publish-release (push) Successful in 13s
Docker images / frontend-image (push) Successful in 3m16s
Docker images / backend-image (push) Successful in 3m0s
Docker images / backend-test (push) Successful in 2m4s
Docker images / updater-image (push) Successful in 46s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 9s
На общем Docker-раннере имя mm-pg и порт 5432 сталкивались с прошлым запуском. Контейнер и порт теперь уникальны, старый mm-pg снимается.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:34:29 +07:00
DenozordecandCursor 30a8ec4420 fix(db): исправить импорт jsonb из sqlite
Docker images / publish-release (push) Skipped
Docker images / backend-image (push) Skipped
Docker images / frontend-image (push) Successful in 3m14s
Docker images / updater-image (push) Successful in 47s
Docker images / backend-test (push) Failing after 12s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 11s
JSON-колонки передаются строкой с приведением ::jsonb, иначе node-pg кодирует массивы как PostgreSQL array и ETL падает. Повтор импорта идёт, пока нет маркера. Том PG18 монтируется в /var/lib/postgresql.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:28:03 +07:00
DenozordecandCursor ec43591a99 feat(db): перевести хранилище с SQLite на PostgreSQL
Docker images / publish-release (push) Successful in 11s
Docker images / frontend-image (push) Successful in 4m28s
Docker images / backend-image (push) Successful in 2m49s
Docker images / updater-image (push) Successful in 58s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 12s
Docker images / backend-test (push) Successful in 4m9s
При старте backend накатывает схему PostgreSQL 18 и, если база пустая, один раз импортирует mikrotik.db с тома. Повторный старт не копирует данные. Бэкап в UI идёт через pg_dump.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 01:36:48 +07:00
DenozordecandCursor 0e5fb065e2 fix(backend): уменьшить лишние записи SQLite
Docker images / frontend-image (push) Successful in 3m14s
Docker images / publish-release (push) Successful in 12s
Docker images / backend-image (push) Successful in 2m8s
Docker images / updater-image (push) Successful in 47s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 10s
Убрать WAL TRUNCATE с hot path NetFlow, не писать неизменённые UPDATE
и служебные INSERT, кэшировать карты topology/analytics.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 20:22:20 +07:00
DenozordecandCursor 5188b2aff2 fix(network-map): обрезать пунктир до сервиса и показать пути клиентов
Docker images / publish-release (push) Successful in 13s
Docker images / backend-image (push) Successful in 1m58s
Docker images / frontend-image (push) Successful in 3m17s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 49s
Docker images / prepare-release (push) Successful in 8s
Линия от обода EN до рамки сервиса; таблица клиент, узел и сервис с подсветкой на карте.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:39:18 +07:00
DenozordecandCursor cd1fd2c9d3 fix(network-map): рисовать пунктир и скорость до сервиса
Docker images / publish-release (push) Successful in 9s
Docker images / backend-image (push) Successful in 1m41s
Docker images / frontend-image (push) Successful in 2m55s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 43s
Docker images / prepare-release (push) Successful in 8s
Якорь hop на EN даже без nextHop; линия ARN\to Google с NetflowRateBadge.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:02:28 +07:00
DenozordecandCursor 77425cca32 fix(network-map): якорить сервисы на выходную ноду
Docker images / publish-release (push) Successful in 16s
Docker images / backend-image (push) Successful in 1m46s
Docker images / frontend-image (push) Successful in 2m56s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 45s
Docker images / prepare-release (push) Successful in 8s
Пунктир от EN, а не от JH; перетаскивание узлов сервисов; иконка Google без foreignObject.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:10:39 +07:00
DenozordecandCursor 29d245cde3 feat(traffic): enhance flow analytics and brand classification
Docker images / publish-release (push) Successful in 12s
Docker images / backend-image (push) Successful in 2m12s
Docker images / frontend-image (push) Successful in 4m3s
Docker images / updater-image (push) Successful in 48s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 11s
- Introduced `pickInternetPeer` function to improve IP classification by selecting the appropriate public IP from source and destination.
- Updated `buildFlowAnalytics` and related functions to utilize the new peer selection logic, enhancing accuracy in flow analytics.
- Added tests for new classifications and ensured existing tests cover new scenarios for Google and Cloudflare.
- Refactored traffic flow brand mappings to include additional CIDR ranges for Google and Cloudflare.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:35:52 +07:00
DenozordecandCursor 7a491a325d fix(network-map): убрать тяжёлую классификацию из poll карты
Docker images / publish-release (push) Successful in 12s
Docker images / backend-image (push) Successful in 1m53s
Docker images / frontend-image (push) Successful in 3m11s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 49s
Docker images / prepare-release (push) Successful in 9s
Не сканировать RIPE и каталог по каждой строке окна; сервисы по уникальным dst и кэшу ASN. Порог доли на карте настраиваемый и отключаемый.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 14:17:04 +07:00
DenozordecandCursor db64621122 feat(network-map): показать конечные сервисы на карте сети
Docker images / publish-release (push) Successful in 12s
Docker images / backend-image (push) Successful in 2m0s
Docker images / frontend-image (push) Successful in 3m15s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 45s
Docker images / prepare-release (push) Successful in 9s
NetFlow ≥ 5% окна, узлы с логотипом бренда справа от EN, скорость потока на рёбрах к сервисам.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 13:30:45 +07:00
DenozordecandCursor 6332d83a12 feat(traffic): показать поток NetFlow на карте сети
Docker images / publish-release (push) Successful in 11s
Docker images / backend-image (push) Successful in 2m14s
Docker images / frontend-image (push) Successful in 3m14s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 46s
Docker images / prepare-release (push) Successful in 10s
Скорость между узлами считается как в Трафике (5 мин, без overlay/mesh), отдельно от ёмкости WAN и BT.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 12:37:47 +07:00
DenozordecandCursor 3834c40aa8 fix(traffic): починить сборку tsc для частичных IPFIX-фикстур
Docker images / publish-release (push) Successful in 11s
Docker images / backend-image (push) Successful in 1m50s
Docker images / frontend-image (push) Successful in 3m15s
Docker images / updater-image (push) Successful in 47s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 6s
Тесты не должны попадать в Docker tsc; ingest принимает ParsedFlowInput и нормализует поля.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 11:45:22 +07:00
DenozordecandCursor 90c8c393e5 feat(traffic): разделить плоскости IPFIX и показать путь JH→EN
Docker images / publish-release (push) Skipped
Docker images / backend-image (push) Failing after 1m31s
Docker images / frontend-image (push) Successful in 2m36s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 42s
Docker images / prepare-release (push) Successful in 8s
Считать payload отдельно от overlay GRE/ESP и mesh; вкладка Пути и KPI Wire из счётчиков iface.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 11:39:14 +07:00
DenozordecandCursor cb799da13a fix(netflow): изолировать коллектор IPFIX и срезать раздувание базы
Docker images / publish-release (push) Successful in 12s
Docker images / backend-image (push) Successful in 2m23s
Docker images / frontend-image (push) Successful in 3m16s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 57s
Docker images / prepare-release (push) Successful in 8s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 09:50:24 +07:00
DenozordecandCursor e0ddb17539 feat(traffic): классифицировать потоки по брендам и разгрузить ingest
Docker images / publish-release (push) Successful in 8s
Docker images / backend-image (push) Successful in 1m48s
Docker images / frontend-image (push) Successful in 2m53s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 41s
Docker images / prepare-release (push) Successful in 12s
Починить ISO-страну Cloudflare, не держать holder как сервис, клик по срезу открывает Сессии. Не вызывать REST /interface с UDP, flush SQLite пачкой — uptime не должен ловить timeout 10s.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 03:01:14 +07:00
DenozordecandCursor 2820683cba feat(traffic): добавить карту и срезы IPFIX по странам и сессиям
Docker images / publish-release (push) Successful in 14s
Docker images / backend-image (push) Successful in 2m6s
Docker images / frontend-image (push) Successful in 3m23s
Docker images / updater-image (push) Successful in 49s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 11s
Имена ifIndex пишутся по обоим ключам REST, дедуп 5-tuple по max байт, RIPEstat только из prefix-кэша, карта откуда-куда в Frame.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 02:13:21 +07:00
DenozordecandCursor 37167f78e3 feat(traffic): показать аналитику IPFIX по серверам и интерфейсам
Docker images / publish-release (push) Successful in 11s
Docker images / backend-image (push) Successful in 2m10s
Docker images / frontend-image (push) Successful in 2m53s
Docker images / updater-image (push) Successful in 48s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 12s
Резолвить ifIndex в имена RouterOS, дать вкладке Потоки ту же оболочку сервер/клиент/iface, что у обычного трафика, и обновлять срезы live без перезагрузки.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 01:21:12 +07:00
DenozordecandCursor cf68b59b3f fix(traffic): сбрасывать src-address Traffic Flow в авто
Docker images / publish-release (push) Successful in 12s
Docker images / backend-image (push) Successful in 2m2s
Docker images / frontend-image (push) Successful in 3m11s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 47s
Docker images / prepare-release (push) Successful in 11s
Target с адресом wg-flow помечался invalid, IPFIX не уходил на коллектор.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 00:37:12 +07:00
DenozordecandCursor 5e512407e5 fix(traffic): записывать потоки при подмене UDP-источника в Docker
Docker images / publish-release (push) Successful in 11s
Docker images / backend-image (push) Successful in 2m11s
Docker images / frontend-image (push) Successful in 2m57s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 46s
Docker images / prepare-release (push) Successful in 11s
Пакеты IPFIX доходили, но разговоры отбрасывались, если Docker подменял адрес jump-host на 172.x.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 00:02:50 +07:00
DenozordecandCursor 13889005f8 refactor(traffic): update traffic flow host file generation and configuration scripts
Docker images / frontend-image (push) Successful in 3m2s
Docker images / publish-release (push) Successful in 9s
Docker images / backend-image (push) Successful in 1m39s
Docker images / updater-image (push) Successful in 43s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 6s
- Renamed and refactored functions for better clarity, including `buildHostComposeSnippet` to `buildHostComposeOverride` and `buildHostNftSnippet` to `buildHostLinuxInstallSh`.
- Introduced a new script for Linux installation of WireGuard, enhancing the setup process for Docker hosts.
- Updated the `generateNativeConf` function to conditionally include the listen port in the configuration.
- Adjusted the `FlowOverlaySheet` component to default to the new Linux tab and improved the user interface for selecting jump-hosts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 23:20:12 +07:00
DenozordecandCursor f0dc5acfd3 fix(traffic): сделать JH сервером WG и патчить traffic-flow по id
Docker images / publish-release (push) Successful in 9s
Docker images / backend-image (push) Successful in 1m43s
Docker images / frontend-image (push) Successful in 2m52s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 45s
Docker images / prepare-release (push) Successful in 11s
RouterOS не принимает PATCH без .id у singleton. Пир на jump-host без endpoint: клиент — хост MM с Endpoint JH:13232.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 22:58:31 +07:00
DenozordecandCursor 63bed28251 fix(ci): импортировать TrafficFlowHostFile в клиенте overlay
Docker images / publish-release (push) Successful in 16s
Docker images / backend-image (push) Successful in 56s
Docker images / frontend-image (push) Successful in 3m6s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 49s
Docker images / prepare-release (push) Successful in 11s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 22:24:44 +07:00
DenozordecandCursor 95dcd3df58 fix(traffic): спрашивать endpoint MM в sheet подключения JH
Docker images / publish-release (push) Skipped
Docker images / backend-image (push) Successful in 1m31s
Docker images / frontend-image (push) Failing after 2m38s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 46s
Docker images / prepare-release (push) Successful in 6s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 22:16:41 +07:00
DenozordecandCursor 1e9312acbd feat(traffic): добавить приём Traffic Flow с jump-host
Docker images / publish-release (push) Successful in 12s
Docker images / backend-image (push) Successful in 2m1s
Docker images / frontend-image (push) Successful in 3m56s
Docker images / updater-image (push) Successful in 46s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 8s
Чтобы видеть «кто с кем», а не только объём порта: IPFIX внутри WG на хосте Docker MM, REST-счётчики не трогаем.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 21:54:30 +07:00
Denozordec 5884bd8873 feat(traffic, users): enhance interface and peer management features
Docker images / publish-release (push) Successful in 10s
Docker images / backend-image (push) Successful in 1m37s
Docker images / frontend-image (push) Successful in 2m44s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 40s
Docker images / prepare-release (push) Successful in 7s
Added support for managing peer information in interface bindings, including new fields for peerPublicKey and peerName in the BoundIfaceTraffic interface. Updated the database schema to include these fields in user_interface_bindings and traffic_samples tables. Enhanced the UI components to display peer details alongside interface names, improving user experience and clarity in the traffic management system. Updated relevant functions and services to handle peer-specific logic, ensuring robust integration across the application.
2026-09-06 20:45:37 +07:00
Denozordec fc161506e7 feat(users): enhance interface type mapping and parsing logic
Docker images / publish-release (push) Successful in 8s
Docker images / backend-image (push) Successful in 1m30s
Docker images / frontend-image (push) Successful in 2m11s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 40s
Docker images / prepare-release (push) Successful in 6s
Updated the mapRosInterfaceType function to support additional interface types, including "gre-tunnel" and improved handling for various input formats. Enhanced the parseRawInterfaces function to accommodate new interface types in the test cases, ensuring accurate parsing and type assignment. Added corresponding test cases to validate the new functionality and ensure robustness in interface type handling.
2026-09-06 19:35:01 +07:00
Denozordec b3e50a1f5f feat(users): implement user management features and database schema
Docker images / publish-release (push) Successful in 11s
Docker images / backend-image (push) Successful in 1m57s
Docker images / frontend-image (push) Successful in 4m8s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 44s
Docker images / prepare-release (push) Successful in 10s
Added user management functionality, including the creation of app_users and user_interface_bindings tables in the database. Implemented API routes for user data retrieval and permissions handling. Enhanced the traffic monitoring system to include user traffic statistics and interface bindings. Updated relevant components and services to support the new user features, improving overall application functionality and user experience.
2026-09-06 19:20:05 +07:00
Denozordec fe32c9313a feat(ui): integrate KpiStatGrid for enhanced statistics display
Docker images / publish-release (push) Successful in 8s
Docker images / backend-image (push) Successful in 1m43s
Docker images / frontend-image (push) Successful in 2m58s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 39s
Docker images / prepare-release (push) Successful in 9s
Replaced existing KPI display implementations across multiple pages with the new KpiStatGrid component for a more consistent and visually appealing presentation of statistics. Updated the Backups, BGP, Certificates, Communities, Containers, Dashboard, and Data Collection pages to utilize the KpiStatGrid, improving the overall user experience and maintainability of the codebase. Additionally, added new dependencies in package.json for required libraries.
2026-09-06 17:58:05 +07:00
Denozordec 6123660346 feat(terminal, wireguard): enhance UI components and functionality
Docker images / publish-release (push) Successful in 10s
Docker images / backend-image (push) Successful in 1m36s
Docker images / frontend-image (push) Successful in 2m45s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 43s
Docker images / prepare-release (push) Successful in 7s
Updated the TerminalPage to include a new ServerTileRail for server selection and added QuickCmds for quick command execution. Enhanced the WireGuardPage with new tabs for interface and peer management, improved server selection handling, and added support for displaying peer details. Refactored data grids to support compact server views and improved empty state handling. Introduced new hooks for managing server states and improved user experience across components.
2026-09-06 01:23:40 +07:00
Denozordec b680f882cc feat(ui): enhance CodeExportSheet and WgExportSheet components
Docker images / publish-release (push) Successful in 8s
Docker images / backend-image (push) Successful in 1m40s
Docker images / frontend-image (push) Successful in 2m47s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 38s
Docker images / prepare-release (push) Successful in 9s
Updated CodeExportSheet to improve UI elements, including the addition of a Badge component for live status indication and refined layout adjustments. Modified WgExportSheet to simplify format labels and incorporate live content fetching capabilities. Adjusted styles for better visual consistency and user experience.
2026-09-06 00:23:51 +07:00
DenozordecandCursor 5e0c16e808 fix(ui): выровнять confirms и токены под ReUI PRO
Docker images / publish-release (push) Successful in 10s
Docker images / backend-image (push) Successful in 1m31s
Docker images / frontend-image (push) Successful in 2m11s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 40s
Docker images / prepare-release (push) Successful in 8s
Добавить ui-design-contract, AlertDialog вместо hand-roll, CodeExportSheet для preview фильтров, ReUI Badge и gap вместо space-y.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 00:12:57 +07:00
DenozordecandCursor 66509b26bd fix(ui): выровнять экспорт WireGuard под ReUI Frame
Убрать дубль копирования, вынести CodeExportSheet и семантические токены.
Открывать вкладку Peer при экспорте пира. Мигрировать VXLAN/Firewall/Containers/GRE.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 00:12:50 +07:00
Denozordec 15ad53af1f feat(wireguard): implement WireGuard interface management and permissions
Docker images / frontend-image (push) Successful in 2m56s
Docker images / publish-release (push) Successful in 10s
Docker images / backend-image (push) Successful in 1m39s
Docker images / updater-image (push) Successful in 53s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 8s
Added comprehensive support for managing WireGuard interfaces, including CRUD operations and peer management. Updated permissions to include access control for WireGuard routes. Enhanced the UI components to display and interact with WireGuard configurations, improving user experience and functionality. Introduced new tests for WireGuard-related functionalities to ensure reliability.
2026-09-05 02:10:55 +07:00
Denozordec 883842636b refactor(api): streamline API requests with requestJson and requestBlob functions
Docker images / publish-release (push) Successful in 7s
Docker images / backend-image (push) Successful in 1m24s
Docker images / frontend-image (push) Successful in 2m6s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 43s
Docker images / prepare-release (push) Successful in 6s
Replaced direct fetch calls with requestJson and requestBlob utility functions across multiple components for improved consistency and error handling. This change enhances the maintainability of the codebase by centralizing API request logic and ensuring uniform handling of authentication and response parsing.
2026-09-05 01:42:44 +07:00
Denozordec b9f430de16 refactor(acme-cloudflare): enhance upsertARecord and syncCertificateDomainRecords functions
Docker images / publish-release (push) Successful in 8s
Docker images / backend-image (push) Successful in 1m32s
Docker images / frontend-image (push) Successful in 2m21s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 41s
Docker images / prepare-release (push) Successful in 8s
Updated the upsertARecord function to return status messages ("updated", "created", "skipped_cname") instead of void, improving clarity on record handling. Modified syncCertificateDomainRecords to collect and return skipped CNAME records, enhancing error handling and feedback during DNS operations.
2026-09-05 01:29:58 +07:00
Denozordec 25e040a5dd fix(settings): improve error handling and success notifications in EvoBGP settings
Docker images / publish-release (push) Successful in 8s
Docker images / backend-image (push) Successful in 1m26s
Docker images / frontend-image (push) Successful in 2m26s
Docker images / updater-image (push) Successful in 41s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 7s
Enhanced the error handling in the settings page by introducing a dedicated error message function. Added success and error toast notifications for better user feedback during settings save operations. Updated API key normalization to ensure consistent handling across the application.
2026-09-05 00:07:58 +07:00
Denozordec f2df990746 chore(docker): enhance Dockerfile for backend to manage nested dependencies
Docker images / publish-release (push) Successful in 9s
Docker images / backend-image (push) Successful in 1m23s
Docker images / frontend-image (push) Successful in 2m12s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 42s
Docker images / prepare-release (push) Successful in 5s
Updated the Dockerfile to create a directory for nested workspace dependencies and adjusted the copy commands to ensure proper handling of node_modules during the build process.
2026-09-04 23:48:03 +07:00
Denozordec 77bc174e43 chore(deps): update package-lock.json and backend dependencies, adjust Dockerfile for leaner backend image
Docker images / publish-release (push) Successful in 6s
Docker images / backend-image (push) Successful in 1m46s
Docker images / frontend-image (push) Successful in 2m35s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 38s
Docker images / prepare-release (push) Successful in 7s
Removed unnecessary frontend dependencies from backend Docker image and updated package-lock.json to include new dev dependencies. Adjusted backend Dockerfile to streamline the build process and ensure proper workspace configuration.
2026-09-04 23:37:23 +07:00
DenozordecandCursor 0e9349e508 feat(auth): интегрировать SSO auth-portal
Docker images / frontend-image (push) Successful in 2m23s
Docker images / publish-release (push) Successful in 8s
Docker images / backend-image (push) Successful in 2m52s
Docker images / updater-image (push) Successful in 38s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 5s
JWT на backend, handoff/callback на UI, RBAC mm:*, AUTH_* в compose.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 20:38:28 +07:00
DenozordecandCursor 0208aa4d7c chore(deploy): добавить Traefik-стеки и общий compose с CDNManager
Docker images / frontend-image (push) Successful in 2m1s
Docker images / publish-release (push) Successful in 6s
Docker images / backend-image (push) Successful in 3m23s
Docker images / updater-image (push) Successful in 38s
Docker images / notify-webhook (push) Skipped
Docker images / prepare-release (push) Successful in 5s
Единый стек CDN+MM, вариант рядом с CDN Traefik и CLI-скрипт запуска.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 19:07:49 +07:00
Denozordec 42a2e18047 docs: обновить раздел о прод-развёртывании Docker и изменить ссылки на репозиторий
Docker images / publish-release (push) Skipped
Docker images / backend-image (push) Failing after 1m30s
Docker images / frontend-image (push) Successful in 3m45s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 50s
Docker images / prepare-release (push) Successful in 23s
2026-09-04 18:54:26 +07:00
DenozordecandCursor 9df3971f6c chore(reui): обновить ReUI agent skill до актуальной версии
Docker images / publish-release (push) Successful in 6s
Docker images / backend-image (push) Successful in 5m58s
Docker images / frontend-image (push) Successful in 2m55s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 53s
Docker images / prepare-release (push) Successful in 4s
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-19 20:03:55 +07:00
DenozordecandCursor 7ed269cf2c ci: переключить registry на git.shx.one
Docker images / publish-release (push) Successful in 6s
Docker images / backend-image (push) Successful in 4m25s
Docker images / frontend-image (push) Successful in 2m10s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 45s
Docker images / prepare-release (push) Successful in 6s
Обновить Gitea Actions, compose, updater и ссылки на образы.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 16:43:40 +07:00
Denozordec 7f81c304ae fix(config): добавить ключ лицензии REUI в настройки локальной конфигурации
Docker images / publish-release (push) Skipped
Docker images / backend-image (push) Failing after 2m40s
Docker images / frontend-image (push) Successful in 1m49s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 42s
Docker images / prepare-release (push) Successful in 5s
2026-08-17 15:42:10 +07:00
DenozordecandCursor 5f29cfaf0f fix(ui): выровнять chrome Frame и убрать Card-оболочки
Docker images / publish-release (push) Skipped
Docker images / backend-image (push) Failing after 2m36s
Docker images / frontend-image (push) Successful in 2m22s
Docker images / notify-webhook (push) Skipped
Docker images / updater-image (push) Successful in 55s
Docker images / prepare-release (push) Successful in 4s
Подключить App Switcher, NavUser, OpsPanel и AlertDialog вместо Card-shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-17 15:36:56 +07:00
Denozordec d2de8d3188 fix(ui): улучшить функциональность панели данных и заменить устаревшие компоненты
Docker images / backend-image (push) Successful in 2m1s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 8s
Docker images / prepare-release (push) Successful in 7s
Docker images / frontend-image (push) Successful in 2m7s
Docker images / updater-image (push) Successful in 41s
2026-06-30 22:36:00 +07:00
Denozordec d3a2d38b37 fix(ui): заменить таблицы на карточки данных и улучшить функциональность поиска
Docker images / backend-image (push) Successful in 1m37s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 7s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 1m50s
Docker images / updater-image (push) Successful in 44s
2026-06-30 22:22:51 +07:00
Denozordec a1a9124f3d fix(config): добавить новые зависимости и обновить конфигурацию компонентов
Docker images / backend-image (push) Successful in 2m37s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 8s
Docker images / prepare-release (push) Successful in 5s
Docker images / frontend-image (push) Successful in 2m22s
Docker images / updater-image (push) Successful in 38s
2026-06-30 21:30:40 +07:00
Denozordec 009011a917 chore(docs): обновить инструкции по локальному запуску проекта
Docker images / backend-image (push) Successful in 3m42s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 8s
Docker images / prepare-release (push) Successful in 7s
Docker images / frontend-image (push) Successful in 2m40s
Docker images / updater-image (push) Successful in 53s
2026-06-30 20:07:20 +07:00
Denozordec 399871f4f9 fix(config): улучшить обработку URL для бэкенда и увеличить таймаут запросов
Docker images / backend-image (push) Successful in 1m36s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 8s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 1m39s
Docker images / updater-image (push) Successful in 50s
2026-05-12 23:19:51 +07:00
Denozordec 158fc36294 fix(api): увеличить лимит размера тела запроса и улучшить обработку URL для API
Docker images / backend-image (push) Successful in 1m36s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 1m40s
Docker images / updater-image (push) Successful in 38s
2026-05-12 23:11:23 +07:00
Denozordec 7dc4836c71 fix(dashboard): улучшить логику загрузки данных на странице панели управления
Docker images / backend-image (push) Successful in 1m43s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 7s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 1m47s
Docker images / updater-image (push) Successful in 54s
2026-05-12 22:47:30 +07:00
Denozordec efc3812e12 fix(updater): обновить URL для проверки состояния сервиса 2026-05-12 22:46:16 +07:00
Denozordec 8d5fd84962 fix(data-collection): добавить возможность отключения переключателей и улучшить обработку настроек
Docker images / backend-image (push) Successful in 1m31s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 7s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 1m41s
Docker images / updater-image (push) Successful in 37s
2026-05-12 22:37:55 +07:00
Denozordec f69e65b014 fix(docker): добавить переменную окружения для внутреннего URL бэкенда
Docker images / backend-image (push) Successful in 1m34s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 1m38s
Docker images / updater-image (push) Successful in 37s
2026-05-12 22:21:57 +07:00
Denozordec 49d14a00af fix(data-collection): улучшить обработку ошибок и загрузку данных с API
Docker images / backend-image (push) Successful in 1m32s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 7s
Docker images / prepare-release (push) Successful in 5s
Docker images / frontend-image (push) Successful in 1m41s
Docker images / updater-image (push) Successful in 37s
2026-05-12 22:11:49 +07:00
Denozordec 9ab2418a5f feat(backup): добавить таблицу для резервных копий и функции для работы с ними
Docker images / backend-image (push) Successful in 1m35s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 1m42s
Docker images / updater-image (push) Successful in 37s
2026-05-12 21:56:13 +07:00
Denozordec 63aa9d424b chore(backups): удалить устаревшие резервные копии Gateway
Docker images / backend-image (push) Successful in 1m32s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 7s
Docker images / frontend-image (push) Successful in 1m38s
Docker images / updater-image (push) Successful in 37s
2026-05-12 21:55:41 +07:00
Denozordec 43ab17b253 feat(scheduler): добавить расписание бэкапов и автообновление сертификатов
Docker images / backend-image (push) Successful in 2m13s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 8s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 2m11s
Docker images / updater-image (push) Successful in 50s
2026-05-12 21:46:11 +07:00
Denozordec 4b8cf83ee9 fix(backend): улучшить управление блокировками и очистку устаревших директорий
Docker images / backend-image (push) Successful in 1m34s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 7s
Docker images / prepare-release (push) Successful in 5s
Docker images / frontend-image (push) Successful in 1m41s
Docker images / updater-image (push) Successful in 45s
2026-05-12 21:28:08 +07:00
Denozordec cdaf3deb03 chore(release): обновить заметки о релизе и манифест для версии 1.3.4
Docker images / backend-image (push) Successful in 2m30s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 2m7s
Docker images / updater-image (push) Successful in 38s
2026-05-12 20:51:21 +07:00
Denozordec 3ce4179f3c chore(package): обновить зависимости и добавить поддержку swc для Windows 2026-05-12 20:48:45 +07:00
Denozordec 1a47905beb fix(backend): улучшить обработку сертификатов и добавить поддержку цепочек сертификатов 2026-05-12 20:43:34 +07:00
Denozordec b51d979a1c fix(backend): улучшить обработку хранилищ доверия для сертификатов 2026-05-12 20:40:56 +07:00
Denozordec bc01da1708 fix(backend): добавить функции для работы с IP-адресами и DNS-записями 2026-05-12 20:35:07 +07:00
Denozordec 500a543045 fix(backend): улучшить уникальность идентификаторов сертификатов 2026-05-12 20:29:57 +07:00
Denozordec 60024facab fix(backend): улучшить обработку сертификатов и добавить поддержку PUT запросов 2026-05-12 20:29:06 +07:00
Denozordec 53ea0e74a3 fix(ui): добавить новые компоненты для управления сертификатами 2026-05-12 20:11:22 +07:00
Denozordec 6c8ca17590 fix(ui): улучшить отображение таблицы сертификатов и добавить классы для сетки 2026-05-12 20:04:44 +07:00
Denozordec d62d212c86 chore(backend): добавить поддержку ACME и управление сертификатами 2026-05-12 20:00:25 +07:00
Denozordec bfceb07a23 fix(ui): убрать проверку статуса бэкенда из компонентов
Docker images / backend-image (push) Successful in 1m32s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 5s
Docker images / frontend-image (push) Successful in 1m39s
Docker images / updater-image (push) Successful in 37s
2026-05-12 18:58:38 +07:00
Denozordec e7a8ad0910 chore(rules): добавить локальный hook для проверки сообщений коммитов
Docker images / backend-image (push) Successful in 2m36s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 5s
Docker images / frontend-image (push) Successful in 2m25s
Docker images / updater-image (push) Successful in 37s
2026-05-12 18:18:30 +07:00
Denozordec 0435608ef9 chore: обновить правила коммитов и улучшить форматирование релизных заметок
Docker images / backend-image (push) Successful in 1m33s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 5s
Docker images / frontend-image (push) Successful in 1m39s
Docker images / updater-image (push) Successful in 37s
- Уточнены правила формирования сообщений коммитов, включая использование русского языка и уточнение типов изменений (fix/chore/feat).
- Добавлена функция для форматирования заголовков коммитов в компоненте модалки релизов, улучшая читаемость.
- Обновлены ссылки на правила коммитов в документации для большей ясности.
2026-05-12 18:06:29 +07:00
Denozordec c2a8a08618 feat: обновить название проекта и улучшить документацию
Docker images / backend-image (push) Successful in 1m32s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 5s
Docker images / frontend-image (push) Successful in 1m37s
Docker images / updater-image (push) Successful in 38s
- Изменено название проекта с "RouterLists" на "MikrotikManager" во всех соответствующих файлах и компонентах.
- Обновлены ссылки и комментарии в документации, чтобы отразить новое название и улучшить ясность.
- Внесены изменения в правила коммитов, чтобы обеспечить использование русского языка в сообщениях коммитов.
2026-05-12 17:53:53 +07:00
Denozordec 35876fcd6f feat: update Dockerfile and release management scripts
Docker images / backend-image (push) Successful in 1m45s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 1m37s
Docker images / updater-image (push) Successful in 37s
- Replaced the public directory creation step with a direct copy in the Dockerfile for improved build efficiency.
- Enhanced the compute-release script to retrieve all tags and manage release manifests more effectively, including better handling of published timestamps and commit details.
- Updated the ReleasesPage component to conditionally format the published date based on the build type, improving user clarity on release status.
2026-05-12 17:39:50 +07:00
Denozordec 7207d1b749 feat: update release notes and manifest for v1.1.0
Docker images / backend-image (push) Successful in 2m34s
Docker images / notify-webhook (push) Has been skipped
Docker images / publish-release (push) Successful in 6s
Docker images / prepare-release (push) Successful in 6s
Docker images / frontend-image (push) Successful in 2m8s
Docker images / updater-image (push) Successful in 37s
- Added release notes for version 1.1.0, highlighting enhancements and refactoring.
- Updated release manifest with new published timestamp and commit details for the latest release.
- Modified compute-release script to allow dynamic output directory configuration, improving flexibility in release management.
2026-05-12 17:30:25 +07:00
Denozordec 4b92a6eb81 feat: release v1.1.0 with enhancements and refactoring
Docker images / backend-image (push) Has been skipped
Docker images / publish-release (push) Has been skipped
Docker images / notify-webhook (push) Has been skipped
Docker images / prepare-release (push) Failing after 7s
Docker images / frontend-image (push) Has been skipped
Docker images / updater-image (push) Has been skipped
- Updated application version to 1.1.0, reflecting new features and improvements.
- Enhanced release management by allowing Docker images to be built even when no new commits are present since the last tag.
- Implemented new features including database backup and restore functionality, improved network configuration handling, and enhanced UI feedback with toast notifications.
- Refactored code to replace custom API fetch logic with a utility function for better maintainability.
- Streamlined Docker workflows and improved build efficiency through various configuration updates.
2026-05-12 17:28:13 +07:00
Denozordec 9ccc8459d7 feat: update application versioning and enhance release management
Docker images / backend-image (push) Has been skipped
Docker images / publish-release (push) Has been skipped
Docker images / notify-webhook (push) Has been skipped
Docker images / prepare-release (push) Successful in 38s
Docker images / frontend-image (push) Has been skipped
Docker images / updater-image (push) Has been skipped
- Bumped application version to 1.0.0 across all relevant package files, ensuring consistency in versioning.
- Introduced new environment variables for application version and release URL in Dockerfiles, improving deployment transparency.
- Enhanced the health check endpoint to return the current application version, providing better visibility for monitoring.
- Updated CI/CD workflows to include steps for preparing and publishing releases, streamlining the release process.
- Added a new "Releases" section in the application sidebar for easier access to version information.
2026-05-12 17:19:20 +07:00
Denozordec f282585b52 feat: enhance network configuration handling in updater script
Docker images / backend-image (push) Successful in 39s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 40s
Docker images / updater-image (push) Successful in 45s
- Improved network mode handling by introducing a variable for network names, allowing for better management of custom networks.
- Added support for network aliases, enabling the specification of multiple aliases for a given network in the snapshot.
- Enhanced health check logging to include the last HTTP status received, providing better visibility into health check failures.
2026-05-12 16:42:00 +07:00
Denozordec 40e2040fb0 feat: refactor theme management and remove next-themes dependency
Docker images / backend-image (push) Successful in 2m35s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 2m9s
Docker images / updater-image (push) Successful in 38s
- Replaced the next-themes package with a custom ThemeProvider component for enhanced theme management.
- Implemented local storage handling for theme persistence and system theme detection.
- Updated the Toaster component to utilize the new theme context.
- Removed unused next-themes references from package.json and package-lock.json.
2026-05-12 16:07:40 +07:00
Denozordec bb07ba0f69 feat: implement database backup and restore functionality in settings page
Docker images / backend-image (push) Successful in 1m39s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 1m51s
Docker images / updater-image (push) Successful in 36s
- Added UI components for downloading and restoring the application database, enhancing data management capabilities.
- Integrated new API routes for system database operations in the backend.
- Implemented state management for backup and restore processes, including loading indicators and user notifications.
2026-05-12 15:59:27 +07:00
Denozordec 1fefed2aa0 chore: enhance data source configuration and mock data handling
Docker images / backend-image (push) Successful in 39s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 1m38s
Docker images / updater-image (push) Successful in 35s
- Added support for mock data mode in the frontend by introducing a new environment variable in the Dockerfile and workflow configuration.
- Updated the settings page to conditionally display options based on the availability of mock data, improving user experience.
- Refactored data source logic to include a check for mock data availability, ensuring proper mode handling in the application.
2026-05-12 15:38:27 +07:00
Denozordec 4489dfb2d6 chore: enhance frontend configuration for backend integration
Docker images / backend-image (push) Successful in 39s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 1m36s
Docker images / updater-image (push) Successful in 37s
- Added environment variables for backend URLs in the Dockerfile to facilitate dynamic configuration.
- Updated Next.js configuration to include rewrites for health and API endpoints, improving backend connectivity.
- Modified settings page to handle backend URL locking and normalization, enhancing user experience and data integrity.
2026-05-12 15:28:20 +07:00
Denozordec 4b240d70d0 chore: add server and server_snapshots tables to database schema
Docker images / backend-image (push) Successful in 1m32s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 41s
Docker images / updater-image (push) Successful in 36s
- Introduced new tables for managing server configurations and snapshots, enhancing data organization and retrieval.
- The servers table includes fields for server details, while the server_snapshots table captures performance metrics and status updates.
2026-05-12 15:17:28 +07:00
Denozordec 63252ae85e chore: enhance image reference resolution in updater script
Docker images / backend-image (push) Successful in 38s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 40s
Docker images / updater-image (push) Successful in 45s
- Added functionality to resolve image references with digests, improving the rollback process in the updater script.
- Updated health check URLs in targets.json.example to use service names instead of localhost, ensuring proper connectivity in containerized environments.
2026-05-12 15:12:23 +07:00
Denozordec a359874a42 chore: enhance Dockerfile for backend to rebuild better-sqlite3
Docker images / backend-image (push) Successful in 2m32s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 42s
Docker images / updater-image (push) Successful in 36s
- Updated the backend Dockerfile to include a rebuild step for better-sqlite3 after npm ci, improving compatibility and performance.
- Removed redundant package installation commands to streamline the Docker build process.
2026-05-12 15:08:11 +07:00
Denozordec 4ec247f2c0 chore: update Docker Compose configuration for data volume management
Docker images / backend-image (push) Successful in 40s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 40s
Docker images / updater-image (push) Successful in 35s
- Changed backend data volume mapping to use a specific host path for data storage.
- Updated updater service volume mappings to point to designated host paths for state and configuration files, streamlining the deployment process.
2026-05-12 14:51:10 +07:00
Denozordec 2697a35c0a chore: streamline Docker workflow and enhance build efficiency
Docker images / backend-image (push) Successful in 40s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 39s
Docker images / updater-image (push) Successful in 36s
- Updated Dockerfiles for frontend and backend to include the --ignore-scripts flag in npm ci commands, further optimizing build times.
- Added a step in the Docker workflow to create the public directory in the staging environment, ensuring proper setup for deployments.
- Enhanced the configuration for dynamic image naming in the Docker workflow, improving consistency across builds.
2026-05-12 14:46:52 +07:00
Denozordec 7295545cde chore: add updater image configuration to Docker workflow
Docker images / backend-image (push) Successful in 39s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 40s
Docker images / updater-image (push) Successful in 49s
- Introduced a new job for building and pushing an updater Docker image, dynamically setting its name based on the repository structure.
- Updated existing image name configurations for frontend and backend to strip version numbers, ensuring cleaner image tags.
- Enhanced the Docker workflow with steps for checking out the repository, configuring Buildx, and logging into the Gitea registry.
2026-05-12 14:26:59 +07:00
Denozordec a5b5a2a3d3 chore: enhance Dockerfiles and package.json for improved build process
Docker images / backend-image (push) Successful in 3m5s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Successful in 2m13s
- Added ENV npm_config_ignore_scripts=true to frontend and backend Dockerfiles to skip scripts during npm install, optimizing build times.
- Introduced a postinstall script in package.json to ensure the build process for @mmapp/contracts runs after installation.
2026-05-12 14:04:01 +07:00
Denozordec 01596864dc chore: update Dockerfiles to ignore scripts during npm install
Docker images / backend-image (push) Failing after 1m33s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Failing after 55s
- Modified Dockerfile for frontend and backend to include the --ignore-scripts flag in npm ci commands, improving build efficiency.
- Added a step in the Docker workflow to create the public directory in the staging environment.
2026-05-12 14:00:05 +07:00
Denozordec 02119a3acd chore: configure dynamic image naming for frontend and backend in Docker workflow
Docker images / backend-image (push) Failing after 1m31s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Failing after 30s
- Added steps to dynamically set the image names for both frontend and backend based on the repository owner and name.
- Updated Docker build tags to use the newly configured image names instead of hardcoded values.
2026-05-12 13:56:56 +07:00
Denozordec c36994c36b chore: update configuration and dependencies
Docker images / backend-image (push) Failing after 2m56s
Docker images / notify-webhook (push) Has been skipped
Docker images / frontend-image (push) Failing after 32s
- Added .ci/docker/ to .gitignore to exclude Docker CI files.
- Set Next.js output configuration to "standalone" for optimized deployment.
- Updated package-lock.json to include new optional dependency for Windows SWC binaries.
2026-05-12 12:11:43 +07:00
DenozordecandCursor dfbaa859ad chore: isolate frontend and backend via npm workspaces and @mmapp/contracts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 10:59:05 +07:00
Denozordec b9a75b6831 feat: implement internet path functionality with backend support
Added internet path settings and snapshot management to the application. This includes new database tables for internet path settings and snapshots, API routes for fetching and managing internet path data, and integration into the dashboard and data collection pages. Enhanced the scheduler to support internet path jobs, ensuring regular data collection and updates. Updated relevant types and interfaces to accommodate the new functionality.
2026-05-08 00:40:41 +07:00
Denozordec 11ad94f67d feat: integrate sonner for toast notifications and enhance UI feedback
Added the sonner library for toast notifications across various components, improving user feedback for actions such as saving settings, syncing rules, and handling errors. Updated the layout to include a Toaster component for consistent notification display. Refactored alert messages in the backups, gre, and filters pages to utilize the new notification system, enhancing overall user experience.
2026-05-07 20:49:35 +07:00
Denozordec 84ecd4f061 feat: enhance backups page with live data loading and backup job management
Implemented live data fetching for servers and backups on the backups page, replacing static initial data. Added functionality for manual backup creation and job status tracking, including error handling and UI updates. Updated the network map layout to improve node prioritization and visual representation of server roles.

Also, registered new backups API routes in the backend for improved data handling.
2026-05-07 14:24:58 +07:00
Denozordec 6d8379501c refactor: replace custom API fetch logic with requestJson utility across multiple pages
Updated the API fetching mechanism in various components to utilize the new requestJson function for improved consistency and error handling. This change affects the alerts, dashboard, data collection, filters, gre, network map, probes, recursive routes, route optimizer, servers, settings, traffic, and uptime pages.
2026-05-07 13:35:41 +07:00
DenozordecandCursor 5f31bb47fb chore: synchronize pending app/backend updates and repository hygiene
Includes current frontend and backend work in progress and removes generated artifacts from tracking to keep the repository clean for дальнейшая разработка.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-07 12:29:04 +07:00
Denozordec bdb9b72fac Init 2 2026-05-03 11:16:07 +07:00
Denozordec ce00c4c671 Update .gitignore to include additional build and log files 2026-05-02 15:48:45 +07:00
Denozordec f3f831653f Init commit 2026-05-02 01:17:08 +07:00
1512 changed files with 408497 additions and 2458 deletions

No files matched your search

+67
View File
@@ -0,0 +1,67 @@
---
name: reui
description: Use the ReUI registry from your AI agent - find, install, and correctly use ReUI components (the 22 free building blocks like data-grid, kanban, filters), their free examples, premium blocks, and Motion Icons. Applies in any project using ReUI, the @reui registry, REUI_LICENSE_KEY, or any shadcn project where the user asks for premium blocks, data grids, kanban boards, dashboards, or full pages. Pairs with the free ReUI MCP server for live, scored registry search and inline component APIs.
user-invocable: false
allowed-tools: Bash(npx shadcn@latest *), Bash(pnpm dlx shadcn@latest *), Bash(bunx --bun shadcn@latest *)
---
> **ReUI skill version `fe6742e29c`.** If the ReUI MCP's `get_agent_skill` reports a newer `version`, re-run the ReUI installer (see `get_agent_skill` -> `install.recommended`) to update this skill. Cloud/tools-only agents have no local file and always read the latest - they can ignore this.
# ReUI for Agents
ReUI is a shadcn-compatible registry. It ships four things you **reuse** - never redesign:
- **components** - the 22 ReUI building blocks with real APIs: `data-grid`, `kanban`, `filters`, `date-selector`, `tree`, `stepper`, ... (free)
- **examples** - free `c-*` single-pattern use-cases of a component (`c-kanban-1`); install one and read it to see exact composition
- **blocks** - premium full-page sections that compose components (`data-grid-2`, `pricing-page-1`); Pro or Ultimate license at install
- **icons** - Motion Icons in 4 styles, static + hover-animated variants; Ultimate license at install
The skill is free and this MCP is free to use; it just needs a ReUI account. On first use your agent opens a browser "Sign in with ReUI" prompt (a free account is created if you don't have one). Free covers components and examples with a daily request allowance; a Pro or Ultimate license unlocks premium blocks and Motion Icons and removes the limit (see [rules/registry.md](./rules/registry.md)). The same account and skill work in every agent and service the MCP connects to - this skill is agent-agnostic.
Skill + MCP are a team: this skill is the workflow (how to find, install, read the API, and adapt by reuse); the MCP is the live data and the hands (search, get_component, install commands). Your job: find the right item, install it with the shadcn CLI, read its real API, and **adapt by reuse** - wire real data and theme it; do not hand-roll or restyle what ReUI already provides. This skill **layers on the shadcn skill**: follow that for generic rules (spacing, `cn()`, semantic colors, forms); follow this for everything ReUI-specific.
## The core loop (MCP-native)
1. **Find** - call the ReUI MCP `search` tool with the user's intent. It returns a ranked, scored list across components/examples/blocks/icons, each with an `install` command, `previewUrl`, `docsUrl`, and `componentsUsed`. Pass hints (`type`, `component`, `category`, `features`, `free`) when you can infer them.
2. **Install** - run the returned command non-interactively (`npx shadcn@latest add @reui/<name> --yes`). The CLI resolves deps, aliases, and the base/style from `components.json`. See [cli.md](./rules/cli.md).
3. **Read the API (on your base)** - first note your base from `components.json` -> `style` (`base-nova` -> Base UI, `radix-nova` -> Radix UI). For each component an item uses, call `get_component(name)` and read its **inline `api`** (no web fetch); then `get_examples(name)` to install a worked example and copy its composition - the installed files are already in your base. Whenever you work with a component's API, also **share its `docsUrl`** (the primitive's API documentation page) with the user so they have the full reference. See [components.md](./rules/components.md).
4. **Adapt (reuse-first)** - swap demo data for real data, fix icon imports, align tokens. Do not redesign. See [adapting.md](./rules/adapting.md).
**Always show the preview.** Every item a tool returns carries a `previewUrl` (a live preview page). Whenever you list, recommend, or present ReUI items to the user - blocks, components, examples, or icons, whether from `search`, `search_icons`, `list_components`, `compose_page`, or any getter - include each item's `previewUrl` so they can SEE it before installing. Blocks and examples open an individual live preview; icons and components link to their live category/component page. Never present an item without its preview link.
If the ReUI MCP is not configured, fall back to `npx shadcn@latest search @reui -q "..."` then `add` - but the MCP gives scored matches + inline APIs; prefer it.
## Commands
Run ReUI as explicit slash commands (via the ReUI MCP) **or** just ask in plain language - both run the same workflow.
| Command | Invoke | Does |
| ----------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| **build** | `/mcp__reui__build <what>` | Compose a page/section/feature from ReUI: plan → install → read API → adapt → craft → audit. |
| **add** | `/mcp__reui__add <item>` | Find & install one component/example/block/icon and wire it in. |
| **fix** | `/mcp__reui__fix [target]` | Diagnose & fix ReUI usage: wrong/undocumented props, base/radix mismatch, missing states, a11y/scroll. |
| **improve** | `/mcp__reui__improve [target]` | Refine + extend existing ReUI UI to a production-exceptional bar (hierarchy, density, states, responsive, motion). |
Invocation differs slightly per agent (`/mcp__reui__build` in Claude Code/Cursor/Windsurf, `/mcp.reui.build` in VS Code). No command surface? Just describe what you want - this skill drives the identical loop.
## When to reach for ReUI vs plain shadcn
| Need | Reach for |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| A full page or section (dashboard, billing, auth, pricing, settings) | `compose_page` first (plans sections + best blocks), then ReUI **blocks** |
| A data table with sorting/filtering/pagination/virtualization | the **data-grid** component (never hand-roll a `<table>`) |
| A drag-and-drop board | the **kanban** component |
| Advanced column filtering, date range, tree, stepper, ... | the matching ReUI **component** |
| A single generic control already in shadcn (Button, Dialog, Select) | plain **shadcn** |
## Detailed references
- [rules/registry.md](./rules/registry.md) - the four types, the @reui registry, base/radix, free vs premium + license
- [rules/workflow.md](./rules/workflow.md) - the find -> install -> read-API -> adapt loop (most important)
- [rules/components.md](./rules/components.md) - the 22 components, the data-grid contract, base vs radix
- [rules/adapting.md](./rules/adapting.md) - reuse-first: preserve the design (no over-customizing), reuse examples + a block's own elements, real data, don't invent APIs
- [rules/craft.md](./rules/craft.md) - make it exceptional: point of view, hierarchy, density, states, responsive, motion, the bar
- [rules/quality.md](./rules/quality.md) - security, accessibility, and scroll gates (the done gate)
- [rules/styling.md](./rules/styling.md) - ReUI extended tokens, theme adaptation, density
- [rules/icons.md](./rules/icons.md) - portable icons, swapping imports, Motion Icons (static + animated)
- [tools.md](./tools.md) - the ReUI MCP: golden path, the 19 tools, token rules, result shapes, errors
+43
View File
@@ -0,0 +1,43 @@
# Adapting installed ReUI code (reuse-first, no AI slop)
ReUI items ship production-quality. Your job is to **adapt by reuse** - wire real data and fit the app - not to redesign or hand-roll. The output should look like ReUI built it for this product.
## Preserve the design - don't over-customize
The design IS the product. A ReUI block/component encodes senior-designer decisions: spacing, hierarchy, density, color treatment, and component choices. The fastest way to turn a premium block back into generic AI slop is to "improve" its look - so don't.
- Change **data, copy, and props**; keep the **structure and styling** it ships with. Make the **smallest** change that wires the real data. If your diff touches `className` / JSX structure more than data / props, you are over-customizing - stop and reuse.
- Don't swap ReUI components for hand-rolled ones, restructure the layout, re-skin spacing / radius / colors, or add decorative chrome. Let the installed components carry the default spacing, radius, sizing, icon rhythm, density, and state styling; add custom Tailwind only when a component genuinely lacks a contract you need.
- Want a different look? `search` for a block whose design already fits and reuse that - don't restyle this one into a new design.
## Reuse the parts: examples and the block's own elements
- **Examples are building parts.** A free `c-*` example is a correct, single-pattern composition you can reuse. Before composing from scratch, `get_examples(component)`, install the closest one, and reuse its wiring - assemble UI from examples instead of hand-rolling what an example already shows.
- **Reuse a block's own elements.** Need more rows, cards, items, or sections than ship by default? Repeat the block's **existing** element by mapping real data through the same markup - never invent parallel markup that drifts from its design. Need a variant (empty / loading / expanded)? Derive it from an element the block already has.
## Don't invent (read, don't guess)
- Never write a prop, variant value, import path, or `@reui/...` name you didn't read in a component's inline `api`, an installed example, or a `search` result. If you didn't see it, treat it as nonexistent - call `get_component` / `get_examples` / `search` first, or run the MCP `validate_usage` tool to check planned names + props against the docs before writing code.
- If a getter returns `found: false` or `search` returns nothing, say so and fall back (plain shadcn, or ask) - never fabricate an install command or an API.
## What to change vs leave alone
- **Change:** the item's own data, copy, props, and layout to fit the app.
- **Leave alone:** installed component files, hooks, and the shared theme - do not edit vendored ReUI internals; change behavior through props and the documented API.
- Blocks are **portable React** - no `next/link`, `next/image`, or other framework-runtime imports inside them. Keep them portable.
## Demo data -> real data
- Replace every placeholder with the user's real data. Model it as **typed data structures** and **map over arrays** - never duplicate JSX per row/card. Keep small block-specific formatters next to the data.
- Wire the real source (columns, fields, fetch). For `data-grid`, implement the server fetch contract if the user needs server-side data.
- **Type from the component API, derive during render.** Type domain state through the component's own types - e.g. map status to `BadgeProps["variant"]` via a typed `Record<Status, …>` - instead of stringly-typed values. Compute view state during render; don't mirror derived data into `useState`/`useEffect`.
- **Adapt on the right base.** Use the API for the project's base (Base UI vs Radix - see [components.md](./components.md)); the installed files are already base-correct, so reuse their shape rather than translating from memory.
## Believable content (no AI tells)
- Use realistic labels, counts, timestamps, and statuses that map to a real workflow.
- No decorative buttons, fake tabs, meaningless toggles, equal-weight card walls, empty gradients, ornamental icons, or generic SaaS filler. Every element should do something.
## Operational surfaces (settings / profile / admin)
Pick ONE archetype and keep the family consistent: a vertical rail (3-6 sections), horizontal tabs (5-8), or a frame/stack. Prefer `frame` for tool-like surfaces, a card for profile-like ones. Don't mix archetypes in one surface.
+60
View File
@@ -0,0 +1,60 @@
# CLI: registry setup, license, non-interactive install
## Registry setup (one-time, per project)
Free items (the 22 components and all `c-*` examples) need only the plain string registry in `components.json`:
```json
{ "registries": { "@reui": "https://reui.io/r/{style}/{name}.json" } }
```
Premium items (blocks; Motion Icons and templates) require a ReUI license at install:
1. Add the key to `.env.local`:
```bash
REUI_LICENSE_KEY=your-license-key
```
2. Switch `components.json` to the authenticated object form:
```json
{
"registries": {
"@reui": {
"url": "https://reui.io/r/{style}/{name}.json",
"headers": { "Authorization": "Bearer ${REUI_LICENSE_KEY}" }
}
}
}
```
The shadcn CLI expands `${REUI_LICENSE_KEY}` from `.env.local` inside `components.json`, but an MCP client config never expands variables, so a ReUI MCP server config must carry the raw token instead (for example `reui_pat_your_token_here`).
The MCP `get_project_context` tool returns the right config. Full guide: https://reui.io/docs/registry?ref=skill
## Installing
Use the project's package runner (check `packageManager`):
```bash
npx shadcn@latest add @reui/<name> --yes # npm
pnpm dlx shadcn@latest add @reui/<name> --yes # pnpm
bunx --bun shadcn@latest add @reui/<name> --yes # bun
```
`--yes` skips confirmation prompts. The CLI auto-detects the package manager from the lockfile (there is no `--package-manager` flag). It also resolves the correct base+style variant from `components.json`, so do not pass a style.
## Handling prompts and conflicts
- **Always pass `--yes`** so the CLI does not block on confirmation prompts.
- **Do NOT pass `--overwrite` by default.** If the CLI reports an existing file, read the output and resolve deliberately: install under a different name, adjust the path, or ask the user. Only use `--overwrite` when the user explicitly wants to replace a file.
- **Preview first when touching an existing project**: `npx shadcn@latest add @reui/<name> --dry-run` shows what would change; `--diff <file>` shows a specific file's diff. Use these before overwriting.
- Run from the **project root** so `components.json` and `.env.local` are found.
## Free vs premium boundary
- Public, no key: `c-*` examples and the 22 components (`@reui/data-grid`, `@reui/badge`, ...) that those examples depend on.
- Key required at install: blocks (`@reui/<category>-N`) need a Pro or Ultimate license; Motion Icons (`@reui/icons/...`) and templates need Ultimate.
If an install 401/403s, the license key is missing, invalid, or the plan does not cover that resource (blocks: Pro or higher; icons and templates: Ultimate). Point the user to https://reui.io/account?ref=skill (their key) or https://reui.io/pricing?ref=skill (upgrade).
+428
View File
@@ -0,0 +1,428 @@
# ReUI components
The 22 ReUI building blocks: `alert`, `autocomplete`, `badge`, `cascader`, `code-block`, `data-grid`, `date-selector`, `event-calendar`, `filters`, `frame`, `gantt`, `icon-stack`, `icon-tile`, `kanban`, `number-field`, `phone-input`, `rating`, `scrollspy`, `sortable`, `stepper`, `timeline`, `tree`. Examples and blocks are composed from these.
**Rule one: never guess a component's API. Read it first.** Call **`get_component(name)`** for its inline `api` (props + usage, no web fetch), and **share the result's `docsUrl`** (the component's API documentation page) with the user whenever you work with that component's API, so they have the full reference (the `/llms.txt` index is a further fallback). Then call **`get_examples(name)`** to install a worked example and copy real composition. The contracts below are first-try orientation (required props, composition shape, the one gotcha); the inline `api` is the full reference. No single block fits? Compose: search the components you need, read each `get_component`, install a `get_examples` example per component, and adapt.
## data-grid (the flagship - read its API every time)
`data-grid` wraps TanStack Table v9. It is NOT a styled `<table>` and does NOT take `data`/`columns` props directly. The contract:
- Build a TanStack table instance with `useTable({ features: dataGridFeatures, ... })` (columns, data). `dataGridFeatures` is exported by the primitive and already bundles sorting, filtering, pagination, row selection, expanding, pinning, resizing and faceting, so there are no per-table row models to wire.
- Pass that instance to `<DataGrid table={table} recordCount={total}>`.
- Compose the body with `DataGridTable` inside `DataGrid`, and enable features through `tableLayout` (e.g. `{ headerSticky: true, columnsResizable: true }`), not ad-hoc classes.
- Server-side data uses the documented fetch shape (`recordCount` is the total for pagination).
```tsx
const table = useTable({
features: dataGridFeatures,
data,
columns,
})
<DataGrid table={table} recordCount={data.length}>
<DataGridTable />
</DataGrid>
```
Common mistakes:
- **Incorrect:** `<DataGrid data={rows} columns={cols} />` - these props do not exist. **Correct:** build a `useTable({ features: dataGridFeatures, ... })` instance and pass `table={table}` + `recordCount`.
- **Incorrect:** a raw `<table>` / hand-rolled pagination. **Correct:** use `data-grid`; read its API for sticky header, pagination, virtualization, row selection.
- **Incorrect:** styling rows/cells with arbitrary classes. **Correct:** drive layout via `tableLayout` and the primitive's `DataGridColumnMeta` (e.g. `cellClassName`, `headerTitle`), set through the bundle's `columnMeta` slot.
## event-calendar
**Required:** events via `events`/`onEventsChange` (controlled) or `defaultEvents` (uncontrolled), plus a height on the root.
**Shape:**
```tsx
<EventCalendar defaultEvents={events} defaultView="month" className="h-[560px]">
<EventCalendarNav />
<EventCalendarContent />
</EventCalendar>
```
**Gotcha:** headless-first: `EventCalendarContent` renders the active view (month/week/day/days/agenda; a resource view activates when `resources` is passed) - there is no per-view JSX to compose. Events are `{ id, title, start, end (exclusive), allDay?, color?, recurrence?, resourceId? }`. Mutations flow through `onEventUpdate`/`canDropEvent` (return `false` to reject); the root needs an explicit height because it is a min-h-0 flex column.
## gantt
**Required:** `resources` (the left tree) plus bars via `events`/`defaultEvents` attached by `resourceId`.
**Shape:**
```tsx
<Gantt defaultEvents={bars} resources={tasks} defaultScale="month" className="h-[480px]">
<GanttNav />
<GanttView />
</Gantt>
```
**Gotcha:** bars move along the time axis only (never across rows) and are all-day spans with exclusive `end`; `progress` is 0-100. Scales are `day | week | month | quarter | year`. Zoom control, infinite scroll, summary rollups, and row checkboxes are ON by default - turn off what you do not need. Same `onEventUpdate`/`canDropEvent` commit pipeline as `event-calendar`; the root needs an explicit height.
## kanban
**Required:** `value` (`Record<string, T[]>`), `onValueChange`, `getItemValue`
**Shape:**
```tsx
<Kanban value={cols} onValueChange={setCols} getItemValue={(i) => i.id}>
<KanbanBoard>
{Object.entries(cols).map(([id, items]) => (
<KanbanColumn key={id} value={id}>
<KanbanColumnHandle><h3>{id}</h3></KanbanColumnHandle>
<KanbanColumnContent value={id}>
{items.map((i) => (
<KanbanItem key={i.id} value={i.id}>
<KanbanItemHandle>{i.title}</KanbanItemHandle>
</KanbanItem>
))}
</KanbanColumnContent>
</KanbanColumn>
))}
</KanbanBoard>
<KanbanOverlay><div className="bg-muted size-full rounded-md" /></KanbanOverlay>
</Kanban>
```
**Gotcha:** state is `Record<columnId, T[]>`. Each `KanbanColumnContent value` must match its parent `KanbanColumn value`. Omit `KanbanOverlay` and the drag preview silently breaks.
## sortable
**Required:** `value` (`T[]`), `onValueChange`, `getItemValue`
**Shape:**
```tsx
<Sortable value={items} onValueChange={setItems} getItemValue={(i) => i.id}>
{items.map((i) => (
<SortableItem key={i.id} value={i.id}>
<SortableItemHandle><GripVertical /></SortableItemHandle>
{i.label}
</SortableItem>
))}
</Sortable>
```
**Gotcha:** a flat 1D reorder list (not columns - that is `kanban`). `getItemValue` must return a stable, unique string. Pass `layout="grid"` or `layout="nested"` for non-list layouts.
## filters
**Required:** `fields` (`FilterField[]`). The value is ONE `FilterQuery` tree - `query` + `onQueryChange`, or uncontrolled `defaultQuery`.
**Shape:**
```tsx
const fields: FilterField[] = [
{ id: "title", label: "Title", type: "text" },
{
id: "status",
label: "Status",
type: "select",
options: [
{ value: "active", label: "Active" },
{ value: "archived", label: "Archived" },
],
},
]
const [query, setQuery] = useState<FilterQuery>(() => createFilterQuery())
<Filters fields={fields} query={query} onQueryChange={setQuery} />
```
**Gotcha:** the state is a TREE, not a list of chips. `FilterQuery` is a group of rules joined by `and`/`or` and a group may hold another group, so `(A and B) or C` is expressible; a rule is `{ id, type: "rule", path: ["status"], operator, value }` and `path` is the whole nested attribute path, root first. The pre-rewrite API is GONE: there is no `filters`/`onChange` prop, no `FilterFieldConfig` (fields are `FilterField`, nested through their own `fields`, keyed `id` not `key`), and no `createFilter()` - it minted ids inside a pure function and broke hydration, so ids now come from `createFilterIdFactory(seed)` seeded off `useId`, and `createFilterQuery()` / `createFilterRule()` take one. Read the query back with `flattenFilterConditions` (`{ path, field, operator, values, negated }` per rule, incomplete rules skipped) and walk the tree yourself when the parentheses carry meaning - the primitive compiles nothing, no SQL, no query string.
`variant` picks the chrome over that one query: `"basic"`, the default, is the flat chip row for a toolbar over a table; `"advanced"` is the condition builder, hung off a trigger or rendered in place with `advancedMode="inline"`. Both read and write the same tree, so a saved view built in one opens in the other. Other props worth knowing before you hand-roll them: `size` is two rungs, `"sm" | "default"`, resolved per style (there is no `lg`); `reorderable` turns on drag and Alt+Arrow row moves in the builder; `onBeforeQueryChange` is the ONE veto point for every write (return `false` to refuse, it cannot rewrite); `editors` registers custom value editors a field selects by `editor` name; `labels` / `operatorLabels` own every rendered string; `pathCollapse` + `maxPathSegments` shorten deep attribute paths; `renderChip` / `renderValue` / `renderEmpty` replace rendered parts. On a field, `loadOptions` supplies async options with paging and `resolveValues` renders a chip restored from a saved view whose option was never loaded. Pairs naturally with `data-grid`.
## cascader
**Required:** `items` (a tree of `{ value, label, children? }`), plus the panel parts inside `CascaderContent`.
**Shape:**
```tsx
<Cascader items={items} value={value} onValueChange={setValue}>
<CascaderTrigger render={<Button variant="outline" />}>
<CascaderValue placeholder="Select an attribute" />
</CascaderTrigger>
<CascaderContent className="w-80">
<CascaderPanel>
<CascaderNav>
<CascaderBreadcrumb />
<CascaderInput />
</CascaderNav>
<CascaderEmpty />
<CascaderList maxHeight={288}>
<CascaderItems />
</CascaderList>
<CascaderStatus />
</CascaderPanel>
</CascaderContent>
</Cascader>
```
**Gotcha:** pressing a branch NAVIGATES, it does not select - only leaves are selectable until you pass `selectable="any"` or a predicate, and once a branch is selectable its chevron becomes the only way to open it. `CascaderInput` must stay inside `CascaderContent` (Base UI refills the query from the selection when the input sits outside the popup). Always include `CascaderStatus`: it is the live region announcing level changes, which the visual breadcrumb does not provide to screen readers. Accepts a flat adjacency list via `getParent` as well as nested `children`. `searchScope="deep"` searches every level and annotates results with their path; `multiple` gives checkbox rows; `inline` + a bare `CascaderPanel` embeds it with no popover.
The shape above is `mode="drill"`, the default. `mode="tree"` keeps the same parts (drop `CascaderBreadcrumb`, pass `showBack={false}`, drive expansion with `expanded`/`onExpandedChange`); `mode="columns"` REPLACES `CascaderList` + `CascaderItems` with a single `CascaderColumns`, and has no breadcrumb. Other props worth knowing before you hand-roll them: `cascade` (multi-select only, parent/child selection with indeterminate branches - pair it with `selectable="any"`, since a leaf-only tree can never cascade), `indicator={false}` to drop the single-select check and its gutter (visual only, no-op with `multiple`), `virtualize`/`virtualizeThreshold` plus `CascaderVirtualItems` for long levels, and `getChildren` for async levels with cursor paging, retry on failure and optional `prefetch`. `CascaderFooter` pins commands below the list (`actions` is the quick path) and `CascaderSubmenu` opens one as a side-anchored flyout with the full menu keyboard model. To head a run of rows use `CascaderGroup` wrapping a `CascaderLabel` - a bare label inside a listbox names nothing and is dropped from the accessibility tree - and `CascaderSeparator` for the rule between runs. Every rendered string comes from `labels`, and the panel is RTL-correct under a `DirectionProvider` or `dir="rtl"`.
## date-selector
**Required:** none, but wire `onChange` to capture the value.
**Shape:**
```tsx
const [value, setValue] = useState<DateSelectorValue | undefined>()
<DateSelector value={value} onChange={setValue} label="Due date" />
```
**Gotcha:** the value is a structured `DateSelectorValue` (period / operator / start+end dates), NOT a `Date` - never pass a raw `Date`. Use `allowRange={false}` to lock single-date picking. Read `get_component("date-selector")` for the value shape.
## tree
**Required:** `tree` (a `@headless-tree/core` instance you construct)
**Shape:**
```tsx
<Tree tree={tree}>
{tree.getItems().map((item) => (
<TreeItem key={item.getId()} item={item}>
<TreeItemLabel />
</TreeItem>
))}
</Tree>
```
**Gotcha:** `Tree` is a styled shell - it takes a headless-tree instance via `tree`, NOT `data`/`items` props. Build the instance with `@headless-tree/react`. External API: https://headless-tree.lukasbach.com/
## stepper
**Required:** `StepperItem step` (number), `StepperContent value` (number)
**Shape:**
```tsx
<Stepper defaultValue={1}>
<StepperNav>
<StepperItem step={1}>
<StepperTrigger><StepperIndicator>1</StepperIndicator></StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem step={2}>
<StepperTrigger><StepperIndicator>2</StepperIndicator></StepperTrigger>
</StepperItem>
</StepperNav>
<StepperPanel>
<StepperContent value={1}>Step 1 content</StepperContent>
<StepperContent value={2}>Step 2 content</StepperContent>
</StepperPanel>
</Stepper>
```
**Gotcha:** steps are 1-indexed. Without `StepperPanel` + `StepperContent` you render the nav trail but no body. Put `StepperSeparator` in every `StepperItem` except the last.
## timeline
**Required:** `TimelineItem step` (number)
**Shape:**
```tsx
<Timeline>
<TimelineItem step={1}>
<TimelineHeader>
<TimelineDate>March 2024</TimelineDate>
<TimelineTitle>Project initialized</TimelineTitle>
</TimelineHeader>
<TimelineIndicator />
<TimelineSeparator />
<TimelineContent>Repo and architecture set up.</TimelineContent>
</TimelineItem>
</Timeline>
```
**Gotcha:** each item needs a unique `step`. `orientation` is `"vertical"` (default) or `"horizontal"`. This is a static event display, not interactive like `stepper`.
## autocomplete
**Required:** `items` (array; each item has at least `value`)
**Shape:**
```tsx
<Autocomplete items={items}>
<AutocompleteInput placeholder="Search..." />
<AutocompleteContent>
<AutocompleteEmpty>No results found.</AutocompleteEmpty>
<AutocompleteList>
{(item) => (
<AutocompleteItem key={item.value} value={item}>{item.label}</AutocompleteItem>
)}
</AutocompleteList>
</AutocompleteContent>
</Autocomplete>
```
**Gotcha:** `AutocompleteList` takes a render-prop `(item) => ReactNode`, NOT a mapped array of children. External API: https://base-ui.com/react/components/autocomplete
## phone-input
**Required:** none, but wire `onChange`.
**Shape:**
```tsx
<PhoneInput placeholder="Enter phone number" defaultCountry="US" value={value} onChange={setValue} />
```
**Gotcha:** `value`/`onChange` use an E.164 string (e.g. `"+14155551234"`), not a display-formatted string; `onChange` can fire `undefined`. `defaultCountry` is a 2-letter ISO code. Wraps `react-phone-number-input`.
## number-field
**Required:** wrap the controls in `NumberFieldGroup`.
**Shape:**
```tsx
<NumberField defaultValue={0}>
<NumberFieldScrubArea label="Quantity" />
<NumberFieldGroup>
<NumberFieldDecrement />
<NumberFieldInput />
<NumberFieldIncrement />
</NumberFieldGroup>
</NumberField>
```
**Gotcha:** import from `@/components/ui/number-field`. The accessible label goes on `NumberFieldScrubArea`, not `NumberField`. External API: https://base-ui.com/react/components/number-field
## rating
**Required:** `rating` (number)
**Shape:**
```tsx
<Rating rating={4.5} showValue editable onRatingChange={setRating} />
```
**Gotcha:** supports decimals (partial stars). Pass `editable` + `onRatingChange` for interactive input; omit both for a read-only display.
## scrollspy
**Required:** `targetRef` (the scroll container ref)
**Shape:**
```tsx
<Scrollspy targetRef={containerRef}>
<a href="#s1" data-scrollspy-anchor="s1">Section 1</a>
<a href="#s2" data-scrollspy-anchor="s2">Section 2</a>
</Scrollspy>
<div ref={containerRef}>
<div id="s1">...</div>
<div id="s2">...</div>
</div>
```
**Gotcha:** each link's `data-scrollspy-anchor` must match a section `id`. `targetRef` is the scrollable container (defaults to the window).
## frame
**Required:** `Frame` > `FramePanel`
**Shape:**
```tsx
<Frame>
<FramePanel>
<FrameHeader>
<FrameTitle>Title</FrameTitle>
<FrameDescription>Description</FrameDescription>
</FrameHeader>
<div className="p-5">Content</div>
<FrameFooter>Footer</FrameFooter>
</FramePanel>
</Frame>
```
**Gotcha:** a structured card shell for tool-like surfaces. `stacked` connects multiple panels with shared borders; `dense` removes panel padding; radius via the `--frame-radius` CSS variable.
## icon-stack
**Required:** one child icon
**Shape:**
```tsx
<IconStack aria-hidden="true">
<InboxIcon className="size-4" />
</IconStack>
```
**Gotcha:** isometric layered artwork for empty states and illustrations; style the inner icon via its own `className`. Mark purely decorative stacks `aria-hidden="true"` and keep the real label in surrounding copy.
## icon-tile
**Required:** one child icon
**Shape:**
```tsx
<IconTile variant="elevated" size="lg">
<PackageIcon />
</IconTile>
```
**Gotcha:** the square container an icon sits in, so every list row, feature card and empty state shares one affordance. `variant`: `outline` (default) | `elevated` (muted fill, raised ring) | `soft` (tinted nested, tone from currentColor) | `solid` (filled tone, contrasting glyph) | `frame` (double container). `soft` and `solid` retint from one text color class (they default to `text-primary`). `size`: `xs | sm | default | lg | xl` (24/32/40/48/64px tile, glyph scales 12/14/16/20/24px). `radius`: `default | full`. Do not set a `size-*` class on the child icon unless you mean to override the tile's glyph size; recolor with `className` on the tile, not the icon.
## code-block
**Required:** `code` + `language`, or pre-highlighted `lines`.
**Shape:**
```tsx
<CodeBlock code={code} language="tsx" />
<CodeBlock code={code} language="tsx" showLineNumbers maxLines={20}>
<CodeBlockHeader>
<CodeBlockTitle>use-totals.ts</CodeBlockTitle>
<CodeBlockLanguage />
<CodeBlockCopyButton className="ml-auto" />
</CodeBlockHeader>
<CodeBlockExpandButton />
</CodeBlock>
```
**Gotcha:** the one-liner is already a complete block; every child (header, title, language label, copy button, wrap toggle, expand button, line actions) is optional chrome, at any depth. Shiki is the only npm dependency and loads lazily, one chunk per language, on first highlight; `lines` (from `highlightCode` in `code-block-highlight`, which is server-safe and has no `"use client"`) or `highlight={false}` loads nothing at all. `maxLines` caps the height AND marks the block collapsible, which is what makes `CodeBlockExpandButton` appear. Use `variant="ghost"` when the block sits inside a surface that already has a border.
## alert
**Required:** `Alert` > `AlertTitle`
**Shape:**
```tsx
<Alert variant="success">
<ShieldCheckIcon />
<AlertTitle>Security update</AlertTitle>
<AlertDescription>Enable two-factor authentication.</AlertDescription>
<AlertAction><Button size="xs">Update</Button></AlertAction>
</Alert>
```
**Gotcha:** shadcn-compatible API. `variant`: `default | destructive | info | success | warning | invert`. The non-default variants use ReUI extended color tokens (`--success`/`--info`/`--warning`/`--invert`), which the install adds. Defer generic alert rules to the shadcn skill.
## badge
**Required:** none (text child).
**Shape:**
```tsx
<Badge variant="success-light" size="sm">Success</Badge>
<Badge variant="outline" radius="full">Pill</Badge>
```
**Gotcha:** shadcn-compatible. Rich `variant` set (solid, `-outline`, `-light` per color), `size` `xs..xl`, `radius` `default | full`. Like `alert`, the color variants rely on ReUI extended tokens. Prefer `Badge` variants over raw color classes for statuses.
## base vs radix - write for the project's base
ReUI ships every component in two builds: `base` (Base UI) and `radix` (Radix UI). The install command and name are identical, and the CLI installs the build matching the project. But you must write/adapt code against the **right base**, because their APIs differ.
**Detect the base first.** Read `components.json` -> `style` and take the segment before the first `-`:
- `"style": "base-nova"` -> **Base UI**
- `"style": "radix-nova"` -> **Radix UI**
**Then use that base's API.** The deltas mirror shadcn's base-vs-radix split:
- Slot/composition: Base UI `render={<… />}` vs Radix `asChild`.
- `Select`: Base UI takes `items`; Radix uses `<SelectItem>` children.
- `ToggleGroup`: Base UI `multiple` boolean vs Radix `type="single" | "multiple"`.
The safest path is to **read the installed files and `c-*` examples** - they're already in your base, so reuse their wiring instead of guessing. When `get_component`'s inline `api` or an example shows the other base's shape, translate it to your base (or `validate_usage` to confirm). Defer the generic base/radix mechanics to the shadcn skill.
+45
View File
@@ -0,0 +1,45 @@
# Craft: make ReUI UI exceptional, not generic
ReUI items ship senior-designer quality. Your adaptation has to hold that bar, so the result reads like a real product surface a team would keep - not a wireframe an AI generated. Use these alongside the reuse rules in [adapting.md](./adapting.md).
## Have a point of view
Pick an emotional register before you compose - calm, operational, premium, editorial, dense, energetic - and let layout, spacing, surface treatment, and icon behavior all reinforce it. One or two memorable decisions and restraint everywhere else beats ten generic ones. UI with no point of view reads as generated.
## Brutally clear hierarchy
One focal point per card or panel: the dominant metric or task first, its label second, supporting detail third. The first thing the eye lands on should be the right thing; secondary text must read as secondary. Borders, separators, and surfaces do real work to create 2-3 information bands - don't flatten everything to equal weight.
## Spacing rhythm and deliberate density
Gaps are a signal, not a default. Keep them intentional and consistent within a family (`gap-1`/`gap-2` for tight operational rows, larger gaps for section breaks), and smaller within a group than between groups. Match the surrounding ReUI density; don't pad an operational surface like a marketing page, and don't drift density mid-section. The composition should still feel authored in grayscale.
## Cover the real states (the usual miss)
A surface isn't done at the happy path. Compose, and wire:
- **Empty** - a purposeful empty state (short message + the primary action), never a blank panel.
- **Loading** - a **skeleton** that matches the real layout, not a centered spinner.
- **Error** - an inline, recoverable error with a retry, announced via `role="status"`/`aria-live`.
Derive these from an element the block already has (don't invent parallel markup), or `get_examples` for a state-specific example.
## Responsive by default
Mobile-first, not mobile-afterthought. In constrained rows/cards/sidebars, put `min-w-0` on the shrinking container and `truncate` long single-line labels; protect the primary label's width and let secondary content compress. Reflow layouts (multi-column -> single column) rather than just shrinking them. Desktop and mobile should both look designed.
## Motion, subtly
Motion should clarify, not decorate. Use ReUI Motion Icons on primary actions for a subtle hover cue; keep transitions short (~200-300ms) with calm easing; prefer a skeleton pulse over a spinner. No bouncing, no gratuitous entrance animations on every element.
## Real, activated content
Use believable, typed data (realistic labels, counts, timestamps, statuses that map to a real workflow) - never lorem or abstract filler. Every visible control does something: no decorative buttons, fake tabs, meaningless toggles, or stats with no job. It must still hold with long names, empty values, and crowded data.
## Avoid the AI tells
These instantly read as generated - don't ship them: equal-weight card walls, empty gradients, repetitive padding everywhere, generic enterprise copy, ornamental icons, and number tiles that don't earn their place.
## The bar
Before you finish, ask: **would a product team keep this instead of replacing it? Does it still feel strong after swapping in real content?** If not, reuse the shipped ReUI design harder - don't restyle it into something new - then run the [quality.md](./quality.md) gates.
+39
View File
@@ -0,0 +1,39 @@
# Icons (ReUI delta over shadcn)
Follow the shadcn icon rules (use the project's configured `iconLibrary`, `data-icon` on icons inside `Button`, no sizing classes on icons inside components, pass icons as component objects not string keys). ReUI adds the following.
## Portable icons (library-agnostic)
ReUI components, examples, and blocks are authored to be icon-library-agnostic. When `iconLibrary` is set in `components.json`, the shadcn CLI installs each item's icons in **your** library automatically - you swap nothing. If an installed item's icons don't match your project (for example `iconLibrary` isn't set, so they came in from the item's demo library), change the **import source and component name** to your library, keeping the same icon-name semantics:
- `lucide` -> `lucide-react`
- `tabler` -> `@tabler/icons-react`
- `phosphor` -> `@phosphor-icons/react`
- `remix` -> `@remixicon/react`
- `hugeicons` -> `@hugeicons/react`
Don't assume `lucide-react`; read `iconLibrary` from `components.json`.
## Keep icons purposeful
Icons support the hierarchy, they don't replace it: keep them small, matched to the surrounding density, and decorative ones `aria-hidden="true"` (an icon-only control still needs an accessible label on the control). Don't add ornamental icons that do no job.
## Motion Icons (the `@reui/icons/...` set)
ReUI ships its own icon set in 4 styles (outline, solid, duotone, filled), each icon in two variants:
```bash
npx shadcn@latest add @reui/icons/default/<style>/<name> --yes # static
npx shadcn@latest add @reui/icons/animated/<style>/<name> --yes # hover-animated (motion/react)
```
Finding them via the MCP is free; installing requires an Ultimate license (`REUI_LICENSE_KEY`, see [cli.md](./cli.md)). Reach for a Motion Icon on a primary action when a subtle hover cue helps; keep motion restrained.
Finding icons:
- Several icons (the common case): **`search_icons(concepts[])`** - up to 24 concepts in one call, the best icons per concept with install commands. Pass `animated: true` to get only icons with a hover-animated Motion variant.
- One icon: `search` with `type: "icon"`.
- Icon results and `get_icon` carry `animated: true` and `installAnimated` when an animated variant exists - use those install strings, do not construct paths by hand.
- Every icon result carries a `previewUrl` (its live icon-category page) - **share it with the user** so they can SEE the icon before installing.
The `icon-stack` component composes multiple icons into a stacked display.
+22
View File
@@ -0,0 +1,22 @@
# Quality gates (security, accessibility, scroll)
These are the **done gate**, not a nice-to-have: before you call any ReUI work finished, call the MCP `get_audit_checklist` tool and pass every item below (plus the craft bar in [craft.md](./craft.md)). Then typecheck and lint.
## Security
- Never `dangerouslySetInnerHTML`. Render data as text/components.
- External links (`target="_blank"`) must always pair `rel="noopener noreferrer"`.
- No real PII, secrets, or tokens in demo or committed code. Remote media only from sources the project already allows.
## Accessibility
- Implicit list/card items that navigate get real anchors with a standard hover affordance.
- Icon-only or numeric buttons need an `aria-label`; decorative icons get `aria-hidden`.
- Every non-submit button is `type="button"`.
- Keyboard + focus: everything interactive is reachable in a sensible Tab order with a visible focus ring; layers (dialogs/sheets/menus) trap focus and close on `Escape`. ReUI components ship standard keyboard behavior - read each component's inline `api` rather than re-implementing it.
- Announce async UI: loading and error messages use `role="status"` / `aria-live` so they're not silent to screen readers.
## Scroll mechanics
- Make scroll regions with a parent-owned height: a `min-h-0` + flex chain down to the scroll container. Never guess a `max-h`.
- The scroll container owns `overflow-auto`; ancestors stay `min-h-0` so the height resolves.
+35
View File
@@ -0,0 +1,35 @@
# ReUI registry structure
ReUI is a shadcn-compatible registry with four entity types. **Examples and blocks are built FROM components** - reuse them, don't rebuild.
- **component** - one of the 22 ReUI building blocks with a real API (`data-grid`, `kanban`, `filters`, `date-selector`, `tree`, ...). Install directly (`@reui/data-grid`) or let it come in as a dependency of an example/block. Free. Read its API with `get_component(name)`.
- **example** - a free `c-*` single-pattern use-case of a component (`c-kanban-1`, `c-data-grid-3`). Install one and read it to copy real composition. Find a component's examples with `get_examples(name)`.
- **block** - a premium, full-page section that composes several components (`data-grid-2`, `pricing-page-1`). Pro or Ultimate license at install. Adapts to your active theme via semantic tokens.
- **icon** - Motion Icons in 4 styles (outline, solid, duotone, filled), static (`@reui/icons/default/<style>/<name>`) and hover-animated (`@reui/icons/animated/<style>/<name>`). Ultimate license at install. See [icons.md](./icons.md).
## The @reui registry
Install everything through the shadcn CLI: `npx shadcn@latest add @reui/<name> --yes`. The CLI reads the `@reui` registry from the project's `components.json`. Free items need only the plain string form:
```json
{ "registries": { "@reui": "https://reui.io/r/{style}/{name}.json" } }
```
Premium installs need the authenticated form + `REUI_LICENSE_KEY` in `.env.local` - see [cli.md](./cli.md). The MCP `get_project_context` tool returns the right config.
## Know your base: base or radix
ReUI ships every item in two builds - `base` (Base UI) and `radix` (Radix UI) - with mirrored names. The CLI installs the build matching your project automatically, but **you must write code against the right base's API**. Detect it from `components.json` -> `style`: the segment before the first `-` is the base (`base-nova` -> Base UI, `radix-nova` -> Radix UI). The installed files and `c-*` examples are already in your base - read them and adapt on that base. See [components.md](./components.md) for the API deltas.
**So the MCP's own `docsUrl` and `previewUrl` match your base**, send your `style` to the MCP: add `?style=<your components.json style>` to the ReUI MCP server URL (or set an `X-Reui-Style` header) in your MCP client config - set once, applies to every call. The MCP then resolves docs/preview links to YOUR library (`/docs/components/radix/...`, `/preview/radix/...` for a radix project) instead of the default base; `get_project_context` echoes back the style it currently sees so you can confirm it. Install commands are unaffected (the CLI already installs the right variant). If you notice the MCP returning `base` links for a `radix` project, tell the user to add `?style=` to the server URL.
Blocks adapt to your active theme through semantic tokens and CSS variables - change the theme and every block follows.
## Free vs premium
- **Free, no key:** the 22 components, all `c-*` examples, the ReUI MCP, and this skill.
- **Premium, license required at install:** blocks (Pro or Ultimate), Motion Icons and templates (Ultimate). Set `REUI_LICENSE_KEY` (see [cli.md](./cli.md)).
## Component API index
The canonical index of every component's API docs is **https://reui.io/llms.txt** (returned as `componentsApiUrl` in MCP results). Prefer the inline `api` from `get_component`; use the index/docs as the fallback.
+26
View File
@@ -0,0 +1,26 @@
# Styling (ReUI delta over shadcn)
Follow the shadcn skill for the generic rules (semantic colors not raw values, `gap-*` not `space-y-*`, `size-*`, `cn()`, no manual `dark:` overrides, no overlay `z-index`). This file is only the ReUI-specific additions.
## ReUI extended semantic tokens
ReUI adds semantic tokens beyond shadcn's base set. Use these instead of raw colors for status and emphasis:
- `--success` / `--success-foreground`
- `--info` / `--info-foreground`
- `--warning` / `--warning-foreground`
- `--destructive-foreground` (paired with shadcn's `--destructive`)
- `--invert` / `--invert-foreground` (inverted surfaces)
Use them as Tailwind utilities (`bg-success text-success-foreground`, `text-warning`, ...). They are defined in the project's global CSS and registered with Tailwind (`@theme inline` on v4). If a token is missing in the project, add it to the global CSS file (never a new file) following the same `name` / `name-foreground` convention, exactly as the shadcn customization rules describe.
**Incorrect:** `<span className="text-green-600">Active</span>`
**Correct:** `<Badge variant="success">Active</Badge>` or `<span className="text-success">Active</span>`
## Blocks follow your theme
When you install a block it adapts to your active theme through the semantic tokens above and the project's CSS variables. Don't hardcode style-specific values into installed block code and don't fork it to "restyle" - change the theme via the CSS variables / a preset and every block follows. Want a different look? `search` for a block whose design already fits instead of re-skinning one.
## Density and typography rhythm
ReUI operational UI usually feels dense, not airy. Keep the gap between a title and its supporting description tight by default (`gap-0.5`, `space-y-1`, or `space-y-px`), and smaller than the gap between sections. Match the surrounding ReUI density when you add rows or fields; do not pad operational surfaces like a marketing page.
+54
View File
@@ -0,0 +1,54 @@
# Workflow: find -> install -> read API -> adapt
The core ReUI loop. The MCP tells you what to install and gives you the API; the shadcn CLI installs it; you turn the installed files into correct, themed, data-wired code by **reuse**, not redesign.
## 1. Find (ReUI MCP `search` / `compose_page`)
**Full multi-section page ask?** Call `compose_page(intent, sections?)` FIRST, before searching block-by-block. It returns ordered sections, each with the best block for the intent (top pick + alternates); sections listed in `unavailableSections` have no real inventory - compose those from components, do not force a bad block.
For everything else, call `search` with the user's intent. Pass structured hints whenever you can infer them - you are an LLM, so do the parsing the server cannot:
- `type`: `"component"` (one of the 22 building blocks), `"example"` (a c-\* use-case), `"block"` (a full page/section), `"icon"`.
- `component`: the ReUI component the request implies (`"data-grid"`, `"kanban"`, ...).
- `category`, `features` (e.g. `["sortable","pagination"]`), `free`.
Example: "build a users management page with filters" -> `search({ query: "users management page with filters", type: "block", component: "data-grid", features: ["filters"] })`.
Each result has `install`, `previewUrl`, `docsUrl`, `componentsUsed`, `score`, `termCoverage`, and `whyMatch`. `score` is relative to the top hit (the top is ~100 by construction), not an absolute quality - compare results to each other, and show the user the top options if several score closely; do not silently guess. A low `termCoverage` means a weak match even with a high score - rephrase or widen.
**Always show the preview link.** Whenever you list or recommend items - from `search`, `search_icons`, `list_components`, `compose_page`, or a getter - include each item's `previewUrl` (a live preview page) so the user can SEE it before you install. Blocks and examples link to an individual live preview; icons and components to their live category/component page. This applies to every listing, not only a single pick.
## 2. Install (shadcn CLI)
Run the result's `install` command from the project root, non-interactively:
```bash
npx shadcn@latest add @reui/<name> --yes
```
The CLI reads `components.json`, installs the correct base+style variant, resolves `registryDependencies` (a block pulls in its components), installs npm deps, and rewrites aliases. Do not pass the base/style. See [cli.md](./cli.md).
## 3. Read the API (do not guess props)
Before writing code against any component an item uses:
1. The item's `componentDigests` already give a 1-line contract per component - often enough to wire it. For the full API, call **`get_component(names)`** with ALL of `componentsUsed` in ONE call (it accepts an array) and read each inline `api` - no web fetch. **Share the component's `docsUrl`** (its API documentation page) with the user whenever you work with that component's API, so they have the full reference; the `/llms.txt` index is a further fallback.
2. Call **`get_examples(name)`** for the free `c-*` examples of that component; install one and **read the added files** to copy the exact composition. This is the fastest correct path - the example shows real wiring you adapt, not invent.
3. About to write a prop you did not see in an `api` or installed file? Run **`validate_usage`** BEFORE writing the code - per-prop documented / notDocumented verdicts plus did-you-mean suggestions. notDocumented means read the API, not push on.
## 4. Adapt (reuse-first) - do not skip
Installing files is not the end, and redesigning them defeats the point. First note the project's **base** so you write the right API - read `components.json` -> `style` and take the segment before the first `-` (`base-nova` -> Base UI, `radix-nova` -> Radix UI), see [components.md](./components.md). After `add`:
1. **Read the added files**; keep the composition intact. For a block, verify the components are wired correctly (for `data-grid`: a `useTable({ features: dataGridFeatures, ... })` instance passed as `table`, `recordCount` set - see [components.md](./components.md)).
2. **Replace demo data with the user's real data** via typed structures (see [adapting.md](./adapting.md)).
3. **Fix icon imports** to the project's icon library (see [icons.md](./icons.md)).
4. **Align styling** to semantic tokens and the active theme - no raw colors (see [styling.md](./styling.md)).
5. **Validate before finalizing**: if your adaptation introduced components or props you did not read in an `api` or example, run `validate_usage` on them.
6. **Hit the craft bar** - clear hierarchy, deliberate density, the empty / loading / error states, subtle motion, and mobile-first responsiveness (see [craft.md](./craft.md)). Generic-looking output means you under-reused the design, not that it needs restyling.
7. **Pass the quality gates** (security, a11y, scroll) - call the MCP `get_audit_checklist` tool and clear every item (see [quality.md](./quality.md)).
8. **Typecheck / lint**.
## If no single block fits
Compose from components (`compose_page` tells you which sections have no block inventory via `unavailableSections`). `search` the components you need, read each `get_component` API, install a worked `get_examples` example for each, and assemble by adapting those examples. A block in the same category is a useful reference - install it and read its files to see how ReUI composes those components, then adapt.
+58
View File
@@ -0,0 +1,58 @@
# ReUI MCP: full reference
The ReUI MCP (`https://mcp.reui.io`, Streamable HTTP) is free to use but needs a ReUI account: on first use the agent signs in with ReUI (a free account is created if the user has none), so every request is tied to an account. Free covers components and examples; a Pro or Ultimate license unlocks premium blocks and Motion Icons and removes the daily request limit. It does **discovery + guidance** (search, inline APIs, page planning, validation) and never serves source; the shadcn CLI does **installation**, and the license key lives there (the `@reui` entry in `components.json`, backed by `.env.local`). Goal: from the user's intent to correct, themed, data-wired ReUI code in the **fewest tokens and calls**, with **no guessing**.
## Golden path (token-optimal - follow this order)
Most tasks need 2-4 MCP calls and ZERO web fetches:
1. **`search(query, ...hints)`** -> pick the top 1-3 results. Each result already carries `install`, `previewUrl`, `docsUrl`, `componentsUsed`, `score`, `whyMatch`. The payload is complete - do not call another tool just to "confirm" a result.
2. **`get_component([...componentsUsed])`** in ONE batched call (one name or an array of up to 20) -> read each inline `api`. This **replaces** fetching docs pages. Often skippable: search responses carry `componentDigests`, a compact API contract per referenced component.
3. **`get_examples(component)`** -> install ONE returned `c-*` example, read the added files, copy the composition.
4. **`get_install_command(item)`** only to validate a name you are unsure of (results already include `install`). Run the install with the shadcn CLI (`--yes`).
5. **`get_audit_checklist()`** before declaring done.
If you already know the exact item name, skip `search`. Everything else is situational.
## The 5 task-specific tools (when to reach for each)
- **`compose_page`** - BEFORE building any full page (dashboard, settings, billing, landing). Pass the intent (and optionally the sections you want); it returns ordered sections, each with the best premium block for the intent (top pick + alternates). Sections with no real inventory are listed honestly in `unavailableSections` - compose those from components instead of forcing a bad block.
- **`search_icons`** - whenever you need icons, especially several. Batch up to 24 concepts in one call; each concept returns its best icons with install commands. Pass `animated: true` to get only icons that have a hover-animated Motion variant.
- **`validate_usage`** - BEFORE writing code with component names or props you have not read in an inline `api` or an installed example. It checks planned names + props against the indexed API docs and registry item names; returns did-you-mean suggestions and per-prop documented / notDocumented verdicts. Deterministic, no inference - a notDocumented prop means stop and read the API, not push on.
- **`whats_new`** - when your registry knowledge might be stale (a name 404s, the user mentions an item you don't know). Returns items added/removed per build, newest first.
- **`report_issue`** - when an installed item is actually broken (bad source, wrong dependency, broken preview). Goes straight to the ReUI team; rate-limited 5/hour. Not for usage questions.
## All 19 tools
`search`, `get_block`, `get_example`, `get_icon`, `list_block_groups`, `list_block_categories`, `list_example_categories`, `list_icon_categories`, `list_components`, `get_component`, `get_examples`, `search_icons`, `compose_page`, `validate_usage`, `whats_new`, `report_issue`, `get_install_command`, `get_project_context`, `get_audit_checklist`. The MCP serves the full parameter schemas; do not guess parameters beyond them.
## Token + speed rules
- **Batch `get_component`** - ONE call with the whole `componentsUsed` array, never N calls. Skip it entirely when `componentDigests` already answers the question.
- **Read source by installing** - the MCP serves no source. To read or analyze an item's real code, install it with the shadcn CLI and open the local files. Learn an API from the inline `api` / `componentDigests`, never by reading raw source.
- **Infer `search` hints yourself** (`type`, `component`, `category`, `features`, `free`) - hints shrink the result set and the tokens. Keep `limit` low; one right result beats ten.
- Run independent calls (and the shadcn install) concurrently in one turn - serial tool calls are the main source of slowness.
- Don't repeat a search for the same intent; don't call `list_*` to "see everything" - `search` is the entry point, `list_*` is only for browsing a taxonomy the user explicitly wants to explore.
- Prefer `get_component`'s inline `api` over `docsUrl` / `/llms.txt`. Fetch a web page only as a last resort.
## Result shapes (so you don't re-fetch)
- `score` is 0-100 RELATIVE to the top hit (the top is ~100 by construction), not absolute - compare results to each other.
- `termCoverage` (0-1) is the share of the query the item matched - low means a weak match even if the score looks high; rephrase or widen the search.
- Each result carries `whyMatch`, `install`, docs/preview URLs, and a `free` flag; premium items carry `requiredPlan` (`"pro"` for blocks, `"ultimate"` for icons).
- `componentDigests` is a top-level map: a compact API contract per referenced component - often enough to wire an item without a `get_component` call.
- Icon results and `get_icon` include `animated: true` and `installAnimated` when a hover-animated Motion variant exists (animated: `@reui/icons/animated/<style>/<name>`; static: `@reui/icons/default/<style>/<name>`).
## Error playbook
- **401** - the MCP requires a signed-in ReUI account. The client prompts "Sign in with ReUI" (OAuth) on first use; a free account is created if needed. For headless/CI, pass a personal token (`reui_pat_...`, created at https://reui.io/account/mcp?ref=skill) as `Authorization: Bearer`.
- **403 / locked result** - a valid account but the plan does not cover the item: premium blocks need Pro, Motion Icons need Ultimate. Point to https://reui.io/pricing?ref=skill (upgrade). Free accounts still get all components + examples.
- **429** - rate limited (120 requests/min per IP); back off, honor `Retry-After`.
- **not found** (`found: false`) - use the returned `suggestions`, or `search`; check `whats_new` if you suspect a stale name. Never run a fabricated install command.
## Fallbacks
- No ReUI MCP: `npx shadcn@latest search @reui -q "..."` then `add` (generic, no scoring / inline API).
- The shadcn project's own MCP also works over the `@reui` registry: https://ui.shadcn.com/docs/mcp.
Per-agent MCP setup: https://reui.io/docs/mcp?ref=skill
+1
View File
@@ -0,0 +1 @@
{"version":"0.0.1","configurations":[{"name":"MikrotikManager","runtimeExecutable":"npm","runtimeArgs":["run","dev"],"port":3000,"autoPort":true}]}
+70
View File
@@ -0,0 +1,70 @@
{
"permissions": {
"allow": [
"Bash(npm install *)",
"mcp__Claude_Preview__preview_start",
"Bash(npx tsc *)",
"Bash(npm run *)",
"Bash(curl -s -o /dev/null -w \"%{http_code}\" http://localhost:3000/dashboard)",
"Bash(curl -s -o /dev/null -w '%{http_code}' http://localhost:3000__TRACKED_VAR__)",
"Bash(curl -s -o /dev/null -w '%{http_code}' http://localhost:3001__TRACKED_VAR__)",
"PowerShell(netstat -ano | Select-String \":300\" | Where-Object { $_ -match \"LISTENING\" })",
"Bash(curl -s -o /dev/null -w '%{http_code}' http://localhost:__TRACKED_VAR__/dashboard)",
"Bash(curl -s -o /dev/null -w '%{http_code}' http://localhost:3333__TRACKED_VAR__)",
"Bash(curl -s -o /dev/null -w '%{http_code}' http://localhost:59959__TRACKED_VAR__)",
"WebFetch(domain:git.shx.one)",
"Bash(curl -s \"https://git.shx.one/denozord/router-lists-ui/raw/branch/v5/frontend/src/RouteOptimizerPage.jsx\")",
"Bash(curl -s \"https://git.shx.one/denozord/router-lists-ui/raw/branch/v5/frontend/src/OspfToolsPage.jsx\")",
"Bash(node -e ' *)",
"Bash(powershell -Command \"Get-Item 'C:\\\\Users\\\\shats\\\\.claude\\\\projects\\\\C--Users-shats-Dev-MikrotikManager-3\\\\b1dbd554-4665-40c0-bb5b-19d63bb494a0.jsonl'\")",
"Bash(node -e \"const { createRequire } = require\\('module'\\); const r = createRequire\\(__filename\\); const lucide = r\\('lucide-react'\\); ['SlackIcon','WebhookIcon'].forEach\\(n => console.log\\(n, !!lucide[n]\\)\\)\")",
"mcp__Claude_in_Chrome__tabs_context_mcp",
"Bash(npx eslint *)",
"Bash(grep -E \"^C:\\\\\\\\\\\\\\\\| [0-9]+:[0-9]+ error\")",
"Bash(grep -E \"\\(\\\\\\\\\\\\\\\\.*\\\\.tsx$\\)|\\(error\\)\")",
"Bash(python -c \"import sys,json; data=json.load\\(sys.stdin\\); [print\\(m['ruleId'], m['line'], m['message'][:60]\\) for f in data for m in f['messages'] if m['severity']==2]\")",
"Bash(python -c \"import sys,json; data=json.load\\(sys.stdin\\); [print\\(m['ruleId'], m['line'], m['message'][:80]\\) for f in data for m in f['messages'] if m['severity']==2]\")",
"Bash(npx next *)",
"Bash(dir \"C:\\\\Users\\\\shats\\\\Dev\\\\MikrotikManager-3\\\\app\\\\\\(main\\)\")",
"Bash(Get-ChildItem \"C:\\\\Users\\\\shats\\\\Dev\\\\MikrotikManager-3\\\\app\\\\\\(main\\)\" -Directory)",
"Bash(Select-Object Name)",
"Bash(Sort-Object Name)",
"Bash(awk 'NR>=508 && NR<=730' \"app/\\(main\\)/servers/page.tsx\")",
"Bash(grep -n \"Fragment\\\\|<>\\\\s*$\" \"app/\\(main\\)/filters/page.tsx\")",
"Bash(grep -n \"\\\\.map\\\\|Fragment\\\\|<>\\\\s*$\" \"app/\\(main\\)/ospf/page.tsx\")",
"Bash(grep -v \"//.*console\\\\|ErrorRecord\\\\|console\\\\.error.*err\\\\|any>\\\\|: any\\\\|as any\\\\|any\\\\[\\\\]\\\\|Record<.*any\\\\|Promise<any\")",
"Bash(curl -s http://localhost:8000/api/servers)",
"Bash(curl -s -X POST http://localhost:8000/api/servers/1/poll)",
"Bash(curl -s http://localhost:8000/api/servers/1)",
"Bash(curl -s http://localhost:8000/api/servers/1/snapshots)",
"Bash(curl -s -X DELETE http://localhost:8000/api/servers/1 -w \"\\\\nHTTP %{http_code}\")",
"Bash(curl -s http://localhost:8000/api/servers/999)",
"Bash(curl -s -X POST http://localhost:8000/api/servers -H \"Content-Type: application/json\" -d \"{}\")",
"Bash(curl -s -X POST http://localhost:8000/api/servers/test-connection -H 'Content-Type: application/json' -d '{\"host\":\"192.168.0.254\",\"port\":80,\"useSsl\":false,\"verifySsl\":false,\"apiPath\":\"/rest\",\"username\":\"admin\",\"password\":\"\"}')",
"Bash(curl -s -X POST http://localhost:8000/api/servers -H 'Content-Type: application/json' -d '{\"host\":\"192.168.0.254\",\"port\":80,\"useSsl\":false,\"verifySsl\":false,\"username\":\"admin\",\"password\":\"test123\",\"name\":\"RB5009 Home\",\"type\":\"home-router\",\"site\":\"MSK\",\"country\":\"RU\",\"asn\":\"\",\"comment\":\"Тестовый роутер\",\"enabled\":true}')",
"Bash(python3 -m json.tool)",
"Bash(curl -s -X POST http://localhost:8000/api/servers -H 'Content-Type: application/json' -d '{\"host\":\"192.168.0.254\",\"port\":80,\"useSsl\":false,\"verifySsl\":false,\"username\":\"admin\",\"password\":\"test123\",\"name\":\"RB5009 Home\",\"type\":\"home-router\",\"site\":\"MSK\",\"country\":\"RU\"}')",
"Bash(node -e \"const d=require\\('fs'\\).readFileSync\\('/dev/stdin','utf8'\\); const a=JSON.parse\\(d\\); a.forEach\\(s=>console.log\\(s.id, s.host, s.name\\)\\)\")",
"Bash(curl -s http://localhost:8000/api/bgp/sessions)",
"Bash(curl -s \"http://localhost:8000/api/bgp/sessions/raw/3\")",
"Bash(node -e \"0\")",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://vpsville.msk.rt.shx.su/rest/routing/ospf/neighbor\")",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://vpsville.msk.rt.shx.su/rest/routing/ospf/instance\")",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://vpsville.msk.rt.shx.su/rest/routing/ospf/area\")",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://vpsville.msk.rt.shx.su/rest/routing/ospf/interface-template\")",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://vpsville.msk.rt.shx.su/rest/ip/route?.type=ospf\")",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://vpsville.msk.rt.shx.su/rest/ip/route\")",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://192.168.0.254/rest/routing/ospf/neighbor\")",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://192.168.0.254/rest/routing/ospf/instance\")",
"Bash(curl -s http://localhost:8000/api/ospf/all)",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://192.168.0.254/rest/routing/bfd/session\")",
"Bash(curl -su \"admin:Ifwrbqifwrbq1995\" \"http://vpsville.msk.rt.shx.su/rest/routing/bfd/session\")",
"Bash(node -e \"const j=JSON.parse\\(require\\('fs'\\).readFileSync\\(0,'utf8'\\)\\); console.log\\('bfd:', JSON.stringify\\(j.bfdSessions, null, 2\\)\\)\")",
"Bash(xargs grep *)",
"Bash(npx shadcn@latest add popover --yes)"
]
},
"env": {
"REUI_LICENSE_KEY": "REUI-EAF4-EA40-6C5C-5D86"
}
}
+67
View File
@@ -0,0 +1,67 @@
---
name: reui
description: Use the ReUI registry from your AI agent - find, install, and correctly use ReUI components (the 22 free building blocks like data-grid, kanban, filters), their free examples, premium blocks, and Motion Icons. Applies in any project using ReUI, the @reui registry, REUI_LICENSE_KEY, or any shadcn project where the user asks for premium blocks, data grids, kanban boards, dashboards, or full pages. Pairs with the free ReUI MCP server for live, scored registry search and inline component APIs.
user-invocable: false
allowed-tools: Bash(npx shadcn@latest *), Bash(pnpm dlx shadcn@latest *), Bash(bunx --bun shadcn@latest *)
---
> **ReUI skill version `fe6742e29c`.** If the ReUI MCP's `get_agent_skill` reports a newer `version`, re-run the ReUI installer (see `get_agent_skill` -> `install.recommended`) to update this skill. Cloud/tools-only agents have no local file and always read the latest - they can ignore this.
# ReUI for Agents
ReUI is a shadcn-compatible registry. It ships four things you **reuse** - never redesign:
- **components** - the 22 ReUI building blocks with real APIs: `data-grid`, `kanban`, `filters`, `date-selector`, `tree`, `stepper`, ... (free)
- **examples** - free `c-*` single-pattern use-cases of a component (`c-kanban-1`); install one and read it to see exact composition
- **blocks** - premium full-page sections that compose components (`data-grid-2`, `pricing-page-1`); Pro or Ultimate license at install
- **icons** - Motion Icons in 4 styles, static + hover-animated variants; Ultimate license at install
The skill is free and this MCP is free to use; it just needs a ReUI account. On first use your agent opens a browser "Sign in with ReUI" prompt (a free account is created if you don't have one). Free covers components and examples with a daily request allowance; a Pro or Ultimate license unlocks premium blocks and Motion Icons and removes the limit (see [rules/registry.md](./rules/registry.md)). The same account and skill work in every agent and service the MCP connects to - this skill is agent-agnostic.
Skill + MCP are a team: this skill is the workflow (how to find, install, read the API, and adapt by reuse); the MCP is the live data and the hands (search, get_component, install commands). Your job: find the right item, install it with the shadcn CLI, read its real API, and **adapt by reuse** - wire real data and theme it; do not hand-roll or restyle what ReUI already provides. This skill **layers on the shadcn skill**: follow that for generic rules (spacing, `cn()`, semantic colors, forms); follow this for everything ReUI-specific.
## The core loop (MCP-native)
1. **Find** - call the ReUI MCP `search` tool with the user's intent. It returns a ranked, scored list across components/examples/blocks/icons, each with an `install` command, `previewUrl`, `docsUrl`, and `componentsUsed`. Pass hints (`type`, `component`, `category`, `features`, `free`) when you can infer them.
2. **Install** - run the returned command non-interactively (`npx shadcn@latest add @reui/<name> --yes`). The CLI resolves deps, aliases, and the base/style from `components.json`. See [cli.md](./rules/cli.md).
3. **Read the API (on your base)** - first note your base from `components.json` -> `style` (`base-nova` -> Base UI, `radix-nova` -> Radix UI). For each component an item uses, call `get_component(name)` and read its **inline `api`** (no web fetch); then `get_examples(name)` to install a worked example and copy its composition - the installed files are already in your base. Whenever you work with a component's API, also **share its `docsUrl`** (the primitive's API documentation page) with the user so they have the full reference. See [components.md](./rules/components.md).
4. **Adapt (reuse-first)** - swap demo data for real data, fix icon imports, align tokens. Do not redesign. See [adapting.md](./rules/adapting.md).
**Always show the preview.** Every item a tool returns carries a `previewUrl` (a live preview page). Whenever you list, recommend, or present ReUI items to the user - blocks, components, examples, or icons, whether from `search`, `search_icons`, `list_components`, `compose_page`, or any getter - include each item's `previewUrl` so they can SEE it before installing. Blocks and examples open an individual live preview; icons and components link to their live category/component page. Never present an item without its preview link.
If the ReUI MCP is not configured, fall back to `npx shadcn@latest search @reui -q "..."` then `add` - but the MCP gives scored matches + inline APIs; prefer it.
## Commands
Run ReUI as explicit slash commands (via the ReUI MCP) **or** just ask in plain language - both run the same workflow.
| Command | Invoke | Does |
| ----------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| **build** | `/mcp__reui__build <what>` | Compose a page/section/feature from ReUI: plan → install → read API → adapt → craft → audit. |
| **add** | `/mcp__reui__add <item>` | Find & install one component/example/block/icon and wire it in. |
| **fix** | `/mcp__reui__fix [target]` | Diagnose & fix ReUI usage: wrong/undocumented props, base/radix mismatch, missing states, a11y/scroll. |
| **improve** | `/mcp__reui__improve [target]` | Refine + extend existing ReUI UI to a production-exceptional bar (hierarchy, density, states, responsive, motion). |
Invocation differs slightly per agent (`/mcp__reui__build` in Claude Code/Cursor/Windsurf, `/mcp.reui.build` in VS Code). No command surface? Just describe what you want - this skill drives the identical loop.
## When to reach for ReUI vs plain shadcn
| Need | Reach for |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| A full page or section (dashboard, billing, auth, pricing, settings) | `compose_page` first (plans sections + best blocks), then ReUI **blocks** |
| A data table with sorting/filtering/pagination/virtualization | the **data-grid** component (never hand-roll a `<table>`) |
| A drag-and-drop board | the **kanban** component |
| Advanced column filtering, date range, tree, stepper, ... | the matching ReUI **component** |
| A single generic control already in shadcn (Button, Dialog, Select) | plain **shadcn** |
## Detailed references
- [rules/registry.md](./rules/registry.md) - the four types, the @reui registry, base/radix, free vs premium + license
- [rules/workflow.md](./rules/workflow.md) - the find -> install -> read-API -> adapt loop (most important)
- [rules/components.md](./rules/components.md) - the 22 components, the data-grid contract, base vs radix
- [rules/adapting.md](./rules/adapting.md) - reuse-first: preserve the design (no over-customizing), reuse examples + a block's own elements, real data, don't invent APIs
- [rules/craft.md](./rules/craft.md) - make it exceptional: point of view, hierarchy, density, states, responsive, motion, the bar
- [rules/quality.md](./rules/quality.md) - security, accessibility, and scroll gates (the done gate)
- [rules/styling.md](./rules/styling.md) - ReUI extended tokens, theme adaptation, density
- [rules/icons.md](./rules/icons.md) - portable icons, swapping imports, Motion Icons (static + animated)
- [tools.md](./tools.md) - the ReUI MCP: golden path, the 19 tools, token rules, result shapes, errors
+43
View File
@@ -0,0 +1,43 @@
# Adapting installed ReUI code (reuse-first, no AI slop)
ReUI items ship production-quality. Your job is to **adapt by reuse** - wire real data and fit the app - not to redesign or hand-roll. The output should look like ReUI built it for this product.
## Preserve the design - don't over-customize
The design IS the product. A ReUI block/component encodes senior-designer decisions: spacing, hierarchy, density, color treatment, and component choices. The fastest way to turn a premium block back into generic AI slop is to "improve" its look - so don't.
- Change **data, copy, and props**; keep the **structure and styling** it ships with. Make the **smallest** change that wires the real data. If your diff touches `className` / JSX structure more than data / props, you are over-customizing - stop and reuse.
- Don't swap ReUI components for hand-rolled ones, restructure the layout, re-skin spacing / radius / colors, or add decorative chrome. Let the installed components carry the default spacing, radius, sizing, icon rhythm, density, and state styling; add custom Tailwind only when a component genuinely lacks a contract you need.
- Want a different look? `search` for a block whose design already fits and reuse that - don't restyle this one into a new design.
## Reuse the parts: examples and the block's own elements
- **Examples are building parts.** A free `c-*` example is a correct, single-pattern composition you can reuse. Before composing from scratch, `get_examples(component)`, install the closest one, and reuse its wiring - assemble UI from examples instead of hand-rolling what an example already shows.
- **Reuse a block's own elements.** Need more rows, cards, items, or sections than ship by default? Repeat the block's **existing** element by mapping real data through the same markup - never invent parallel markup that drifts from its design. Need a variant (empty / loading / expanded)? Derive it from an element the block already has.
## Don't invent (read, don't guess)
- Never write a prop, variant value, import path, or `@reui/...` name you didn't read in a component's inline `api`, an installed example, or a `search` result. If you didn't see it, treat it as nonexistent - call `get_component` / `get_examples` / `search` first, or run the MCP `validate_usage` tool to check planned names + props against the docs before writing code.
- If a getter returns `found: false` or `search` returns nothing, say so and fall back (plain shadcn, or ask) - never fabricate an install command or an API.
## What to change vs leave alone
- **Change:** the item's own data, copy, props, and layout to fit the app.
- **Leave alone:** installed component files, hooks, and the shared theme - do not edit vendored ReUI internals; change behavior through props and the documented API.
- Blocks are **portable React** - no `next/link`, `next/image`, or other framework-runtime imports inside them. Keep them portable.
## Demo data -> real data
- Replace every placeholder with the user's real data. Model it as **typed data structures** and **map over arrays** - never duplicate JSX per row/card. Keep small block-specific formatters next to the data.
- Wire the real source (columns, fields, fetch). For `data-grid`, implement the server fetch contract if the user needs server-side data.
- **Type from the component API, derive during render.** Type domain state through the component's own types - e.g. map status to `BadgeProps["variant"]` via a typed `Record<Status, …>` - instead of stringly-typed values. Compute view state during render; don't mirror derived data into `useState`/`useEffect`.
- **Adapt on the right base.** Use the API for the project's base (Base UI vs Radix - see [components.md](./components.md)); the installed files are already base-correct, so reuse their shape rather than translating from memory.
## Believable content (no AI tells)
- Use realistic labels, counts, timestamps, and statuses that map to a real workflow.
- No decorative buttons, fake tabs, meaningless toggles, equal-weight card walls, empty gradients, ornamental icons, or generic SaaS filler. Every element should do something.
## Operational surfaces (settings / profile / admin)
Pick ONE archetype and keep the family consistent: a vertical rail (3-6 sections), horizontal tabs (5-8), or a frame/stack. Prefer `frame` for tool-like surfaces, a card for profile-like ones. Don't mix archetypes in one surface.
+60
View File
@@ -0,0 +1,60 @@
# CLI: registry setup, license, non-interactive install
## Registry setup (one-time, per project)
Free items (the 22 components and all `c-*` examples) need only the plain string registry in `components.json`:
```json
{ "registries": { "@reui": "https://reui.io/r/{style}/{name}.json" } }
```
Premium items (blocks; Motion Icons and templates) require a ReUI license at install:
1. Add the key to `.env.local`:
```bash
REUI_LICENSE_KEY=your-license-key
```
2. Switch `components.json` to the authenticated object form:
```json
{
"registries": {
"@reui": {
"url": "https://reui.io/r/{style}/{name}.json",
"headers": { "Authorization": "Bearer ${REUI_LICENSE_KEY}" }
}
}
}
```
The shadcn CLI expands `${REUI_LICENSE_KEY}` from `.env.local` inside `components.json`, but an MCP client config never expands variables, so a ReUI MCP server config must carry the raw token instead (for example `reui_pat_your_token_here`).
The MCP `get_project_context` tool returns the right config. Full guide: https://reui.io/docs/registry?ref=skill
## Installing
Use the project's package runner (check `packageManager`):
```bash
npx shadcn@latest add @reui/<name> --yes # npm
pnpm dlx shadcn@latest add @reui/<name> --yes # pnpm
bunx --bun shadcn@latest add @reui/<name> --yes # bun
```
`--yes` skips confirmation prompts. The CLI auto-detects the package manager from the lockfile (there is no `--package-manager` flag). It also resolves the correct base+style variant from `components.json`, so do not pass a style.
## Handling prompts and conflicts
- **Always pass `--yes`** so the CLI does not block on confirmation prompts.
- **Do NOT pass `--overwrite` by default.** If the CLI reports an existing file, read the output and resolve deliberately: install under a different name, adjust the path, or ask the user. Only use `--overwrite` when the user explicitly wants to replace a file.
- **Preview first when touching an existing project**: `npx shadcn@latest add @reui/<name> --dry-run` shows what would change; `--diff <file>` shows a specific file's diff. Use these before overwriting.
- Run from the **project root** so `components.json` and `.env.local` are found.
## Free vs premium boundary
- Public, no key: `c-*` examples and the 22 components (`@reui/data-grid`, `@reui/badge`, ...) that those examples depend on.
- Key required at install: blocks (`@reui/<category>-N`) need a Pro or Ultimate license; Motion Icons (`@reui/icons/...`) and templates need Ultimate.
If an install 401/403s, the license key is missing, invalid, or the plan does not cover that resource (blocks: Pro or higher; icons and templates: Ultimate). Point the user to https://reui.io/account?ref=skill (their key) or https://reui.io/pricing?ref=skill (upgrade).
+428
View File
@@ -0,0 +1,428 @@
# ReUI components
The 22 ReUI building blocks: `alert`, `autocomplete`, `badge`, `cascader`, `code-block`, `data-grid`, `date-selector`, `event-calendar`, `filters`, `frame`, `gantt`, `icon-stack`, `icon-tile`, `kanban`, `number-field`, `phone-input`, `rating`, `scrollspy`, `sortable`, `stepper`, `timeline`, `tree`. Examples and blocks are composed from these.
**Rule one: never guess a component's API. Read it first.** Call **`get_component(name)`** for its inline `api` (props + usage, no web fetch), and **share the result's `docsUrl`** (the component's API documentation page) with the user whenever you work with that component's API, so they have the full reference (the `/llms.txt` index is a further fallback). Then call **`get_examples(name)`** to install a worked example and copy real composition. The contracts below are first-try orientation (required props, composition shape, the one gotcha); the inline `api` is the full reference. No single block fits? Compose: search the components you need, read each `get_component`, install a `get_examples` example per component, and adapt.
## data-grid (the flagship - read its API every time)
`data-grid` wraps TanStack Table v9. It is NOT a styled `<table>` and does NOT take `data`/`columns` props directly. The contract:
- Build a TanStack table instance with `useTable({ features: dataGridFeatures, ... })` (columns, data). `dataGridFeatures` is exported by the primitive and already bundles sorting, filtering, pagination, row selection, expanding, pinning, resizing and faceting, so there are no per-table row models to wire.
- Pass that instance to `<DataGrid table={table} recordCount={total}>`.
- Compose the body with `DataGridTable` inside `DataGrid`, and enable features through `tableLayout` (e.g. `{ headerSticky: true, columnsResizable: true }`), not ad-hoc classes.
- Server-side data uses the documented fetch shape (`recordCount` is the total for pagination).
```tsx
const table = useTable({
features: dataGridFeatures,
data,
columns,
})
<DataGrid table={table} recordCount={data.length}>
<DataGridTable />
</DataGrid>
```
Common mistakes:
- **Incorrect:** `<DataGrid data={rows} columns={cols} />` - these props do not exist. **Correct:** build a `useTable({ features: dataGridFeatures, ... })` instance and pass `table={table}` + `recordCount`.
- **Incorrect:** a raw `<table>` / hand-rolled pagination. **Correct:** use `data-grid`; read its API for sticky header, pagination, virtualization, row selection.
- **Incorrect:** styling rows/cells with arbitrary classes. **Correct:** drive layout via `tableLayout` and the primitive's `DataGridColumnMeta` (e.g. `cellClassName`, `headerTitle`), set through the bundle's `columnMeta` slot.
## event-calendar
**Required:** events via `events`/`onEventsChange` (controlled) or `defaultEvents` (uncontrolled), plus a height on the root.
**Shape:**
```tsx
<EventCalendar defaultEvents={events} defaultView="month" className="h-[560px]">
<EventCalendarNav />
<EventCalendarContent />
</EventCalendar>
```
**Gotcha:** headless-first: `EventCalendarContent` renders the active view (month/week/day/days/agenda; a resource view activates when `resources` is passed) - there is no per-view JSX to compose. Events are `{ id, title, start, end (exclusive), allDay?, color?, recurrence?, resourceId? }`. Mutations flow through `onEventUpdate`/`canDropEvent` (return `false` to reject); the root needs an explicit height because it is a min-h-0 flex column.
## gantt
**Required:** `resources` (the left tree) plus bars via `events`/`defaultEvents` attached by `resourceId`.
**Shape:**
```tsx
<Gantt defaultEvents={bars} resources={tasks} defaultScale="month" className="h-[480px]">
<GanttNav />
<GanttView />
</Gantt>
```
**Gotcha:** bars move along the time axis only (never across rows) and are all-day spans with exclusive `end`; `progress` is 0-100. Scales are `day | week | month | quarter | year`. Zoom control, infinite scroll, summary rollups, and row checkboxes are ON by default - turn off what you do not need. Same `onEventUpdate`/`canDropEvent` commit pipeline as `event-calendar`; the root needs an explicit height.
## kanban
**Required:** `value` (`Record<string, T[]>`), `onValueChange`, `getItemValue`
**Shape:**
```tsx
<Kanban value={cols} onValueChange={setCols} getItemValue={(i) => i.id}>
<KanbanBoard>
{Object.entries(cols).map(([id, items]) => (
<KanbanColumn key={id} value={id}>
<KanbanColumnHandle><h3>{id}</h3></KanbanColumnHandle>
<KanbanColumnContent value={id}>
{items.map((i) => (
<KanbanItem key={i.id} value={i.id}>
<KanbanItemHandle>{i.title}</KanbanItemHandle>
</KanbanItem>
))}
</KanbanColumnContent>
</KanbanColumn>
))}
</KanbanBoard>
<KanbanOverlay><div className="bg-muted size-full rounded-md" /></KanbanOverlay>
</Kanban>
```
**Gotcha:** state is `Record<columnId, T[]>`. Each `KanbanColumnContent value` must match its parent `KanbanColumn value`. Omit `KanbanOverlay` and the drag preview silently breaks.
## sortable
**Required:** `value` (`T[]`), `onValueChange`, `getItemValue`
**Shape:**
```tsx
<Sortable value={items} onValueChange={setItems} getItemValue={(i) => i.id}>
{items.map((i) => (
<SortableItem key={i.id} value={i.id}>
<SortableItemHandle><GripVertical /></SortableItemHandle>
{i.label}
</SortableItem>
))}
</Sortable>
```
**Gotcha:** a flat 1D reorder list (not columns - that is `kanban`). `getItemValue` must return a stable, unique string. Pass `layout="grid"` or `layout="nested"` for non-list layouts.
## filters
**Required:** `fields` (`FilterField[]`). The value is ONE `FilterQuery` tree - `query` + `onQueryChange`, or uncontrolled `defaultQuery`.
**Shape:**
```tsx
const fields: FilterField[] = [
{ id: "title", label: "Title", type: "text" },
{
id: "status",
label: "Status",
type: "select",
options: [
{ value: "active", label: "Active" },
{ value: "archived", label: "Archived" },
],
},
]
const [query, setQuery] = useState<FilterQuery>(() => createFilterQuery())
<Filters fields={fields} query={query} onQueryChange={setQuery} />
```
**Gotcha:** the state is a TREE, not a list of chips. `FilterQuery` is a group of rules joined by `and`/`or` and a group may hold another group, so `(A and B) or C` is expressible; a rule is `{ id, type: "rule", path: ["status"], operator, value }` and `path` is the whole nested attribute path, root first. The pre-rewrite API is GONE: there is no `filters`/`onChange` prop, no `FilterFieldConfig` (fields are `FilterField`, nested through their own `fields`, keyed `id` not `key`), and no `createFilter()` - it minted ids inside a pure function and broke hydration, so ids now come from `createFilterIdFactory(seed)` seeded off `useId`, and `createFilterQuery()` / `createFilterRule()` take one. Read the query back with `flattenFilterConditions` (`{ path, field, operator, values, negated }` per rule, incomplete rules skipped) and walk the tree yourself when the parentheses carry meaning - the primitive compiles nothing, no SQL, no query string.
`variant` picks the chrome over that one query: `"basic"`, the default, is the flat chip row for a toolbar over a table; `"advanced"` is the condition builder, hung off a trigger or rendered in place with `advancedMode="inline"`. Both read and write the same tree, so a saved view built in one opens in the other. Other props worth knowing before you hand-roll them: `size` is two rungs, `"sm" | "default"`, resolved per style (there is no `lg`); `reorderable` turns on drag and Alt+Arrow row moves in the builder; `onBeforeQueryChange` is the ONE veto point for every write (return `false` to refuse, it cannot rewrite); `editors` registers custom value editors a field selects by `editor` name; `labels` / `operatorLabels` own every rendered string; `pathCollapse` + `maxPathSegments` shorten deep attribute paths; `renderChip` / `renderValue` / `renderEmpty` replace rendered parts. On a field, `loadOptions` supplies async options with paging and `resolveValues` renders a chip restored from a saved view whose option was never loaded. Pairs naturally with `data-grid`.
## cascader
**Required:** `items` (a tree of `{ value, label, children? }`), plus the panel parts inside `CascaderContent`.
**Shape:**
```tsx
<Cascader items={items} value={value} onValueChange={setValue}>
<CascaderTrigger render={<Button variant="outline" />}>
<CascaderValue placeholder="Select an attribute" />
</CascaderTrigger>
<CascaderContent className="w-80">
<CascaderPanel>
<CascaderNav>
<CascaderBreadcrumb />
<CascaderInput />
</CascaderNav>
<CascaderEmpty />
<CascaderList maxHeight={288}>
<CascaderItems />
</CascaderList>
<CascaderStatus />
</CascaderPanel>
</CascaderContent>
</Cascader>
```
**Gotcha:** pressing a branch NAVIGATES, it does not select - only leaves are selectable until you pass `selectable="any"` or a predicate, and once a branch is selectable its chevron becomes the only way to open it. `CascaderInput` must stay inside `CascaderContent` (Base UI refills the query from the selection when the input sits outside the popup). Always include `CascaderStatus`: it is the live region announcing level changes, which the visual breadcrumb does not provide to screen readers. Accepts a flat adjacency list via `getParent` as well as nested `children`. `searchScope="deep"` searches every level and annotates results with their path; `multiple` gives checkbox rows; `inline` + a bare `CascaderPanel` embeds it with no popover.
The shape above is `mode="drill"`, the default. `mode="tree"` keeps the same parts (drop `CascaderBreadcrumb`, pass `showBack={false}`, drive expansion with `expanded`/`onExpandedChange`); `mode="columns"` REPLACES `CascaderList` + `CascaderItems` with a single `CascaderColumns`, and has no breadcrumb. Other props worth knowing before you hand-roll them: `cascade` (multi-select only, parent/child selection with indeterminate branches - pair it with `selectable="any"`, since a leaf-only tree can never cascade), `indicator={false}` to drop the single-select check and its gutter (visual only, no-op with `multiple`), `virtualize`/`virtualizeThreshold` plus `CascaderVirtualItems` for long levels, and `getChildren` for async levels with cursor paging, retry on failure and optional `prefetch`. `CascaderFooter` pins commands below the list (`actions` is the quick path) and `CascaderSubmenu` opens one as a side-anchored flyout with the full menu keyboard model. To head a run of rows use `CascaderGroup` wrapping a `CascaderLabel` - a bare label inside a listbox names nothing and is dropped from the accessibility tree - and `CascaderSeparator` for the rule between runs. Every rendered string comes from `labels`, and the panel is RTL-correct under a `DirectionProvider` or `dir="rtl"`.
## date-selector
**Required:** none, but wire `onChange` to capture the value.
**Shape:**
```tsx
const [value, setValue] = useState<DateSelectorValue | undefined>()
<DateSelector value={value} onChange={setValue} label="Due date" />
```
**Gotcha:** the value is a structured `DateSelectorValue` (period / operator / start+end dates), NOT a `Date` - never pass a raw `Date`. Use `allowRange={false}` to lock single-date picking. Read `get_component("date-selector")` for the value shape.
## tree
**Required:** `tree` (a `@headless-tree/core` instance you construct)
**Shape:**
```tsx
<Tree tree={tree}>
{tree.getItems().map((item) => (
<TreeItem key={item.getId()} item={item}>
<TreeItemLabel />
</TreeItem>
))}
</Tree>
```
**Gotcha:** `Tree` is a styled shell - it takes a headless-tree instance via `tree`, NOT `data`/`items` props. Build the instance with `@headless-tree/react`. External API: https://headless-tree.lukasbach.com/
## stepper
**Required:** `StepperItem step` (number), `StepperContent value` (number)
**Shape:**
```tsx
<Stepper defaultValue={1}>
<StepperNav>
<StepperItem step={1}>
<StepperTrigger><StepperIndicator>1</StepperIndicator></StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem step={2}>
<StepperTrigger><StepperIndicator>2</StepperIndicator></StepperTrigger>
</StepperItem>
</StepperNav>
<StepperPanel>
<StepperContent value={1}>Step 1 content</StepperContent>
<StepperContent value={2}>Step 2 content</StepperContent>
</StepperPanel>
</Stepper>
```
**Gotcha:** steps are 1-indexed. Without `StepperPanel` + `StepperContent` you render the nav trail but no body. Put `StepperSeparator` in every `StepperItem` except the last.
## timeline
**Required:** `TimelineItem step` (number)
**Shape:**
```tsx
<Timeline>
<TimelineItem step={1}>
<TimelineHeader>
<TimelineDate>March 2024</TimelineDate>
<TimelineTitle>Project initialized</TimelineTitle>
</TimelineHeader>
<TimelineIndicator />
<TimelineSeparator />
<TimelineContent>Repo and architecture set up.</TimelineContent>
</TimelineItem>
</Timeline>
```
**Gotcha:** each item needs a unique `step`. `orientation` is `"vertical"` (default) or `"horizontal"`. This is a static event display, not interactive like `stepper`.
## autocomplete
**Required:** `items` (array; each item has at least `value`)
**Shape:**
```tsx
<Autocomplete items={items}>
<AutocompleteInput placeholder="Search..." />
<AutocompleteContent>
<AutocompleteEmpty>No results found.</AutocompleteEmpty>
<AutocompleteList>
{(item) => (
<AutocompleteItem key={item.value} value={item}>{item.label}</AutocompleteItem>
)}
</AutocompleteList>
</AutocompleteContent>
</Autocomplete>
```
**Gotcha:** `AutocompleteList` takes a render-prop `(item) => ReactNode`, NOT a mapped array of children. External API: https://base-ui.com/react/components/autocomplete
## phone-input
**Required:** none, but wire `onChange`.
**Shape:**
```tsx
<PhoneInput placeholder="Enter phone number" defaultCountry="US" value={value} onChange={setValue} />
```
**Gotcha:** `value`/`onChange` use an E.164 string (e.g. `"+14155551234"`), not a display-formatted string; `onChange` can fire `undefined`. `defaultCountry` is a 2-letter ISO code. Wraps `react-phone-number-input`.
## number-field
**Required:** wrap the controls in `NumberFieldGroup`.
**Shape:**
```tsx
<NumberField defaultValue={0}>
<NumberFieldScrubArea label="Quantity" />
<NumberFieldGroup>
<NumberFieldDecrement />
<NumberFieldInput />
<NumberFieldIncrement />
</NumberFieldGroup>
</NumberField>
```
**Gotcha:** import from `@/components/ui/number-field`. The accessible label goes on `NumberFieldScrubArea`, not `NumberField`. External API: https://base-ui.com/react/components/number-field
## rating
**Required:** `rating` (number)
**Shape:**
```tsx
<Rating rating={4.5} showValue editable onRatingChange={setRating} />
```
**Gotcha:** supports decimals (partial stars). Pass `editable` + `onRatingChange` for interactive input; omit both for a read-only display.
## scrollspy
**Required:** `targetRef` (the scroll container ref)
**Shape:**
```tsx
<Scrollspy targetRef={containerRef}>
<a href="#s1" data-scrollspy-anchor="s1">Section 1</a>
<a href="#s2" data-scrollspy-anchor="s2">Section 2</a>
</Scrollspy>
<div ref={containerRef}>
<div id="s1">...</div>
<div id="s2">...</div>
</div>
```
**Gotcha:** each link's `data-scrollspy-anchor` must match a section `id`. `targetRef` is the scrollable container (defaults to the window).
## frame
**Required:** `Frame` > `FramePanel`
**Shape:**
```tsx
<Frame>
<FramePanel>
<FrameHeader>
<FrameTitle>Title</FrameTitle>
<FrameDescription>Description</FrameDescription>
</FrameHeader>
<div className="p-5">Content</div>
<FrameFooter>Footer</FrameFooter>
</FramePanel>
</Frame>
```
**Gotcha:** a structured card shell for tool-like surfaces. `stacked` connects multiple panels with shared borders; `dense` removes panel padding; radius via the `--frame-radius` CSS variable.
## icon-stack
**Required:** one child icon
**Shape:**
```tsx
<IconStack aria-hidden="true">
<InboxIcon className="size-4" />
</IconStack>
```
**Gotcha:** isometric layered artwork for empty states and illustrations; style the inner icon via its own `className`. Mark purely decorative stacks `aria-hidden="true"` and keep the real label in surrounding copy.
## icon-tile
**Required:** one child icon
**Shape:**
```tsx
<IconTile variant="elevated" size="lg">
<PackageIcon />
</IconTile>
```
**Gotcha:** the square container an icon sits in, so every list row, feature card and empty state shares one affordance. `variant`: `outline` (default) | `elevated` (muted fill, raised ring) | `soft` (tinted nested, tone from currentColor) | `solid` (filled tone, contrasting glyph) | `frame` (double container). `soft` and `solid` retint from one text color class (they default to `text-primary`). `size`: `xs | sm | default | lg | xl` (24/32/40/48/64px tile, glyph scales 12/14/16/20/24px). `radius`: `default | full`. Do not set a `size-*` class on the child icon unless you mean to override the tile's glyph size; recolor with `className` on the tile, not the icon.
## code-block
**Required:** `code` + `language`, or pre-highlighted `lines`.
**Shape:**
```tsx
<CodeBlock code={code} language="tsx" />
<CodeBlock code={code} language="tsx" showLineNumbers maxLines={20}>
<CodeBlockHeader>
<CodeBlockTitle>use-totals.ts</CodeBlockTitle>
<CodeBlockLanguage />
<CodeBlockCopyButton className="ml-auto" />
</CodeBlockHeader>
<CodeBlockExpandButton />
</CodeBlock>
```
**Gotcha:** the one-liner is already a complete block; every child (header, title, language label, copy button, wrap toggle, expand button, line actions) is optional chrome, at any depth. Shiki is the only npm dependency and loads lazily, one chunk per language, on first highlight; `lines` (from `highlightCode` in `code-block-highlight`, which is server-safe and has no `"use client"`) or `highlight={false}` loads nothing at all. `maxLines` caps the height AND marks the block collapsible, which is what makes `CodeBlockExpandButton` appear. Use `variant="ghost"` when the block sits inside a surface that already has a border.
## alert
**Required:** `Alert` > `AlertTitle`
**Shape:**
```tsx
<Alert variant="success">
<ShieldCheckIcon />
<AlertTitle>Security update</AlertTitle>
<AlertDescription>Enable two-factor authentication.</AlertDescription>
<AlertAction><Button size="xs">Update</Button></AlertAction>
</Alert>
```
**Gotcha:** shadcn-compatible API. `variant`: `default | destructive | info | success | warning | invert`. The non-default variants use ReUI extended color tokens (`--success`/`--info`/`--warning`/`--invert`), which the install adds. Defer generic alert rules to the shadcn skill.
## badge
**Required:** none (text child).
**Shape:**
```tsx
<Badge variant="success-light" size="sm">Success</Badge>
<Badge variant="outline" radius="full">Pill</Badge>
```
**Gotcha:** shadcn-compatible. Rich `variant` set (solid, `-outline`, `-light` per color), `size` `xs..xl`, `radius` `default | full`. Like `alert`, the color variants rely on ReUI extended tokens. Prefer `Badge` variants over raw color classes for statuses.
## base vs radix - write for the project's base
ReUI ships every component in two builds: `base` (Base UI) and `radix` (Radix UI). The install command and name are identical, and the CLI installs the build matching the project. But you must write/adapt code against the **right base**, because their APIs differ.
**Detect the base first.** Read `components.json` -> `style` and take the segment before the first `-`:
- `"style": "base-nova"` -> **Base UI**
- `"style": "radix-nova"` -> **Radix UI**
**Then use that base's API.** The deltas mirror shadcn's base-vs-radix split:
- Slot/composition: Base UI `render={<… />}` vs Radix `asChild`.
- `Select`: Base UI takes `items`; Radix uses `<SelectItem>` children.
- `ToggleGroup`: Base UI `multiple` boolean vs Radix `type="single" | "multiple"`.
The safest path is to **read the installed files and `c-*` examples** - they're already in your base, so reuse their wiring instead of guessing. When `get_component`'s inline `api` or an example shows the other base's shape, translate it to your base (or `validate_usage` to confirm). Defer the generic base/radix mechanics to the shadcn skill.
+45
View File
@@ -0,0 +1,45 @@
# Craft: make ReUI UI exceptional, not generic
ReUI items ship senior-designer quality. Your adaptation has to hold that bar, so the result reads like a real product surface a team would keep - not a wireframe an AI generated. Use these alongside the reuse rules in [adapting.md](./adapting.md).
## Have a point of view
Pick an emotional register before you compose - calm, operational, premium, editorial, dense, energetic - and let layout, spacing, surface treatment, and icon behavior all reinforce it. One or two memorable decisions and restraint everywhere else beats ten generic ones. UI with no point of view reads as generated.
## Brutally clear hierarchy
One focal point per card or panel: the dominant metric or task first, its label second, supporting detail third. The first thing the eye lands on should be the right thing; secondary text must read as secondary. Borders, separators, and surfaces do real work to create 2-3 information bands - don't flatten everything to equal weight.
## Spacing rhythm and deliberate density
Gaps are a signal, not a default. Keep them intentional and consistent within a family (`gap-1`/`gap-2` for tight operational rows, larger gaps for section breaks), and smaller within a group than between groups. Match the surrounding ReUI density; don't pad an operational surface like a marketing page, and don't drift density mid-section. The composition should still feel authored in grayscale.
## Cover the real states (the usual miss)
A surface isn't done at the happy path. Compose, and wire:
- **Empty** - a purposeful empty state (short message + the primary action), never a blank panel.
- **Loading** - a **skeleton** that matches the real layout, not a centered spinner.
- **Error** - an inline, recoverable error with a retry, announced via `role="status"`/`aria-live`.
Derive these from an element the block already has (don't invent parallel markup), or `get_examples` for a state-specific example.
## Responsive by default
Mobile-first, not mobile-afterthought. In constrained rows/cards/sidebars, put `min-w-0` on the shrinking container and `truncate` long single-line labels; protect the primary label's width and let secondary content compress. Reflow layouts (multi-column -> single column) rather than just shrinking them. Desktop and mobile should both look designed.
## Motion, subtly
Motion should clarify, not decorate. Use ReUI Motion Icons on primary actions for a subtle hover cue; keep transitions short (~200-300ms) with calm easing; prefer a skeleton pulse over a spinner. No bouncing, no gratuitous entrance animations on every element.
## Real, activated content
Use believable, typed data (realistic labels, counts, timestamps, statuses that map to a real workflow) - never lorem or abstract filler. Every visible control does something: no decorative buttons, fake tabs, meaningless toggles, or stats with no job. It must still hold with long names, empty values, and crowded data.
## Avoid the AI tells
These instantly read as generated - don't ship them: equal-weight card walls, empty gradients, repetitive padding everywhere, generic enterprise copy, ornamental icons, and number tiles that don't earn their place.
## The bar
Before you finish, ask: **would a product team keep this instead of replacing it? Does it still feel strong after swapping in real content?** If not, reuse the shipped ReUI design harder - don't restyle it into something new - then run the [quality.md](./quality.md) gates.
+39
View File
@@ -0,0 +1,39 @@
# Icons (ReUI delta over shadcn)
Follow the shadcn icon rules (use the project's configured `iconLibrary`, `data-icon` on icons inside `Button`, no sizing classes on icons inside components, pass icons as component objects not string keys). ReUI adds the following.
## Portable icons (library-agnostic)
ReUI components, examples, and blocks are authored to be icon-library-agnostic. When `iconLibrary` is set in `components.json`, the shadcn CLI installs each item's icons in **your** library automatically - you swap nothing. If an installed item's icons don't match your project (for example `iconLibrary` isn't set, so they came in from the item's demo library), change the **import source and component name** to your library, keeping the same icon-name semantics:
- `lucide` -> `lucide-react`
- `tabler` -> `@tabler/icons-react`
- `phosphor` -> `@phosphor-icons/react`
- `remix` -> `@remixicon/react`
- `hugeicons` -> `@hugeicons/react`
Don't assume `lucide-react`; read `iconLibrary` from `components.json`.
## Keep icons purposeful
Icons support the hierarchy, they don't replace it: keep them small, matched to the surrounding density, and decorative ones `aria-hidden="true"` (an icon-only control still needs an accessible label on the control). Don't add ornamental icons that do no job.
## Motion Icons (the `@reui/icons/...` set)
ReUI ships its own icon set in 4 styles (outline, solid, duotone, filled), each icon in two variants:
```bash
npx shadcn@latest add @reui/icons/default/<style>/<name> --yes # static
npx shadcn@latest add @reui/icons/animated/<style>/<name> --yes # hover-animated (motion/react)
```
Finding them via the MCP is free; installing requires an Ultimate license (`REUI_LICENSE_KEY`, see [cli.md](./cli.md)). Reach for a Motion Icon on a primary action when a subtle hover cue helps; keep motion restrained.
Finding icons:
- Several icons (the common case): **`search_icons(concepts[])`** - up to 24 concepts in one call, the best icons per concept with install commands. Pass `animated: true` to get only icons with a hover-animated Motion variant.
- One icon: `search` with `type: "icon"`.
- Icon results and `get_icon` carry `animated: true` and `installAnimated` when an animated variant exists - use those install strings, do not construct paths by hand.
- Every icon result carries a `previewUrl` (its live icon-category page) - **share it with the user** so they can SEE the icon before installing.
The `icon-stack` component composes multiple icons into a stacked display.
+22
View File
@@ -0,0 +1,22 @@
# Quality gates (security, accessibility, scroll)
These are the **done gate**, not a nice-to-have: before you call any ReUI work finished, call the MCP `get_audit_checklist` tool and pass every item below (plus the craft bar in [craft.md](./craft.md)). Then typecheck and lint.
## Security
- Never `dangerouslySetInnerHTML`. Render data as text/components.
- External links (`target="_blank"`) must always pair `rel="noopener noreferrer"`.
- No real PII, secrets, or tokens in demo or committed code. Remote media only from sources the project already allows.
## Accessibility
- Implicit list/card items that navigate get real anchors with a standard hover affordance.
- Icon-only or numeric buttons need an `aria-label`; decorative icons get `aria-hidden`.
- Every non-submit button is `type="button"`.
- Keyboard + focus: everything interactive is reachable in a sensible Tab order with a visible focus ring; layers (dialogs/sheets/menus) trap focus and close on `Escape`. ReUI components ship standard keyboard behavior - read each component's inline `api` rather than re-implementing it.
- Announce async UI: loading and error messages use `role="status"` / `aria-live` so they're not silent to screen readers.
## Scroll mechanics
- Make scroll regions with a parent-owned height: a `min-h-0` + flex chain down to the scroll container. Never guess a `max-h`.
- The scroll container owns `overflow-auto`; ancestors stay `min-h-0` so the height resolves.
+35
View File
@@ -0,0 +1,35 @@
# ReUI registry structure
ReUI is a shadcn-compatible registry with four entity types. **Examples and blocks are built FROM components** - reuse them, don't rebuild.
- **component** - one of the 22 ReUI building blocks with a real API (`data-grid`, `kanban`, `filters`, `date-selector`, `tree`, ...). Install directly (`@reui/data-grid`) or let it come in as a dependency of an example/block. Free. Read its API with `get_component(name)`.
- **example** - a free `c-*` single-pattern use-case of a component (`c-kanban-1`, `c-data-grid-3`). Install one and read it to copy real composition. Find a component's examples with `get_examples(name)`.
- **block** - a premium, full-page section that composes several components (`data-grid-2`, `pricing-page-1`). Pro or Ultimate license at install. Adapts to your active theme via semantic tokens.
- **icon** - Motion Icons in 4 styles (outline, solid, duotone, filled), static (`@reui/icons/default/<style>/<name>`) and hover-animated (`@reui/icons/animated/<style>/<name>`). Ultimate license at install. See [icons.md](./icons.md).
## The @reui registry
Install everything through the shadcn CLI: `npx shadcn@latest add @reui/<name> --yes`. The CLI reads the `@reui` registry from the project's `components.json`. Free items need only the plain string form:
```json
{ "registries": { "@reui": "https://reui.io/r/{style}/{name}.json" } }
```
Premium installs need the authenticated form + `REUI_LICENSE_KEY` in `.env.local` - see [cli.md](./cli.md). The MCP `get_project_context` tool returns the right config.
## Know your base: base or radix
ReUI ships every item in two builds - `base` (Base UI) and `radix` (Radix UI) - with mirrored names. The CLI installs the build matching your project automatically, but **you must write code against the right base's API**. Detect it from `components.json` -> `style`: the segment before the first `-` is the base (`base-nova` -> Base UI, `radix-nova` -> Radix UI). The installed files and `c-*` examples are already in your base - read them and adapt on that base. See [components.md](./components.md) for the API deltas.
**So the MCP's own `docsUrl` and `previewUrl` match your base**, send your `style` to the MCP: add `?style=<your components.json style>` to the ReUI MCP server URL (or set an `X-Reui-Style` header) in your MCP client config - set once, applies to every call. The MCP then resolves docs/preview links to YOUR library (`/docs/components/radix/...`, `/preview/radix/...` for a radix project) instead of the default base; `get_project_context` echoes back the style it currently sees so you can confirm it. Install commands are unaffected (the CLI already installs the right variant). If you notice the MCP returning `base` links for a `radix` project, tell the user to add `?style=` to the server URL.
Blocks adapt to your active theme through semantic tokens and CSS variables - change the theme and every block follows.
## Free vs premium
- **Free, no key:** the 22 components, all `c-*` examples, the ReUI MCP, and this skill.
- **Premium, license required at install:** blocks (Pro or Ultimate), Motion Icons and templates (Ultimate). Set `REUI_LICENSE_KEY` (see [cli.md](./cli.md)).
## Component API index
The canonical index of every component's API docs is **https://reui.io/llms.txt** (returned as `componentsApiUrl` in MCP results). Prefer the inline `api` from `get_component`; use the index/docs as the fallback.
+26
View File
@@ -0,0 +1,26 @@
# Styling (ReUI delta over shadcn)
Follow the shadcn skill for the generic rules (semantic colors not raw values, `gap-*` not `space-y-*`, `size-*`, `cn()`, no manual `dark:` overrides, no overlay `z-index`). This file is only the ReUI-specific additions.
## ReUI extended semantic tokens
ReUI adds semantic tokens beyond shadcn's base set. Use these instead of raw colors for status and emphasis:
- `--success` / `--success-foreground`
- `--info` / `--info-foreground`
- `--warning` / `--warning-foreground`
- `--destructive-foreground` (paired with shadcn's `--destructive`)
- `--invert` / `--invert-foreground` (inverted surfaces)
Use them as Tailwind utilities (`bg-success text-success-foreground`, `text-warning`, ...). They are defined in the project's global CSS and registered with Tailwind (`@theme inline` on v4). If a token is missing in the project, add it to the global CSS file (never a new file) following the same `name` / `name-foreground` convention, exactly as the shadcn customization rules describe.
**Incorrect:** `<span className="text-green-600">Active</span>`
**Correct:** `<Badge variant="success">Active</Badge>` or `<span className="text-success">Active</span>`
## Blocks follow your theme
When you install a block it adapts to your active theme through the semantic tokens above and the project's CSS variables. Don't hardcode style-specific values into installed block code and don't fork it to "restyle" - change the theme via the CSS variables / a preset and every block follows. Want a different look? `search` for a block whose design already fits instead of re-skinning one.
## Density and typography rhythm
ReUI operational UI usually feels dense, not airy. Keep the gap between a title and its supporting description tight by default (`gap-0.5`, `space-y-1`, or `space-y-px`), and smaller than the gap between sections. Match the surrounding ReUI density when you add rows or fields; do not pad operational surfaces like a marketing page.
+54
View File
@@ -0,0 +1,54 @@
# Workflow: find -> install -> read API -> adapt
The core ReUI loop. The MCP tells you what to install and gives you the API; the shadcn CLI installs it; you turn the installed files into correct, themed, data-wired code by **reuse**, not redesign.
## 1. Find (ReUI MCP `search` / `compose_page`)
**Full multi-section page ask?** Call `compose_page(intent, sections?)` FIRST, before searching block-by-block. It returns ordered sections, each with the best block for the intent (top pick + alternates); sections listed in `unavailableSections` have no real inventory - compose those from components, do not force a bad block.
For everything else, call `search` with the user's intent. Pass structured hints whenever you can infer them - you are an LLM, so do the parsing the server cannot:
- `type`: `"component"` (one of the 22 building blocks), `"example"` (a c-\* use-case), `"block"` (a full page/section), `"icon"`.
- `component`: the ReUI component the request implies (`"data-grid"`, `"kanban"`, ...).
- `category`, `features` (e.g. `["sortable","pagination"]`), `free`.
Example: "build a users management page with filters" -> `search({ query: "users management page with filters", type: "block", component: "data-grid", features: ["filters"] })`.
Each result has `install`, `previewUrl`, `docsUrl`, `componentsUsed`, `score`, `termCoverage`, and `whyMatch`. `score` is relative to the top hit (the top is ~100 by construction), not an absolute quality - compare results to each other, and show the user the top options if several score closely; do not silently guess. A low `termCoverage` means a weak match even with a high score - rephrase or widen.
**Always show the preview link.** Whenever you list or recommend items - from `search`, `search_icons`, `list_components`, `compose_page`, or a getter - include each item's `previewUrl` (a live preview page) so the user can SEE it before you install. Blocks and examples link to an individual live preview; icons and components to their live category/component page. This applies to every listing, not only a single pick.
## 2. Install (shadcn CLI)
Run the result's `install` command from the project root, non-interactively:
```bash
npx shadcn@latest add @reui/<name> --yes
```
The CLI reads `components.json`, installs the correct base+style variant, resolves `registryDependencies` (a block pulls in its components), installs npm deps, and rewrites aliases. Do not pass the base/style. See [cli.md](./cli.md).
## 3. Read the API (do not guess props)
Before writing code against any component an item uses:
1. The item's `componentDigests` already give a 1-line contract per component - often enough to wire it. For the full API, call **`get_component(names)`** with ALL of `componentsUsed` in ONE call (it accepts an array) and read each inline `api` - no web fetch. **Share the component's `docsUrl`** (its API documentation page) with the user whenever you work with that component's API, so they have the full reference; the `/llms.txt` index is a further fallback.
2. Call **`get_examples(name)`** for the free `c-*` examples of that component; install one and **read the added files** to copy the exact composition. This is the fastest correct path - the example shows real wiring you adapt, not invent.
3. About to write a prop you did not see in an `api` or installed file? Run **`validate_usage`** BEFORE writing the code - per-prop documented / notDocumented verdicts plus did-you-mean suggestions. notDocumented means read the API, not push on.
## 4. Adapt (reuse-first) - do not skip
Installing files is not the end, and redesigning them defeats the point. First note the project's **base** so you write the right API - read `components.json` -> `style` and take the segment before the first `-` (`base-nova` -> Base UI, `radix-nova` -> Radix UI), see [components.md](./components.md). After `add`:
1. **Read the added files**; keep the composition intact. For a block, verify the components are wired correctly (for `data-grid`: a `useTable({ features: dataGridFeatures, ... })` instance passed as `table`, `recordCount` set - see [components.md](./components.md)).
2. **Replace demo data with the user's real data** via typed structures (see [adapting.md](./adapting.md)).
3. **Fix icon imports** to the project's icon library (see [icons.md](./icons.md)).
4. **Align styling** to semantic tokens and the active theme - no raw colors (see [styling.md](./styling.md)).
5. **Validate before finalizing**: if your adaptation introduced components or props you did not read in an `api` or example, run `validate_usage` on them.
6. **Hit the craft bar** - clear hierarchy, deliberate density, the empty / loading / error states, subtle motion, and mobile-first responsiveness (see [craft.md](./craft.md)). Generic-looking output means you under-reused the design, not that it needs restyling.
7. **Pass the quality gates** (security, a11y, scroll) - call the MCP `get_audit_checklist` tool and clear every item (see [quality.md](./quality.md)).
8. **Typecheck / lint**.
## If no single block fits
Compose from components (`compose_page` tells you which sections have no block inventory via `unavailableSections`). `search` the components you need, read each `get_component` API, install a worked `get_examples` example for each, and assemble by adapting those examples. A block in the same category is a useful reference - install it and read its files to see how ReUI composes those components, then adapt.
+58
View File
@@ -0,0 +1,58 @@
# ReUI MCP: full reference
The ReUI MCP (`https://mcp.reui.io`, Streamable HTTP) is free to use but needs a ReUI account: on first use the agent signs in with ReUI (a free account is created if the user has none), so every request is tied to an account. Free covers components and examples; a Pro or Ultimate license unlocks premium blocks and Motion Icons and removes the daily request limit. It does **discovery + guidance** (search, inline APIs, page planning, validation) and never serves source; the shadcn CLI does **installation**, and the license key lives there (the `@reui` entry in `components.json`, backed by `.env.local`). Goal: from the user's intent to correct, themed, data-wired ReUI code in the **fewest tokens and calls**, with **no guessing**.
## Golden path (token-optimal - follow this order)
Most tasks need 2-4 MCP calls and ZERO web fetches:
1. **`search(query, ...hints)`** -> pick the top 1-3 results. Each result already carries `install`, `previewUrl`, `docsUrl`, `componentsUsed`, `score`, `whyMatch`. The payload is complete - do not call another tool just to "confirm" a result.
2. **`get_component([...componentsUsed])`** in ONE batched call (one name or an array of up to 20) -> read each inline `api`. This **replaces** fetching docs pages. Often skippable: search responses carry `componentDigests`, a compact API contract per referenced component.
3. **`get_examples(component)`** -> install ONE returned `c-*` example, read the added files, copy the composition.
4. **`get_install_command(item)`** only to validate a name you are unsure of (results already include `install`). Run the install with the shadcn CLI (`--yes`).
5. **`get_audit_checklist()`** before declaring done.
If you already know the exact item name, skip `search`. Everything else is situational.
## The 5 task-specific tools (when to reach for each)
- **`compose_page`** - BEFORE building any full page (dashboard, settings, billing, landing). Pass the intent (and optionally the sections you want); it returns ordered sections, each with the best premium block for the intent (top pick + alternates). Sections with no real inventory are listed honestly in `unavailableSections` - compose those from components instead of forcing a bad block.
- **`search_icons`** - whenever you need icons, especially several. Batch up to 24 concepts in one call; each concept returns its best icons with install commands. Pass `animated: true` to get only icons that have a hover-animated Motion variant.
- **`validate_usage`** - BEFORE writing code with component names or props you have not read in an inline `api` or an installed example. It checks planned names + props against the indexed API docs and registry item names; returns did-you-mean suggestions and per-prop documented / notDocumented verdicts. Deterministic, no inference - a notDocumented prop means stop and read the API, not push on.
- **`whats_new`** - when your registry knowledge might be stale (a name 404s, the user mentions an item you don't know). Returns items added/removed per build, newest first.
- **`report_issue`** - when an installed item is actually broken (bad source, wrong dependency, broken preview). Goes straight to the ReUI team; rate-limited 5/hour. Not for usage questions.
## All 19 tools
`search`, `get_block`, `get_example`, `get_icon`, `list_block_groups`, `list_block_categories`, `list_example_categories`, `list_icon_categories`, `list_components`, `get_component`, `get_examples`, `search_icons`, `compose_page`, `validate_usage`, `whats_new`, `report_issue`, `get_install_command`, `get_project_context`, `get_audit_checklist`. The MCP serves the full parameter schemas; do not guess parameters beyond them.
## Token + speed rules
- **Batch `get_component`** - ONE call with the whole `componentsUsed` array, never N calls. Skip it entirely when `componentDigests` already answers the question.
- **Read source by installing** - the MCP serves no source. To read or analyze an item's real code, install it with the shadcn CLI and open the local files. Learn an API from the inline `api` / `componentDigests`, never by reading raw source.
- **Infer `search` hints yourself** (`type`, `component`, `category`, `features`, `free`) - hints shrink the result set and the tokens. Keep `limit` low; one right result beats ten.
- Run independent calls (and the shadcn install) concurrently in one turn - serial tool calls are the main source of slowness.
- Don't repeat a search for the same intent; don't call `list_*` to "see everything" - `search` is the entry point, `list_*` is only for browsing a taxonomy the user explicitly wants to explore.
- Prefer `get_component`'s inline `api` over `docsUrl` / `/llms.txt`. Fetch a web page only as a last resort.
## Result shapes (so you don't re-fetch)
- `score` is 0-100 RELATIVE to the top hit (the top is ~100 by construction), not absolute - compare results to each other.
- `termCoverage` (0-1) is the share of the query the item matched - low means a weak match even if the score looks high; rephrase or widen the search.
- Each result carries `whyMatch`, `install`, docs/preview URLs, and a `free` flag; premium items carry `requiredPlan` (`"pro"` for blocks, `"ultimate"` for icons).
- `componentDigests` is a top-level map: a compact API contract per referenced component - often enough to wire an item without a `get_component` call.
- Icon results and `get_icon` include `animated: true` and `installAnimated` when a hover-animated Motion variant exists (animated: `@reui/icons/animated/<style>/<name>`; static: `@reui/icons/default/<style>/<name>`).
## Error playbook
- **401** - the MCP requires a signed-in ReUI account. The client prompts "Sign in with ReUI" (OAuth) on first use; a free account is created if needed. For headless/CI, pass a personal token (`reui_pat_...`, created at https://reui.io/account/mcp?ref=skill) as `Authorization: Bearer`.
- **403 / locked result** - a valid account but the plan does not cover the item: premium blocks need Pro, Motion Icons need Ultimate. Point to https://reui.io/pricing?ref=skill (upgrade). Free accounts still get all components + examples.
- **429** - rate limited (120 requests/min per IP); back off, honor `Retry-After`.
- **not found** (`found: false`) - use the returned `suggestions`, or `search`; check `whats_new` if you suspect a stale name. Never run a fabricated install command.
## Fallbacks
- No ReUI MCP: `npx shadcn@latest search @reui -q "..."` then `add` (generic, no scoring / inline API).
- The shadcn project's own MCP also works over the `@reui` registry: https://ui.shadcn.com/docs/mcp.
Per-agent MCP setup: https://reui.io/docs/mcp?ref=skill
+16
View File
@@ -0,0 +1,16 @@
# CodeGraph data files
# These are local to each machine and should not be committed
# Database
*.db
*.db-wal
*.db-shm
# Cache
cache/
# Logs
*.log
# Hook markers
.dirty
+3
View File
@@ -0,0 +1,3 @@
[mcp_servers.reui]
url = "https://mcp.reui.io/api/mcp?style=base-nova"
bearer_token_env_var = "REUI_LICENSE_KEY"
+21
View File
@@ -0,0 +1,21 @@
{"sessionId":"00844d","runId":"initial","hypothesisId":"H6","location":"components/debug-runtime-probe.tsx","message":"cursor-ref-count-on-mount","data":{"pathname":"/bgp","count":80},"timestamp":1777738439411}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H5","location":"components/debug-runtime-probe.tsx","message":"route-change","data":{"pathname":"/bgp","search":""},"timestamp":1777738439411}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"provider-mounted","data":{"mode":"mock","backendUrl":"http://localhost:8000","storedMode":"live","storedBackend":"http://localhost:8000"},"timestamp":1777738439416}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"hydrated-from-storage","data":{"mode":"live","backendUrl":"http://localhost:8000"},"timestamp":1777738439428}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"provider-mounted","data":{"mode":"live","backendUrl":"http://localhost:8000","storedMode":"live","storedBackend":"http://localhost:8000"},"timestamp":1777738439603}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H4","location":"lib/data-source.tsx","message":"check-backend-start","data":{"url":"http://localhost:8000"},"timestamp":1777738439605}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H4","location":"lib/data-source.tsx","message":"check-backend-result","data":{"url":"http://localhost:8000","ok":true,"status":200},"timestamp":1777738439621}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"provider-mounted","data":{"mode":"mock","backendUrl":"http://localhost:8000","storedMode":"live","storedBackend":"http://localhost:8000"},"timestamp":1777738508126}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"provider-mounted","data":{"mode":"mock","backendUrl":"http://localhost:8000","storedMode":"live","storedBackend":"http://localhost:8000"},"timestamp":1777738508134}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"hydrated-from-storage","data":{"mode":"live","backendUrl":"http://localhost:8000"},"timestamp":1777738508145}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"hydrated-from-storage","data":{"mode":"live","backendUrl":"http://localhost:8000"},"timestamp":1777738508145}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"provider-mounted","data":{"mode":"live","backendUrl":"http://localhost:8000","storedMode":"live","storedBackend":"http://localhost:8000"},"timestamp":1777738508204}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H4","location":"lib/data-source.tsx","message":"check-backend-start","data":{"url":"http://localhost:8000"},"timestamp":1777738508205}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H4","location":"lib/data-source.tsx","message":"check-backend-result","data":{"url":"http://localhost:8000","ok":true,"status":200},"timestamp":1777738508228}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"provider-mounted","data":{"mode":"mock","backendUrl":"http://localhost:8000","storedMode":"live","storedBackend":"http://localhost:8000"},"timestamp":1777738508553}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"provider-mounted","data":{"mode":"mock","backendUrl":"http://localhost:8000","storedMode":"live","storedBackend":"http://localhost:8000"},"timestamp":1777738508560}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"hydrated-from-storage","data":{"mode":"live","backendUrl":"http://localhost:8000"},"timestamp":1777738508571}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"hydrated-from-storage","data":{"mode":"live","backendUrl":"http://localhost:8000"},"timestamp":1777738508572}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H7","location":"lib/data-source.tsx","message":"provider-mounted","data":{"mode":"live","backendUrl":"http://localhost:8000","storedMode":"live","storedBackend":"http://localhost:8000"},"timestamp":1777738508662}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H4","location":"lib/data-source.tsx","message":"check-backend-start","data":{"url":"http://localhost:8000"},"timestamp":1777738508663}
{"sessionId":"00844d","runId":"initial","hypothesisId":"H4","location":"lib/data-source.tsx","message":"check-backend-result","data":{"url":"http://localhost:8000","ok":true,"status":200},"timestamp":1777738508676}
+34
View File
@@ -0,0 +1,34 @@
---
description: "Generate Commit Message: русский subject, fix vs feat, Conventional Commits"
alwaysApply: true
---
# Git commit message (Generate Commit Message)
При **Generate Commit Message**, автогенерации subject и предложении `git commit`:
## Обязательно
- Subject и body — **только на русском** (после `:` в conventional commit).
- Локальный hook `.githooks/commit-msg` **отклоняет** коммиты без кириллицы в subject.
- Префикс и scope — английский: `fix(ui):`, `chore(rules):`.
## Тип: сначала не `feat`
- **`fix`** — баг, регрессия, правка вёрстки/модалки, некорректное поведение, CI/CD, мелкий дефект.
- **`chore` / `docs` / `ci` / `build`** — правила Cursor, README, workflow, зависимости, рефакторинг без новой UX-фичи.
- **`feat`** — только **новая** пользовательская возможность (страница, API, сценарий), которой не было.
Если сомневаешься между `feat` и `fix` — выбирай **`fix`** или **`chore`**, не `feat`.
## Примеры
- `fix(ui): выровнять модалку сводки релиза`
- `fix(ci): исправить сборку release manifest`
- `chore(rules): усилить правила русских commit message`
- `feat(releases): добавить страницу релизов`
## Запрещено
- `feat: update layout`, `fix: add modal`, `chore: update rules` — английский subject.
- `feat` для правки UI, правил, документации и багфиксов.
+44
View File
@@ -0,0 +1,44 @@
---
description: "Быстрый запуск локального frontend и backend"
alwaysApply: true
---
# Локальный запуск проекта
## Требования
- **Node.js 22**, npm с workspaces.
- Первый раз (или после смены зависимостей): `npm install` из корня репозитория.
- Backend: скопировать `backend/.env.example` → `backend/.env` (по умолчанию `PORT=8000`, `CORS_ORIGIN=http://localhost:3000`).
## Запуск (два процесса)
Из корня репозитория поднять **два** long-running процесса в **отдельных** терминалах:
```powershell
npm run dev
npm --prefix backend run dev
```
| Сервис | URL | Проверка |
|--------|-----|----------|
| Frontend (Next.js 16, Turbopack) | http://localhost:3000 | открыть в браузере |
| Backend (Fastify) | http://localhost:8000 | `GET /health` |
Проверка backend в PowerShell:
```powershell
Invoke-WebRequest -Uri http://localhost:8000/health -UseBasicParsing | Select-Object -ExpandProperty Content
```
Ожидаемый ответ: `{"status":"ok",...}`.
## Поведение агента
Если пользователь просит «запусти проект», «запусти фронт и бэк» или похожее:
1. Сначала проверить уже запущенные терминалы — не дублировать процессы.
2. Запустить обе команды выше как фоновые long-running процессы.
3. Дождаться готовности: frontend — `Ready`, backend — `Server listening` / успешный `/health`.
Подробности архитектуры и env — `README.md`, раздел «Запуск».
+131
View File
@@ -0,0 +1,131 @@
---
description: "Fastify 5 + Zod + Drizzle + SQLite — модульная архитектура, слои, валидация, ошибки (ответы на русском)"
globs: "**/{features,shared,lib,plugins}/**/*.ts,**/app.ts,**/server.ts"
alwaysApply: false
---
# Backend: Fastify 5 + TypeScript (ESM) + Zod + Drizzle + SQLite
**Язык:** все ответы пользователю — **только на русском**.
**Стек:** TypeScript (`"type": "module"`), **Fastify 5.x**, **Zod** + `@fastify/type-provider-zod`, **SQLite** (`better-sqlite3`) + **Drizzle ORM**, `@fastify/cors`, `pino-pretty`, `undici`, `dotenv`.
**Цель:** масштабируемый модульный backend, предсказуемый DX, строгое разделение ответственности.
---
## 1. Архитектура (критично)
- **Feature-based модули**, не монолитные файлы. Каждая фича — изолированная папка.
Структура фичи:
```text
/features/<feature-name>/
route.ts — регистрация маршрутов Fastify
controller.ts — разбор запроса/ответа, вызов сервиса
service.ts — бизнес-логика (переиспользуемая)
schema.ts — Zod-схемы (params, query, body, response)
repository.ts — только Drizzle-запросы к БД
types.ts — опционально
```
**Запреты:** не смешивать слои; **нет** бизнес-логики в `route`; **нет** SQL/Drizzle в `controller`; сервисы не должны дублировать обязанности репозитория.
---
## 2. Fastify
- Регистрация фич через **плагины** и инкапсулированные модули.
- Везде **async/await**; декорации инстанса Fastify — только при реальной необходимости.
---
## 3. Валидация (Zod обязательна)
- **Все входы** — через Zod; `@fastify/type-provider-zod` для типобезопасности.
- Явно задавать схемы: **params**, **query**, **body**, **response** (где уместно).
- Нет «сырого» входа; схемы **переиспользовать** между слоями (импорт из `schema.ts`).
---
## 4. База данных (Drizzle)
- Любой доступ к БД — **только** из `repository.ts` / слоя репозитория.
- Типизированные запросы Drizzle; **без** raw SQL, если нет веской причины.
- Запросы — простые, композируемые; логику БД не выносить наружу репозитория.
- Учитывать возможную смену БД: избегать sqlite-специфичных костылей вне репозитория/миграций.
---
## 5. Ошибки
- Единый формат ошибок API (код/сообщение для клиента).
- Обрабатывать: ошибки валидации, БД, внешних HTTP (`undici`).
- **Не** отдавать клиенту внутренние детали (стейки, SQL, секреты).
---
## 6. Логирование
- **Pino**; в dev — **pino-pretty**.
- Логировать ошибки и значимые действия; не засорять лог шумом.
---
## 7. Внешние HTTP (undici)
- Вызовы только из **service** (или выделенного клиента, вызываемого из сервиса).
- Таймауты, обработка ошибок сети/статусов, без утечки сырого ответа наружу.
---
## 8. Конфигурация окружения
- `dotenv` для локальной разработки; **валидация env** (предпочтительно через Zod-схему).
---
## 9. Организация кода
- Небольшие файлы, одна ответственность на файл.
- Композиция вместо копипаста; общее — в `/shared/` и `/lib/`.
---
## 10. Масштабируемость
- Расширяемые границы модулей, слабая связанность, явные контракты между слоями.
---
## 11. Процесс изменений (обязательно)
Для каждого изменения в ответе указать: что сделано; зачем (архитектура + практики); затронутые файлы; минимальный полный дифф без лишнего рефакторинга.
---
## 12. Формат ответа агента
1. Что изменено
2. Почему (архитектура + практики)
3. Структура файлов (если новая фича)
4. Код (несколько файлов при необходимости)
5. Замечания / улучшения
---
## 13. Антипаттерны (строго запрещено)
- Толстые route handlers
- Смешение БД и бизнес-логики в одном месте
- Пропуск валидации входа
- Глобальное мутабельное состояние
- Дублирование запросов к БД
- Хардкод секретов и конфигурации (всё через env/конфиг)
---
## Роль агента
Вести себя как **senior backend engineer**: чистый модульный код, строгое разделение слоёв, долгосрочная поддерживаемость и предсказуемый процесс разработки.
+38
View File
@@ -0,0 +1,38 @@
---
description: "[Multi-agent] Роль ANALYZER — анализ кодовой базы перед реализацией, без кода"
alwaysApply: false
---
# Агент: ANALYZER (анализатор)
Ты выполняешь **только фазу анализа** перед любыми изменениями кода.
## Язык
- Все ответы пользователю — **на русском**.
## Обязанности
- Искать по **всему** репозиторию релевантные места.
- Зафиксировать:
- похожие компоненты и дубликаты по смыслу;
- существующие UI-паттерны, **особенно в зоне `/servers`** (`app/(main)/servers` и связанные компоненты);
- общие хуки, утилиты, UI-обёртки;
- стратегии загрузки данных (RSC, route handlers, server actions, клиентский fetch — что уже принято в проекте).
- Явно отметить **риски дублирования** и конфликты с текущими абстракциями.
## Запреты
- **Нельзя** писать реализацию (патчи, готовый production-код, большие вставки «как сделать»). Допустимы короткие псевдокод-намёки уровня «расширить X», без полной реализации.
- **Нельзя** предлагать «с нуля», если в кодовой базе уже есть переиспользуемое решение — приоритет **reuse**.
## Формат вывода (строго)
1. **Релевантные файлы** (пути).
2. **Существующие паттерны** (кратко, с привязкой к файлам).
3. **Что переиспользовать** (компоненты, хуки, утилиты).
4. **Риски и конфликты** (дубли, расхождение с `/servers`, ломкие зависимости).
## Цель фазы
Дать Implementer’у однозначный вход: **что трогать, что не плодить, откуда копировать поведение**.
+30
View File
@@ -0,0 +1,30 @@
---
description: "[Multi-agent] Глобальные правила пайплайна (Next 16.2.4, Turbopack, shadcn) — подключать с ролями"
alwaysApply: false
---
# Глобальные правила (все агенты пайплайна)
**Язык:** отвечать пользователю **только на русском**.
## Стек и документация
- Next.js **16.2.4** (App Router, **Turbopack**), React, **shadcn/ui**.
- Сверять решения с **официальной** документацией Next.js и shadcn для версий проекта. Не придумывать API и недокументированные паттерны.
## Встроенные возможности Next.js (предпочтительно)
- App Router, Server Components, Server Actions, Route Handlers — вместо обходных кастомных путей, если задача покрывается фреймворком.
## Эталон UI
- **`app/(main)/servers`** — эталон **поведения** CRUD. Оболочка ops: **Frame + DataGrid**, не Card-shell. Не копировать `DataPageCard` на новые экраны.
## Качество и совместимость
- Устранять: ошибки сборки, TypeScript, гидратации, предупреждения о плохих практиках; учитывать **Turbopack** в dev.
## Связь с проектом
- Полные стандарты проекта (формат ответа, чеклисты) — в правиле **`next-shadcn-production.mdc`** (обычно уже подключено). Эти правила **дополняют** его ролью в пайплайне, не отменяют.
- Сообщения коммитов: **`commit-messages-ru.mdc`** (язык и `fix` vs `feat`), semver bump — **`release-versioning.mdc`**.
+37
View File
@@ -0,0 +1,37 @@
---
description: "[Multi-agent] Роль IMPLEMENTER — реализация по результатам анализа, /servers, shadcn"
alwaysApply: false
---
# Агент: IMPLEMENTER (реализатор)
Ты пишешь **production-ready** изменения **на основе** отчёта Analyzer (и уточнённой задачи пользователя).
## Язык
- Все ответы пользователю — **на русском**.
## Обязанности
- Внедрять фичу **минимально**, но **полностью**: все затронутые файлы (типы, UI, API, actions/handlers) согласованы.
- **Переиспользовать** существующие абстракции из отчёта анализа и кодовой базы.
- Выравнивать UI/UX с **`/servers`** как с главным эталоном (layout, отступы, сетка, типографика, композиция).
- Предпочитать **Server Components**; `'use client'` — только при необходимости интерактива (состояние, браузерные API, обработчики).
- UI: по возможности **shadcn/ui**; не вводить новый визуальный/UX-паттерн, если на `/servers` уже есть эквивалент.
- При завершении задачи предлагать subject по **`commit-messages-ru.mdc`**: правки UI/багов → `fix`, инфраструктура/правила → `chore`, новая фича → `feat`; описание **на русском**.
## Формат вывода (строго)
1. **Что изменено** (файлы и суть).
2. **Почему так** — связка Next.js + shadcn/ui + эталон **`/servers`** + принятые в репозитории паттерны.
3. **Код** — диффы или полные фрагменты по всем затронутым файлам.
4. По возможности: **Server vs Client** для новых/изменённых границ компонентов.
## Запреты
- Не оставлять «полфичи» (забытые типы, сломанные импорты, несогласованный API).
- Не копипастить большие куски без привязки к существующим компонентам, если анализ уже указал переиспользование.
## Согласование с проектом
- Если активно правило **`next-shadcn-production.mdc`**, выдерживай его структуру ответа (шаги 0–6) и требования к проверкам.
+58
View File
@@ -0,0 +1,58 @@
---
description: "[Multi-agent] Оркестратор — последовательность Analyzer→Implementer→Reviewer→UI Guardian"
alwaysApply: false
---
# Оркестратор пайплайна (multi-agent)
Используй это правило, когда нужно прогнать задачу через **все роли по очереди**. Подключай вместе с **`ma-global.mdc`** и при необходимости **`next-shadcn-production.mdc`**.
## Язык
- На каждой фазе ответы пользователю — **на русском**.
## Порядок фаз (не нарушать)
1. **Analyzer** — правило **`ma-analyzer.mdc`**: только анализ, без реализации.
2. **Implementer** — правило **`ma-implementer.mdc`**: код по результатам фазы 1.
3. **Reviewer** — правило **`ma-reviewer.mdc`**: строгое ревью результата фазы 2.
4. **UI Guardian** — правило **`ma-ui-guardian.mdc`**: только сверка с **`/servers`**.
## Как исполнять в одном чате
- Выполни **фазу 1** целиком и остановись на выходном формате Analyzer.
- Затем **фаза 2** с явной ссылкой: «реализуй согласно отчёту Analyzer выше».
- Затем **фаза 3** по артефакту фазы 2.
- Затем **фаза 4** по UI-части изменений.
Если пользователь просит «только одну фазу» — выполни только её и напомни номер следующей.
## Промпт-шаблон для пользователя (скопировать в чат)
```text
Запусти multi-agent пайплайн для задачи ниже.
Фазы строго по порядку: Analyzer → Implementer → Reviewer → UI Guardian.
Язык ответов — русский. Стек: Next.js 16.2.4 App Router + Turbopack, shadcn/ui.
Эталон UI: app/(main)/servers.
Следуй правилам ma-global и соответствующим ma-* ролям.
Задача:
<опишите фичу или баг>
```
## Файлы ролей в `.cursor/rules/`
| Роль | Файл |
|------------|-------------------------|
| Глобальные | `ma-global.mdc` |
| Analyzer | `ma-analyzer.mdc` |
| Implementer| `ma-implementer.mdc` |
| Reviewer | `ma-reviewer.mdc` |
| UI Guardian| `ma-ui-guardian.mdc` |
| Оркестратор| `ma-orchestrator.mdc` |
## Ожидаемый результат пайплайна
- Согласованность с кодовой базой и **максимальный reuse**.
- UI, выровненный под **`/servers`**.
- Отсутствие известных блокеров по Next.js, гидратации, TS и заметных anti-patterns после фазы Reviewer.
+42
View File
@@ -0,0 +1,42 @@
---
description: "[Multi-agent] Роль REVIEWER — строгая проверка Next/shadcn/a11y/гидратации/Turbopack"
alwaysApply: false
---
# Агент: REVIEWER (ревьюер)
Ты **валидируешь** предложенные или уже внесённые изменения. Режим: **строгий**.
## Язык
- Все ответы пользователю — **на русском**.
## Что проверять
- **Next.js:** App Router, границы RSC/Client, данные ближе к серверу, кэширование/revalidate где уместно, корректные route handlers и server actions.
- **shadcn/ui:** композиция, токены/классы проекта, отсутствие «левого» самописного UI там, где хватает shadcn.
- **Производительность:** лишние клиентские деревья, waterfall fetch, чрезмерные `'use client'` границы.
- **a11y:** семантика, фокус, aria, клавиатура (в разумных пределах контекста правки).
- **Гидратация:** несовпадение разметки/случайные значения на сервере и клиенте, неправильное использование браузерных API в RSC.
- **Turbopack:** не предлагать паттерны, ломающие dev-сборку Next 16 + Turbopack; учитывать типичные предупреждения toolchain.
## Обязательные находки
- Ошибочное **смешение Server/Client** (хуки в RSC, серверные модули в клиенте без обёртки и т.д.).
- **Over-fetching** и дублирующая логика запросов.
- **Дублирование** логики/UI там, где уже есть общий модуль или паттерн `/servers`.
## Формат вывода (строго)
Таблица или списки:
1. **Проблема** (кратко).
2. **Серьёзность:** блокер / высокая / средняя / низкая.
3. **Рекомендация по исправлению** (конкретные шаги или патч-уровень).
Если дефектов нет — явно напиши **«Блокирующих замечаний нет»** и перечисли **что именно** было проверено.
## Запреты
- Нельзя «мягко пропускать» очевидные проблемы ради скорости.
- Нельзя ограничиваться общими фразами — каждая **рекомендация должна быть actionable**.
+43
View File
@@ -0,0 +1,43 @@
---
description: "[Multi-agent] Роль UI GUARDIAN — сверка UI с CRUD /servers и оболочкой Frame+DataGrid"
alwaysApply: false
---
# Агент: UI GUARDIAN (хранитель UI)
Ты отвечаешь **только** за **визуальную и UX-согласованность**.
## Язык
- Все ответы пользователю — **на русском**.
## Эталон
Два слоя (не смешивать):
1. **Поведение CRUD** — каталог **`app/(main)/servers`**: фильтры, таблица, диалоги, формы, плотность, паттерны кнопок.
2. **Оболочка ops** — **ReUI Frame + DataGrid**, не shadcn `Card` как page shell. KPI — `IconTile` `variant="elevated"` `className="size-10.5"`. Preview: [frame](https://reui.io/docs/components/base/frame) · [data-grid](https://reui.io/docs/components/base/data-grid) · [stats-12](https://reui.io/preview/base/stats-12) · [icon-tile](https://reui.io/docs/components/base/icon-tile).
`DataPageCard` — ops list shell на ReUI Frame; новые экраны не копируют Card-shell.
## Обязанности
- Сравнить **каждое** спорное UI-решение: CRUD — с `/servers`; оболочка — с Frame+DataGrid.
- Требовать **переиспользование** существующих компонентов/обёрток, если они покрывают задачу.
## Правила
- **Нельзя** принимать новый Card page-shell без явной технической необходимости (назвать её).
- **Нельзя** предлагать «новый стиль» ради вариации — только выравнивание с эталоном или расширение существующих примитивов.
## Формат вывода (строго)
1. **Несоответствия** эталону (конкретно: CRUD vs Frame-shell).
2. **Обязательные правки** (что поменять).
3. **Что переиспользовать**: файлы/компоненты и паттерн.
Если расхождений нет — явно: **«Расхождений с эталоном CRUD /servers и Frame+DataGrid не выявлено»** и кратко перечисли проверенные аспекты.
## Граница ответственности
- Не дублируй полный код-ревью Implementer/Reviewer: фокус только на **консистентности** и **reuse** UI.
+84
View File
@@ -0,0 +1,84 @@
---
description: Next.js App Router + shadcn/ui — эталон /servers, поиск по репозиторию, формат ответа и проверки
alwaysApply: true
---
# Next.js 16 (App Router, Turbopack) + shadcn/ui — правила проекта
Стек ориентира: **Next.js 16.2.4** (App Router, Turbopack), **React**, **shadcn/ui**. При расхождении с документацией — верифицировать по официальным источникам для вашей версии.
**Язык:** все ответы пользователю — **только на русском**.
**Git / Generate Commit Message:** subject и body — **на русском**; `feat` только для новой UX-фичи, иначе `fix`/`chore`. См. **`commit-messages-ru.mdc`** и **`release-versioning.mdc`**.
## 1. Документация в первую очередь
- Решения сверять с **официальной** документацией Next.js и shadcn/ui (актуальные версии проекта).
- Не выдумывать API и «недокументированные» паттерны; предпочитать стабильные, описанные в доках решения.
## 2. Эталон UI/UX: `/servers` (CRUD) + Frame+DataGrid (оболочка)
- **`app/(main)/servers`** — эталон **поведения** CRUD: фильтры, сортировка, пагинация, диалоги, формы, плотность.
- **Оболочка ops-списков / dashboard / KPI:** **ReUI Frame + DataGrid**, не shadcn `Card` как page shell. Preview: [frame](https://reui.io/docs/components/base/frame) · [data-grid](https://reui.io/docs/components/base/data-grid) · [stats-12](https://reui.io/preview/base/stats-12) · [icon-tile](https://reui.io/docs/components/base/icon-tile).
- `DataPageCard` — ops list shell на ReUI Frame (`components/data-page-card.tsx`). Внутренние панели — `OpsPanel` / Frame, не shadcn Card как page shell.
- Переиспользовать паттерны `/servers` для CRUD; **не** вводить Card-grid как новый SoT.
## 3. Большой репозиторий (критично)
- **Перед изменениями** искать по проекту: похожие компоненты, существующие паттерны, общие утилиты, хуки, UI-абстракции.
- **Не дублировать:** если похожее решение уже есть — расширять или переиспользовать, а не писать с нуля.
## 4. Согласованность между файлами
При правке фичи проверять и при необходимости обновлять **все** связанное: компоненты, хуки, route handlers / server actions, типы, стили/обёртки UI — не только открытый файл.
## 5. Зависимости и влияние
Перед реализацией: от чего зависит целевой файл, где используется, какие побочные эффекты; избегать ломающих изменений без явной необходимости.
## 6. Нативные возможности фреймворка
- Next.js: App Router, Server Components, Server Actions, Route Handlers — по умолчанию предпочтительнее кастомных обходных путей.
- UI: компоненты **shadcn/ui**; не плодить самописное, если стандартное решение покрывает задачу.
## 7. Практики качества
- Рекомендации Next.js: загрузка данных, рендеринг, производительность.
- Минимизировать `'use client'` там, где достаточно серверных компонентов.
- Композиция shadcn/ui и доступность (a11y).
## 8. Валидация каждого изменения (обязательно)
В ответе явно указать:
- **Почему** это согласуется с Next.js, shadcn/ui, CRUD `/servers` и оболочкой Frame+DataGrid.
- **Server vs Client Component** и обоснование.
- Что **переиспользовано** из проекта (паттерны/компоненты).
- Какие **файлы проанализированы**.
## 9. Turbopack и консоль разработки
После правок: проверить сборку/типы (по возможности запустить проверки проекта), ошибки гидратации, предупреждения; критичное исправить; не игнорировать предупреждения о плохих практиках.
## 10. Правки кода
- Минимальные, но **полные** (все зависимые места обновлены).
- Не рефакторить несвязанную логику.
## 11. Формат ответа (обязательная структура)
1. **Шаг 0:** список проанализированных файлов.
2. **Шаг 1:** что изменено.
3. **Шаг 2:** почему (Next.js + shadcn/ui + CRUD `/servers` + Frame+DataGrid + паттерны кодовой базы).
4. **Шаг 3:** анализ влияния (что ещё затронуто).
5. **Шаг 4:** код (диффы или несколько файлов).
6. **Шаг 5:** проверка dev/консоли (ошибки, предупреждения, исправления).
7. **Шаг 6:** опциональные улучшения.
## 12. Дублирование и антипаттерны
Явно указывать, если найдено дублирование или антипаттерн; ссылаться на существующую реализацию в проекте; предлагать переиспользование или рефакторинг вместо копипаста.
## Цель
Вести себя как **senior** в production-кодовой базе: консистентность, переиспользование, CRUD как на `/servers`, оболочка Frame+DataGrid (не Card-shell), безопасные масштабируемые изменения по best practices Next.js и shadcn/ui, готовый к продакшену код без ошибок сборки/рантайма по возможности.
+49
View File
@@ -0,0 +1,49 @@
---
description: "Conventional Commits, semver релизов MikrotikManager и русские git commit message (Generate Commit Message)"
alwaysApply: true
---
# Версионирование релизов
## Generate Commit Message (критично)
Для **Generate Commit Message** в Cursor, предложения subject в чате, `git commit` и любой автогенерации сообщения коммита:
- Формат: `тип(scope): описание на русском` — префикс Conventional Commits и scope **на английском**, текст после `:` **только на русском**.
- Body и footer (если нужны) — **только на русском**.
- В описании после `:` не использовать английские слова: `add`, `update`, `implement`, `rename` и т.п.
- **`feat` не по умолчанию.** Сначала проверь `fix` / `chore` / `ci` / `docs`; `feat` — только новая пользовательская возможность.
- Примеры: `fix(ui): выровнять модалку релиза`; `chore(rules): усилить правила commit message`; `feat(releases): добавить страницу релизов`.
- Детальный чеклист типов — **`commit-messages-ru.mdc`**.
- Версию **не** править вручную в UI, `package.json` и git-тегах; bump делает CI через [`.ci/scripts/compute-release.mjs`](.ci/scripts/compute-release.mjs).
- Базовая линия: `v1.0.0`. Формат отображения: `v1.2.3`.
- **Язык коммитов:** subject и body — **только на русском**; префикс Conventional Commits (`feat`, `fix`, `chore` и т.д.) и scope — на английском.
## Patch (`1.0.x`)
`fix:`, `chore:`, `docs:`, `refactor:`, `style:`, `test:`, `build:`, `ci:`
- Один логический смысл на коммит; subject в повелительном наклонении, до ~72 символов, **на русском**.
- Scope по желанию: `fix(servers):`, `chore(ci):`.
## Minor (`1.x.0`)
`feat:` — новая пользовательская возможность.
## Major (`2.0.0` после `1.x`)
`тип!:`, `тип(scope)!:` или footer `BREAKING CHANGE:` / `BREAKING-CHANGE:` повышают major, обнуляя minor и patch. При смешанной истории major имеет приоритет над minor и patch. Версия, тег, manifest и Docker tags вычисляются CI; package.json вручную не меняется. Для согласованного перехода на вторую основную версию используется `chore(release)!:` с русским описанием.
## Примеры
- `fix(servers): исправить опрос API после таймаута` — patch
- `feat(filters): добавить синхронизацию BGP in` — minor
- `chore(ci): добавить job prepare-release` — хорошо
- `feat: add release modal` — плохо (subject не на русском)
## Антипаттерны
WIP, «update», subject на английском, смешение несвязанных изменений, маскировка фич под `fix`/`chore`, ручной bump в sidebar.
Подробности — раздел CI/CD в `README.md`.
+73
View File
@@ -0,0 +1,73 @@
---
description: Use the ReUI registry (blocks, primitives, icons) correctly
globs: ["**/*.tsx","**/*.ts"]
alwaysApply: false
---
---
name: reui
description: Use the ReUI registry from your AI agent - find, install, and correctly use ReUI components (the 22 free building blocks like data-grid, kanban, filters), their free examples, premium blocks, and Motion Icons. Applies in any project using ReUI, the @reui registry, REUI_LICENSE_KEY, or any shadcn project where the user asks for premium blocks, data grids, kanban boards, dashboards, or full pages. Pairs with the free ReUI MCP server for live, scored registry search and inline component APIs.
user-invocable: false
allowed-tools: Bash(npx shadcn@latest *), Bash(pnpm dlx shadcn@latest *), Bash(bunx --bun shadcn@latest *)
---
> **ReUI skill version `fe6742e29c`.** If the ReUI MCP's `get_agent_skill` reports a newer `version`, re-run the ReUI installer (see `get_agent_skill` -> `install.recommended`) to update this skill. Cloud/tools-only agents have no local file and always read the latest - they can ignore this.
# ReUI for Agents
ReUI is a shadcn-compatible registry. It ships four things you **reuse** - never redesign:
- **components** - the 22 ReUI building blocks with real APIs: `data-grid`, `kanban`, `filters`, `date-selector`, `tree`, `stepper`, ... (free)
- **examples** - free `c-*` single-pattern use-cases of a component (`c-kanban-1`); install one and read it to see exact composition
- **blocks** - premium full-page sections that compose components (`data-grid-2`, `pricing-page-1`); Pro or Ultimate license at install
- **icons** - Motion Icons in 4 styles, static + hover-animated variants; Ultimate license at install
The skill is free and this MCP is free to use; it just needs a ReUI account. On first use your agent opens a browser "Sign in with ReUI" prompt (a free account is created if you don't have one). Free covers components and examples with a daily request allowance; a Pro or Ultimate license unlocks premium blocks and Motion Icons and removes the limit (see [rules/registry.md](./rules/registry.md)). The same account and skill work in every agent and service the MCP connects to - this skill is agent-agnostic.
Skill + MCP are a team: this skill is the workflow (how to find, install, read the API, and adapt by reuse); the MCP is the live data and the hands (search, get_component, install commands). Your job: find the right item, install it with the shadcn CLI, read its real API, and **adapt by reuse** - wire real data and theme it; do not hand-roll or restyle what ReUI already provides. This skill **layers on the shadcn skill**: follow that for generic rules (spacing, `cn()`, semantic colors, forms); follow this for everything ReUI-specific.
## The core loop (MCP-native)
1. **Find** - call the ReUI MCP `search` tool with the user's intent. It returns a ranked, scored list across components/examples/blocks/icons, each with an `install` command, `previewUrl`, `docsUrl`, and `componentsUsed`. Pass hints (`type`, `component`, `category`, `features`, `free`) when you can infer them.
2. **Install** - run the returned command non-interactively (`npx shadcn@latest add @reui/<name> --yes`). The CLI resolves deps, aliases, and the base/style from `components.json`. See [cli.md](./rules/cli.md).
3. **Read the API (on your base)** - first note your base from `components.json` -> `style` (`base-nova` -> Base UI, `radix-nova` -> Radix UI). For each component an item uses, call `get_component(name)` and read its **inline `api`** (no web fetch); then `get_examples(name)` to install a worked example and copy its composition - the installed files are already in your base. Whenever you work with a component's API, also **share its `docsUrl`** (the primitive's API documentation page) with the user so they have the full reference. See [components.md](./rules/components.md).
4. **Adapt (reuse-first)** - swap demo data for real data, fix icon imports, align tokens. Do not redesign. See [adapting.md](./rules/adapting.md).
**Always show the preview.** Every item a tool returns carries a `previewUrl` (a live preview page). Whenever you list, recommend, or present ReUI items to the user - blocks, components, examples, or icons, whether from `search`, `search_icons`, `list_components`, `compose_page`, or any getter - include each item's `previewUrl` so they can SEE it before installing. Blocks and examples open an individual live preview; icons and components link to their live category/component page. Never present an item without its preview link.
If the ReUI MCP is not configured, fall back to `npx shadcn@latest search @reui -q "..."` then `add` - but the MCP gives scored matches + inline APIs; prefer it.
## Commands
Run ReUI as explicit slash commands (via the ReUI MCP) **or** just ask in plain language - both run the same workflow.
| Command | Invoke | Does |
| ----------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| **build** | `/mcp__reui__build <what>` | Compose a page/section/feature from ReUI: plan → install → read API → adapt → craft → audit. |
| **add** | `/mcp__reui__add <item>` | Find & install one component/example/block/icon and wire it in. |
| **fix** | `/mcp__reui__fix [target]` | Diagnose & fix ReUI usage: wrong/undocumented props, base/radix mismatch, missing states, a11y/scroll. |
| **improve** | `/mcp__reui__improve [target]` | Refine + extend existing ReUI UI to a production-exceptional bar (hierarchy, density, states, responsive, motion). |
Invocation differs slightly per agent (`/mcp__reui__build` in Claude Code/Cursor/Windsurf, `/mcp.reui.build` in VS Code). No command surface? Just describe what you want - this skill drives the identical loop.
## When to reach for ReUI vs plain shadcn
| Need | Reach for |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| A full page or section (dashboard, billing, auth, pricing, settings) | `compose_page` first (plans sections + best blocks), then ReUI **blocks** |
| A data table with sorting/filtering/pagination/virtualization | the **data-grid** component (never hand-roll a `<table>`) |
| A drag-and-drop board | the **kanban** component |
| Advanced column filtering, date range, tree, stepper, ... | the matching ReUI **component** |
| A single generic control already in shadcn (Button, Dialog, Select) | plain **shadcn** |
## Detailed references
- [rules/registry.md](./rules/registry.md) - the four types, the @reui registry, base/radix, free vs premium + license
- [rules/workflow.md](./rules/workflow.md) - the find -> install -> read-API -> adapt loop (most important)
- [rules/components.md](./rules/components.md) - the 22 components, the data-grid contract, base vs radix
- [rules/adapting.md](./rules/adapting.md) - reuse-first: preserve the design (no over-customizing), reuse examples + a block's own elements, real data, don't invent APIs
- [rules/craft.md](./rules/craft.md) - make it exceptional: point of view, hierarchy, density, states, responsive, motion, the bar
- [rules/quality.md](./rules/quality.md) - security, accessibility, and scroll gates (the done gate)
- [rules/styling.md](./rules/styling.md) - ReUI extended tokens, theme adaptation, density
- [rules/icons.md](./rules/icons.md) - portable icons, swapping imports, Motion Icons (static + animated)
- [tools.md](./tools.md) - the ReUI MCP: golden path, the 19 tools, token rules, result shapes, errors
+67
View File
@@ -0,0 +1,67 @@
---
name: reui
description: Use the ReUI registry from your AI agent - find, install, and correctly use ReUI components (the 22 free building blocks like data-grid, kanban, filters), their free examples, premium blocks, and Motion Icons. Applies in any project using ReUI, the @reui registry, REUI_LICENSE_KEY, or any shadcn project where the user asks for premium blocks, data grids, kanban boards, dashboards, or full pages. Pairs with the free ReUI MCP server for live, scored registry search and inline component APIs.
user-invocable: false
allowed-tools: Bash(npx shadcn@latest *), Bash(pnpm dlx shadcn@latest *), Bash(bunx --bun shadcn@latest *)
---
> **ReUI skill version `fe6742e29c`.** If the ReUI MCP's `get_agent_skill` reports a newer `version`, re-run the ReUI installer (see `get_agent_skill` -> `install.recommended`) to update this skill. Cloud/tools-only agents have no local file and always read the latest - they can ignore this.
# ReUI for Agents
ReUI is a shadcn-compatible registry. It ships four things you **reuse** - never redesign:
- **components** - the 22 ReUI building blocks with real APIs: `data-grid`, `kanban`, `filters`, `date-selector`, `tree`, `stepper`, ... (free)
- **examples** - free `c-*` single-pattern use-cases of a component (`c-kanban-1`); install one and read it to see exact composition
- **blocks** - premium full-page sections that compose components (`data-grid-2`, `pricing-page-1`); Pro or Ultimate license at install
- **icons** - Motion Icons in 4 styles, static + hover-animated variants; Ultimate license at install
The skill is free and this MCP is free to use; it just needs a ReUI account. On first use your agent opens a browser "Sign in with ReUI" prompt (a free account is created if you don't have one). Free covers components and examples with a daily request allowance; a Pro or Ultimate license unlocks premium blocks and Motion Icons and removes the limit (see [rules/registry.md](./rules/registry.md)). The same account and skill work in every agent and service the MCP connects to - this skill is agent-agnostic.
Skill + MCP are a team: this skill is the workflow (how to find, install, read the API, and adapt by reuse); the MCP is the live data and the hands (search, get_component, install commands). Your job: find the right item, install it with the shadcn CLI, read its real API, and **adapt by reuse** - wire real data and theme it; do not hand-roll or restyle what ReUI already provides. This skill **layers on the shadcn skill**: follow that for generic rules (spacing, `cn()`, semantic colors, forms); follow this for everything ReUI-specific.
## The core loop (MCP-native)
1. **Find** - call the ReUI MCP `search` tool with the user's intent. It returns a ranked, scored list across components/examples/blocks/icons, each with an `install` command, `previewUrl`, `docsUrl`, and `componentsUsed`. Pass hints (`type`, `component`, `category`, `features`, `free`) when you can infer them.
2. **Install** - run the returned command non-interactively (`npx shadcn@latest add @reui/<name> --yes`). The CLI resolves deps, aliases, and the base/style from `components.json`. See [cli.md](./rules/cli.md).
3. **Read the API (on your base)** - first note your base from `components.json` -> `style` (`base-nova` -> Base UI, `radix-nova` -> Radix UI). For each component an item uses, call `get_component(name)` and read its **inline `api`** (no web fetch); then `get_examples(name)` to install a worked example and copy its composition - the installed files are already in your base. Whenever you work with a component's API, also **share its `docsUrl`** (the primitive's API documentation page) with the user so they have the full reference. See [components.md](./rules/components.md).
4. **Adapt (reuse-first)** - swap demo data for real data, fix icon imports, align tokens. Do not redesign. See [adapting.md](./rules/adapting.md).
**Always show the preview.** Every item a tool returns carries a `previewUrl` (a live preview page). Whenever you list, recommend, or present ReUI items to the user - blocks, components, examples, or icons, whether from `search`, `search_icons`, `list_components`, `compose_page`, or any getter - include each item's `previewUrl` so they can SEE it before installing. Blocks and examples open an individual live preview; icons and components link to their live category/component page. Never present an item without its preview link.
If the ReUI MCP is not configured, fall back to `npx shadcn@latest search @reui -q "..."` then `add` - but the MCP gives scored matches + inline APIs; prefer it.
## Commands
Run ReUI as explicit slash commands (via the ReUI MCP) **or** just ask in plain language - both run the same workflow.
| Command | Invoke | Does |
| ----------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| **build** | `/mcp__reui__build <what>` | Compose a page/section/feature from ReUI: plan → install → read API → adapt → craft → audit. |
| **add** | `/mcp__reui__add <item>` | Find & install one component/example/block/icon and wire it in. |
| **fix** | `/mcp__reui__fix [target]` | Diagnose & fix ReUI usage: wrong/undocumented props, base/radix mismatch, missing states, a11y/scroll. |
| **improve** | `/mcp__reui__improve [target]` | Refine + extend existing ReUI UI to a production-exceptional bar (hierarchy, density, states, responsive, motion). |
Invocation differs slightly per agent (`/mcp__reui__build` in Claude Code/Cursor/Windsurf, `/mcp.reui.build` in VS Code). No command surface? Just describe what you want - this skill drives the identical loop.
## When to reach for ReUI vs plain shadcn
| Need | Reach for |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| A full page or section (dashboard, billing, auth, pricing, settings) | `compose_page` first (plans sections + best blocks), then ReUI **blocks** |
| A data table with sorting/filtering/pagination/virtualization | the **data-grid** component (never hand-roll a `<table>`) |
| A drag-and-drop board | the **kanban** component |
| Advanced column filtering, date range, tree, stepper, ... | the matching ReUI **component** |
| A single generic control already in shadcn (Button, Dialog, Select) | plain **shadcn** |
## Detailed references
- [rules/registry.md](./rules/registry.md) - the four types, the @reui registry, base/radix, free vs premium + license
- [rules/workflow.md](./rules/workflow.md) - the find -> install -> read-API -> adapt loop (most important)
- [rules/components.md](./rules/components.md) - the 22 components, the data-grid contract, base vs radix
- [rules/adapting.md](./rules/adapting.md) - reuse-first: preserve the design (no over-customizing), reuse examples + a block's own elements, real data, don't invent APIs
- [rules/craft.md](./rules/craft.md) - make it exceptional: point of view, hierarchy, density, states, responsive, motion, the bar
- [rules/quality.md](./rules/quality.md) - security, accessibility, and scroll gates (the done gate)
- [rules/styling.md](./rules/styling.md) - ReUI extended tokens, theme adaptation, density
- [rules/icons.md](./rules/icons.md) - portable icons, swapping imports, Motion Icons (static + animated)
- [tools.md](./tools.md) - the ReUI MCP: golden path, the 19 tools, token rules, result shapes, errors
+43
View File
@@ -0,0 +1,43 @@
# Adapting installed ReUI code (reuse-first, no AI slop)
ReUI items ship production-quality. Your job is to **adapt by reuse** - wire real data and fit the app - not to redesign or hand-roll. The output should look like ReUI built it for this product.
## Preserve the design - don't over-customize
The design IS the product. A ReUI block/component encodes senior-designer decisions: spacing, hierarchy, density, color treatment, and component choices. The fastest way to turn a premium block back into generic AI slop is to "improve" its look - so don't.
- Change **data, copy, and props**; keep the **structure and styling** it ships with. Make the **smallest** change that wires the real data. If your diff touches `className` / JSX structure more than data / props, you are over-customizing - stop and reuse.
- Don't swap ReUI components for hand-rolled ones, restructure the layout, re-skin spacing / radius / colors, or add decorative chrome. Let the installed components carry the default spacing, radius, sizing, icon rhythm, density, and state styling; add custom Tailwind only when a component genuinely lacks a contract you need.
- Want a different look? `search` for a block whose design already fits and reuse that - don't restyle this one into a new design.
## Reuse the parts: examples and the block's own elements
- **Examples are building parts.** A free `c-*` example is a correct, single-pattern composition you can reuse. Before composing from scratch, `get_examples(component)`, install the closest one, and reuse its wiring - assemble UI from examples instead of hand-rolling what an example already shows.
- **Reuse a block's own elements.** Need more rows, cards, items, or sections than ship by default? Repeat the block's **existing** element by mapping real data through the same markup - never invent parallel markup that drifts from its design. Need a variant (empty / loading / expanded)? Derive it from an element the block already has.
## Don't invent (read, don't guess)
- Never write a prop, variant value, import path, or `@reui/...` name you didn't read in a component's inline `api`, an installed example, or a `search` result. If you didn't see it, treat it as nonexistent - call `get_component` / `get_examples` / `search` first, or run the MCP `validate_usage` tool to check planned names + props against the docs before writing code.
- If a getter returns `found: false` or `search` returns nothing, say so and fall back (plain shadcn, or ask) - never fabricate an install command or an API.
## What to change vs leave alone
- **Change:** the item's own data, copy, props, and layout to fit the app.
- **Leave alone:** installed component files, hooks, and the shared theme - do not edit vendored ReUI internals; change behavior through props and the documented API.
- Blocks are **portable React** - no `next/link`, `next/image`, or other framework-runtime imports inside them. Keep them portable.
## Demo data -> real data
- Replace every placeholder with the user's real data. Model it as **typed data structures** and **map over arrays** - never duplicate JSX per row/card. Keep small block-specific formatters next to the data.
- Wire the real source (columns, fields, fetch). For `data-grid`, implement the server fetch contract if the user needs server-side data.
- **Type from the component API, derive during render.** Type domain state through the component's own types - e.g. map status to `BadgeProps["variant"]` via a typed `Record<Status, …>` - instead of stringly-typed values. Compute view state during render; don't mirror derived data into `useState`/`useEffect`.
- **Adapt on the right base.** Use the API for the project's base (Base UI vs Radix - see [components.md](./components.md)); the installed files are already base-correct, so reuse their shape rather than translating from memory.
## Believable content (no AI tells)
- Use realistic labels, counts, timestamps, and statuses that map to a real workflow.
- No decorative buttons, fake tabs, meaningless toggles, equal-weight card walls, empty gradients, ornamental icons, or generic SaaS filler. Every element should do something.
## Operational surfaces (settings / profile / admin)
Pick ONE archetype and keep the family consistent: a vertical rail (3-6 sections), horizontal tabs (5-8), or a frame/stack. Prefer `frame` for tool-like surfaces, a card for profile-like ones. Don't mix archetypes in one surface.
+60
View File
@@ -0,0 +1,60 @@
# CLI: registry setup, license, non-interactive install
## Registry setup (one-time, per project)
Free items (the 22 components and all `c-*` examples) need only the plain string registry in `components.json`:
```json
{ "registries": { "@reui": "https://reui.io/r/{style}/{name}.json" } }
```
Premium items (blocks; Motion Icons and templates) require a ReUI license at install:
1. Add the key to `.env.local`:
```bash
REUI_LICENSE_KEY=your-license-key
```
2. Switch `components.json` to the authenticated object form:
```json
{
"registries": {
"@reui": {
"url": "https://reui.io/r/{style}/{name}.json",
"headers": { "Authorization": "Bearer ${REUI_LICENSE_KEY}" }
}
}
}
```
The shadcn CLI expands `${REUI_LICENSE_KEY}` from `.env.local` inside `components.json`, but an MCP client config never expands variables, so a ReUI MCP server config must carry the raw token instead (for example `reui_pat_your_token_here`).
The MCP `get_project_context` tool returns the right config. Full guide: https://reui.io/docs/registry?ref=skill
## Installing
Use the project's package runner (check `packageManager`):
```bash
npx shadcn@latest add @reui/<name> --yes # npm
pnpm dlx shadcn@latest add @reui/<name> --yes # pnpm
bunx --bun shadcn@latest add @reui/<name> --yes # bun
```
`--yes` skips confirmation prompts. The CLI auto-detects the package manager from the lockfile (there is no `--package-manager` flag). It also resolves the correct base+style variant from `components.json`, so do not pass a style.
## Handling prompts and conflicts
- **Always pass `--yes`** so the CLI does not block on confirmation prompts.
- **Do NOT pass `--overwrite` by default.** If the CLI reports an existing file, read the output and resolve deliberately: install under a different name, adjust the path, or ask the user. Only use `--overwrite` when the user explicitly wants to replace a file.
- **Preview first when touching an existing project**: `npx shadcn@latest add @reui/<name> --dry-run` shows what would change; `--diff <file>` shows a specific file's diff. Use these before overwriting.
- Run from the **project root** so `components.json` and `.env.local` are found.
## Free vs premium boundary
- Public, no key: `c-*` examples and the 22 components (`@reui/data-grid`, `@reui/badge`, ...) that those examples depend on.
- Key required at install: blocks (`@reui/<category>-N`) need a Pro or Ultimate license; Motion Icons (`@reui/icons/...`) and templates need Ultimate.
If an install 401/403s, the license key is missing, invalid, or the plan does not cover that resource (blocks: Pro or higher; icons and templates: Ultimate). Point the user to https://reui.io/account?ref=skill (their key) or https://reui.io/pricing?ref=skill (upgrade).
+428
View File
@@ -0,0 +1,428 @@
# ReUI components
The 22 ReUI building blocks: `alert`, `autocomplete`, `badge`, `cascader`, `code-block`, `data-grid`, `date-selector`, `event-calendar`, `filters`, `frame`, `gantt`, `icon-stack`, `icon-tile`, `kanban`, `number-field`, `phone-input`, `rating`, `scrollspy`, `sortable`, `stepper`, `timeline`, `tree`. Examples and blocks are composed from these.
**Rule one: never guess a component's API. Read it first.** Call **`get_component(name)`** for its inline `api` (props + usage, no web fetch), and **share the result's `docsUrl`** (the component's API documentation page) with the user whenever you work with that component's API, so they have the full reference (the `/llms.txt` index is a further fallback). Then call **`get_examples(name)`** to install a worked example and copy real composition. The contracts below are first-try orientation (required props, composition shape, the one gotcha); the inline `api` is the full reference. No single block fits? Compose: search the components you need, read each `get_component`, install a `get_examples` example per component, and adapt.
## data-grid (the flagship - read its API every time)
`data-grid` wraps TanStack Table v9. It is NOT a styled `<table>` and does NOT take `data`/`columns` props directly. The contract:
- Build a TanStack table instance with `useTable({ features: dataGridFeatures, ... })` (columns, data). `dataGridFeatures` is exported by the primitive and already bundles sorting, filtering, pagination, row selection, expanding, pinning, resizing and faceting, so there are no per-table row models to wire.
- Pass that instance to `<DataGrid table={table} recordCount={total}>`.
- Compose the body with `DataGridTable` inside `DataGrid`, and enable features through `tableLayout` (e.g. `{ headerSticky: true, columnsResizable: true }`), not ad-hoc classes.
- Server-side data uses the documented fetch shape (`recordCount` is the total for pagination).
```tsx
const table = useTable({
features: dataGridFeatures,
data,
columns,
})
<DataGrid table={table} recordCount={data.length}>
<DataGridTable />
</DataGrid>
```
Common mistakes:
- **Incorrect:** `<DataGrid data={rows} columns={cols} />` - these props do not exist. **Correct:** build a `useTable({ features: dataGridFeatures, ... })` instance and pass `table={table}` + `recordCount`.
- **Incorrect:** a raw `<table>` / hand-rolled pagination. **Correct:** use `data-grid`; read its API for sticky header, pagination, virtualization, row selection.
- **Incorrect:** styling rows/cells with arbitrary classes. **Correct:** drive layout via `tableLayout` and the primitive's `DataGridColumnMeta` (e.g. `cellClassName`, `headerTitle`), set through the bundle's `columnMeta` slot.
## event-calendar
**Required:** events via `events`/`onEventsChange` (controlled) or `defaultEvents` (uncontrolled), plus a height on the root.
**Shape:**
```tsx
<EventCalendar defaultEvents={events} defaultView="month" className="h-[560px]">
<EventCalendarNav />
<EventCalendarContent />
</EventCalendar>
```
**Gotcha:** headless-first: `EventCalendarContent` renders the active view (month/week/day/days/agenda; a resource view activates when `resources` is passed) - there is no per-view JSX to compose. Events are `{ id, title, start, end (exclusive), allDay?, color?, recurrence?, resourceId? }`. Mutations flow through `onEventUpdate`/`canDropEvent` (return `false` to reject); the root needs an explicit height because it is a min-h-0 flex column.
## gantt
**Required:** `resources` (the left tree) plus bars via `events`/`defaultEvents` attached by `resourceId`.
**Shape:**
```tsx
<Gantt defaultEvents={bars} resources={tasks} defaultScale="month" className="h-[480px]">
<GanttNav />
<GanttView />
</Gantt>
```
**Gotcha:** bars move along the time axis only (never across rows) and are all-day spans with exclusive `end`; `progress` is 0-100. Scales are `day | week | month | quarter | year`. Zoom control, infinite scroll, summary rollups, and row checkboxes are ON by default - turn off what you do not need. Same `onEventUpdate`/`canDropEvent` commit pipeline as `event-calendar`; the root needs an explicit height.
## kanban
**Required:** `value` (`Record<string, T[]>`), `onValueChange`, `getItemValue`
**Shape:**
```tsx
<Kanban value={cols} onValueChange={setCols} getItemValue={(i) => i.id}>
<KanbanBoard>
{Object.entries(cols).map(([id, items]) => (
<KanbanColumn key={id} value={id}>
<KanbanColumnHandle><h3>{id}</h3></KanbanColumnHandle>
<KanbanColumnContent value={id}>
{items.map((i) => (
<KanbanItem key={i.id} value={i.id}>
<KanbanItemHandle>{i.title}</KanbanItemHandle>
</KanbanItem>
))}
</KanbanColumnContent>
</KanbanColumn>
))}
</KanbanBoard>
<KanbanOverlay><div className="bg-muted size-full rounded-md" /></KanbanOverlay>
</Kanban>
```
**Gotcha:** state is `Record<columnId, T[]>`. Each `KanbanColumnContent value` must match its parent `KanbanColumn value`. Omit `KanbanOverlay` and the drag preview silently breaks.
## sortable
**Required:** `value` (`T[]`), `onValueChange`, `getItemValue`
**Shape:**
```tsx
<Sortable value={items} onValueChange={setItems} getItemValue={(i) => i.id}>
{items.map((i) => (
<SortableItem key={i.id} value={i.id}>
<SortableItemHandle><GripVertical /></SortableItemHandle>
{i.label}
</SortableItem>
))}
</Sortable>
```
**Gotcha:** a flat 1D reorder list (not columns - that is `kanban`). `getItemValue` must return a stable, unique string. Pass `layout="grid"` or `layout="nested"` for non-list layouts.
## filters
**Required:** `fields` (`FilterField[]`). The value is ONE `FilterQuery` tree - `query` + `onQueryChange`, or uncontrolled `defaultQuery`.
**Shape:**
```tsx
const fields: FilterField[] = [
{ id: "title", label: "Title", type: "text" },
{
id: "status",
label: "Status",
type: "select",
options: [
{ value: "active", label: "Active" },
{ value: "archived", label: "Archived" },
],
},
]
const [query, setQuery] = useState<FilterQuery>(() => createFilterQuery())
<Filters fields={fields} query={query} onQueryChange={setQuery} />
```
**Gotcha:** the state is a TREE, not a list of chips. `FilterQuery` is a group of rules joined by `and`/`or` and a group may hold another group, so `(A and B) or C` is expressible; a rule is `{ id, type: "rule", path: ["status"], operator, value }` and `path` is the whole nested attribute path, root first. The pre-rewrite API is GONE: there is no `filters`/`onChange` prop, no `FilterFieldConfig` (fields are `FilterField`, nested through their own `fields`, keyed `id` not `key`), and no `createFilter()` - it minted ids inside a pure function and broke hydration, so ids now come from `createFilterIdFactory(seed)` seeded off `useId`, and `createFilterQuery()` / `createFilterRule()` take one. Read the query back with `flattenFilterConditions` (`{ path, field, operator, values, negated }` per rule, incomplete rules skipped) and walk the tree yourself when the parentheses carry meaning - the primitive compiles nothing, no SQL, no query string.
`variant` picks the chrome over that one query: `"basic"`, the default, is the flat chip row for a toolbar over a table; `"advanced"` is the condition builder, hung off a trigger or rendered in place with `advancedMode="inline"`. Both read and write the same tree, so a saved view built in one opens in the other. Other props worth knowing before you hand-roll them: `size` is two rungs, `"sm" | "default"`, resolved per style (there is no `lg`); `reorderable` turns on drag and Alt+Arrow row moves in the builder; `onBeforeQueryChange` is the ONE veto point for every write (return `false` to refuse, it cannot rewrite); `editors` registers custom value editors a field selects by `editor` name; `labels` / `operatorLabels` own every rendered string; `pathCollapse` + `maxPathSegments` shorten deep attribute paths; `renderChip` / `renderValue` / `renderEmpty` replace rendered parts. On a field, `loadOptions` supplies async options with paging and `resolveValues` renders a chip restored from a saved view whose option was never loaded. Pairs naturally with `data-grid`.
## cascader
**Required:** `items` (a tree of `{ value, label, children? }`), plus the panel parts inside `CascaderContent`.
**Shape:**
```tsx
<Cascader items={items} value={value} onValueChange={setValue}>
<CascaderTrigger render={<Button variant="outline" />}>
<CascaderValue placeholder="Select an attribute" />
</CascaderTrigger>
<CascaderContent className="w-80">
<CascaderPanel>
<CascaderNav>
<CascaderBreadcrumb />
<CascaderInput />
</CascaderNav>
<CascaderEmpty />
<CascaderList maxHeight={288}>
<CascaderItems />
</CascaderList>
<CascaderStatus />
</CascaderPanel>
</CascaderContent>
</Cascader>
```
**Gotcha:** pressing a branch NAVIGATES, it does not select - only leaves are selectable until you pass `selectable="any"` or a predicate, and once a branch is selectable its chevron becomes the only way to open it. `CascaderInput` must stay inside `CascaderContent` (Base UI refills the query from the selection when the input sits outside the popup). Always include `CascaderStatus`: it is the live region announcing level changes, which the visual breadcrumb does not provide to screen readers. Accepts a flat adjacency list via `getParent` as well as nested `children`. `searchScope="deep"` searches every level and annotates results with their path; `multiple` gives checkbox rows; `inline` + a bare `CascaderPanel` embeds it with no popover.
The shape above is `mode="drill"`, the default. `mode="tree"` keeps the same parts (drop `CascaderBreadcrumb`, pass `showBack={false}`, drive expansion with `expanded`/`onExpandedChange`); `mode="columns"` REPLACES `CascaderList` + `CascaderItems` with a single `CascaderColumns`, and has no breadcrumb. Other props worth knowing before you hand-roll them: `cascade` (multi-select only, parent/child selection with indeterminate branches - pair it with `selectable="any"`, since a leaf-only tree can never cascade), `indicator={false}` to drop the single-select check and its gutter (visual only, no-op with `multiple`), `virtualize`/`virtualizeThreshold` plus `CascaderVirtualItems` for long levels, and `getChildren` for async levels with cursor paging, retry on failure and optional `prefetch`. `CascaderFooter` pins commands below the list (`actions` is the quick path) and `CascaderSubmenu` opens one as a side-anchored flyout with the full menu keyboard model. To head a run of rows use `CascaderGroup` wrapping a `CascaderLabel` - a bare label inside a listbox names nothing and is dropped from the accessibility tree - and `CascaderSeparator` for the rule between runs. Every rendered string comes from `labels`, and the panel is RTL-correct under a `DirectionProvider` or `dir="rtl"`.
## date-selector
**Required:** none, but wire `onChange` to capture the value.
**Shape:**
```tsx
const [value, setValue] = useState<DateSelectorValue | undefined>()
<DateSelector value={value} onChange={setValue} label="Due date" />
```
**Gotcha:** the value is a structured `DateSelectorValue` (period / operator / start+end dates), NOT a `Date` - never pass a raw `Date`. Use `allowRange={false}` to lock single-date picking. Read `get_component("date-selector")` for the value shape.
## tree
**Required:** `tree` (a `@headless-tree/core` instance you construct)
**Shape:**
```tsx
<Tree tree={tree}>
{tree.getItems().map((item) => (
<TreeItem key={item.getId()} item={item}>
<TreeItemLabel />
</TreeItem>
))}
</Tree>
```
**Gotcha:** `Tree` is a styled shell - it takes a headless-tree instance via `tree`, NOT `data`/`items` props. Build the instance with `@headless-tree/react`. External API: https://headless-tree.lukasbach.com/
## stepper
**Required:** `StepperItem step` (number), `StepperContent value` (number)
**Shape:**
```tsx
<Stepper defaultValue={1}>
<StepperNav>
<StepperItem step={1}>
<StepperTrigger><StepperIndicator>1</StepperIndicator></StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem step={2}>
<StepperTrigger><StepperIndicator>2</StepperIndicator></StepperTrigger>
</StepperItem>
</StepperNav>
<StepperPanel>
<StepperContent value={1}>Step 1 content</StepperContent>
<StepperContent value={2}>Step 2 content</StepperContent>
</StepperPanel>
</Stepper>
```
**Gotcha:** steps are 1-indexed. Without `StepperPanel` + `StepperContent` you render the nav trail but no body. Put `StepperSeparator` in every `StepperItem` except the last.
## timeline
**Required:** `TimelineItem step` (number)
**Shape:**
```tsx
<Timeline>
<TimelineItem step={1}>
<TimelineHeader>
<TimelineDate>March 2024</TimelineDate>
<TimelineTitle>Project initialized</TimelineTitle>
</TimelineHeader>
<TimelineIndicator />
<TimelineSeparator />
<TimelineContent>Repo and architecture set up.</TimelineContent>
</TimelineItem>
</Timeline>
```
**Gotcha:** each item needs a unique `step`. `orientation` is `"vertical"` (default) or `"horizontal"`. This is a static event display, not interactive like `stepper`.
## autocomplete
**Required:** `items` (array; each item has at least `value`)
**Shape:**
```tsx
<Autocomplete items={items}>
<AutocompleteInput placeholder="Search..." />
<AutocompleteContent>
<AutocompleteEmpty>No results found.</AutocompleteEmpty>
<AutocompleteList>
{(item) => (
<AutocompleteItem key={item.value} value={item}>{item.label}</AutocompleteItem>
)}
</AutocompleteList>
</AutocompleteContent>
</Autocomplete>
```
**Gotcha:** `AutocompleteList` takes a render-prop `(item) => ReactNode`, NOT a mapped array of children. External API: https://base-ui.com/react/components/autocomplete
## phone-input
**Required:** none, but wire `onChange`.
**Shape:**
```tsx
<PhoneInput placeholder="Enter phone number" defaultCountry="US" value={value} onChange={setValue} />
```
**Gotcha:** `value`/`onChange` use an E.164 string (e.g. `"+14155551234"`), not a display-formatted string; `onChange` can fire `undefined`. `defaultCountry` is a 2-letter ISO code. Wraps `react-phone-number-input`.
## number-field
**Required:** wrap the controls in `NumberFieldGroup`.
**Shape:**
```tsx
<NumberField defaultValue={0}>
<NumberFieldScrubArea label="Quantity" />
<NumberFieldGroup>
<NumberFieldDecrement />
<NumberFieldInput />
<NumberFieldIncrement />
</NumberFieldGroup>
</NumberField>
```
**Gotcha:** import from `@/components/ui/number-field`. The accessible label goes on `NumberFieldScrubArea`, not `NumberField`. External API: https://base-ui.com/react/components/number-field
## rating
**Required:** `rating` (number)
**Shape:**
```tsx
<Rating rating={4.5} showValue editable onRatingChange={setRating} />
```
**Gotcha:** supports decimals (partial stars). Pass `editable` + `onRatingChange` for interactive input; omit both for a read-only display.
## scrollspy
**Required:** `targetRef` (the scroll container ref)
**Shape:**
```tsx
<Scrollspy targetRef={containerRef}>
<a href="#s1" data-scrollspy-anchor="s1">Section 1</a>
<a href="#s2" data-scrollspy-anchor="s2">Section 2</a>
</Scrollspy>
<div ref={containerRef}>
<div id="s1">...</div>
<div id="s2">...</div>
</div>
```
**Gotcha:** each link's `data-scrollspy-anchor` must match a section `id`. `targetRef` is the scrollable container (defaults to the window).
## frame
**Required:** `Frame` > `FramePanel`
**Shape:**
```tsx
<Frame>
<FramePanel>
<FrameHeader>
<FrameTitle>Title</FrameTitle>
<FrameDescription>Description</FrameDescription>
</FrameHeader>
<div className="p-5">Content</div>
<FrameFooter>Footer</FrameFooter>
</FramePanel>
</Frame>
```
**Gotcha:** a structured card shell for tool-like surfaces. `stacked` connects multiple panels with shared borders; `dense` removes panel padding; radius via the `--frame-radius` CSS variable.
## icon-stack
**Required:** one child icon
**Shape:**
```tsx
<IconStack aria-hidden="true">
<InboxIcon className="size-4" />
</IconStack>
```
**Gotcha:** isometric layered artwork for empty states and illustrations; style the inner icon via its own `className`. Mark purely decorative stacks `aria-hidden="true"` and keep the real label in surrounding copy.
## icon-tile
**Required:** one child icon
**Shape:**
```tsx
<IconTile variant="elevated" size="lg">
<PackageIcon />
</IconTile>
```
**Gotcha:** the square container an icon sits in, so every list row, feature card and empty state shares one affordance. `variant`: `outline` (default) | `elevated` (muted fill, raised ring) | `soft` (tinted nested, tone from currentColor) | `solid` (filled tone, contrasting glyph) | `frame` (double container). `soft` and `solid` retint from one text color class (they default to `text-primary`). `size`: `xs | sm | default | lg | xl` (24/32/40/48/64px tile, glyph scales 12/14/16/20/24px). `radius`: `default | full`. Do not set a `size-*` class on the child icon unless you mean to override the tile's glyph size; recolor with `className` on the tile, not the icon.
## code-block
**Required:** `code` + `language`, or pre-highlighted `lines`.
**Shape:**
```tsx
<CodeBlock code={code} language="tsx" />
<CodeBlock code={code} language="tsx" showLineNumbers maxLines={20}>
<CodeBlockHeader>
<CodeBlockTitle>use-totals.ts</CodeBlockTitle>
<CodeBlockLanguage />
<CodeBlockCopyButton className="ml-auto" />
</CodeBlockHeader>
<CodeBlockExpandButton />
</CodeBlock>
```
**Gotcha:** the one-liner is already a complete block; every child (header, title, language label, copy button, wrap toggle, expand button, line actions) is optional chrome, at any depth. Shiki is the only npm dependency and loads lazily, one chunk per language, on first highlight; `lines` (from `highlightCode` in `code-block-highlight`, which is server-safe and has no `"use client"`) or `highlight={false}` loads nothing at all. `maxLines` caps the height AND marks the block collapsible, which is what makes `CodeBlockExpandButton` appear. Use `variant="ghost"` when the block sits inside a surface that already has a border.
## alert
**Required:** `Alert` > `AlertTitle`
**Shape:**
```tsx
<Alert variant="success">
<ShieldCheckIcon />
<AlertTitle>Security update</AlertTitle>
<AlertDescription>Enable two-factor authentication.</AlertDescription>
<AlertAction><Button size="xs">Update</Button></AlertAction>
</Alert>
```
**Gotcha:** shadcn-compatible API. `variant`: `default | destructive | info | success | warning | invert`. The non-default variants use ReUI extended color tokens (`--success`/`--info`/`--warning`/`--invert`), which the install adds. Defer generic alert rules to the shadcn skill.
## badge
**Required:** none (text child).
**Shape:**
```tsx
<Badge variant="success-light" size="sm">Success</Badge>
<Badge variant="outline" radius="full">Pill</Badge>
```
**Gotcha:** shadcn-compatible. Rich `variant` set (solid, `-outline`, `-light` per color), `size` `xs..xl`, `radius` `default | full`. Like `alert`, the color variants rely on ReUI extended tokens. Prefer `Badge` variants over raw color classes for statuses.
## base vs radix - write for the project's base
ReUI ships every component in two builds: `base` (Base UI) and `radix` (Radix UI). The install command and name are identical, and the CLI installs the build matching the project. But you must write/adapt code against the **right base**, because their APIs differ.
**Detect the base first.** Read `components.json` -> `style` and take the segment before the first `-`:
- `"style": "base-nova"` -> **Base UI**
- `"style": "radix-nova"` -> **Radix UI**
**Then use that base's API.** The deltas mirror shadcn's base-vs-radix split:
- Slot/composition: Base UI `render={<… />}` vs Radix `asChild`.
- `Select`: Base UI takes `items`; Radix uses `<SelectItem>` children.
- `ToggleGroup`: Base UI `multiple` boolean vs Radix `type="single" | "multiple"`.
The safest path is to **read the installed files and `c-*` examples** - they're already in your base, so reuse their wiring instead of guessing. When `get_component`'s inline `api` or an example shows the other base's shape, translate it to your base (or `validate_usage` to confirm). Defer the generic base/radix mechanics to the shadcn skill.
+45
View File
@@ -0,0 +1,45 @@
# Craft: make ReUI UI exceptional, not generic
ReUI items ship senior-designer quality. Your adaptation has to hold that bar, so the result reads like a real product surface a team would keep - not a wireframe an AI generated. Use these alongside the reuse rules in [adapting.md](./adapting.md).
## Have a point of view
Pick an emotional register before you compose - calm, operational, premium, editorial, dense, energetic - and let layout, spacing, surface treatment, and icon behavior all reinforce it. One or two memorable decisions and restraint everywhere else beats ten generic ones. UI with no point of view reads as generated.
## Brutally clear hierarchy
One focal point per card or panel: the dominant metric or task first, its label second, supporting detail third. The first thing the eye lands on should be the right thing; secondary text must read as secondary. Borders, separators, and surfaces do real work to create 2-3 information bands - don't flatten everything to equal weight.
## Spacing rhythm and deliberate density
Gaps are a signal, not a default. Keep them intentional and consistent within a family (`gap-1`/`gap-2` for tight operational rows, larger gaps for section breaks), and smaller within a group than between groups. Match the surrounding ReUI density; don't pad an operational surface like a marketing page, and don't drift density mid-section. The composition should still feel authored in grayscale.
## Cover the real states (the usual miss)
A surface isn't done at the happy path. Compose, and wire:
- **Empty** - a purposeful empty state (short message + the primary action), never a blank panel.
- **Loading** - a **skeleton** that matches the real layout, not a centered spinner.
- **Error** - an inline, recoverable error with a retry, announced via `role="status"`/`aria-live`.
Derive these from an element the block already has (don't invent parallel markup), or `get_examples` for a state-specific example.
## Responsive by default
Mobile-first, not mobile-afterthought. In constrained rows/cards/sidebars, put `min-w-0` on the shrinking container and `truncate` long single-line labels; protect the primary label's width and let secondary content compress. Reflow layouts (multi-column -> single column) rather than just shrinking them. Desktop and mobile should both look designed.
## Motion, subtly
Motion should clarify, not decorate. Use ReUI Motion Icons on primary actions for a subtle hover cue; keep transitions short (~200-300ms) with calm easing; prefer a skeleton pulse over a spinner. No bouncing, no gratuitous entrance animations on every element.
## Real, activated content
Use believable, typed data (realistic labels, counts, timestamps, statuses that map to a real workflow) - never lorem or abstract filler. Every visible control does something: no decorative buttons, fake tabs, meaningless toggles, or stats with no job. It must still hold with long names, empty values, and crowded data.
## Avoid the AI tells
These instantly read as generated - don't ship them: equal-weight card walls, empty gradients, repetitive padding everywhere, generic enterprise copy, ornamental icons, and number tiles that don't earn their place.
## The bar
Before you finish, ask: **would a product team keep this instead of replacing it? Does it still feel strong after swapping in real content?** If not, reuse the shipped ReUI design harder - don't restyle it into something new - then run the [quality.md](./quality.md) gates.
+39
View File
@@ -0,0 +1,39 @@
# Icons (ReUI delta over shadcn)
Follow the shadcn icon rules (use the project's configured `iconLibrary`, `data-icon` on icons inside `Button`, no sizing classes on icons inside components, pass icons as component objects not string keys). ReUI adds the following.
## Portable icons (library-agnostic)
ReUI components, examples, and blocks are authored to be icon-library-agnostic. When `iconLibrary` is set in `components.json`, the shadcn CLI installs each item's icons in **your** library automatically - you swap nothing. If an installed item's icons don't match your project (for example `iconLibrary` isn't set, so they came in from the item's demo library), change the **import source and component name** to your library, keeping the same icon-name semantics:
- `lucide` -> `lucide-react`
- `tabler` -> `@tabler/icons-react`
- `phosphor` -> `@phosphor-icons/react`
- `remix` -> `@remixicon/react`
- `hugeicons` -> `@hugeicons/react`
Don't assume `lucide-react`; read `iconLibrary` from `components.json`.
## Keep icons purposeful
Icons support the hierarchy, they don't replace it: keep them small, matched to the surrounding density, and decorative ones `aria-hidden="true"` (an icon-only control still needs an accessible label on the control). Don't add ornamental icons that do no job.
## Motion Icons (the `@reui/icons/...` set)
ReUI ships its own icon set in 4 styles (outline, solid, duotone, filled), each icon in two variants:
```bash
npx shadcn@latest add @reui/icons/default/<style>/<name> --yes # static
npx shadcn@latest add @reui/icons/animated/<style>/<name> --yes # hover-animated (motion/react)
```
Finding them via the MCP is free; installing requires an Ultimate license (`REUI_LICENSE_KEY`, see [cli.md](./cli.md)). Reach for a Motion Icon on a primary action when a subtle hover cue helps; keep motion restrained.
Finding icons:
- Several icons (the common case): **`search_icons(concepts[])`** - up to 24 concepts in one call, the best icons per concept with install commands. Pass `animated: true` to get only icons with a hover-animated Motion variant.
- One icon: `search` with `type: "icon"`.
- Icon results and `get_icon` carry `animated: true` and `installAnimated` when an animated variant exists - use those install strings, do not construct paths by hand.
- Every icon result carries a `previewUrl` (its live icon-category page) - **share it with the user** so they can SEE the icon before installing.
The `icon-stack` component composes multiple icons into a stacked display.
+22
View File
@@ -0,0 +1,22 @@
# Quality gates (security, accessibility, scroll)
These are the **done gate**, not a nice-to-have: before you call any ReUI work finished, call the MCP `get_audit_checklist` tool and pass every item below (plus the craft bar in [craft.md](./craft.md)). Then typecheck and lint.
## Security
- Never `dangerouslySetInnerHTML`. Render data as text/components.
- External links (`target="_blank"`) must always pair `rel="noopener noreferrer"`.
- No real PII, secrets, or tokens in demo or committed code. Remote media only from sources the project already allows.
## Accessibility
- Implicit list/card items that navigate get real anchors with a standard hover affordance.
- Icon-only or numeric buttons need an `aria-label`; decorative icons get `aria-hidden`.
- Every non-submit button is `type="button"`.
- Keyboard + focus: everything interactive is reachable in a sensible Tab order with a visible focus ring; layers (dialogs/sheets/menus) trap focus and close on `Escape`. ReUI components ship standard keyboard behavior - read each component's inline `api` rather than re-implementing it.
- Announce async UI: loading and error messages use `role="status"` / `aria-live` so they're not silent to screen readers.
## Scroll mechanics
- Make scroll regions with a parent-owned height: a `min-h-0` + flex chain down to the scroll container. Never guess a `max-h`.
- The scroll container owns `overflow-auto`; ancestors stay `min-h-0` so the height resolves.
+35
View File
@@ -0,0 +1,35 @@
# ReUI registry structure
ReUI is a shadcn-compatible registry with four entity types. **Examples and blocks are built FROM components** - reuse them, don't rebuild.
- **component** - one of the 22 ReUI building blocks with a real API (`data-grid`, `kanban`, `filters`, `date-selector`, `tree`, ...). Install directly (`@reui/data-grid`) or let it come in as a dependency of an example/block. Free. Read its API with `get_component(name)`.
- **example** - a free `c-*` single-pattern use-case of a component (`c-kanban-1`, `c-data-grid-3`). Install one and read it to copy real composition. Find a component's examples with `get_examples(name)`.
- **block** - a premium, full-page section that composes several components (`data-grid-2`, `pricing-page-1`). Pro or Ultimate license at install. Adapts to your active theme via semantic tokens.
- **icon** - Motion Icons in 4 styles (outline, solid, duotone, filled), static (`@reui/icons/default/<style>/<name>`) and hover-animated (`@reui/icons/animated/<style>/<name>`). Ultimate license at install. See [icons.md](./icons.md).
## The @reui registry
Install everything through the shadcn CLI: `npx shadcn@latest add @reui/<name> --yes`. The CLI reads the `@reui` registry from the project's `components.json`. Free items need only the plain string form:
```json
{ "registries": { "@reui": "https://reui.io/r/{style}/{name}.json" } }
```
Premium installs need the authenticated form + `REUI_LICENSE_KEY` in `.env.local` - see [cli.md](./cli.md). The MCP `get_project_context` tool returns the right config.
## Know your base: base or radix
ReUI ships every item in two builds - `base` (Base UI) and `radix` (Radix UI) - with mirrored names. The CLI installs the build matching your project automatically, but **you must write code against the right base's API**. Detect it from `components.json` -> `style`: the segment before the first `-` is the base (`base-nova` -> Base UI, `radix-nova` -> Radix UI). The installed files and `c-*` examples are already in your base - read them and adapt on that base. See [components.md](./components.md) for the API deltas.
**So the MCP's own `docsUrl` and `previewUrl` match your base**, send your `style` to the MCP: add `?style=<your components.json style>` to the ReUI MCP server URL (or set an `X-Reui-Style` header) in your MCP client config - set once, applies to every call. The MCP then resolves docs/preview links to YOUR library (`/docs/components/radix/...`, `/preview/radix/...` for a radix project) instead of the default base; `get_project_context` echoes back the style it currently sees so you can confirm it. Install commands are unaffected (the CLI already installs the right variant). If you notice the MCP returning `base` links for a `radix` project, tell the user to add `?style=` to the server URL.
Blocks adapt to your active theme through semantic tokens and CSS variables - change the theme and every block follows.
## Free vs premium
- **Free, no key:** the 22 components, all `c-*` examples, the ReUI MCP, and this skill.
- **Premium, license required at install:** blocks (Pro or Ultimate), Motion Icons and templates (Ultimate). Set `REUI_LICENSE_KEY` (see [cli.md](./cli.md)).
## Component API index
The canonical index of every component's API docs is **https://reui.io/llms.txt** (returned as `componentsApiUrl` in MCP results). Prefer the inline `api` from `get_component`; use the index/docs as the fallback.
+26
View File
@@ -0,0 +1,26 @@
# Styling (ReUI delta over shadcn)
Follow the shadcn skill for the generic rules (semantic colors not raw values, `gap-*` not `space-y-*`, `size-*`, `cn()`, no manual `dark:` overrides, no overlay `z-index`). This file is only the ReUI-specific additions.
## ReUI extended semantic tokens
ReUI adds semantic tokens beyond shadcn's base set. Use these instead of raw colors for status and emphasis:
- `--success` / `--success-foreground`
- `--info` / `--info-foreground`
- `--warning` / `--warning-foreground`
- `--destructive-foreground` (paired with shadcn's `--destructive`)
- `--invert` / `--invert-foreground` (inverted surfaces)
Use them as Tailwind utilities (`bg-success text-success-foreground`, `text-warning`, ...). They are defined in the project's global CSS and registered with Tailwind (`@theme inline` on v4). If a token is missing in the project, add it to the global CSS file (never a new file) following the same `name` / `name-foreground` convention, exactly as the shadcn customization rules describe.
**Incorrect:** `<span className="text-green-600">Active</span>`
**Correct:** `<Badge variant="success">Active</Badge>` or `<span className="text-success">Active</span>`
## Blocks follow your theme
When you install a block it adapts to your active theme through the semantic tokens above and the project's CSS variables. Don't hardcode style-specific values into installed block code and don't fork it to "restyle" - change the theme via the CSS variables / a preset and every block follows. Want a different look? `search` for a block whose design already fits instead of re-skinning one.
## Density and typography rhythm
ReUI operational UI usually feels dense, not airy. Keep the gap between a title and its supporting description tight by default (`gap-0.5`, `space-y-1`, or `space-y-px`), and smaller than the gap between sections. Match the surrounding ReUI density when you add rows or fields; do not pad operational surfaces like a marketing page.
+54
View File
@@ -0,0 +1,54 @@
# Workflow: find -> install -> read API -> adapt
The core ReUI loop. The MCP tells you what to install and gives you the API; the shadcn CLI installs it; you turn the installed files into correct, themed, data-wired code by **reuse**, not redesign.
## 1. Find (ReUI MCP `search` / `compose_page`)
**Full multi-section page ask?** Call `compose_page(intent, sections?)` FIRST, before searching block-by-block. It returns ordered sections, each with the best block for the intent (top pick + alternates); sections listed in `unavailableSections` have no real inventory - compose those from components, do not force a bad block.
For everything else, call `search` with the user's intent. Pass structured hints whenever you can infer them - you are an LLM, so do the parsing the server cannot:
- `type`: `"component"` (one of the 22 building blocks), `"example"` (a c-\* use-case), `"block"` (a full page/section), `"icon"`.
- `component`: the ReUI component the request implies (`"data-grid"`, `"kanban"`, ...).
- `category`, `features` (e.g. `["sortable","pagination"]`), `free`.
Example: "build a users management page with filters" -> `search({ query: "users management page with filters", type: "block", component: "data-grid", features: ["filters"] })`.
Each result has `install`, `previewUrl`, `docsUrl`, `componentsUsed`, `score`, `termCoverage`, and `whyMatch`. `score` is relative to the top hit (the top is ~100 by construction), not an absolute quality - compare results to each other, and show the user the top options if several score closely; do not silently guess. A low `termCoverage` means a weak match even with a high score - rephrase or widen.
**Always show the preview link.** Whenever you list or recommend items - from `search`, `search_icons`, `list_components`, `compose_page`, or a getter - include each item's `previewUrl` (a live preview page) so the user can SEE it before you install. Blocks and examples link to an individual live preview; icons and components to their live category/component page. This applies to every listing, not only a single pick.
## 2. Install (shadcn CLI)
Run the result's `install` command from the project root, non-interactively:
```bash
npx shadcn@latest add @reui/<name> --yes
```
The CLI reads `components.json`, installs the correct base+style variant, resolves `registryDependencies` (a block pulls in its components), installs npm deps, and rewrites aliases. Do not pass the base/style. See [cli.md](./cli.md).
## 3. Read the API (do not guess props)
Before writing code against any component an item uses:
1. The item's `componentDigests` already give a 1-line contract per component - often enough to wire it. For the full API, call **`get_component(names)`** with ALL of `componentsUsed` in ONE call (it accepts an array) and read each inline `api` - no web fetch. **Share the component's `docsUrl`** (its API documentation page) with the user whenever you work with that component's API, so they have the full reference; the `/llms.txt` index is a further fallback.
2. Call **`get_examples(name)`** for the free `c-*` examples of that component; install one and **read the added files** to copy the exact composition. This is the fastest correct path - the example shows real wiring you adapt, not invent.
3. About to write a prop you did not see in an `api` or installed file? Run **`validate_usage`** BEFORE writing the code - per-prop documented / notDocumented verdicts plus did-you-mean suggestions. notDocumented means read the API, not push on.
## 4. Adapt (reuse-first) - do not skip
Installing files is not the end, and redesigning them defeats the point. First note the project's **base** so you write the right API - read `components.json` -> `style` and take the segment before the first `-` (`base-nova` -> Base UI, `radix-nova` -> Radix UI), see [components.md](./components.md). After `add`:
1. **Read the added files**; keep the composition intact. For a block, verify the components are wired correctly (for `data-grid`: a `useTable({ features: dataGridFeatures, ... })` instance passed as `table`, `recordCount` set - see [components.md](./components.md)).
2. **Replace demo data with the user's real data** via typed structures (see [adapting.md](./adapting.md)).
3. **Fix icon imports** to the project's icon library (see [icons.md](./icons.md)).
4. **Align styling** to semantic tokens and the active theme - no raw colors (see [styling.md](./styling.md)).
5. **Validate before finalizing**: if your adaptation introduced components or props you did not read in an `api` or example, run `validate_usage` on them.
6. **Hit the craft bar** - clear hierarchy, deliberate density, the empty / loading / error states, subtle motion, and mobile-first responsiveness (see [craft.md](./craft.md)). Generic-looking output means you under-reused the design, not that it needs restyling.
7. **Pass the quality gates** (security, a11y, scroll) - call the MCP `get_audit_checklist` tool and clear every item (see [quality.md](./quality.md)).
8. **Typecheck / lint**.
## If no single block fits
Compose from components (`compose_page` tells you which sections have no block inventory via `unavailableSections`). `search` the components you need, read each `get_component` API, install a worked `get_examples` example for each, and assemble by adapting those examples. A block in the same category is a useful reference - install it and read its files to see how ReUI composes those components, then adapt.
+58
View File
@@ -0,0 +1,58 @@
# ReUI MCP: full reference
The ReUI MCP (`https://mcp.reui.io`, Streamable HTTP) is free to use but needs a ReUI account: on first use the agent signs in with ReUI (a free account is created if the user has none), so every request is tied to an account. Free covers components and examples; a Pro or Ultimate license unlocks premium blocks and Motion Icons and removes the daily request limit. It does **discovery + guidance** (search, inline APIs, page planning, validation) and never serves source; the shadcn CLI does **installation**, and the license key lives there (the `@reui` entry in `components.json`, backed by `.env.local`). Goal: from the user's intent to correct, themed, data-wired ReUI code in the **fewest tokens and calls**, with **no guessing**.
## Golden path (token-optimal - follow this order)
Most tasks need 2-4 MCP calls and ZERO web fetches:
1. **`search(query, ...hints)`** -> pick the top 1-3 results. Each result already carries `install`, `previewUrl`, `docsUrl`, `componentsUsed`, `score`, `whyMatch`. The payload is complete - do not call another tool just to "confirm" a result.
2. **`get_component([...componentsUsed])`** in ONE batched call (one name or an array of up to 20) -> read each inline `api`. This **replaces** fetching docs pages. Often skippable: search responses carry `componentDigests`, a compact API contract per referenced component.
3. **`get_examples(component)`** -> install ONE returned `c-*` example, read the added files, copy the composition.
4. **`get_install_command(item)`** only to validate a name you are unsure of (results already include `install`). Run the install with the shadcn CLI (`--yes`).
5. **`get_audit_checklist()`** before declaring done.
If you already know the exact item name, skip `search`. Everything else is situational.
## The 5 task-specific tools (when to reach for each)
- **`compose_page`** - BEFORE building any full page (dashboard, settings, billing, landing). Pass the intent (and optionally the sections you want); it returns ordered sections, each with the best premium block for the intent (top pick + alternates). Sections with no real inventory are listed honestly in `unavailableSections` - compose those from components instead of forcing a bad block.
- **`search_icons`** - whenever you need icons, especially several. Batch up to 24 concepts in one call; each concept returns its best icons with install commands. Pass `animated: true` to get only icons that have a hover-animated Motion variant.
- **`validate_usage`** - BEFORE writing code with component names or props you have not read in an inline `api` or an installed example. It checks planned names + props against the indexed API docs and registry item names; returns did-you-mean suggestions and per-prop documented / notDocumented verdicts. Deterministic, no inference - a notDocumented prop means stop and read the API, not push on.
- **`whats_new`** - when your registry knowledge might be stale (a name 404s, the user mentions an item you don't know). Returns items added/removed per build, newest first.
- **`report_issue`** - when an installed item is actually broken (bad source, wrong dependency, broken preview). Goes straight to the ReUI team; rate-limited 5/hour. Not for usage questions.
## All 19 tools
`search`, `get_block`, `get_example`, `get_icon`, `list_block_groups`, `list_block_categories`, `list_example_categories`, `list_icon_categories`, `list_components`, `get_component`, `get_examples`, `search_icons`, `compose_page`, `validate_usage`, `whats_new`, `report_issue`, `get_install_command`, `get_project_context`, `get_audit_checklist`. The MCP serves the full parameter schemas; do not guess parameters beyond them.
## Token + speed rules
- **Batch `get_component`** - ONE call with the whole `componentsUsed` array, never N calls. Skip it entirely when `componentDigests` already answers the question.
- **Read source by installing** - the MCP serves no source. To read or analyze an item's real code, install it with the shadcn CLI and open the local files. Learn an API from the inline `api` / `componentDigests`, never by reading raw source.
- **Infer `search` hints yourself** (`type`, `component`, `category`, `features`, `free`) - hints shrink the result set and the tokens. Keep `limit` low; one right result beats ten.
- Run independent calls (and the shadcn install) concurrently in one turn - serial tool calls are the main source of slowness.
- Don't repeat a search for the same intent; don't call `list_*` to "see everything" - `search` is the entry point, `list_*` is only for browsing a taxonomy the user explicitly wants to explore.
- Prefer `get_component`'s inline `api` over `docsUrl` / `/llms.txt`. Fetch a web page only as a last resort.
## Result shapes (so you don't re-fetch)
- `score` is 0-100 RELATIVE to the top hit (the top is ~100 by construction), not absolute - compare results to each other.
- `termCoverage` (0-1) is the share of the query the item matched - low means a weak match even if the score looks high; rephrase or widen the search.
- Each result carries `whyMatch`, `install`, docs/preview URLs, and a `free` flag; premium items carry `requiredPlan` (`"pro"` for blocks, `"ultimate"` for icons).
- `componentDigests` is a top-level map: a compact API contract per referenced component - often enough to wire an item without a `get_component` call.
- Icon results and `get_icon` include `animated: true` and `installAnimated` when a hover-animated Motion variant exists (animated: `@reui/icons/animated/<style>/<name>`; static: `@reui/icons/default/<style>/<name>`).
## Error playbook
- **401** - the MCP requires a signed-in ReUI account. The client prompts "Sign in with ReUI" (OAuth) on first use; a free account is created if needed. For headless/CI, pass a personal token (`reui_pat_...`, created at https://reui.io/account/mcp?ref=skill) as `Authorization: Bearer`.
- **403 / locked result** - a valid account but the plan does not cover the item: premium blocks need Pro, Motion Icons need Ultimate. Point to https://reui.io/pricing?ref=skill (upgrade). Free accounts still get all components + examples.
- **429** - rate limited (120 requests/min per IP); back off, honor `Retry-After`.
- **not found** (`found: false`) - use the returned `suggestions`, or `search`; check `whats_new` if you suspect a stale name. Never run a fabricated install command.
## Fallbacks
- No ReUI MCP: `npx shadcn@latest search @reui -q "..."` then `add` (generic, no scoring / inline API).
- The shadcn project's own MCP also works over the `@reui` registry: https://ui.shadcn.com/docs/mcp.
Per-agent MCP setup: https://reui.io/docs/mcp?ref=skill
+30
View File
@@ -3,3 +3,33 @@ deploy/netflow-agent/*.py text eol=lf
# Migration hashes authenticate exact reviewed bytes, including existing CRLF files. # Migration hashes authenticate exact reviewed bytes, including existing CRLF files.
# Preserve those bytes on every checkout instead of applying core.autocrlf. # Preserve those bytes on every checkout instead of applying core.autocrlf.
backend/drizzle/*.sql -text backend/drizzle/*.sql -text
# Receipts pinned by SHA-256 over their exact CRLF bytes; keep them byte-for-byte.
/docs/bandwidth-operator-effect-ledger.md -text
/docs/bandwidth-operator-metadata-effect-contract.md -text
/docs/mcp-2gb-operating-progress-20261028.json -text
/docs/mcp-chr-ospf-source-cleanup.json -text
/docs/mcp-chr-ssh-forwarding-policy-observation-v1.json -text
/docs/mcp-db-connected-publisher-source-applied-20261102.json -text
/docs/mcp-db-publisher-journal-lease-source-applied-20261102.json -text
/docs/mcp-db-registry-fusion-acceptance-20261101.json -text
/docs/mcp-db-registry-read-contract-acceptance-20261101.json -text
/docs/mcp-guarded-peer-sources-acceptance-20261029.json -text
/docs/mcp-ipsec-user-create-acceptance-v2.json -text
/docs/mcp-linux-inventory-collector-raw-acceptance-20261101.json -text
/docs/mcp-netflow-settings-acceptance-v2.json -text
/docs/mcp-node-key-effect-progress-20261029.json -text
/docs/mcp-operator-peer-metadata-managed-acceptance-20261028.json -text
/docs/mcp-operator-public-metadata-progress-20261028.json -text
/docs/mcp-portal-permission-catalog-source-applied-20261103.json -text
/docs/mcp-public-registry-metadata-acceptance-20261028.json -text
/docs/mcp-publisher-current-operator-linux-acceptance-20261103.json -text
/docs/mcp-routing-manual-inverse-charge-reproduction-20261101.json -text
/docs/mcp-routing-manual-inverse-charge-reproduction-20261101.md -text
/docs/mcp-routing-manual-inverse-six-case-acceptance-20261101.json -text
/docs/mcp-routing-manual-inverse-six-case-acceptance-20261101.md -text
/docs/mcp-routing44-upgrade-bridge-acceptance-20261101.json -text
/docs/mcp-server-poll-expiry-alignment-source-applied-20261102.json -text
/docs/mcp-two-chr-v40-execution-20261106.json -text
/docs/mcp-vrf-production-ticket-acceptance-v1.json -text
/docs/netflow-agent.md -text
+2 -6
View File
@@ -16,7 +16,7 @@ permissions:
packages: write packages: write
jobs: jobs:
backend-preview: backend-preview:
if: ${{ gitea.event_name == 'workflow_dispatch' && gitea.ref == 'refs/heads/codex/mcp-acceptance-current-20261103' }} if: ${{ gitea.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 40 timeout-minutes: 40
env: env:
@@ -24,7 +24,6 @@ jobs:
EXPECTED_SHA: ${{ inputs.expected_sha }} EXPECTED_SHA: ${{ inputs.expected_sha }}
DISPATCH_SHA: ${{ gitea.sha }} DISPATCH_SHA: ${{ gitea.sha }}
DISPATCH_EVENT: ${{ gitea.event_name }} DISPATCH_EVENT: ${{ gitea.event_name }}
DISPATCH_REF: ${{ gitea.ref }}
REPOSITORY: ${{ gitea.repository }} REPOSITORY: ${{ gitea.repository }}
RUN_ID: ${{ gitea.run_id }} RUN_ID: ${{ gitea.run_id }}
RUN_ATTEMPT: ${{ gitea.run_attempt }} RUN_ATTEMPT: ${{ gitea.run_attempt }}
@@ -43,7 +42,6 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
test "$DISPATCH_EVENT" = workflow_dispatch test "$DISPATCH_EVENT" = workflow_dispatch
test "$DISPATCH_REF" = refs/heads/codex/mcp-acceptance-current-20261103
[[ "$EXPECTED_SHA" =~ ^[0-9a-f]{40}$ ]] [[ "$EXPECTED_SHA" =~ ^[0-9a-f]{40}$ ]]
test "$EXPECTED_SHA" = "$DISPATCH_SHA" test "$EXPECTED_SHA" = "$DISPATCH_SHA"
test "$(git rev-parse HEAD)" = "$EXPECTED_SHA" test "$(git rev-parse HEAD)" = "$EXPECTED_SHA"
@@ -139,7 +137,7 @@ jobs:
if-no-files-found: error if-no-files-found: error
retention-days: 14 retention-days: 14
frontend-preview: frontend-preview:
if: ${{ gitea.event_name == 'workflow_dispatch' && gitea.ref == 'refs/heads/codex/mcp-acceptance-current-20261103' }} if: ${{ gitea.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 40 timeout-minutes: 40
env: env:
@@ -147,7 +145,6 @@ jobs:
EXPECTED_SHA: ${{ inputs.expected_sha }} EXPECTED_SHA: ${{ inputs.expected_sha }}
DISPATCH_SHA: ${{ gitea.sha }} DISPATCH_SHA: ${{ gitea.sha }}
DISPATCH_EVENT: ${{ gitea.event_name }} DISPATCH_EVENT: ${{ gitea.event_name }}
DISPATCH_REF: ${{ gitea.ref }}
REPOSITORY: ${{ gitea.repository }} REPOSITORY: ${{ gitea.repository }}
RUN_ID: ${{ gitea.run_id }} RUN_ID: ${{ gitea.run_id }}
RUN_ATTEMPT: ${{ gitea.run_attempt }} RUN_ATTEMPT: ${{ gitea.run_attempt }}
@@ -179,7 +176,6 @@ jobs:
run: | run: |
set -euo pipefail set -euo pipefail
test "$DISPATCH_EVENT" = workflow_dispatch test "$DISPATCH_EVENT" = workflow_dispatch
test "$DISPATCH_REF" = refs/heads/codex/mcp-acceptance-current-20261103
[[ "$EXPECTED_SHA" =~ ^[0-9a-f]{40}$ ]] [[ "$EXPECTED_SHA" =~ ^[0-9a-f]{40}$ ]]
test "$EXPECTED_SHA" = "$DISPATCH_SHA" test "$EXPECTED_SHA" = "$DISPATCH_SHA"
test "$(git rev-parse HEAD)" = "$EXPECTED_SHA" test "$(git rev-parse HEAD)" = "$EXPECTED_SHA"
+6
View File
@@ -78,3 +78,9 @@ backend/dist-operator/
# Agent-local permissions can contain commands with deployment credentials. # Agent-local permissions can contain commands with deployment credentials.
/.claude/settings.local.json /.claude/settings.local.json
# Local scratch and disposable build outputs (root-anchored).
/tmp-*
/.next-*/
/.serena/
/backend/dist-*/
+67
View File
@@ -0,0 +1,67 @@
---
name: reui
description: Use the ReUI registry from your AI agent - find, install, and correctly use ReUI components (the 22 free building blocks like data-grid, kanban, filters), their free examples, premium blocks, and Motion Icons. Applies in any project using ReUI, the @reui registry, REUI_LICENSE_KEY, or any shadcn project where the user asks for premium blocks, data grids, kanban boards, dashboards, or full pages. Pairs with the free ReUI MCP server for live, scored registry search and inline component APIs.
user-invocable: false
allowed-tools: Bash(npx shadcn@latest *), Bash(pnpm dlx shadcn@latest *), Bash(bunx --bun shadcn@latest *)
---
> **ReUI skill version `fe6742e29c`.** If the ReUI MCP's `get_agent_skill` reports a newer `version`, re-run the ReUI installer (see `get_agent_skill` -> `install.recommended`) to update this skill. Cloud/tools-only agents have no local file and always read the latest - they can ignore this.
# ReUI for Agents
ReUI is a shadcn-compatible registry. It ships four things you **reuse** - never redesign:
- **components** - the 22 ReUI building blocks with real APIs: `data-grid`, `kanban`, `filters`, `date-selector`, `tree`, `stepper`, ... (free)
- **examples** - free `c-*` single-pattern use-cases of a component (`c-kanban-1`); install one and read it to see exact composition
- **blocks** - premium full-page sections that compose components (`data-grid-2`, `pricing-page-1`); Pro or Ultimate license at install
- **icons** - Motion Icons in 4 styles, static + hover-animated variants; Ultimate license at install
The skill is free and this MCP is free to use; it just needs a ReUI account. On first use your agent opens a browser "Sign in with ReUI" prompt (a free account is created if you don't have one). Free covers components and examples with a daily request allowance; a Pro or Ultimate license unlocks premium blocks and Motion Icons and removes the limit (see [rules/registry.md](./rules/registry.md)). The same account and skill work in every agent and service the MCP connects to - this skill is agent-agnostic.
Skill + MCP are a team: this skill is the workflow (how to find, install, read the API, and adapt by reuse); the MCP is the live data and the hands (search, get_component, install commands). Your job: find the right item, install it with the shadcn CLI, read its real API, and **adapt by reuse** - wire real data and theme it; do not hand-roll or restyle what ReUI already provides. This skill **layers on the shadcn skill**: follow that for generic rules (spacing, `cn()`, semantic colors, forms); follow this for everything ReUI-specific.
## The core loop (MCP-native)
1. **Find** - call the ReUI MCP `search` tool with the user's intent. It returns a ranked, scored list across components/examples/blocks/icons, each with an `install` command, `previewUrl`, `docsUrl`, and `componentsUsed`. Pass hints (`type`, `component`, `category`, `features`, `free`) when you can infer them.
2. **Install** - run the returned command non-interactively (`npx shadcn@latest add @reui/<name> --yes`). The CLI resolves deps, aliases, and the base/style from `components.json`. See [cli.md](./rules/cli.md).
3. **Read the API (on your base)** - first note your base from `components.json` -> `style` (`base-nova` -> Base UI, `radix-nova` -> Radix UI). For each component an item uses, call `get_component(name)` and read its **inline `api`** (no web fetch); then `get_examples(name)` to install a worked example and copy its composition - the installed files are already in your base. Whenever you work with a component's API, also **share its `docsUrl`** (the primitive's API documentation page) with the user so they have the full reference. See [components.md](./rules/components.md).
4. **Adapt (reuse-first)** - swap demo data for real data, fix icon imports, align tokens. Do not redesign. See [adapting.md](./rules/adapting.md).
**Always show the preview.** Every item a tool returns carries a `previewUrl` (a live preview page). Whenever you list, recommend, or present ReUI items to the user - blocks, components, examples, or icons, whether from `search`, `search_icons`, `list_components`, `compose_page`, or any getter - include each item's `previewUrl` so they can SEE it before installing. Blocks and examples open an individual live preview; icons and components link to their live category/component page. Never present an item without its preview link.
If the ReUI MCP is not configured, fall back to `npx shadcn@latest search @reui -q "..."` then `add` - but the MCP gives scored matches + inline APIs; prefer it.
## Commands
Run ReUI as explicit slash commands (via the ReUI MCP) **or** just ask in plain language - both run the same workflow.
| Command | Invoke | Does |
| ----------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| **build** | `/mcp__reui__build <what>` | Compose a page/section/feature from ReUI: plan → install → read API → adapt → craft → audit. |
| **add** | `/mcp__reui__add <item>` | Find & install one component/example/block/icon and wire it in. |
| **fix** | `/mcp__reui__fix [target]` | Diagnose & fix ReUI usage: wrong/undocumented props, base/radix mismatch, missing states, a11y/scroll. |
| **improve** | `/mcp__reui__improve [target]` | Refine + extend existing ReUI UI to a production-exceptional bar (hierarchy, density, states, responsive, motion). |
Invocation differs slightly per agent (`/mcp__reui__build` in Claude Code/Cursor/Windsurf, `/mcp.reui.build` in VS Code). No command surface? Just describe what you want - this skill drives the identical loop.
## When to reach for ReUI vs plain shadcn
| Need | Reach for |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------- |
| A full page or section (dashboard, billing, auth, pricing, settings) | `compose_page` first (plans sections + best blocks), then ReUI **blocks** |
| A data table with sorting/filtering/pagination/virtualization | the **data-grid** component (never hand-roll a `<table>`) |
| A drag-and-drop board | the **kanban** component |
| Advanced column filtering, date range, tree, stepper, ... | the matching ReUI **component** |
| A single generic control already in shadcn (Button, Dialog, Select) | plain **shadcn** |
## Detailed references
- [rules/registry.md](./rules/registry.md) - the four types, the @reui registry, base/radix, free vs premium + license
- [rules/workflow.md](./rules/workflow.md) - the find -> install -> read-API -> adapt loop (most important)
- [rules/components.md](./rules/components.md) - the 22 components, the data-grid contract, base vs radix
- [rules/adapting.md](./rules/adapting.md) - reuse-first: preserve the design (no over-customizing), reuse examples + a block's own elements, real data, don't invent APIs
- [rules/craft.md](./rules/craft.md) - make it exceptional: point of view, hierarchy, density, states, responsive, motion, the bar
- [rules/quality.md](./rules/quality.md) - security, accessibility, and scroll gates (the done gate)
- [rules/styling.md](./rules/styling.md) - ReUI extended tokens, theme adaptation, density
- [rules/icons.md](./rules/icons.md) - portable icons, swapping imports, Motion Icons (static + animated)
- [tools.md](./tools.md) - the ReUI MCP: golden path, the 19 tools, token rules, result shapes, errors
+43
View File
@@ -0,0 +1,43 @@
# Adapting installed ReUI code (reuse-first, no AI slop)
ReUI items ship production-quality. Your job is to **adapt by reuse** - wire real data and fit the app - not to redesign or hand-roll. The output should look like ReUI built it for this product.
## Preserve the design - don't over-customize
The design IS the product. A ReUI block/component encodes senior-designer decisions: spacing, hierarchy, density, color treatment, and component choices. The fastest way to turn a premium block back into generic AI slop is to "improve" its look - so don't.
- Change **data, copy, and props**; keep the **structure and styling** it ships with. Make the **smallest** change that wires the real data. If your diff touches `className` / JSX structure more than data / props, you are over-customizing - stop and reuse.
- Don't swap ReUI components for hand-rolled ones, restructure the layout, re-skin spacing / radius / colors, or add decorative chrome. Let the installed components carry the default spacing, radius, sizing, icon rhythm, density, and state styling; add custom Tailwind only when a component genuinely lacks a contract you need.
- Want a different look? `search` for a block whose design already fits and reuse that - don't restyle this one into a new design.
## Reuse the parts: examples and the block's own elements
- **Examples are building parts.** A free `c-*` example is a correct, single-pattern composition you can reuse. Before composing from scratch, `get_examples(component)`, install the closest one, and reuse its wiring - assemble UI from examples instead of hand-rolling what an example already shows.
- **Reuse a block's own elements.** Need more rows, cards, items, or sections than ship by default? Repeat the block's **existing** element by mapping real data through the same markup - never invent parallel markup that drifts from its design. Need a variant (empty / loading / expanded)? Derive it from an element the block already has.
## Don't invent (read, don't guess)
- Never write a prop, variant value, import path, or `@reui/...` name you didn't read in a component's inline `api`, an installed example, or a `search` result. If you didn't see it, treat it as nonexistent - call `get_component` / `get_examples` / `search` first, or run the MCP `validate_usage` tool to check planned names + props against the docs before writing code.
- If a getter returns `found: false` or `search` returns nothing, say so and fall back (plain shadcn, or ask) - never fabricate an install command or an API.
## What to change vs leave alone
- **Change:** the item's own data, copy, props, and layout to fit the app.
- **Leave alone:** installed component files, hooks, and the shared theme - do not edit vendored ReUI internals; change behavior through props and the documented API.
- Blocks are **portable React** - no `next/link`, `next/image`, or other framework-runtime imports inside them. Keep them portable.
## Demo data -> real data
- Replace every placeholder with the user's real data. Model it as **typed data structures** and **map over arrays** - never duplicate JSX per row/card. Keep small block-specific formatters next to the data.
- Wire the real source (columns, fields, fetch). For `data-grid`, implement the server fetch contract if the user needs server-side data.
- **Type from the component API, derive during render.** Type domain state through the component's own types - e.g. map status to `BadgeProps["variant"]` via a typed `Record<Status, …>` - instead of stringly-typed values. Compute view state during render; don't mirror derived data into `useState`/`useEffect`.
- **Adapt on the right base.** Use the API for the project's base (Base UI vs Radix - see [components.md](./components.md)); the installed files are already base-correct, so reuse their shape rather than translating from memory.
## Believable content (no AI tells)
- Use realistic labels, counts, timestamps, and statuses that map to a real workflow.
- No decorative buttons, fake tabs, meaningless toggles, equal-weight card walls, empty gradients, ornamental icons, or generic SaaS filler. Every element should do something.
## Operational surfaces (settings / profile / admin)
Pick ONE archetype and keep the family consistent: a vertical rail (3-6 sections), horizontal tabs (5-8), or a frame/stack. Prefer `frame` for tool-like surfaces, a card for profile-like ones. Don't mix archetypes in one surface.
+60
View File
@@ -0,0 +1,60 @@
# CLI: registry setup, license, non-interactive install
## Registry setup (one-time, per project)
Free items (the 22 components and all `c-*` examples) need only the plain string registry in `components.json`:
```json
{ "registries": { "@reui": "https://reui.io/r/{style}/{name}.json" } }
```
Premium items (blocks; Motion Icons and templates) require a ReUI license at install:
1. Add the key to `.env.local`:
```bash
REUI_LICENSE_KEY=your-license-key
```
2. Switch `components.json` to the authenticated object form:
```json
{
"registries": {
"@reui": {
"url": "https://reui.io/r/{style}/{name}.json",
"headers": { "Authorization": "Bearer ${REUI_LICENSE_KEY}" }
}
}
}
```
The shadcn CLI expands `${REUI_LICENSE_KEY}` from `.env.local` inside `components.json`, but an MCP client config never expands variables, so a ReUI MCP server config must carry the raw token instead (for example `reui_pat_your_token_here`).
The MCP `get_project_context` tool returns the right config. Full guide: https://reui.io/docs/registry?ref=skill
## Installing
Use the project's package runner (check `packageManager`):
```bash
npx shadcn@latest add @reui/<name> --yes # npm
pnpm dlx shadcn@latest add @reui/<name> --yes # pnpm
bunx --bun shadcn@latest add @reui/<name> --yes # bun
```
`--yes` skips confirmation prompts. The CLI auto-detects the package manager from the lockfile (there is no `--package-manager` flag). It also resolves the correct base+style variant from `components.json`, so do not pass a style.
## Handling prompts and conflicts
- **Always pass `--yes`** so the CLI does not block on confirmation prompts.
- **Do NOT pass `--overwrite` by default.** If the CLI reports an existing file, read the output and resolve deliberately: install under a different name, adjust the path, or ask the user. Only use `--overwrite` when the user explicitly wants to replace a file.
- **Preview first when touching an existing project**: `npx shadcn@latest add @reui/<name> --dry-run` shows what would change; `--diff <file>` shows a specific file's diff. Use these before overwriting.
- Run from the **project root** so `components.json` and `.env.local` are found.
## Free vs premium boundary
- Public, no key: `c-*` examples and the 22 components (`@reui/data-grid`, `@reui/badge`, ...) that those examples depend on.
- Key required at install: blocks (`@reui/<category>-N`) need a Pro or Ultimate license; Motion Icons (`@reui/icons/...`) and templates need Ultimate.
If an install 401/403s, the license key is missing, invalid, or the plan does not cover that resource (blocks: Pro or higher; icons and templates: Ultimate). Point the user to https://reui.io/account?ref=skill (their key) or https://reui.io/pricing?ref=skill (upgrade).
+428
View File
@@ -0,0 +1,428 @@
# ReUI components
The 22 ReUI building blocks: `alert`, `autocomplete`, `badge`, `cascader`, `code-block`, `data-grid`, `date-selector`, `event-calendar`, `filters`, `frame`, `gantt`, `icon-stack`, `icon-tile`, `kanban`, `number-field`, `phone-input`, `rating`, `scrollspy`, `sortable`, `stepper`, `timeline`, `tree`. Examples and blocks are composed from these.
**Rule one: never guess a component's API. Read it first.** Call **`get_component(name)`** for its inline `api` (props + usage, no web fetch), and **share the result's `docsUrl`** (the component's API documentation page) with the user whenever you work with that component's API, so they have the full reference (the `/llms.txt` index is a further fallback). Then call **`get_examples(name)`** to install a worked example and copy real composition. The contracts below are first-try orientation (required props, composition shape, the one gotcha); the inline `api` is the full reference. No single block fits? Compose: search the components you need, read each `get_component`, install a `get_examples` example per component, and adapt.
## data-grid (the flagship - read its API every time)
`data-grid` wraps TanStack Table v9. It is NOT a styled `<table>` and does NOT take `data`/`columns` props directly. The contract:
- Build a TanStack table instance with `useTable({ features: dataGridFeatures, ... })` (columns, data). `dataGridFeatures` is exported by the primitive and already bundles sorting, filtering, pagination, row selection, expanding, pinning, resizing and faceting, so there are no per-table row models to wire.
- Pass that instance to `<DataGrid table={table} recordCount={total}>`.
- Compose the body with `DataGridTable` inside `DataGrid`, and enable features through `tableLayout` (e.g. `{ headerSticky: true, columnsResizable: true }`), not ad-hoc classes.
- Server-side data uses the documented fetch shape (`recordCount` is the total for pagination).
```tsx
const table = useTable({
features: dataGridFeatures,
data,
columns,
})
<DataGrid table={table} recordCount={data.length}>
<DataGridTable />
</DataGrid>
```
Common mistakes:
- **Incorrect:** `<DataGrid data={rows} columns={cols} />` - these props do not exist. **Correct:** build a `useTable({ features: dataGridFeatures, ... })` instance and pass `table={table}` + `recordCount`.
- **Incorrect:** a raw `<table>` / hand-rolled pagination. **Correct:** use `data-grid`; read its API for sticky header, pagination, virtualization, row selection.
- **Incorrect:** styling rows/cells with arbitrary classes. **Correct:** drive layout via `tableLayout` and the primitive's `DataGridColumnMeta` (e.g. `cellClassName`, `headerTitle`), set through the bundle's `columnMeta` slot.
## event-calendar
**Required:** events via `events`/`onEventsChange` (controlled) or `defaultEvents` (uncontrolled), plus a height on the root.
**Shape:**
```tsx
<EventCalendar defaultEvents={events} defaultView="month" className="h-[560px]">
<EventCalendarNav />
<EventCalendarContent />
</EventCalendar>
```
**Gotcha:** headless-first: `EventCalendarContent` renders the active view (month/week/day/days/agenda; a resource view activates when `resources` is passed) - there is no per-view JSX to compose. Events are `{ id, title, start, end (exclusive), allDay?, color?, recurrence?, resourceId? }`. Mutations flow through `onEventUpdate`/`canDropEvent` (return `false` to reject); the root needs an explicit height because it is a min-h-0 flex column.
## gantt
**Required:** `resources` (the left tree) plus bars via `events`/`defaultEvents` attached by `resourceId`.
**Shape:**
```tsx
<Gantt defaultEvents={bars} resources={tasks} defaultScale="month" className="h-[480px]">
<GanttNav />
<GanttView />
</Gantt>
```
**Gotcha:** bars move along the time axis only (never across rows) and are all-day spans with exclusive `end`; `progress` is 0-100. Scales are `day | week | month | quarter | year`. Zoom control, infinite scroll, summary rollups, and row checkboxes are ON by default - turn off what you do not need. Same `onEventUpdate`/`canDropEvent` commit pipeline as `event-calendar`; the root needs an explicit height.
## kanban
**Required:** `value` (`Record<string, T[]>`), `onValueChange`, `getItemValue`
**Shape:**
```tsx
<Kanban value={cols} onValueChange={setCols} getItemValue={(i) => i.id}>
<KanbanBoard>
{Object.entries(cols).map(([id, items]) => (
<KanbanColumn key={id} value={id}>
<KanbanColumnHandle><h3>{id}</h3></KanbanColumnHandle>
<KanbanColumnContent value={id}>
{items.map((i) => (
<KanbanItem key={i.id} value={i.id}>
<KanbanItemHandle>{i.title}</KanbanItemHandle>
</KanbanItem>
))}
</KanbanColumnContent>
</KanbanColumn>
))}
</KanbanBoard>
<KanbanOverlay><div className="bg-muted size-full rounded-md" /></KanbanOverlay>
</Kanban>
```
**Gotcha:** state is `Record<columnId, T[]>`. Each `KanbanColumnContent value` must match its parent `KanbanColumn value`. Omit `KanbanOverlay` and the drag preview silently breaks.
## sortable
**Required:** `value` (`T[]`), `onValueChange`, `getItemValue`
**Shape:**
```tsx
<Sortable value={items} onValueChange={setItems} getItemValue={(i) => i.id}>
{items.map((i) => (
<SortableItem key={i.id} value={i.id}>
<SortableItemHandle><GripVertical /></SortableItemHandle>
{i.label}
</SortableItem>
))}
</Sortable>
```
**Gotcha:** a flat 1D reorder list (not columns - that is `kanban`). `getItemValue` must return a stable, unique string. Pass `layout="grid"` or `layout="nested"` for non-list layouts.
## filters
**Required:** `fields` (`FilterField[]`). The value is ONE `FilterQuery` tree - `query` + `onQueryChange`, or uncontrolled `defaultQuery`.
**Shape:**
```tsx
const fields: FilterField[] = [
{ id: "title", label: "Title", type: "text" },
{
id: "status",
label: "Status",
type: "select",
options: [
{ value: "active", label: "Active" },
{ value: "archived", label: "Archived" },
],
},
]
const [query, setQuery] = useState<FilterQuery>(() => createFilterQuery())
<Filters fields={fields} query={query} onQueryChange={setQuery} />
```
**Gotcha:** the state is a TREE, not a list of chips. `FilterQuery` is a group of rules joined by `and`/`or` and a group may hold another group, so `(A and B) or C` is expressible; a rule is `{ id, type: "rule", path: ["status"], operator, value }` and `path` is the whole nested attribute path, root first. The pre-rewrite API is GONE: there is no `filters`/`onChange` prop, no `FilterFieldConfig` (fields are `FilterField`, nested through their own `fields`, keyed `id` not `key`), and no `createFilter()` - it minted ids inside a pure function and broke hydration, so ids now come from `createFilterIdFactory(seed)` seeded off `useId`, and `createFilterQuery()` / `createFilterRule()` take one. Read the query back with `flattenFilterConditions` (`{ path, field, operator, values, negated }` per rule, incomplete rules skipped) and walk the tree yourself when the parentheses carry meaning - the primitive compiles nothing, no SQL, no query string.
`variant` picks the chrome over that one query: `"basic"`, the default, is the flat chip row for a toolbar over a table; `"advanced"` is the condition builder, hung off a trigger or rendered in place with `advancedMode="inline"`. Both read and write the same tree, so a saved view built in one opens in the other. Other props worth knowing before you hand-roll them: `size` is two rungs, `"sm" | "default"`, resolved per style (there is no `lg`); `reorderable` turns on drag and Alt+Arrow row moves in the builder; `onBeforeQueryChange` is the ONE veto point for every write (return `false` to refuse, it cannot rewrite); `editors` registers custom value editors a field selects by `editor` name; `labels` / `operatorLabels` own every rendered string; `pathCollapse` + `maxPathSegments` shorten deep attribute paths; `renderChip` / `renderValue` / `renderEmpty` replace rendered parts. On a field, `loadOptions` supplies async options with paging and `resolveValues` renders a chip restored from a saved view whose option was never loaded. Pairs naturally with `data-grid`.
## cascader
**Required:** `items` (a tree of `{ value, label, children? }`), plus the panel parts inside `CascaderContent`.
**Shape:**
```tsx
<Cascader items={items} value={value} onValueChange={setValue}>
<CascaderTrigger render={<Button variant="outline" />}>
<CascaderValue placeholder="Select an attribute" />
</CascaderTrigger>
<CascaderContent className="w-80">
<CascaderPanel>
<CascaderNav>
<CascaderBreadcrumb />
<CascaderInput />
</CascaderNav>
<CascaderEmpty />
<CascaderList maxHeight={288}>
<CascaderItems />
</CascaderList>
<CascaderStatus />
</CascaderPanel>
</CascaderContent>
</Cascader>
```
**Gotcha:** pressing a branch NAVIGATES, it does not select - only leaves are selectable until you pass `selectable="any"` or a predicate, and once a branch is selectable its chevron becomes the only way to open it. `CascaderInput` must stay inside `CascaderContent` (Base UI refills the query from the selection when the input sits outside the popup). Always include `CascaderStatus`: it is the live region announcing level changes, which the visual breadcrumb does not provide to screen readers. Accepts a flat adjacency list via `getParent` as well as nested `children`. `searchScope="deep"` searches every level and annotates results with their path; `multiple` gives checkbox rows; `inline` + a bare `CascaderPanel` embeds it with no popover.
The shape above is `mode="drill"`, the default. `mode="tree"` keeps the same parts (drop `CascaderBreadcrumb`, pass `showBack={false}`, drive expansion with `expanded`/`onExpandedChange`); `mode="columns"` REPLACES `CascaderList` + `CascaderItems` with a single `CascaderColumns`, and has no breadcrumb. Other props worth knowing before you hand-roll them: `cascade` (multi-select only, parent/child selection with indeterminate branches - pair it with `selectable="any"`, since a leaf-only tree can never cascade), `indicator={false}` to drop the single-select check and its gutter (visual only, no-op with `multiple`), `virtualize`/`virtualizeThreshold` plus `CascaderVirtualItems` for long levels, and `getChildren` for async levels with cursor paging, retry on failure and optional `prefetch`. `CascaderFooter` pins commands below the list (`actions` is the quick path) and `CascaderSubmenu` opens one as a side-anchored flyout with the full menu keyboard model. To head a run of rows use `CascaderGroup` wrapping a `CascaderLabel` - a bare label inside a listbox names nothing and is dropped from the accessibility tree - and `CascaderSeparator` for the rule between runs. Every rendered string comes from `labels`, and the panel is RTL-correct under a `DirectionProvider` or `dir="rtl"`.
## date-selector
**Required:** none, but wire `onChange` to capture the value.
**Shape:**
```tsx
const [value, setValue] = useState<DateSelectorValue | undefined>()
<DateSelector value={value} onChange={setValue} label="Due date" />
```
**Gotcha:** the value is a structured `DateSelectorValue` (period / operator / start+end dates), NOT a `Date` - never pass a raw `Date`. Use `allowRange={false}` to lock single-date picking. Read `get_component("date-selector")` for the value shape.
## tree
**Required:** `tree` (a `@headless-tree/core` instance you construct)
**Shape:**
```tsx
<Tree tree={tree}>
{tree.getItems().map((item) => (
<TreeItem key={item.getId()} item={item}>
<TreeItemLabel />
</TreeItem>
))}
</Tree>
```
**Gotcha:** `Tree` is a styled shell - it takes a headless-tree instance via `tree`, NOT `data`/`items` props. Build the instance with `@headless-tree/react`. External API: https://headless-tree.lukasbach.com/
## stepper
**Required:** `StepperItem step` (number), `StepperContent value` (number)
**Shape:**
```tsx
<Stepper defaultValue={1}>
<StepperNav>
<StepperItem step={1}>
<StepperTrigger><StepperIndicator>1</StepperIndicator></StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem step={2}>
<StepperTrigger><StepperIndicator>2</StepperIndicator></StepperTrigger>
</StepperItem>
</StepperNav>
<StepperPanel>
<StepperContent value={1}>Step 1 content</StepperContent>
<StepperContent value={2}>Step 2 content</StepperContent>
</StepperPanel>
</Stepper>
```
**Gotcha:** steps are 1-indexed. Without `StepperPanel` + `StepperContent` you render the nav trail but no body. Put `StepperSeparator` in every `StepperItem` except the last.
## timeline
**Required:** `TimelineItem step` (number)
**Shape:**
```tsx
<Timeline>
<TimelineItem step={1}>
<TimelineHeader>
<TimelineDate>March 2024</TimelineDate>
<TimelineTitle>Project initialized</TimelineTitle>
</TimelineHeader>
<TimelineIndicator />
<TimelineSeparator />
<TimelineContent>Repo and architecture set up.</TimelineContent>
</TimelineItem>
</Timeline>
```
**Gotcha:** each item needs a unique `step`. `orientation` is `"vertical"` (default) or `"horizontal"`. This is a static event display, not interactive like `stepper`.
## autocomplete
**Required:** `items` (array; each item has at least `value`)
**Shape:**
```tsx
<Autocomplete items={items}>
<AutocompleteInput placeholder="Search..." />
<AutocompleteContent>
<AutocompleteEmpty>No results found.</AutocompleteEmpty>
<AutocompleteList>
{(item) => (
<AutocompleteItem key={item.value} value={item}>{item.label}</AutocompleteItem>
)}
</AutocompleteList>
</AutocompleteContent>
</Autocomplete>
```
**Gotcha:** `AutocompleteList` takes a render-prop `(item) => ReactNode`, NOT a mapped array of children. External API: https://base-ui.com/react/components/autocomplete
## phone-input
**Required:** none, but wire `onChange`.
**Shape:**
```tsx
<PhoneInput placeholder="Enter phone number" defaultCountry="US" value={value} onChange={setValue} />
```
**Gotcha:** `value`/`onChange` use an E.164 string (e.g. `"+14155551234"`), not a display-formatted string; `onChange` can fire `undefined`. `defaultCountry` is a 2-letter ISO code. Wraps `react-phone-number-input`.
## number-field
**Required:** wrap the controls in `NumberFieldGroup`.
**Shape:**
```tsx
<NumberField defaultValue={0}>
<NumberFieldScrubArea label="Quantity" />
<NumberFieldGroup>
<NumberFieldDecrement />
<NumberFieldInput />
<NumberFieldIncrement />
</NumberFieldGroup>
</NumberField>
```
**Gotcha:** import from `@/components/ui/number-field`. The accessible label goes on `NumberFieldScrubArea`, not `NumberField`. External API: https://base-ui.com/react/components/number-field
## rating
**Required:** `rating` (number)
**Shape:**
```tsx
<Rating rating={4.5} showValue editable onRatingChange={setRating} />
```
**Gotcha:** supports decimals (partial stars). Pass `editable` + `onRatingChange` for interactive input; omit both for a read-only display.
## scrollspy
**Required:** `targetRef` (the scroll container ref)
**Shape:**
```tsx
<Scrollspy targetRef={containerRef}>
<a href="#s1" data-scrollspy-anchor="s1">Section 1</a>
<a href="#s2" data-scrollspy-anchor="s2">Section 2</a>
</Scrollspy>
<div ref={containerRef}>
<div id="s1">...</div>
<div id="s2">...</div>
</div>
```
**Gotcha:** each link's `data-scrollspy-anchor` must match a section `id`. `targetRef` is the scrollable container (defaults to the window).
## frame
**Required:** `Frame` > `FramePanel`
**Shape:**
```tsx
<Frame>
<FramePanel>
<FrameHeader>
<FrameTitle>Title</FrameTitle>
<FrameDescription>Description</FrameDescription>
</FrameHeader>
<div className="p-5">Content</div>
<FrameFooter>Footer</FrameFooter>
</FramePanel>
</Frame>
```
**Gotcha:** a structured card shell for tool-like surfaces. `stacked` connects multiple panels with shared borders; `dense` removes panel padding; radius via the `--frame-radius` CSS variable.
## icon-stack
**Required:** one child icon
**Shape:**
```tsx
<IconStack aria-hidden="true">
<InboxIcon className="size-4" />
</IconStack>
```
**Gotcha:** isometric layered artwork for empty states and illustrations; style the inner icon via its own `className`. Mark purely decorative stacks `aria-hidden="true"` and keep the real label in surrounding copy.
## icon-tile
**Required:** one child icon
**Shape:**
```tsx
<IconTile variant="elevated" size="lg">
<PackageIcon />
</IconTile>
```
**Gotcha:** the square container an icon sits in, so every list row, feature card and empty state shares one affordance. `variant`: `outline` (default) | `elevated` (muted fill, raised ring) | `soft` (tinted nested, tone from currentColor) | `solid` (filled tone, contrasting glyph) | `frame` (double container). `soft` and `solid` retint from one text color class (they default to `text-primary`). `size`: `xs | sm | default | lg | xl` (24/32/40/48/64px tile, glyph scales 12/14/16/20/24px). `radius`: `default | full`. Do not set a `size-*` class on the child icon unless you mean to override the tile's glyph size; recolor with `className` on the tile, not the icon.
## code-block
**Required:** `code` + `language`, or pre-highlighted `lines`.
**Shape:**
```tsx
<CodeBlock code={code} language="tsx" />
<CodeBlock code={code} language="tsx" showLineNumbers maxLines={20}>
<CodeBlockHeader>
<CodeBlockTitle>use-totals.ts</CodeBlockTitle>
<CodeBlockLanguage />
<CodeBlockCopyButton className="ml-auto" />
</CodeBlockHeader>
<CodeBlockExpandButton />
</CodeBlock>
```
**Gotcha:** the one-liner is already a complete block; every child (header, title, language label, copy button, wrap toggle, expand button, line actions) is optional chrome, at any depth. Shiki is the only npm dependency and loads lazily, one chunk per language, on first highlight; `lines` (from `highlightCode` in `code-block-highlight`, which is server-safe and has no `"use client"`) or `highlight={false}` loads nothing at all. `maxLines` caps the height AND marks the block collapsible, which is what makes `CodeBlockExpandButton` appear. Use `variant="ghost"` when the block sits inside a surface that already has a border.
## alert
**Required:** `Alert` > `AlertTitle`
**Shape:**
```tsx
<Alert variant="success">
<ShieldCheckIcon />
<AlertTitle>Security update</AlertTitle>
<AlertDescription>Enable two-factor authentication.</AlertDescription>
<AlertAction><Button size="xs">Update</Button></AlertAction>
</Alert>
```
**Gotcha:** shadcn-compatible API. `variant`: `default | destructive | info | success | warning | invert`. The non-default variants use ReUI extended color tokens (`--success`/`--info`/`--warning`/`--invert`), which the install adds. Defer generic alert rules to the shadcn skill.
## badge
**Required:** none (text child).
**Shape:**
```tsx
<Badge variant="success-light" size="sm">Success</Badge>
<Badge variant="outline" radius="full">Pill</Badge>
```
**Gotcha:** shadcn-compatible. Rich `variant` set (solid, `-outline`, `-light` per color), `size` `xs..xl`, `radius` `default | full`. Like `alert`, the color variants rely on ReUI extended tokens. Prefer `Badge` variants over raw color classes for statuses.
## base vs radix - write for the project's base
ReUI ships every component in two builds: `base` (Base UI) and `radix` (Radix UI). The install command and name are identical, and the CLI installs the build matching the project. But you must write/adapt code against the **right base**, because their APIs differ.
**Detect the base first.** Read `components.json` -> `style` and take the segment before the first `-`:
- `"style": "base-nova"` -> **Base UI**
- `"style": "radix-nova"` -> **Radix UI**
**Then use that base's API.** The deltas mirror shadcn's base-vs-radix split:
- Slot/composition: Base UI `render={<… />}` vs Radix `asChild`.
- `Select`: Base UI takes `items`; Radix uses `<SelectItem>` children.
- `ToggleGroup`: Base UI `multiple` boolean vs Radix `type="single" | "multiple"`.
The safest path is to **read the installed files and `c-*` examples** - they're already in your base, so reuse their wiring instead of guessing. When `get_component`'s inline `api` or an example shows the other base's shape, translate it to your base (or `validate_usage` to confirm). Defer the generic base/radix mechanics to the shadcn skill.
+45
View File
@@ -0,0 +1,45 @@
# Craft: make ReUI UI exceptional, not generic
ReUI items ship senior-designer quality. Your adaptation has to hold that bar, so the result reads like a real product surface a team would keep - not a wireframe an AI generated. Use these alongside the reuse rules in [adapting.md](./adapting.md).
## Have a point of view
Pick an emotional register before you compose - calm, operational, premium, editorial, dense, energetic - and let layout, spacing, surface treatment, and icon behavior all reinforce it. One or two memorable decisions and restraint everywhere else beats ten generic ones. UI with no point of view reads as generated.
## Brutally clear hierarchy
One focal point per card or panel: the dominant metric or task first, its label second, supporting detail third. The first thing the eye lands on should be the right thing; secondary text must read as secondary. Borders, separators, and surfaces do real work to create 2-3 information bands - don't flatten everything to equal weight.
## Spacing rhythm and deliberate density
Gaps are a signal, not a default. Keep them intentional and consistent within a family (`gap-1`/`gap-2` for tight operational rows, larger gaps for section breaks), and smaller within a group than between groups. Match the surrounding ReUI density; don't pad an operational surface like a marketing page, and don't drift density mid-section. The composition should still feel authored in grayscale.
## Cover the real states (the usual miss)
A surface isn't done at the happy path. Compose, and wire:
- **Empty** - a purposeful empty state (short message + the primary action), never a blank panel.
- **Loading** - a **skeleton** that matches the real layout, not a centered spinner.
- **Error** - an inline, recoverable error with a retry, announced via `role="status"`/`aria-live`.
Derive these from an element the block already has (don't invent parallel markup), or `get_examples` for a state-specific example.
## Responsive by default
Mobile-first, not mobile-afterthought. In constrained rows/cards/sidebars, put `min-w-0` on the shrinking container and `truncate` long single-line labels; protect the primary label's width and let secondary content compress. Reflow layouts (multi-column -> single column) rather than just shrinking them. Desktop and mobile should both look designed.
## Motion, subtly
Motion should clarify, not decorate. Use ReUI Motion Icons on primary actions for a subtle hover cue; keep transitions short (~200-300ms) with calm easing; prefer a skeleton pulse over a spinner. No bouncing, no gratuitous entrance animations on every element.
## Real, activated content
Use believable, typed data (realistic labels, counts, timestamps, statuses that map to a real workflow) - never lorem or abstract filler. Every visible control does something: no decorative buttons, fake tabs, meaningless toggles, or stats with no job. It must still hold with long names, empty values, and crowded data.
## Avoid the AI tells
These instantly read as generated - don't ship them: equal-weight card walls, empty gradients, repetitive padding everywhere, generic enterprise copy, ornamental icons, and number tiles that don't earn their place.
## The bar
Before you finish, ask: **would a product team keep this instead of replacing it? Does it still feel strong after swapping in real content?** If not, reuse the shipped ReUI design harder - don't restyle it into something new - then run the [quality.md](./quality.md) gates.
+39
View File
@@ -0,0 +1,39 @@
# Icons (ReUI delta over shadcn)
Follow the shadcn icon rules (use the project's configured `iconLibrary`, `data-icon` on icons inside `Button`, no sizing classes on icons inside components, pass icons as component objects not string keys). ReUI adds the following.
## Portable icons (library-agnostic)
ReUI components, examples, and blocks are authored to be icon-library-agnostic. When `iconLibrary` is set in `components.json`, the shadcn CLI installs each item's icons in **your** library automatically - you swap nothing. If an installed item's icons don't match your project (for example `iconLibrary` isn't set, so they came in from the item's demo library), change the **import source and component name** to your library, keeping the same icon-name semantics:
- `lucide` -> `lucide-react`
- `tabler` -> `@tabler/icons-react`
- `phosphor` -> `@phosphor-icons/react`
- `remix` -> `@remixicon/react`
- `hugeicons` -> `@hugeicons/react`
Don't assume `lucide-react`; read `iconLibrary` from `components.json`.
## Keep icons purposeful
Icons support the hierarchy, they don't replace it: keep them small, matched to the surrounding density, and decorative ones `aria-hidden="true"` (an icon-only control still needs an accessible label on the control). Don't add ornamental icons that do no job.
## Motion Icons (the `@reui/icons/...` set)
ReUI ships its own icon set in 4 styles (outline, solid, duotone, filled), each icon in two variants:
```bash
npx shadcn@latest add @reui/icons/default/<style>/<name> --yes # static
npx shadcn@latest add @reui/icons/animated/<style>/<name> --yes # hover-animated (motion/react)
```
Finding them via the MCP is free; installing requires an Ultimate license (`REUI_LICENSE_KEY`, see [cli.md](./cli.md)). Reach for a Motion Icon on a primary action when a subtle hover cue helps; keep motion restrained.
Finding icons:
- Several icons (the common case): **`search_icons(concepts[])`** - up to 24 concepts in one call, the best icons per concept with install commands. Pass `animated: true` to get only icons with a hover-animated Motion variant.
- One icon: `search` with `type: "icon"`.
- Icon results and `get_icon` carry `animated: true` and `installAnimated` when an animated variant exists - use those install strings, do not construct paths by hand.
- Every icon result carries a `previewUrl` (its live icon-category page) - **share it with the user** so they can SEE the icon before installing.
The `icon-stack` component composes multiple icons into a stacked display.
+22
View File
@@ -0,0 +1,22 @@
# Quality gates (security, accessibility, scroll)
These are the **done gate**, not a nice-to-have: before you call any ReUI work finished, call the MCP `get_audit_checklist` tool and pass every item below (plus the craft bar in [craft.md](./craft.md)). Then typecheck and lint.
## Security
- Never `dangerouslySetInnerHTML`. Render data as text/components.
- External links (`target="_blank"`) must always pair `rel="noopener noreferrer"`.
- No real PII, secrets, or tokens in demo or committed code. Remote media only from sources the project already allows.
## Accessibility
- Implicit list/card items that navigate get real anchors with a standard hover affordance.
- Icon-only or numeric buttons need an `aria-label`; decorative icons get `aria-hidden`.
- Every non-submit button is `type="button"`.
- Keyboard + focus: everything interactive is reachable in a sensible Tab order with a visible focus ring; layers (dialogs/sheets/menus) trap focus and close on `Escape`. ReUI components ship standard keyboard behavior - read each component's inline `api` rather than re-implementing it.
- Announce async UI: loading and error messages use `role="status"` / `aria-live` so they're not silent to screen readers.
## Scroll mechanics
- Make scroll regions with a parent-owned height: a `min-h-0` + flex chain down to the scroll container. Never guess a `max-h`.
- The scroll container owns `overflow-auto`; ancestors stay `min-h-0` so the height resolves.
+35
View File
@@ -0,0 +1,35 @@
# ReUI registry structure
ReUI is a shadcn-compatible registry with four entity types. **Examples and blocks are built FROM components** - reuse them, don't rebuild.
- **component** - one of the 22 ReUI building blocks with a real API (`data-grid`, `kanban`, `filters`, `date-selector`, `tree`, ...). Install directly (`@reui/data-grid`) or let it come in as a dependency of an example/block. Free. Read its API with `get_component(name)`.
- **example** - a free `c-*` single-pattern use-case of a component (`c-kanban-1`, `c-data-grid-3`). Install one and read it to copy real composition. Find a component's examples with `get_examples(name)`.
- **block** - a premium, full-page section that composes several components (`data-grid-2`, `pricing-page-1`). Pro or Ultimate license at install. Adapts to your active theme via semantic tokens.
- **icon** - Motion Icons in 4 styles (outline, solid, duotone, filled), static (`@reui/icons/default/<style>/<name>`) and hover-animated (`@reui/icons/animated/<style>/<name>`). Ultimate license at install. See [icons.md](./icons.md).
## The @reui registry
Install everything through the shadcn CLI: `npx shadcn@latest add @reui/<name> --yes`. The CLI reads the `@reui` registry from the project's `components.json`. Free items need only the plain string form:
```json
{ "registries": { "@reui": "https://reui.io/r/{style}/{name}.json" } }
```
Premium installs need the authenticated form + `REUI_LICENSE_KEY` in `.env.local` - see [cli.md](./cli.md). The MCP `get_project_context` tool returns the right config.
## Know your base: base or radix
ReUI ships every item in two builds - `base` (Base UI) and `radix` (Radix UI) - with mirrored names. The CLI installs the build matching your project automatically, but **you must write code against the right base's API**. Detect it from `components.json` -> `style`: the segment before the first `-` is the base (`base-nova` -> Base UI, `radix-nova` -> Radix UI). The installed files and `c-*` examples are already in your base - read them and adapt on that base. See [components.md](./components.md) for the API deltas.
**So the MCP's own `docsUrl` and `previewUrl` match your base**, send your `style` to the MCP: add `?style=<your components.json style>` to the ReUI MCP server URL (or set an `X-Reui-Style` header) in your MCP client config - set once, applies to every call. The MCP then resolves docs/preview links to YOUR library (`/docs/components/radix/...`, `/preview/radix/...` for a radix project) instead of the default base; `get_project_context` echoes back the style it currently sees so you can confirm it. Install commands are unaffected (the CLI already installs the right variant). If you notice the MCP returning `base` links for a `radix` project, tell the user to add `?style=` to the server URL.
Blocks adapt to your active theme through semantic tokens and CSS variables - change the theme and every block follows.
## Free vs premium
- **Free, no key:** the 22 components, all `c-*` examples, the ReUI MCP, and this skill.
- **Premium, license required at install:** blocks (Pro or Ultimate), Motion Icons and templates (Ultimate). Set `REUI_LICENSE_KEY` (see [cli.md](./cli.md)).
## Component API index
The canonical index of every component's API docs is **https://reui.io/llms.txt** (returned as `componentsApiUrl` in MCP results). Prefer the inline `api` from `get_component`; use the index/docs as the fallback.
+26
View File
@@ -0,0 +1,26 @@
# Styling (ReUI delta over shadcn)
Follow the shadcn skill for the generic rules (semantic colors not raw values, `gap-*` not `space-y-*`, `size-*`, `cn()`, no manual `dark:` overrides, no overlay `z-index`). This file is only the ReUI-specific additions.
## ReUI extended semantic tokens
ReUI adds semantic tokens beyond shadcn's base set. Use these instead of raw colors for status and emphasis:
- `--success` / `--success-foreground`
- `--info` / `--info-foreground`
- `--warning` / `--warning-foreground`
- `--destructive-foreground` (paired with shadcn's `--destructive`)
- `--invert` / `--invert-foreground` (inverted surfaces)
Use them as Tailwind utilities (`bg-success text-success-foreground`, `text-warning`, ...). They are defined in the project's global CSS and registered with Tailwind (`@theme inline` on v4). If a token is missing in the project, add it to the global CSS file (never a new file) following the same `name` / `name-foreground` convention, exactly as the shadcn customization rules describe.
**Incorrect:** `<span className="text-green-600">Active</span>`
**Correct:** `<Badge variant="success">Active</Badge>` or `<span className="text-success">Active</span>`
## Blocks follow your theme
When you install a block it adapts to your active theme through the semantic tokens above and the project's CSS variables. Don't hardcode style-specific values into installed block code and don't fork it to "restyle" - change the theme via the CSS variables / a preset and every block follows. Want a different look? `search` for a block whose design already fits instead of re-skinning one.
## Density and typography rhythm
ReUI operational UI usually feels dense, not airy. Keep the gap between a title and its supporting description tight by default (`gap-0.5`, `space-y-1`, or `space-y-px`), and smaller than the gap between sections. Match the surrounding ReUI density when you add rows or fields; do not pad operational surfaces like a marketing page.
+54
View File
@@ -0,0 +1,54 @@
# Workflow: find -> install -> read API -> adapt
The core ReUI loop. The MCP tells you what to install and gives you the API; the shadcn CLI installs it; you turn the installed files into correct, themed, data-wired code by **reuse**, not redesign.
## 1. Find (ReUI MCP `search` / `compose_page`)
**Full multi-section page ask?** Call `compose_page(intent, sections?)` FIRST, before searching block-by-block. It returns ordered sections, each with the best block for the intent (top pick + alternates); sections listed in `unavailableSections` have no real inventory - compose those from components, do not force a bad block.
For everything else, call `search` with the user's intent. Pass structured hints whenever you can infer them - you are an LLM, so do the parsing the server cannot:
- `type`: `"component"` (one of the 22 building blocks), `"example"` (a c-\* use-case), `"block"` (a full page/section), `"icon"`.
- `component`: the ReUI component the request implies (`"data-grid"`, `"kanban"`, ...).
- `category`, `features` (e.g. `["sortable","pagination"]`), `free`.
Example: "build a users management page with filters" -> `search({ query: "users management page with filters", type: "block", component: "data-grid", features: ["filters"] })`.
Each result has `install`, `previewUrl`, `docsUrl`, `componentsUsed`, `score`, `termCoverage`, and `whyMatch`. `score` is relative to the top hit (the top is ~100 by construction), not an absolute quality - compare results to each other, and show the user the top options if several score closely; do not silently guess. A low `termCoverage` means a weak match even with a high score - rephrase or widen.
**Always show the preview link.** Whenever you list or recommend items - from `search`, `search_icons`, `list_components`, `compose_page`, or a getter - include each item's `previewUrl` (a live preview page) so the user can SEE it before you install. Blocks and examples link to an individual live preview; icons and components to their live category/component page. This applies to every listing, not only a single pick.
## 2. Install (shadcn CLI)
Run the result's `install` command from the project root, non-interactively:
```bash
npx shadcn@latest add @reui/<name> --yes
```
The CLI reads `components.json`, installs the correct base+style variant, resolves `registryDependencies` (a block pulls in its components), installs npm deps, and rewrites aliases. Do not pass the base/style. See [cli.md](./cli.md).
## 3. Read the API (do not guess props)
Before writing code against any component an item uses:
1. The item's `componentDigests` already give a 1-line contract per component - often enough to wire it. For the full API, call **`get_component(names)`** with ALL of `componentsUsed` in ONE call (it accepts an array) and read each inline `api` - no web fetch. **Share the component's `docsUrl`** (its API documentation page) with the user whenever you work with that component's API, so they have the full reference; the `/llms.txt` index is a further fallback.
2. Call **`get_examples(name)`** for the free `c-*` examples of that component; install one and **read the added files** to copy the exact composition. This is the fastest correct path - the example shows real wiring you adapt, not invent.
3. About to write a prop you did not see in an `api` or installed file? Run **`validate_usage`** BEFORE writing the code - per-prop documented / notDocumented verdicts plus did-you-mean suggestions. notDocumented means read the API, not push on.
## 4. Adapt (reuse-first) - do not skip
Installing files is not the end, and redesigning them defeats the point. First note the project's **base** so you write the right API - read `components.json` -> `style` and take the segment before the first `-` (`base-nova` -> Base UI, `radix-nova` -> Radix UI), see [components.md](./components.md). After `add`:
1. **Read the added files**; keep the composition intact. For a block, verify the components are wired correctly (for `data-grid`: a `useTable({ features: dataGridFeatures, ... })` instance passed as `table`, `recordCount` set - see [components.md](./components.md)).
2. **Replace demo data with the user's real data** via typed structures (see [adapting.md](./adapting.md)).
3. **Fix icon imports** to the project's icon library (see [icons.md](./icons.md)).
4. **Align styling** to semantic tokens and the active theme - no raw colors (see [styling.md](./styling.md)).
5. **Validate before finalizing**: if your adaptation introduced components or props you did not read in an `api` or example, run `validate_usage` on them.
6. **Hit the craft bar** - clear hierarchy, deliberate density, the empty / loading / error states, subtle motion, and mobile-first responsiveness (see [craft.md](./craft.md)). Generic-looking output means you under-reused the design, not that it needs restyling.
7. **Pass the quality gates** (security, a11y, scroll) - call the MCP `get_audit_checklist` tool and clear every item (see [quality.md](./quality.md)).
8. **Typecheck / lint**.
## If no single block fits
Compose from components (`compose_page` tells you which sections have no block inventory via `unavailableSections`). `search` the components you need, read each `get_component` API, install a worked `get_examples` example for each, and assemble by adapting those examples. A block in the same category is a useful reference - install it and read its files to see how ReUI composes those components, then adapt.
+58
View File
@@ -0,0 +1,58 @@
# ReUI MCP: full reference
The ReUI MCP (`https://mcp.reui.io`, Streamable HTTP) is free to use but needs a ReUI account: on first use the agent signs in with ReUI (a free account is created if the user has none), so every request is tied to an account. Free covers components and examples; a Pro or Ultimate license unlocks premium blocks and Motion Icons and removes the daily request limit. It does **discovery + guidance** (search, inline APIs, page planning, validation) and never serves source; the shadcn CLI does **installation**, and the license key lives there (the `@reui` entry in `components.json`, backed by `.env.local`). Goal: from the user's intent to correct, themed, data-wired ReUI code in the **fewest tokens and calls**, with **no guessing**.
## Golden path (token-optimal - follow this order)
Most tasks need 2-4 MCP calls and ZERO web fetches:
1. **`search(query, ...hints)`** -> pick the top 1-3 results. Each result already carries `install`, `previewUrl`, `docsUrl`, `componentsUsed`, `score`, `whyMatch`. The payload is complete - do not call another tool just to "confirm" a result.
2. **`get_component([...componentsUsed])`** in ONE batched call (one name or an array of up to 20) -> read each inline `api`. This **replaces** fetching docs pages. Often skippable: search responses carry `componentDigests`, a compact API contract per referenced component.
3. **`get_examples(component)`** -> install ONE returned `c-*` example, read the added files, copy the composition.
4. **`get_install_command(item)`** only to validate a name you are unsure of (results already include `install`). Run the install with the shadcn CLI (`--yes`).
5. **`get_audit_checklist()`** before declaring done.
If you already know the exact item name, skip `search`. Everything else is situational.
## The 5 task-specific tools (when to reach for each)
- **`compose_page`** - BEFORE building any full page (dashboard, settings, billing, landing). Pass the intent (and optionally the sections you want); it returns ordered sections, each with the best premium block for the intent (top pick + alternates). Sections with no real inventory are listed honestly in `unavailableSections` - compose those from components instead of forcing a bad block.
- **`search_icons`** - whenever you need icons, especially several. Batch up to 24 concepts in one call; each concept returns its best icons with install commands. Pass `animated: true` to get only icons that have a hover-animated Motion variant.
- **`validate_usage`** - BEFORE writing code with component names or props you have not read in an inline `api` or an installed example. It checks planned names + props against the indexed API docs and registry item names; returns did-you-mean suggestions and per-prop documented / notDocumented verdicts. Deterministic, no inference - a notDocumented prop means stop and read the API, not push on.
- **`whats_new`** - when your registry knowledge might be stale (a name 404s, the user mentions an item you don't know). Returns items added/removed per build, newest first.
- **`report_issue`** - when an installed item is actually broken (bad source, wrong dependency, broken preview). Goes straight to the ReUI team; rate-limited 5/hour. Not for usage questions.
## All 19 tools
`search`, `get_block`, `get_example`, `get_icon`, `list_block_groups`, `list_block_categories`, `list_example_categories`, `list_icon_categories`, `list_components`, `get_component`, `get_examples`, `search_icons`, `compose_page`, `validate_usage`, `whats_new`, `report_issue`, `get_install_command`, `get_project_context`, `get_audit_checklist`. The MCP serves the full parameter schemas; do not guess parameters beyond them.
## Token + speed rules
- **Batch `get_component`** - ONE call with the whole `componentsUsed` array, never N calls. Skip it entirely when `componentDigests` already answers the question.
- **Read source by installing** - the MCP serves no source. To read or analyze an item's real code, install it with the shadcn CLI and open the local files. Learn an API from the inline `api` / `componentDigests`, never by reading raw source.
- **Infer `search` hints yourself** (`type`, `component`, `category`, `features`, `free`) - hints shrink the result set and the tokens. Keep `limit` low; one right result beats ten.
- Run independent calls (and the shadcn install) concurrently in one turn - serial tool calls are the main source of slowness.
- Don't repeat a search for the same intent; don't call `list_*` to "see everything" - `search` is the entry point, `list_*` is only for browsing a taxonomy the user explicitly wants to explore.
- Prefer `get_component`'s inline `api` over `docsUrl` / `/llms.txt`. Fetch a web page only as a last resort.
## Result shapes (so you don't re-fetch)
- `score` is 0-100 RELATIVE to the top hit (the top is ~100 by construction), not absolute - compare results to each other.
- `termCoverage` (0-1) is the share of the query the item matched - low means a weak match even if the score looks high; rephrase or widen the search.
- Each result carries `whyMatch`, `install`, docs/preview URLs, and a `free` flag; premium items carry `requiredPlan` (`"pro"` for blocks, `"ultimate"` for icons).
- `componentDigests` is a top-level map: a compact API contract per referenced component - often enough to wire an item without a `get_component` call.
- Icon results and `get_icon` include `animated: true` and `installAnimated` when a hover-animated Motion variant exists (animated: `@reui/icons/animated/<style>/<name>`; static: `@reui/icons/default/<style>/<name>`).
## Error playbook
- **401** - the MCP requires a signed-in ReUI account. The client prompts "Sign in with ReUI" (OAuth) on first use; a free account is created if needed. For headless/CI, pass a personal token (`reui_pat_...`, created at https://reui.io/account/mcp?ref=skill) as `Authorization: Bearer`.
- **403 / locked result** - a valid account but the plan does not cover the item: premium blocks need Pro, Motion Icons need Ultimate. Point to https://reui.io/pricing?ref=skill (upgrade). Free accounts still get all components + examples.
- **429** - rate limited (120 requests/min per IP); back off, honor `Retry-After`.
- **not found** (`found: false`) - use the returned `suggestions`, or `search`; check `whats_new` if you suspect a stale name. Never run a fabricated install command.
## Fallbacks
- No ReUI MCP: `npx shadcn@latest search @reui -q "..."` then `add` (generic, no scoring / inline API).
- The shadcn project's own MCP also works over the `@reui` registry: https://ui.shadcn.com/docs/mcp.
Per-agent MCP setup: https://reui.io/docs/mcp?ref=skill
@@ -0,0 +1,63 @@
# Локальные GeoLite2-базы (Country + ASN) для потоков по странам и ASN
## Контекст
Сейчас страна и ASN для netflow-потоков резолвятся через внешний RIPEstat API (`backend/src/services/traffic-flow-ripe.ts`): лимит 30 новых префиксов/мин, очередь на 90, кэш в PG `flow_ip_meta`. Новые IP «дозревают» с задержкой, IPv6 не покрывается (кэш индексируется только по IPv4). Локальные mmdb-базы дают мгновенный синхронный lookup всех IP без внешних вызовов.
Решения (подтверждены):
- Источник — **MaxMind GeoLite2 через P3TERX-зеркало**: `https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-Country.mmdb` и `.../GeoLite2-ASN.mmdb`. Без регистрации, ключей и tar-распаковки. Точность по стране у GeoLite2 и IPinfo паритетная (<1% ошибок у обоих, arXiv 2026); выбран P3TERX за надёжность зеркала (5.2k звёзд) и преемственность: текущий RIPE-путь и так читает GeoLite (`maxmind-geo-lite`), история в кэше остаётся консистентной.
- **RIPEstat остаётся fallback** (до первой загрузки баз / если lookup не дал результата).
- City-базу не качаем (lat/lng фронтенд не использует).
## Изменения
### 1. Зависимость
- `npm install -w mikrotik-manager-backend maxmind` — sync-чтение mmdb, встроенные TS-типы, без транзитивных зависимостей, Node 22 ок.
### 2. Новый сервис `backend/src/services/traffic-flow-geoip.ts`
(по конвенциям окружения traffic-flow-*: контракт → маршрут → сервис, без БД-логики в маршрутах)
- Каталог: `backend/storage/geoip/` (конвенция `storage/backups`), файлы `GeoLite2-Country.mmdb`, `GeoLite2-ASN.mmdb`.
- `initGeoip()` — открыть ридеры best-effort при старте (из `index.ts` рядом с `startTrafficFlowListener`), независимо от настроек автообновления: файлы есть — работают.
- `lookupGeoip(ip): FlowIpMeta | null` — синхронно: `country.iso_code` (fallback `registered_country.iso_code`) с валидацией `isIsoCountry`, ASN = `autonomous_system_number`, holder = `autonomous_system_organization`; приватные IP → negative-запись как в RIPE (`isNonPublicIp`); в PG не пишем (lookup и так быстрый). IPv6 поддержан ридером.
- `resolveFlowIp(ip)` — фасад: `lookupGeoip(ip) ?? lookupRipeCached(ip)`; главный экспорт для потребителей.
- `geoipStatus()` — loaded, даты сборки баз (метаданные mmdb). Тест-хук `setGeoipReadersForTests`. Смена ридеров после обновления — атомарная замена ссылок.
### 3. Коллектор `backend/src/services/geoip-update-collector.ts`
`collectGeoipUpdateOnce()` по образцу `certificate-renew-collector.ts`:
1. Conditional GET с ETag/If-None-Match из настроек → 304 = skip (фолбэк-сравнение: размер/содержимое).
2. Скачивание в `*.tmp` через глобальный `fetch` + AbortController с таймаутом (внешний HTTP из service-слоя — по правилу fastify-backend-drizzle).
3. Валидация: открыть ридер из tmp-файла, пробой 8.8.8.8 (страна US, ASN 15169).
4. `fs.rename` атомарная подмена, старый файл → `*.prev` (откат, если новый ридер не открылся).
5. Перезагрузка ридеров, статус в настройках; snapshot для `scheduler_runs` (checked/downloaded/skipped/bytes/error).
### 4. Планировщик (`backend/src/services/scheduler.ts`)
- `JOB_KEYS` += `geoip_update`; case в `runSchedulerJobBody`; блок в `refreshScheduler()` по образцу `certificates_renew`: интервал `Math.max(6ч, updateIntervalSec*1000)`, по умолчанию 7 дней (upstream обновляется еженедельно) + немедленный первый запуск при включённой настройке.
### 5. Схема и миграция
- `backend/src/db/schema.ts`: singleton `geoip_settings` — `enabled` (default true), `updateIntervalSec` (default 604800), `lastCheckAt`, `lastSuccessAt`, `lastError`, `countryBuildAt`, `asnBuildAt`, `etagsJson` (jsonb), `createdAt/updatedAt`.
- Миграция: `npm run db:generate` → файл в `backend/drizzle/`.
### 6. API + контракты
- `packages/contracts/src/geoip.ts`: zod-схемы настроек/статуса (все входы — Zod, по правилам проекта).
- Новый `backend/src/routes/geoip.ts`, регистрация в `index.ts` с prefix `/api`:
- `GET /api/geoip` — настройки + статус (ready, даты сборки, последняя проверка/ошибка);
- `PUT /api/geoip` — сохранить настройки, затем `refreshScheduler()`;
- `POST /api/geoip/update` — запустить загрузку сейчас (409, если уже идёт; флаг-гард как в коллекторах).
### 7. Интеграция в пайплайн (geoip-first, RIPE-fallback)
- `traffic-flow-engine.ts` (`queueParsedFlows`, ~строка 336): `lookupRipeCached` → `resolveFlowIp`. Логика misses не меняется: при готовом mmdb публичные IP (v4+v6) резолвятся сразу, очередь RIPE пустеет; до скачивания баз — прежнее поведение.
- Остальные вызовы `lookupRipeCached` → `resolveFlowIp` (grep: как минимум `traffic-flow-analytics.ts` ~258–271).
- `classifyFlowDst`/бренды не трогаем: holder из mmdb (org name) встаёт в существующие `HOLDER_BRANDS`-регулярки как есть.
### 8. Frontend (по next-shadcn-production / ui-guardian: только переиспользование)
- Секция «GeoIP-базы (GeoLite2)» внутри существующей `components/traffic/netflow-settings-panel.tsx`: статус (готово/не скачано, даты сборки Country/ASN, последняя проверка, ошибка), тумблер автообновления, интервал, кнопка «Обновить сейчас» с индикатором. Только уже используемые в панели примитивы (Switch/Button/поля) — никаких новых визуальных паттернов и Card-shell. API-клиент через существующие http-хелперы.
### 9. Хаускипинг, тесты, проверки
- `backend/.gitignore`: `storage/geoip/`.
- Тесты `backend/src/services/traffic-flow-geoip.test.ts` + скрипт `test:geoip` (по образцу `test:traffic-flow`): приоритет фасада (geoip hit → RIPE не зовётся; miss → fallback), negative на приватных IP, фильтрация EU/ZZ через `isIsoCountry`, коллектор с мокнутым fetch (304-skip, битый файл → подмены нет, `.prev` сохранён), dims по стране/ASN с засеянным ридером.
- Проверки после реализации (обязательно по правилам): типы/сборка бэка (`npm run build -w mikrotik-manager-backend`), типы фронта при правке UI (`npx tsc --noEmit`), `npm run test:geoip` и `test:traffic-flow`; предупреждения не игнорировать.
- Коммит: `feat(netflow): <subject по-русски>` — новая пользовательская фича (мгновенные страна/ASN в потоках), по commit-messages-ru.
- README: короткий раздел о GeoIP; примечание, что в Docker `storage/geoip` ephemeral без тома — базы перекачаются после пересоздания контейнера (~17 МБ); при желании смонтировать volume.
## Что это даёт
Страна и ASN появляются у потока мгновенно при ingest (включая IPv6), без ограничения скорости RIPE; dims `country`/`asn` в `flow_daily_dims`, аналитика (карта, топы, monthly) становятся полными сразу. Внешняя зависимость от stat.ripe.net остаётся только как fallback до первой загрузки баз.
@@ -0,0 +1,46 @@
# IKEv2/IPsec VPN: клиенты, IP-адреса и сертификаты — по образцу WireGuard
## Архитектура (как у WireGuard)
Роутер — источник истины: live-чтение через существующий REST-клиент (`mikrotik.ts`), мутации прямыми REST-вызовами, история через `config_revisions` (новая секция `"ipsec"`; `section` — TEXT без CHECK → **SQL-миграция не нужна**). Новых таблиц нет. Объекты, созданные мастером/при создании клиентов, помечаются managed-комментарием `mm-ipsec` (по образцу managed-markers).
## Модель RouterOS (что создаём/читаем)
Мастер инициализации сервера (per router): CA-сертификат (`/certificate add` + `sign`, key-usage=key-cert-sign,crl-sign), серверный сертификат (CN=адрес/домен, SAN, tls-server), `/ip/ipsec/peer` (passive, exchange-mode=ike2, certificate=серверный cert), `/ip/ipsec/profile`+`proposal` (aes-256/sha256/modp2048, pfs), `/ip pool` + `/ip/ipsec/mode-config` «VPN» (address-pool, dns), policy-template, и опциональное (default on, чекбокс) managed srcnat masquerade-правило «интернет клиентам».
Клиент = `/ip/ipsec/identity`: **Сертификат** (`/certificate add` CN=<имя> → `sign` ca=<CA> → `export-certificate type=pkcs12` → файл `.p12` скачивается с роутера → identity match-by=certificate) или **PSK** (auth-method=pre-shared-key, remote-id+secret). IP: «из пула» (общий mode-config) или статический (персональный `mc-<user>` mode-config с `address=x.x.x.x/32`). Онлайн — `/ip/ipsec/active-peers`.
Клиентские загрузки: `.p12` (cert+key+CA, passphrase) + strongSwan `.sswan` (генерация на бэкенде) + текстовая инструкция. Перекачка `.p12` — повторный export с новой passphrase (ключ остаётся на роутере).
## Бэкенд
1. **`mikrotik.ts`**: `downloadFile(name): Promise<Buffer>` — бинарно-безопасный GET `/rest/file/<name>` (с fallback `flash/<name>`, как у `uploadTextFile`; текущий конвейер парсит JSON как utf8 — нужен Buffer-режим); хелперы `signCertificate` (с поллингом готовности, sign небыстрый), `exportCertificatePkcs12(name, passphrase)`.
2. **`services/ipsec-config.ts`** (чистые, тестируемые): генератор `.sswan` и инструкции, поиск свободного IP в пуле, naming-конвенции (`ipsec-ca`, `ipsec-server`, `mc-<user>`, `ipsec-user-<name>`).
3. **`services/ipsec-ca.ts`**: `ensureCa/ensureServerCert/issueClientCert/exportClientP12` — add → sign (poll) → export → download.
4. **`services/ipsec-ros.ts`**: put/patch/delete для `/ip/ipsec/{peer,identity,mode-config,profile,proposal,policy}`, `/ip/pool`, NAT managed-правило.
5. **`services/ipsec-live.ts`**: `fetchIpsecState(server)` — параллельные GET peer/identity/mode-config/pool/active-peers/certificate (+какие из них наши по маркеру/имени) → DTO; `listIpsec()` fan-out с failures; `countIpsecClients()` для сайдбара.
6. **`entity-snapshots.ts`**: `canonicalIpsecSnapshot/parseIpsecSnapshot/planIpsecRestore` (секреты через `isHiddenSecret`); `CONFIG_SECTIONS` += `"ipsec"`; enum в `schema.ts` (миграции нет).
7. **`routes/ipsec.ts`**: `GET /ipsec` (+observed revision), `POST /ipsec/server/init`, `DELETE /ipsec/server/:serverId` (только managed-объекты), `POST /ipsec/users` (ответ включает одноразовый p12 base64), `PATCH /ipsec/users/:serverId/:rosId` (имя/статический IP/psk), `DELETE /ipsec/users/...` (identity + mc + опционально клиентский cert), `POST /ipsec/users/:serverId/:rosId/cert` (перекачка p12), `GET /ipsec/revisions` + `POST /ipsec/revisions/:id/restore` — всё по образцу `routes/wireguard.ts` (`captureAndAppendRevision`). Регистрация в `index.ts`; `/api/ipsec` в обе группы network-правил `permissions.ts`.
8. **Модуль Пользователи**: `InterfaceType` += `"ipsec"` (iface-type.ts, schema.ts enum — TEXT, без миграции); каталог интерфейсов дополняется IPsec-клиентами (identity name + CN в peerPublicKey/peerName) — привязка app-пользователя к VPN-клиенту.
## Контракт
`packages/contracts/src/ipsec.ts` (+`package.json` exports, `index.ts`): `ipsecPeerDto/identityDto/modeConfigDto/poolDto/activePeerDto/certInfoDto/serverSummaryDto`, list-response с failures, `initRequest` (CN/SAN, пул, DNS, NAT-чекбокс), `userCreateRequest` (имя, auth: certificate|psk, psk?, ip: static|pool, passphrase, daysValid), `certDownloadResponse {filename, contentB64, mime}`.
## Фронт
`app/(main)/ipsec/page.tsx` — «одно окно» по образцу WG-страницы: ServerRail + KPI (серверы IKEv2 / клиенты / онлайн / CA) + Tabs **«Клиенты»** (grid: имя, сервер, аутентификация, IP, онлайн, действия — скачать .p12/.sswan, изменить, удалить; Sheet создания клиента), **«Сервер»** (peer/pool/mode-config/certs + мастер инициализации Stepper + статус NAT-правила), **«CLI»** (шпаргалка). История/restore — `ConfigHistorySheet`. Компоненты `components/ipsec/*` на существующих DataGridShell/form-kit/Sheet; скачивание бинарного p12 — Blob из base64 (по образцу `downloadText`), `.sswan`/инструкция — через `CodeExportSheet`. Сайдбар «IPsec / IKEv2» в «Управление» + бейдж (`sidebar-counts.ts` + mock в `sidebar-badges.ts`) + command-palette. Mock-данные в `lib/data.ts` для демо-режима.
## Тесты и проверка
- `ipsec-config.test.ts` (чистые функции: sswan, свободный IP, naming); `entity-snapshots.test.ts` — `planIpsecRestore` + `opsTouchOnly(["/ip/ipsec", ...])`.
- `npm run build -w @mmapp/contracts`; `tsc` backend/root; `npm --prefix backend run test:config-sync && test:wireguard` + новые; eslint без новых ошибок.
- Демо-режим: визуальная проверка страницы в браузере (как в прошлый раз).
## Риски (проверить на живом роутере при внедрении)
- REST-скачивание файла `GET /rest/file/<name>` — еслиRouterOS отдаёт только метаданные, fallback: чтение `contents` маленьких PEM-файлов или сборка p12 из PEM-частей.
- Точные имена полей mode-config (`address` vs `address-pool`) сверить с живым GET и адаптировать.
- `/certificate/sign` — поллинг готовности с таймаутом ~30–60 с.
Объём большой; коммит/пуш — по готовности, отдельным `feat(ipsec): …`.
+2
View File
@@ -4,6 +4,8 @@
## Содержание ## Содержание
Разрабатываемый MCP для AI-клиентов: [настройка, возможности и текущие ограничения](docs/mcp.md), [полный план реализации](docs/mcp-implementation-plan.md).
1. [Состав монорепозитория](#состав-монорепозитория) 1. [Состав монорепозитория](#состав-монорепозитория)
2. [Архитектура](#архитектура) 2. [Архитектура](#архитектура)
3. [Локальная разработка](#локальная-разработка) 3. [Локальная разработка](#локальная-разработка)
+81
View File
@@ -0,0 +1,81 @@
# PostgreSQL connection string
DATABASE_URL=postgres://mmapp:mmapp@127.0.0.1:5432/mmapp
# Optional operator-approved request and CA for runtime PostgreSQL TLS and SQL identity checks.
# DATABASE_RUNTIME_REQUEST_FILE=/run/config/mmapp/approved-request.json
# DATABASE_RUNTIME_REQUEST_SHA256=<operator-approved SHA-256 of request bytes>
# DATABASE_RUNTIME_CA_FILE=/run/config/mmapp/postgresql-ca.pem
# Optional live operator activation directory (mount the directory read-only).
# DATABASE_RUNTIME_ACTIVATION_DIRECTORY=/var/lib/mmapp/source-activation
# DATABASE_RUNTIME_ACTIVATION_SHA256=<confirmed activation SHA-256>
# Optional operator-approved logical schema SHA-256 from db:inspect-schema.
# DATABASE_RUNTIME_SCHEMA_SHA256=<approved schema SHA-256>
# Restore-aware signed writer profile. Requires source activation, schema pin and restore checkpoint.
# DATABASE_RUNTIME_WRITER_APPROVAL_FILE=/run/config/mmapp/writer-approval.json
# DATABASE_RUNTIME_WRITER_APPROVAL_SHA256=<operator-approved SHA-256 of approval bytes>
# Protected exports use the approved capture role and require this private password file.
# The PostgreSQL TLS peer must present the approved self-signed non-CA leaf.
# DATABASE_ARCHIVE_PASSWORD_FILE=/run/secrets/mmapp_database_archive_password
# Optional owner connection URI file for restore and its schema migrations.
# DATABASE_RESTORE_URL_FILE=/run/secrets/mmapp_database_restore_url
# Opt in on every backend/CLI after provisioning the restore quarantine in mmapp_control.
# DATABASE_RESTORE_QUARANTINE=true
# Optional operator-approved pair for verifying one archive's restored data.
# Requires DATABASE_RESTORE_QUARANTINE and DATABASE_RESTORE_URL_FILE.
# DATABASE_RESTORE_ARCHIVE_SHA256=<approved archive SHA-256>
# DATABASE_RESTORE_DATA_SHA256=<approved data SHA-256>
# Optional checkpoint in an operator-managed directory outside the PostgreSQL and MCP state backups.
# Mount the whole directory read-only. Restore requires a staged pending checkpoint.
# DATABASE_RESTORE_CHECKPOINT_FILE=/run/config/mmapp-restore/database-restore-checkpoint.json
# Local socket served by the operator-side db:serve-restore-claims process.
# DATABASE_RESTORE_CHECKPOINT_CLAIM_SOCKET=/run/mmapp-restore/claims.sock
# SQLite file used only for one-shot boot ETL (empty PG + existing mikrotik.db)
DATABASE_PATH=./mikrotik.db
# SQLITE_IMPORT_FULL_HISTORY=true
# Port for the Fastify server
PORT=8000
# Allowed CORS origin (Next.js frontend)
CORS_ORIGIN=http://localhost:3000
# Portal SSO (false = open API for local/dev)
AUTH_REQUIRED=false
# Same HS256 secret as auth-portal JWT_SECRET when AUTH_REQUIRED=true
AUTH_JWT_SECRET=dev-secret-change-me
AUTH_ISSUER=https://auth.shnt.top
AUTH_PORTAL_URL=http://localhost:5175
# Optional portal -> MCP revocation webhook. Separate random secret, at least 32 characters.
# Portal must send signed events to /_internal/mcp/portal/revocations; see docs/mcp.md.
# MCP_PORTAL_WEBHOOK_SECRET=
# MCP_PUBLIC_URL=https://manager.example/mcp
# MCP_STATE_DIR=/var/lib/mikrotik-manager/mcp-state
# Optional separate, externally provisioned bandwidth control source. No automatic
# schema/key/identity creation. See docs/mcp-bandwidth-control-source.md.
# Use the restricted control runtime role, never the owner/application role.
# MMAPP_BANDWIDTH_CONTROL_URL=postgresql://bandwidth_runtime:change-me@control-db:5432/bandwidth_control
# MMAPP_BANDWIDTH_CONTROL_ATTESTATION_FILE=/etc/mmapp/control/source.json
# MMAPP_BANDWIDTH_CONTROL_TRUST_KEY_FILE=/etc/mmapp/control/issuer-public.pem
# SHA256 of the Ed25519 public SPKI DER, pinned outside the attestation itself.
# MMAPP_BANDWIDTH_CONTROL_TRUST_KEY_SHA256=
# MMAPP_BANDWIDTH_CONTROL_EVENT_KEY_FILE=/etc/mmapp/control/event.key
# Separate persistent registry issuer key (raw 32 bytes, different from event.key)
# and operator bootstrap signed by the pinned control-source Ed25519 issuer.
# These inputs grant no actor/network permissions and create no registry rows.
# MMAPP_BANDWIDTH_NODE_ISSUER_KEY_FILE=/etc/mmapp/control/node-issuer.key
# MMAPP_BANDWIDTH_NODE_ISSUER_KEY_SHA256=
# MMAPP_BANDWIDTH_NODE_BOOTSTRAP_FILE=/etc/mmapp/control/node-bootstrap.json
# Optional: enabled by the NetFlow agent Compose installer. Linux Unix socket only.
# FLOW_AGENT_SOCKET=/run/mm-netflow-host/agent.sock
# Optional UDP NetFlow v9/IPFIX template lifetime in milliseconds (restart required).
# Collector policy defaults to 90 minutes, not a RouterOS default. Set at least
# 3 times the longest configured exporter template refresh interval; data does
# not refresh templates. Missing/expired templates refuse decoding, not zero traffic.
# FLOW_TEMPLATE_LIFETIME_MS=5400000
# Optional NetFlow read admission: standard (default) or constrained.
# Constrained admits two responses (UI + AI), limits SQL sources to 2 MiB,
# cumulative sources to 4 MiB and encoded responses to 2 MiB; large reads refuse.
# This is not a complete installation memory limit. See docs/mcp-2gb-resource-acceptance.md.
# MM_FLOW_READ_RESOURCE_PROFILE=standard
@@ -0,0 +1,8 @@
BEGIN;
CREATE INDEX mcp_audit_routing_charge_profile_window
ON public.mcp_audit (connection_id, (payload -> 'anchor' ->> 'profileId'), created_at, id)
WHERE action = 'routing.charge.admitted';
INSERT INTO public.schema_migrations (id) VALUES ('0057_mcp_routing_charge_audit_index') ON CONFLICT (id) DO NOTHING;
COMMIT;
+8
View File
@@ -16,6 +16,7 @@
"test:traffic-flow:pg": "node scripts/test-mcp-postgres.mjs --flow-writes", "test:traffic-flow:pg": "node scripts/test-mcp-postgres.mjs --flow-writes",
"test:traffic-flow:quality:pg": "node scripts/test-mcp-postgres.mjs --flow-quality", "test:traffic-flow:quality:pg": "node scripts/test-mcp-postgres.mjs --flow-quality",
"test:traffic-flow:chr-evidence": "tsx --test src/test/traffic-flow-chr-capture-check.test.ts src/test/traffic-flow-chr-wire.test.ts src/test/traffic-flow-chr-target-harness.test.ts src/test/traffic-flow-chr-owned-sequence.test.ts src/test/traffic-flow-chr-reconcile.test.ts", "test:traffic-flow:chr-evidence": "tsx --test src/test/traffic-flow-chr-capture-check.test.ts src/test/traffic-flow-chr-wire.test.ts src/test/traffic-flow-chr-target-harness.test.ts src/test/traffic-flow-chr-owned-sequence.test.ts src/test/traffic-flow-chr-reconcile.test.ts",
"test:changed": "node scripts/test-changed.mjs",
"test:mcp:pg:all": "node scripts/test-mcp-postgres.mjs --all", "test:mcp:pg:all": "node scripts/test-mcp-postgres.mjs --all",
"mcp:stdio": "node dist/scripts/mcp-stdio.js", "mcp:stdio": "node dist/scripts/mcp-stdio.js",
"mcp:stdio:dev": "tsx src/scripts/mcp-stdio.ts", "mcp:stdio:dev": "tsx src/scripts/mcp-stdio.ts",
@@ -30,6 +31,13 @@
"start": "node dist/index.js", "start": "node dist/index.js",
"db:generate": "drizzle-kit generate", "db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate", "db:migrate": "drizzle-kit migrate",
"db:prepare": "tsx src/scripts/prepare-database.ts",
"db:complete-restore": "tsx src/scripts/complete-database-restore.ts",
"db:serve-restore-claims": "tsx src/scripts/serve-restore-checkpoint-claims.ts",
"db:seal-restore-checkpoint": "tsx src/scripts/seal-database-restore-checkpoint.ts",
"db:stage-restore-checkpoint": "tsx src/scripts/stage-database-restore-checkpoint.ts",
"db:inspect-restore-checkpoint": "tsx src/scripts/inspect-database-restore-checkpoint.ts",
"db:inspect-schema": "tsx src/scripts/inspect-database-schema.ts",
"db:studio": "drizzle-kit studio", "db:studio": "drizzle-kit studio",
"db:migrate-from-sqlite": "tsx src/scripts/migrate-sqlite-to-pg.ts", "db:migrate-from-sqlite": "tsx src/scripts/migrate-sqlite-to-pg.ts",
"facts:rebuild": "tsx src/scripts/rebuild-flow-facts.ts", "facts:rebuild": "tsx src/scripts/rebuild-flow-facts.ts",
@@ -0,0 +1,72 @@
import { createHash } from 'node:crypto';
import { execFileSync } from 'node:child_process';
import { cpSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const root = fileURLToPath(new URL('../../../', import.meta.url));
const baseRevision = 'bf3d50e1ff2ee3b5c9268991a255c3b49ce6378e';
const sha = bytes => createHash('sha256').update(bytes).digest('hex');
const require = (value, reason) => { if (!value) throw Error(reason); };
const git = (...args) => execFileSync('git', args, { cwd: root, stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 4 * 1024 * 1024 });
const fromRoot = filename => path.join(root, filename);
const readJson = bytes => JSON.parse(bytes.toString('utf8'));
const manifestPath = ['backend/package.json', 'packages/contracts/package.json'];
const runtimeKeys = ['type', 'exports', 'engines', 'dependencies', 'optionalDependencies', 'peerDependencies'];
const normalizeLock = bytes => bytes.toString('utf8').replace(/\r\n/g, '\n');
const sort = values => [...new Set(values)].sort();
function runtimePins() {
const lockFile = readFileSync(fromRoot('package-lock.json'));
require(normalizeLock(lockFile) === normalizeLock(git('show', baseRevision + ':package-lock.json')), 'Runtime lock differs from cached source');
const lock = readJson(lockFile).packages;
return manifestPath.flatMap(filename => {
const current = readJson(readFileSync(fromRoot(filename)));
const cached = readJson(git('show', baseRevision + ':' + filename));
for (const key of runtimeKeys) {
require(JSON.stringify(current[key]) === JSON.stringify(cached[key]), 'Runtime package manifest differs from cached source');
}
const workspace = path.posix.dirname(filename);
return sort(Object.keys(current.dependencies ?? {})).filter(name => name !== '@mmapp/contracts').map(name => {
const nested = workspace + '/node_modules/' + name, shared = 'node_modules/' + name;
const installed = lock[nested] ? nested : shared;
const version = lock[installed]?.version;
require(typeof version === 'string', 'Runtime dependency pin unavailable');
return { path: installed + '/package.json', name, version };
});
}).filter((item, index, all) => all.findIndex(other => other.path === item.path) === index);
}
function compile(project, outDir) {
execFileSync(process.execPath, [fromRoot('node_modules/typescript/bin/tsc'), '--project', fromRoot(project), '--outDir', outDir,
'--declaration', 'false', '--declarationMap', 'false', '--sourceMap', 'false', '--incremental', 'false'],
{ cwd: root, stdio: 'inherit' });
}
function files(directory, prefix = '') {
return readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name)).flatMap(entry => {
const key = prefix + entry.name, item = path.join(directory, entry.name);
if (entry.isDirectory()) return files(item, key + '/');
require(entry.isFile(), 'Packet contains a nonregular entry');
const bytes = readFileSync(item);
return [{ path: key, size: bytes.length, sha256: sha(bytes) }];
});
}
const [runId, ...extra] = process.argv.slice(2);
require(/^[a-f0-9]{8}$/.test(runId ?? '') && !extra.length, 'Expected one eight-digit hexadecimal run ID');
const directory = fromRoot('tmp/mcp-netflow-smoke-packet-' + runId);
const dependencies = runtimePins();
mkdirSync(directory);
compile('packages/contracts/tsconfig.json', path.join(directory, 'contracts-dist'));
compile('backend/tsconfig.json', path.join(directory, 'dist'));
require(statSync(path.join(directory, 'dist/test/traffic-flow-chr-collector-bootstrap.js')).isFile(), 'Compiled collector entry unavailable');
cpSync(fromRoot('backend/drizzle'), path.join(directory, 'drizzle'), { recursive: true, errorOnExist: true });
const entries = files(directory);
require(entries.length > 0 && entries.length <= 4096 && entries.reduce((sum, entry) => sum + entry.size, 0) <= 128 * 1024 * 1024,
'Packet budget exceeded');
const body = Buffer.from(JSON.stringify({ format: 'mmapp-netflow-collector-smoke-v1', cachedSourceRevision: baseRevision, dependencies,
files: entries }, null, 2) + '\n');
writeFileSync(path.join(directory, 'manifest.json'), body, { flag: 'wx' });
console.log(JSON.stringify({ directory, manifestSha256: sha(body), files: entries.length, dependencies: dependencies.length,
collectorStarted: false, networkUsed: false }));
@@ -0,0 +1,325 @@
"""Fixed, opt-in local Docker owner for the disposable NetFlow collector."""
import argparse
import json
import os
import re
import secrets
import stat
import subprocess
import sys
from pathlib import Path
PG_IMAGE = 'postgres@sha256:77f585114c32fbca283dc835b0596f4e52b51b4c6662d7810b2f4084f60a1873'
NODE_IMAGE = 'git.shx.one/denozord/mikrotikmanager-backend-mcp-acceptance@sha256:151ab635caca5f2f6b50a9d0c27980a1559d7bd67f0e3a8d2b74cfa3f9ec6945'
CID = re.compile(r'[a-f0-9]{64}\Z')
RUN = re.compile(r'[a-f0-9]{8}\Z')
LABEL = 'io.mmapp.netflow.run'
ENV = {'PATH': '/usr/sbin:/usr/bin:/sbin:/bin', 'LC_ALL': 'C',
'HOME': '/nonexistent', 'DOCKER_CONFIG': '/nonexistent'}
def require(value, code):
if not value:
raise ValueError(code)
def root(run):
require(isinstance(run, str) and RUN.fullmatch(run), 'RUN_ID_REFUSED')
return '/tmp/mcp-netflow-' + run
def mounts(source, target, readonly=False):
return ['--mount', 'type=bind,src=' + source + ',dst=' + target + (',readonly' if readonly else '')]
def build_pg(run, uid, gid):
base = root(run)
require(type(uid) is int and 0 < uid <= 65534 and type(gid) is int and 0 < gid <= 65534, 'FIXTURE_ACCOUNT_REFUSED')
return [
'create', '--pull=never', '--name', 'mm-nf-pg-' + run,
'--label', LABEL + '=' + run, '--label', 'io.mmapp.netflow.role=postgres',
'--network=none', '--user', f'{uid}:{gid}', '--read-only',
'--cap-drop=ALL', '--security-opt=no-new-privileges',
'--memory=192m', '--memory-swap=192m',
'--tmpfs', '/tmp:rw,nosuid,nodev,noexec,mode=1777,size=32m',
'--tmpfs', '/var/run/postgresql:rw,nosuid,nodev,noexec,mode=1777,size=1m',
*mounts(base + '/pg', '/owned-pg'),
*mounts(base + '/pg-socket', base + '/pg-socket'),
*mounts(base + '/pg-password', '/run/mm-netflow-pg-secret', True),
'--env', 'PGDATA=/owned-pg/data', '--env', 'POSTGRES_USER=mcp_test',
'--env', 'POSTGRES_DB=mcp_netflow_' + run,
'--env', 'POSTGRES_PASSWORD_FILE=/run/mm-netflow-pg-secret',
'--env', 'POSTGRES_INITDB_ARGS=--auth-local=scram-sha-256 --auth-host=scram-sha-256',
PG_IMAGE, 'postgres', '-c', 'listen_addresses=', '-c', 'unix_socket_directories=' + base + '/pg-socket',
'-c', 'unix_socket_permissions=0700',
]
def build_node(run, uid, gid, anchor_id, port, namespace, host_namespace, packet_digest):
base = root(run)
require(type(uid) is int and 0 < uid <= 65534 and type(gid) is int and 0 < gid <= 65534, 'FIXTURE_ACCOUNT_REFUSED')
require(isinstance(anchor_id, str) and CID.fullmatch(anchor_id), 'ANCHOR_ID_REFUSED')
require(isinstance(packet_digest, str) and CID.fullmatch(packet_digest), 'PACKET_PIN_REFUSED')
require(type(port) is int and 49152 <= port <= 65535, 'COLLECTOR_PORT_REFUSED')
require(all(type(pair) in (tuple, list) and len(pair) == 2 and
all(type(value) is int and 0 < value < 2**64 for value in pair)
for pair in (namespace, host_namespace)) and list(namespace) != list(host_namespace), 'NAMESPACE_PINS_REFUSED')
return [
'create', '--pull=never', '--name', 'mm-nf-node-' + run,
'--label', LABEL + '=' + run, '--label', 'io.mmapp.netflow.role=collector',
'--network=container:' + anchor_id, '--user', f'{uid}:{gid}', '--read-only',
'--cap-drop=ALL', '--security-opt=no-new-privileges', '--interactive', '--tty',
'--memory=320m', '--memory-swap=320m',
'--tmpfs', '/tmp:rw,nosuid,nodev,noexec,mode=1777,size=32m',
*mounts(base + '/collector', base),
*mounts(base + '/pg-socket', base + '/pg-socket'),
*mounts(base + '/pg-password', '/run/mm-netflow-pg-secret', True),
*mounts(base + '/packet/dist', '/app/backend/dist', True),
*mounts(base + '/packet/drizzle', '/app/backend/drizzle', True),
*mounts(base + '/packet/contracts-dist', '/app/packages/contracts/dist', True),
*mounts(base + '/packet/manifest.json', '/run/mm-netflow-packet.json', True),
'--workdir', base, '--env', 'MMAPP_OWN_CHR_NETFLOW_COLLECTOR=true',
'--env', 'MMAPP_NETFLOW_PACKET_SHA256=' + packet_digest,
'--entrypoint', 'node', NODE_IMAGE,
'--max-old-space-size=160', '--max-semi-space-size=8',
'/app/backend/dist/test/traffic-flow-chr-collector-bootstrap.js',
'--container-collector-cycle', run, str(port), *map(str, namespace), *map(str, host_namespace),
]
def capture_args(run, first, second, port):
root(run)
require((first, second) == ('198.18.241.2', '198.18.241.9') and
type(port) is int and 49152 <= port <= 65535, 'CAPTURE_SCOPE_REFUSED')
return ['nsenter', '--net=/run/netns/nf' + run + 'nc', '--',
'tcpdump', '-n', '-p', '-U', '-i', 'nf' + run + 'cv', '-y', 'EN10MB', '-s', '4138',
'-c', '64', '-w', '-', 'udp and dst host 198.18.242.3 and dst port ' + str(port) +
' and (src host ' + first + ' or src host ' + second + ')']
def local_docker():
require(sys.platform == 'linux' and os.geteuid() == 0 and
os.environ.get('MMAPP_OWN_CHR_NETFLOW_CONTAINER') == 'true', 'DOCKER_OWNER_REFUSED')
socket = Path('/var/run/docker.sock')
require(stat.S_ISSOCK(socket.stat().st_mode), 'LOCAL_DOCKER_SOCKET_UNAVAILABLE')
choices = [Path(folder, 'docker') for folder in ('/usr/bin', '/usr/sbin', '/bin')]
binary = next((path.resolve(strict=True) for path in choices if path.is_file()), None)
require(binary is not None and binary.stat().st_uid == 0 and not binary.stat().st_mode & 0o022,
'DOCKER_BINARY_UNPINNED')
def call(*args):
result = subprocess.run([str(binary), '--host', 'unix:///var/run/docker.sock', *args],
env=ENV, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL, timeout=30)
require(result.returncode == 0 and len(result.stdout) <= 256 * 1024, 'DOCKER_OUTCOME_UNCONFIRMED')
return result.stdout.decode('utf-8', 'strict').strip()
def attach(cid):
require(CID.fullmatch(cid) and sys.stdin.isatty() and sys.stdout.isatty(), 'EXACT_TTY_REFUSED')
return subprocess.run([str(binary), '--host', 'unix:///var/run/docker.sock', 'start', '--attach', '--interactive', cid],
env=ENV, timeout=330).returncode
return call, attach
def prepare_private_storage(run, uid, gid):
"""Create only new private bind sources. A retained fixture is never reused."""
require(sys.platform == 'linux' and os.geteuid() == 0 and
os.environ.get('MMAPP_OWN_CHR_NETFLOW_CONTAINER') == 'true', 'DOCKER_OWNER_REFUSED')
require(type(uid) is int and 0 < uid <= 65534 and type(gid) is int and 0 < gid <= 65534, 'FIXTURE_ACCOUNT_REFUSED')
base = Path(root(run))
info = base.lstat()
require(base.resolve(strict=True) == base and stat.S_ISDIR(info.st_mode) and info.st_uid == uid and
stat.S_IMODE(info.st_mode) == 0o700, 'FIXTURE_ROOT_REFUSED')
for name in ('pg', 'pg-socket', 'collector'):
directory = base / name
directory.mkdir(mode=0o700)
os.chown(directory, uid, gid, follow_symlinks=False)
fd = os.open(base / 'pg-password', os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o400)
with os.fdopen(fd, 'wb') as output:
output.write((secrets.token_hex(32) + '\n').encode('ascii'))
output.flush()
os.fsync(output.fileno())
os.fchown(output.fileno(), uid, gid)
class CollectorContainerOwner:
"""Outer Linux parent retains each acknowledged ID and journals it.
An unknown create/start/retire acknowledgement requires reconciliation.
It never searches by label, restarts, prunes, or removes a matched name.
"""
def __init__(self, run, docker, checkpoint):
root(run)
self.run, self.docker, self.checkpoint = run, docker, checkpoint
self.ids = {}
self.attempted = set()
self.verified_exits = {}
self.anchor_start = None
self.adopted = None
self.topology_retired = False
def image(self, reference):
rows = json.loads(self.docker('image', 'inspect', reference))
require(len(rows) == 1 and reference in rows[0]['RepoDigests'] and rows[0]['Os'] == 'linux' and
re.fullmatch(r'sha256:[a-f0-9]{64}', rows[0]['Id']), 'CACHED_IMAGE_UNPINNED')
return rows[0]['Id']
def inspect(self, cid, role, image_id, network):
require(CID.fullmatch(cid), 'CONTAINER_ID_UNPINNED')
rows = json.loads(self.docker('container', 'inspect', cid))
require(len(rows) == 1, 'CONTAINER_UNCONFIRMED')
row = rows[0]
labels = row['Config']['Labels']
memory = (192 if role == 'postgres' else 320) * 1024 * 1024
require(row['Id'] == cid and row['Image'] == image_id and labels[LABEL] == self.run and
labels['io.mmapp.netflow.role'] == role and row['HostConfig']['NetworkMode'] == network and
not row['HostConfig']['Privileged'] and not row['HostConfig']['PortBindings'] and
row['HostConfig']['ReadonlyRootfs'] is True and row['HostConfig']['CapDrop'] == ['ALL'] and
not row['HostConfig']['CapAdd'] and row['HostConfig']['Memory'] == memory and
row['HostConfig']['MemorySwap'] == memory, 'CONTAINER_SCOPE_DRIFT')
return row['State']
def _create(self, role, argv, reference, network):
require(role not in self.attempted, 'CONTAINER_REPLAY_REFUSED')
self.attempted.add(role)
image_id = self.image(reference)
self.checkpoint(role, 'create-intent', None)
cid = self.docker(*argv)
require(CID.fullmatch(cid), 'CREATE_ACK_UNCONFIRMED')
self.checkpoint(role, 'create-acknowledged', cid)
state = self.inspect(cid, role, image_id, network)
require(state['Status'] == 'created' and state['Running'] is False, 'CREATED_STATE_UNCONFIRMED')
self.ids[role] = (cid, image_id, network)
self.checkpoint(role, 'create-verified', cid)
return cid
def create_anchor(self, uid, gid):
return self._create('postgres', build_pg(self.run, uid, gid), PG_IMAGE, 'none')
def create_collector(self, uid, gid, port, namespace, host_namespace, packet_digest, assert_packet):
anchor_id, image_id, network = self.ids['postgres']
anchor = self.inspect(anchor_id, 'postgres', image_id, network)
require(anchor['Running'] is True and anchor['Pid'] > 0, 'ANCHOR_PID_UNCONFIRMED')
require(self.adopted is not None, 'C_ADOPTION_UNCONFIRMED')
adopted, read_mount = self.adopted
require(adopted == self.anchor_namespace() and adopted['namespace'] == list(namespace) and
adopted['hostNamespace'] == list(host_namespace) and read_mount() == adopted['namespace'],
'C_ADOPTION_DRIFT')
assert_packet()
return self._create('collector', build_node(self.run, uid, gid, anchor_id, port, namespace, host_namespace, packet_digest),
NODE_IMAGE, 'container:' + anchor_id)
def start_anchor(self):
cid, image_id, network = self.ids['postgres']
require('postgres-start' not in self.attempted, 'CONTAINER_REPLAY_REFUSED')
self.attempted.add('postgres-start')
self.checkpoint('postgres', 'start-intent', cid)
require(self.docker('start', cid) == cid, 'START_ACK_UNCONFIRMED')
state = self.inspect(cid, 'postgres', image_id, network)
require(state['Running'] is True and type(state['Pid']) is int and state['Pid'] > 0 and
re.fullmatch(r'\d{4}-\d{2}-\d{2}T[0-9:.]+Z', state['StartedAt']), 'ANCHOR_PID_UNCONFIRMED')
self.checkpoint('postgres', 'start-verified', cid)
self.anchor_start = (state['Pid'], state['StartedAt'])
return state['Pid']
def anchor_namespace(self):
"""Return live anchor and host netns pins for the topology owner."""
require(sys.platform == 'linux' and os.geteuid() == 0, 'LINUX_OWNER_REQUIRED')
cid, image_id, network = self.ids['postgres']
state = self.inspect(cid, 'postgres', image_id, network)
pid = state['Pid']
started_at = state['StartedAt']
require(state['Running'] is True and self.anchor_start == (pid, started_at), 'ANCHOR_PID_UNCONFIRMED')
pin = Path('/proc', str(pid), 'ns/net').stat()
host = Path('/proc/self/ns/net').stat()
namespace, host_namespace = [pin.st_dev, pin.st_ino], [host.st_dev, host.st_ino]
latest = self.inspect(cid, 'postgres', image_id, network)
require(latest['Running'] is True and latest['Pid'] == pid and latest['StartedAt'] == started_at and
namespace != host_namespace,
'ANCHOR_NAMESPACE_DRIFT')
return {'containerId': cid, 'pid': pid, 'startedAt': started_at,
'namespace': namespace, 'hostNamespace': host_namespace}
def create_linux_topology(self, executor, backend, journal, planned, pins):
"""Bridge the exact live anchor into the existing guarded Linux owner."""
name = 'nf' + self.run + 'nc'
require(pins['nonce'][:8] == self.run and planned['names']['C'] == name, 'TOPOLOGY_RUN_DIFFERS')
require('topology-adopt' not in self.attempted, 'C_ADOPTION_REPLAY_REFUSED')
self.attempted.add('topology-adopt')
result = executor(backend, journal, planned, pins, read_collector_anchor=self.anchor_namespace)
adopted = journal.value['collectorAnchor']
require(adopted == self.anchor_namespace() and backend.namespace(name) == adopted['namespace'],
'C_ADOPTION_DRIFT')
self.adopted = (adopted, lambda: backend.namespace(name))
return result
def assert_linux_anchor_exited(self, recorded):
"""Validate the journalled container and its exact exit before C cleanup."""
cid, image_id, network = self.ids['postgres']
require(recorded['containerId'] == cid and 'postgres' in self.verified_exits and
('collector' not in self.ids or 'collector' in self.verified_exits), 'ANCHOR_EXIT_NOT_OWNED')
state = self.inspect(cid, 'postgres', image_id, network)
require(state['Running'] is False and state['Status'] == 'exited' and state['Pid'] == 0 and
state['StartedAt'] == recorded['startedAt'] == self.verified_exits['postgres'], 'ANCHOR_EXIT_UNCONFIRMED')
def cleanup_linux_topology(self, executor, backend, journal, planned):
require(self.adopted is not None and self.adopted[0] == journal.value.get('collectorAnchor') and
backend.root_baseline() == journal.value.get('rootBaseline'), 'TOPOLOGY_CLEANUP_SCOPE_DRIFT')
executor(backend, journal, planned, assert_collector_anchor_exited=self.assert_linux_anchor_exited)
require(journal.value['state'] == 'retired' and backend.root_baseline() == journal.value['rootBaseline'],
'TOPOLOGY_CLEANUP_UNCONFIRMED')
self.topology_retired = True
def start_collector(self, attach):
cid, image_id, network = self.ids['collector']
require('collector-start' not in self.attempted, 'CONTAINER_REPLAY_REFUSED')
require(self.adopted is not None and self.adopted[0] == self.anchor_namespace() and
self.adopted[1]() == self.adopted[0]['namespace'], 'C_ADOPTION_DRIFT')
self.attempted.add('collector-start')
self.checkpoint('collector', 'start-intent', cid)
status = attach(cid)
state = self.inspect(cid, 'collector', image_id, network)
require(state['Running'] is False and state['Status'] == 'exited' and state['Pid'] == 0 and
state['ExitCode'] == status and re.fullmatch(r'\d{4}-\d{2}-\d{2}T[0-9:.]+Z', state['StartedAt']),
'COLLECTOR_EXIT_UNCONFIRMED')
self.checkpoint('collector', 'exit-verified', cid)
self.verified_exits['collector'] = state['StartedAt']
require(status == 0, 'COLLECTOR_RUN_REFUSED')
def stop_anchor(self, assert_restored):
cid, image_id, network = self.ids['postgres']
require('postgres-stop' not in self.attempted, 'CONTAINER_REPLAY_REFUSED')
require('collector' not in self.ids or 'collector' in self.verified_exits, 'COLLECTOR_EXIT_UNCONFIRMED')
self.attempted.add('postgres-stop')
assert_restored()
self.checkpoint('postgres', 'stop-intent', cid)
current = self.inspect(cid, 'postgres', image_id, network)
require(current['Running'] is True and self.anchor_start == (current['Pid'], current['StartedAt']), 'ANCHOR_START_DRIFT')
require(self.docker('stop', '--time', '15', cid) == cid, 'STOP_ACK_UNCONFIRMED')
state = self.inspect(cid, 'postgres', image_id, network)
require(state['Running'] is False and state['Status'] == 'exited' and state['Pid'] == 0 and
state['StartedAt'] == self.anchor_start[1] and state['ExitCode'] == 0, 'ANCHOR_EXIT_UNCONFIRMED')
self.checkpoint('postgres', 'exit-verified', cid)
self.verified_exits['postgres'] = state['StartedAt']
def retire_exited(self, role):
cid, image_id, network = self.ids[role]
operation = role + '-retire'
require(operation not in self.attempted, 'CONTAINER_REPLAY_REFUSED')
require(role != 'postgres' or self.adopted is None or self.topology_retired, 'C_RETIREMENT_UNCONFIRMED')
self.attempted.add(operation)
state = self.inspect(cid, role, image_id, network)
require(role in self.verified_exits and state['Running'] is False and state['Status'] == 'exited' and
state['Pid'] == 0 and state['StartedAt'] == self.verified_exits[role], 'EXIT_NOT_CONFIRMED')
self.checkpoint(role, 'retire-intent', cid)
require(self.docker('rm', cid) == cid, 'RETIRE_ACK_UNCONFIRMED')
self.checkpoint(role, 'retire-acknowledged', cid)
if __name__ == '__main__':
cli = argparse.ArgumentParser()
cli.add_argument('--check-only', required=True, metavar='RUN_ID')
args = cli.parse_args()
print(json.dumps({'fixtureRoot': root(args.check_only), 'postgresImage': PG_IMAGE, 'nodeImage': NODE_IMAGE,
'requiresOwnedCollectorNamespace': True, 'dockerUsed': False, 'networkUsed': False}))
@@ -0,0 +1,143 @@
import json
import runpy
import unittest
from pathlib import Path
owner = runpy.run_path(str(Path(__file__).with_name('chr-netflow-collector-container.py')))
RUN = 'a012bcde'
PG_ID = 'a' * 64
NODE_ID = 'b' * 64
PACKET = 'd' * 64
IMAGE_ID = 'sha256:' + 'c' * 64
STARTED = '2026-11-04T12:00:00.000Z'
class DockerFixture:
def __init__(self):
self.calls = []
self.records = {}
self.lose_create = False
def __call__(self, *args):
self.calls.append(args)
if args[:2] == ('image', 'inspect'):
return json.dumps([{'Id': IMAGE_ID, 'Os': 'linux', 'RepoDigests': [args[2]]}])
if args[0] == 'create':
if self.lose_create:
raise RuntimeError('lost ACK')
pg = '--network=none' in args
role, cid = ('postgres', PG_ID) if pg else ('collector', NODE_ID)
self.records[cid] = {'Id': cid, 'Image': IMAGE_ID, 'Config': {'Labels': {
owner['LABEL']: RUN, 'io.mmapp.netflow.role': role}},
'HostConfig': {'NetworkMode': 'none' if pg else 'container:' + PG_ID, 'Privileged': False,
'PortBindings': None, 'ReadonlyRootfs': True, 'CapDrop': ['ALL'], 'CapAdd': None,
'Memory': (192 if pg else 320) * 1024 * 1024,
'MemorySwap': (192 if pg else 320) * 1024 * 1024},
'State': {'Running': False, 'Status': 'created', 'Pid': 0}}
return cid
cid = args[-1]
if args[:2] == ('container', 'inspect'):
return json.dumps([self.records[cid]])
if args[0] == 'start':
self.records[cid]['State'] = {'Running': True, 'Status': 'running', 'Pid': 42, 'StartedAt': STARTED}
elif args[0] == 'stop':
self.records[cid]['State'] = {'Running': False, 'Status': 'exited', 'Pid': 0, 'StartedAt': STARTED, 'ExitCode': 0}
elif args[0] == 'rm':
del self.records[cid]
else:
raise AssertionError(args)
return cid
class TestCollectorLauncher(unittest.TestCase):
def test_exact_images_no_pull_no_privilege_and_fixed_namespace(self):
pg = owner['build_pg'](RUN, 1000, 1000)
node = owner['build_node'](RUN, 1000, 1000, PG_ID, 50100, (4, 5), (4, 6), PACKET)
self.assertIn('--network=none', pg)
self.assertIn('--network=container:' + PG_ID, node)
self.assertIn('listen_addresses=', pg)
for argv in (pg, node):
self.assertIn('--pull=never', argv)
self.assertIn('--cap-drop=ALL', argv)
self.assertNotIn('--privileged', argv)
self.assertNotIn('/var/run/docker.sock', ' '.join(argv))
self.assertNotIn('POSTGRES_PASSWORD=', ' '.join(pg))
with self.assertRaisesRegex(ValueError, 'NAMESPACE_PINS'):
owner['build_node'](RUN, 1000, 1000, PG_ID, 50100, (4, 5), (4, 5), PACKET)
self.assertIn('EN10MB', owner['capture_args'](RUN, '198.18.241.2', '198.18.241.9', 50100))
def test_one_shot_ack_exact_ids_and_verified_cleanup(self):
docker, journal = DockerFixture(), []
launcher = owner['CollectorContainerOwner'](RUN, docker, lambda *entry: journal.append(entry))
self.assertEqual(launcher.create_anchor(1000, 1000), PG_ID)
self.assertEqual(launcher.start_anchor(), 42)
with self.assertRaisesRegex(ValueError, 'ADOPTION_UNCONFIRMED'):
launcher.create_collector(1000, 1000, 50100, (4, 5), (4, 6), PACKET, lambda: None)
anchor = {'containerId': PG_ID, 'pid': 42, 'startedAt': STARTED, 'namespace': [4, 5], 'hostNamespace': [4, 6]}
launcher.anchor_namespace = lambda: anchor
name = 'nf' + RUN + 'nc'
class Topology:
def namespace(self, target):
return [4, 5] if target == name else None
def root_baseline(self):
return 'root-baseline'
class Journal:
value = {}
def provision(backend, journal, planned, pins, read_collector_anchor):
journal.value.update(collectorAnchor=read_collector_anchor(), rootBaseline='root-baseline', state='created')
return {'ns:' + name: backend.namespace(name)}
def cleanup(backend, journal, planned, assert_collector_anchor_exited):
assert_collector_anchor_exited(journal.value['collectorAnchor'])
journal.value['state'] = 'retired'
topology, topology_journal, planned = Topology(), Journal(), {'names': {'C': name}}
launcher.create_linux_topology(provision, topology, topology_journal, planned, {'nonce': RUN + '0' * 24})
self.assertEqual(launcher.create_collector(1000, 1000, 50100, (4, 5), (4, 6), PACKET, lambda: None), NODE_ID)
with self.assertRaisesRegex(ValueError, 'EXIT_NOT_OWNED'):
launcher.cleanup_linux_topology(cleanup, topology, topology_journal, planned)
def attach(cid):
self.assertEqual(cid, NODE_ID)
docker.records[cid]['State'] = {'Running': False, 'Status': 'exited', 'Pid': 0, 'ExitCode': 0, 'StartedAt': STARTED}
return 0
launcher.start_collector(attach)
launcher.retire_exited('collector')
launcher.stop_anchor(lambda: None)
with self.assertRaisesRegex(ValueError, 'C_RETIREMENT_UNCONFIRMED'):
launcher.retire_exited('postgres')
launcher.cleanup_linux_topology(cleanup, topology, topology_journal, planned)
launcher.retire_exited('postgres')
self.assertEqual(docker.records, {})
self.assertIn(('collector', 'exit-verified', NODE_ID), journal)
self.assertEqual([call for call in docker.calls if call[0] == 'rm'], [('rm', NODE_ID), ('rm', PG_ID)])
def test_lost_create_ack_is_not_replayed_or_cleaned_by_name(self):
docker, journal = DockerFixture(), []
docker.lose_create = True
launcher = owner['CollectorContainerOwner'](RUN, docker, lambda *entry: journal.append(entry))
with self.assertRaisesRegex(RuntimeError, 'lost ACK'):
launcher.create_anchor(1000, 1000)
with self.assertRaisesRegex(ValueError, 'REPLAY'):
launcher.create_anchor(1000, 1000)
self.assertEqual(journal, [('postgres', 'create-intent', None)])
self.assertEqual([call[0] for call in docker.calls], ['image', 'create'])
def test_anchor_process_replaced_under_same_container_id_is_never_stopped(self):
docker = DockerFixture()
launcher = owner['CollectorContainerOwner'](RUN, docker, lambda *_: None)
launcher.create_anchor(1000, 1000)
launcher.start_anchor()
docker.records[PG_ID]['State']['StartedAt'] = '2026-11-04T13:00:00.000Z'
with self.assertRaisesRegex(ValueError, 'ANCHOR_START_DRIFT'):
launcher.stop_anchor(lambda: None)
self.assertFalse(any(call[0] == 'stop' for call in docker.calls))
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,242 @@
"""Disposable collector-only cycle. No RouterOS clients or capture are opened."""
import argparse
import gzip
import hashlib
import io
import json
import os
import re
import runpy
import stat
import subprocess
import sys
import tarfile
import time
from pathlib import Path
owner = runpy.run_path(str(Path(__file__).with_name('chr-netflow-collector-container.py')))
require = owner['require']
MAX_PACKET = 128 * 1024 * 1024
PACKET_PATH = re.compile(r'(?:dist|drizzle|contracts-dist)/(?:[A-Za-z0-9_.-]+/)*[A-Za-z0-9_.-]+\Z')
def verify_packet(directory, digest, require_root=False):
require(re.fullmatch(r'[a-f0-9]{64}', digest), 'PACKET_DIGEST_REFUSED')
require(directory.resolve(strict=True) == directory and directory.is_dir(), 'PACKET_DIRECTORY_REFUSED')
manifest = directory / 'manifest.json'
info = manifest.lstat()
require(stat.S_ISREG(info.st_mode) and 0 < info.st_size <= 1048576, 'PACKET_MANIFEST_REFUSED')
raw = manifest.read_bytes()
require(hashlib.sha256(raw).hexdigest() == digest, 'PACKET_MANIFEST_DRIFT')
value = json.loads(raw)
require(value.get('format') == 'mmapp-netflow-collector-smoke-v1' and
value.get('cachedSourceRevision') == 'bf3d50e1ff2ee3b5c9268991a255c3b49ce6378e' and
type(value.get('files')) is list and 1 <= len(value['files']) <= 4096, 'PACKET_MANIFEST_REFUSED')
total, listed = 0, {'manifest.json'}
for row in value['files']:
relative = row.get('path', '')
require(PACKET_PATH.fullmatch(relative) and
not any(part in ('.', '..') for part in relative.split('/')) and relative not in listed and
type(row.get('size')) is int and 0 < row['size'] <= 2 * 1024 * 1024 and
re.fullmatch(r'[a-f0-9]{64}', row.get('sha256', '')), 'PACKET_FILE_REFUSED')
item = directory / relative
info = item.lstat()
total += row['size']
require(total <= MAX_PACKET and stat.S_ISREG(info.st_mode) and item.resolve(strict=True) == item and
info.st_size == row['size'] and hashlib.sha256(item.read_bytes()).hexdigest() == row['sha256'], 'PACKET_FILE_DRIFT')
listed.add(relative)
observed = set()
for folder, directories, filenames in os.walk(directory, followlinks=False):
parent = Path(folder)
for entry in [parent, *(parent / name for name in directories + filenames)]:
info = entry.lstat()
require(not stat.S_ISLNK(info.st_mode) and
(not require_root or info.st_uid == 0 and not info.st_mode & 0o022), 'PACKET_OWNERSHIP_REFUSED')
observed.update((parent / filename).relative_to(directory).as_posix() for filename in filenames)
require(observed == listed and 'dist/test/traffic-flow-chr-collector-bootstrap.js' in listed, 'PACKET_FILE_SET_DRIFT')
return {'files': len(listed) - 1, 'bytes': total, 'manifestSha256': digest}
def pack(directory, digest):
match = re.fullmatch(r'mcp-netflow-smoke-packet-([a-f0-9]{8})', directory.name)
require(match is not None, 'PACKET_DIRECTORY_REFUSED')
verified = verify_packet(directory, digest)
archive = directory.parent / ('mcp-netflow-collector-smoke-' + match[1] + '.tar.gz')
manifest = json.loads((directory / 'manifest.json').read_bytes())
script_root = Path(__file__).resolve().parent
scripts = ('chr-netflow-collector-smoke.py', 'chr-netflow-collector-container.py')
with archive.open('xb') as destination, gzip.GzipFile(fileobj=destination, mode='wb', filename='', mtime=0) as compressed:
with tarfile.open(fileobj=compressed, mode='w|', format=tarfile.USTAR_FORMAT) as tar:
def add(name, body):
item = tarfile.TarInfo(name)
item.mode = 0o644
item.size = len(body)
tar.addfile(item, io.BytesIO(body))
for name in scripts:
add(name, (script_root / name).read_bytes())
add('packet/manifest.json', (directory / 'manifest.json').read_bytes())
for row in manifest['files']:
add('packet/' + row['path'], (directory / row['path']).read_bytes())
with archive.open('rb') as stream:
archive_sha = hashlib.file_digest(stream, 'sha256').hexdigest()
return {**verified, 'archive': str(archive), 'archiveSha256': archive_sha, 'dockerUsed': False, 'networkUsed': False}
class SmokeNamespace:
"""Only the C alias and one local dummy address, never the transit topology."""
def __init__(self, run, ip, namespace, checkpoint):
self.name, self.device = 'nf' + run + 'nc', 'nf' + run + 'cv'
self.ip, self.namespace, self.checkpoint = ip, namespace, checkpoint
self.anchor = None
def create(self, read_anchor):
require(self.anchor is None and self.namespace(self.name) is None, 'SMOKE_NAMESPACE_PRESENT')
anchor = read_anchor()
require(anchor['namespace'] != anchor['hostNamespace'] and read_anchor() == anchor, 'SMOKE_ANCHOR_DRIFT')
self.checkpoint('smoke', 'attach-intent', anchor)
self.ip('netns', 'attach', self.name, str(anchor['pid']))
require(self.namespace(self.name) == anchor['namespace'] and read_anchor() == anchor, 'SMOKE_ATTACH_UNCONFIRMED')
self.checkpoint('smoke', 'attach-verified', anchor)
self.anchor = anchor
def current():
require(self.namespace(self.name) == anchor['namespace'] and read_anchor() == anchor, 'SMOKE_ANCHOR_DRIFT')
links = json.loads(self.ip('-n', self.name, '-j', 'link', 'show'))
require([item['ifname'] for item in links] == ['lo'], 'SMOKE_NAMESPACE_NOT_EMPTY')
self.checkpoint('smoke', 'dummy-intent', self.device)
current()
self.ip('-n', self.name, 'link', 'add', self.device, 'type', 'dummy')
current()
created = json.loads(self.ip('-n', self.name, '-j', '-d', 'link', 'show', 'dev', self.device))
require(len(created) == 1 and created[0]['ifname'] == self.device and
created[0]['linkinfo']['info_kind'] == 'dummy' and created[0]['ifindex'] > 0, 'SMOKE_DUMMY_UNCONFIRMED')
self.ip('-n', self.name, 'address', 'add', '198.18.242.3/32', 'dev', self.device)
current()
self.ip('-n', self.name, 'link', 'set', self.device, 'up')
rows = json.loads(self.ip('-n', self.name, '-j', '-d', 'address', 'show', 'dev', self.device))
routes = json.loads(self.ip('-n', self.name, '-j', '-4', 'route', 'show', 'table', 'all'))
require(len(rows) == 1 and rows[0]['ifname'] == self.device and rows[0]['linkinfo']['info_kind'] == 'dummy' and
rows[0]['ifindex'] == created[0]['ifindex'] and
'UP' in rows[0]['flags'] and any(row.get('local') == '198.18.242.3' and row.get('prefixlen') == 32
for row in rows[0]['addr_info']) and all(row.get('dst') != 'default' for row in routes) and
self.namespace(self.name) == anchor['namespace'] and read_anchor() == anchor, 'SMOKE_DUMMY_UNCONFIRMED')
self.checkpoint('smoke', 'dummy-verified', rows[0]['ifindex'])
return anchor
def restore(self, assert_anchor_exited):
require(self.anchor is not None and self.namespace(self.name) == self.anchor['namespace'],
'SMOKE_NAMESPACE_DRIFT')
assert_anchor_exited(self.anchor)
require(not self.ip('netns', 'pids', self.name).strip(), 'SMOKE_NAMESPACE_BUSY')
self.checkpoint('smoke', 'delete-intent', self.anchor)
self.ip('netns', 'delete', self.name)
require(self.namespace(self.name) is None, 'SMOKE_NAMESPACE_RETIREMENT_UNCONFIRMED')
self.checkpoint('smoke', 'delete-verified', self.anchor)
def linux_ip():
binary = next((item.resolve(strict=True) for item in (Path('/usr/sbin/ip'), Path('/usr/bin/ip'), Path('/sbin/ip'))
if item.is_file()), None)
require(binary is not None and binary.stat().st_uid == 0 and not binary.stat().st_mode & 0o022, 'IP_BINARY_UNPINNED')
def call(*args):
result = subprocess.run([str(binary), *args], env=owner['ENV'], stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, timeout=8)
require(result.returncode == 0 and len(result.stdout) <= 128 * 1024, 'IP_OUTCOME_UNCONFIRMED')
return result.stdout.decode('utf-8', 'strict')
return call
def ns_pin(name):
try:
row = Path('/run/netns', name).lstat()
except FileNotFoundError:
return None
require(stat.S_ISREG(row.st_mode) and row.st_uid == 0, 'SMOKE_NAMESPACE_HANDLE_UNSAFE')
return [row.st_dev, row.st_ino]
def run_smoke(run, uid, gid, port, digest):
docker, attach = owner['local_docker']()
base = Path(owner['root'](run))
packet = base / 'packet'
verify_packet(packet, digest, require_root=True)
ip = linux_ip()
require(ns_pin('nf' + run + 'nc') is None, 'SMOKE_NAMESPACE_PRESENT')
journal = os.open(base / 'collector-smoke.jsonl', os.O_CREAT | os.O_EXCL | os.O_WRONLY | os.O_NOFOLLOW, 0o600)
with os.fdopen(journal, 'w', encoding='utf-8') as report:
def checkpoint(role, phase, value):
report.write(json.dumps({'role': role, 'phase': phase, 'value': value}, separators=(',', ':')) + '\n')
report.flush()
os.fsync(report.fileno())
checkpoint('smoke', 'packet-verified', digest)
owner['prepare_private_storage'](run, uid, gid)
runner = owner['CollectorContainerOwner'](run, docker, checkpoint)
runner.create_anchor(uid, gid)
runner.start_anchor()
scope = SmokeNamespace(run, ip, ns_pin, checkpoint)
# Reuse the container owner's live-C admission and retirement checks.
class Journal:
value = {}
class Backend:
def namespace(self, name):
return ns_pin(name)
def root_baseline(self):
raw = [ip('-j', '-4', 'route', 'show', 'table', 'all'), ip('-j', '-d', 'link', 'show')]
# Link counters/traffic are outside root configuration; use exact names and ifindex.
links = sorted((row['ifname'], row['ifindex']) for row in json.loads(raw[1]))
return hashlib.sha256(json.dumps([json.loads(raw[0]), links], sort_keys=True).encode()).hexdigest()
def provision(backend, ledger, _plan, _pins, read_collector_anchor):
baseline = backend.root_baseline()
anchor = scope.create(read_collector_anchor)
require(backend.root_baseline() == baseline, 'ROOT_NETWORK_DRIFT')
ledger.value.update(collectorAnchor=anchor, rootBaseline=baseline, state='created')
return anchor
def cleanup(_backend, ledger, _plan, assert_collector_anchor_exited):
scope.restore(assert_collector_anchor_exited)
ledger.value['state'] = 'retired'
backend, ledger, plan = Backend(), Journal(), {'names': {'C': scope.name}}
pin = runner.create_linux_topology(provision, backend, ledger, plan, {'nonce': run + '0' * 24})
wait_until = time.monotonic() + 20
socket = base / 'pg-socket' / '.s.PGSQL.5432'
while not socket.exists() and time.monotonic() < wait_until:
time.sleep(.1)
require(stat.S_ISSOCK(socket.lstat().st_mode), 'PRIVATE_PG_NOT_READY')
runner.create_collector(uid, gid, port, pin['namespace'], pin['hostNamespace'], digest,
lambda: verify_packet(packet, digest, require_root=True))
runner.start_collector(attach)
runner.retire_exited('collector')
runner.stop_anchor(lambda: require(ledger.value['state'] == 'created', 'SMOKE_TOPOLOGY_DRIFT'))
runner.cleanup_linux_topology(cleanup, backend, ledger, plan)
runner.retire_exited('postgres')
checkpoint('smoke', 'complete', None)
return {'collectorSmokeCompleted': True, 'chrMutations': 0, 'capturePerformed': False, 'nativeAcceptance': False}
if __name__ == '__main__':
parser = argparse.ArgumentParser()
sub = parser.add_subparsers(dest='mode', required=True)
check = sub.add_parser('check')
check.add_argument('packet', type=Path)
check.add_argument('sha256')
package = sub.add_parser('pack')
package.add_argument('packet', type=Path)
package.add_argument('sha256')
run = sub.add_parser('run')
run.add_argument('run_id')
run.add_argument('uid', type=int)
run.add_argument('gid', type=int)
run.add_argument('port', type=int)
run.add_argument('sha256')
args = parser.parse_args()
try:
if args.mode == 'check':
result = {**verify_packet(args.packet.resolve(), args.sha256), 'dockerUsed': False, 'networkUsed': False}
elif args.mode == 'pack':
result = pack(args.packet.resolve(), args.sha256)
else:
result = run_smoke(args.run_id, args.uid, args.gid, args.port, args.sha256)
print(json.dumps(result))
except (OSError, ValueError, RuntimeError, subprocess.SubprocessError, KeyError) as error:
print(json.dumps({'completed': False, 'failureClass': type(error).__name__, 'automaticReplay': False}))
raise SystemExit(1) from None
@@ -0,0 +1,69 @@
import hashlib
import json
from pathlib import Path
import runpy
import tempfile
import unittest
smoke = runpy.run_path(str(Path(__file__).with_name('chr-netflow-collector-smoke.py')))
class SmokeTests(unittest.TestCase):
def test_pin_and_file_set_drift_fail_closed(self):
with tempfile.TemporaryDirectory(dir=Path(__file__).resolve().parents[3] / 'tmp') as temp:
root = Path(temp).resolve()
entry = root / 'dist/test/traffic-flow-chr-collector-bootstrap.js'
entry.parent.mkdir(parents=True)
entry.write_bytes(b'owned fixture\n')
body = json.dumps({'format': 'mmapp-netflow-collector-smoke-v1',
'cachedSourceRevision': 'bf3d50e1ff2ee3b5c9268991a255c3b49ce6378e',
'files': [{'path': entry.relative_to(root).as_posix(), 'size': entry.stat().st_size,
'sha256': hashlib.sha256(entry.read_bytes()).hexdigest()}]}).encode()
(root / 'manifest.json').write_bytes(body)
digest = hashlib.sha256(body).hexdigest()
self.assertEqual(smoke['verify_packet'](root, digest)['files'], 1)
entry.write_bytes(b'foreign data!\n')
with self.assertRaisesRegex(ValueError, 'FILE_DRIFT'):
smoke['verify_packet'](root, digest)
with self.assertRaisesRegex(ValueError, 'MANIFEST_DRIFT'):
smoke['verify_packet'](root, '0' * 64)
def test_exact_dummy_namespace_and_busy_cleanup(self):
anchor = {'containerId': 'a' * 64, 'pid': 42, 'namespace': [10, 20], 'hostNamespace': [10, 21]}
calls, journal = [], []
namespace = None
busy = True
name, device = 'nfa012bcdenc', 'nfa012bcdecv'
link = {'ifname': device, 'ifindex': 5, 'linkinfo': {'info_kind': 'dummy'}, 'flags': ['UP'],
'addr_info': [{'local': '198.18.242.3', 'prefixlen': 32}]}
def ip(*args):
nonlocal namespace
calls.append(args)
if args[:2] == ('netns', 'attach'):
self.assertEqual(args, ('netns', 'attach', name, '42'))
namespace = anchor['namespace']
elif args[:2] == ('netns', 'pids'):
return '42' if busy else ''
elif args[:2] == ('netns', 'delete'):
self.assertEqual(args, ('netns', 'delete', name))
namespace = None
elif args == ('-n', name, '-j', 'link', 'show'):
return json.dumps([{'ifname': 'lo'}])
elif '-d' in args:
return json.dumps([link])
elif 'route' in args:
return '[]'
return ''
fixture = smoke['SmokeNamespace']('a012bcde', ip, lambda _name: namespace, lambda *row: journal.append(row))
self.assertEqual(fixture.create(lambda: anchor), anchor)
self.assertIn(('-n', name, 'address', 'add', '198.18.242.3/32', 'dev', device), calls)
with self.assertRaisesRegex(ValueError, 'NAMESPACE_BUSY'):
fixture.restore(lambda pin: self.assertEqual(pin, anchor))
self.assertNotIn(('netns', 'delete', name), calls)
busy = False
fixture.restore(lambda pin: self.assertEqual(pin, anchor))
self.assertEqual(journal[-1][1], 'delete-verified')
if __name__ == '__main__':
unittest.main()
@@ -0,0 +1,221 @@
import { createHash } from 'node:crypto';
import { readFile } from 'node:fs/promises';
import { isIPv4 } from 'node:net';
import { pathToFileURL } from 'node:url';
const routes = Object.freeze(['/system/resource', '/ip/traffic-flow', '/ip/traffic-flow/target']);
const policyRoutes = Object.freeze(['/system/resource', '/ip/settings', '/ip/firewall/connection/tracking',
'/ip/firewall/filter', '/ip/firewall/raw', '/ip/firewall/mangle', '/ip/firewall/nat', '/routing/rule', '/ip/vrf']);
const counterFields = ['ifindex', 'rx-packet', 'tx-packet', 'fp-rx-byte', 'fp-tx-byte', 'fp-rx-packet', 'fp-tx-packet'];
const nativeId = value => typeof value === 'string' && /^\*[a-f0-9]{1,16}$/i.test(value);
const ports = Object.freeze({ '194.226.121.150': 19081, '104.165.244.7': 19082 });
const attestation = 'verified-known-host-161.104.46.222-owned-forward';
const reviewedTransportHash = '67d86dbae2710a25145df8ab9469029182f21a31972c49f063cdb6bc3daa8ea6';
const sha = bytes => createHash('sha256').update(bytes).digest('hex');
const deny = () => { throw new Error('NetFlow discovery refused'); };
export async function loadPinnedNetFlowTransport(policy = false) {
const allowedPaths = policy ? policyRoutes : routes;
return loadTransport(allowedPaths, allowedPaths.length * 2, policy ? 131072 : 65536);
}
async function loadTransport(allowedPaths, requests, responseLimit, totalLimit = responseLimit * requests) {
const bytes = await readFile(new URL('./chr-recursive-observation.mjs', import.meta.url));
if (sha(bytes) !== reviewedTransportHash) deny();
const reviewed = bytes.toString('utf8');
const source = reviewed.slice(0, reviewed.indexOf('async function privateStdin()'))
.replace(/const ROOT = .*?;/, 'const ROOT = null;')
.replace(/export const PATHS = Object.freeze\(\[[\s\S]*?\]\);/, `export const PATHS = Object.freeze(${JSON.stringify(allowedPaths)});`)
.replace('response: 1048576, bytes: 8388608, requests: 256',
`response: ${responseLimit}, bytes: ${totalLimit}, requests: ${requests}`);
const transport = await import('data:text/javascript;base64,' + Buffer.from(source).toString('base64'));
if (JSON.stringify(transport.PATHS) !== JSON.stringify(allowedPaths)) deny();
for (const [host, port] of Object.entries(ports)) {
if (endpoint(transport, host) !== `http://127.0.0.1:${port}`) deny();
}
return transport;
}
export async function discoverPinnedInterfaceCounterShape(read) {
const devices = [];
for (const host of Object.keys(ports)) {
const inventory = await read(host, '/interface');
if (!Array.isArray(inventory) || inventory.length > 256 ||
inventory.some(row => !nativeId(row?.['.id'])) ||
new Set(inventory.map(row => row['.id'])).size !== inventory.length) deny();
const preferred = type => inventory.find(row => row.type === type &&
observedFlag(row.running) === true && observedFlag(row.disabled) === false);
const chosen = preferred('wg') ?? preferred('ether');
if (!chosen) {
devices.push({ status: 'no-eligible-interface' });
continue;
}
const exact = single(await read(host, '/interface/' + encodeURIComponent(chosen['.id'])));
if (exact['.id'] !== chosen['.id'] || exact.type !== chosen.type ||
observedFlag(exact.running) !== true || observedFlag(exact.disabled) !== false) deny();
const fields = Object.fromEntries(counterFields.map(key => {
const value = exact[key];
return [key, { present: Object.hasOwn(exact, key),
type: value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value }];
}));
devices.push({ status: 'shape-observed', fields });
}
return { devices, ingressVerified: false, capturePerformed: false, mutationsPerformed: false };
}
function endpoint(transport, host) {
return transport.configuration(['--source', host, '--transport', 'ssh-loopback', '--output',
'tmp/netflow-endpoint-discovery', '--owned-tunnel-attestation', attestation]).endpoint;
}
function bool(value) {
if (value === true || value === 'true') return true;
if (value === false || value === 'false') return false;
return deny();
}
function single(rows) {
if (rows.length !== 1) deny();
return rows[0];
}
function observedFlag(value) {
if ([true, 'true', 'yes'].includes(value)) return true;
if ([false, 'false', 'no'].includes(value)) return false;
return null;
}
export async function discoverPinnedNetFlowPolicy(read) {
const exporters = [];
for (const host of Object.keys(ports)) {
const resource = single(await read(host, policyRoutes[0]));
if (typeof resource.version !== 'string' || !/^\d+\.\d+(?:\.\d+)?(?: \([a-z-]+\))?$/.test(resource.version)) deny();
const ip = single(await read(host, policyRoutes[1]));
const tracking = single(await read(host, policyRoutes[2]));
const firewall = {};
const vetoes = [];
const ipForward = observedFlag(ip['ip-forward']);
const allowFastPath = observedFlag(ip['allow-fast-path']);
const conntrack = tracking.enabled === 'auto' ? 'auto' : observedFlag(tracking.enabled);
if (ipForward !== true) vetoes.push('ip-forward-not-confirmed');
if (allowFastPath !== false) vetoes.push('fast-path-not-confirmed-disabled');
if (conntrack !== true) vetoes.push('conntrack-not-explicitly-enabled');
for (const path of policyRoutes.slice(3, 7)) {
const rows = await read(host, path);
const enabled = rows.filter(row => observedFlag(row.disabled) !== true);
firewall[path.split('/').at(-1)] = {
total: rows.length,
notExplicitlyDisabled: enabled.length,
fastTrack: enabled.filter(row => row.action === 'fasttrack-connection').length,
};
}
const routingRules = await read(host, policyRoutes[7]);
const activeRoutingRules = routingRules.filter(row => observedFlag(row.disabled) !== true).length;
if (activeRoutingRules) vetoes.push('routing-policy-present');
const vrfs = await read(host, policyRoutes[8]);
const mainVrfOnly = vrfs.length === 1 && vrfs[0].name === 'main' && vrfs[0].interfaces === 'all' &&
observedFlag(vrfs[0].disabled) !== true;
if (!mainVrfOnly) vetoes.push('main-vrf-only-not-confirmed');
exporters.push({ host, version: resource.version, ipForward, allowFastPath, conntrack, firewall,
activeRoutingRules, vrfCount: vrfs.length, mainVrfOnly, vetoes });
}
return {
status: exporters.some(item => item.vetoes.length) ? 'pre-topology-veto' : 'no-global-veto-observed',
exporters, routeSelectionVerified: false, tuplePolicyVerified: false,
ingressVerified: false, capturePerformed: false, mutationsPerformed: false,
};
}
function target(row) {
if (bool(row.disabled) || row.version !== 'ipfix') return null;
const destination = row['dst-address'];
const portText = String(row.port);
if (!isIPv4(destination) || !/^[1-9][0-9]{0,4}$/.test(portText) || Number(portText) > 65535) deny();
const source = row['src-address'];
if (source !== undefined && source !== '' && !isIPv4(source)) deny();
return { destination, port: Number(portText), configuredSource: source && source !== '0.0.0.0' ? source : null };
}
export async function discoverPinnedNetFlowEndpoints(read) {
const exporters = [];
for (const host of Object.keys(ports)) {
const resource = single(await read(host, routes[0]));
if (typeof resource.version !== 'string' || !/^\d+\.\d+(?:\.\d+)?(?: \([a-z-]+\))?$/.test(resource.version)) deny();
const enabled = bool(single(await read(host, routes[1])).enabled);
const rows = await read(host, routes[2]);
if (rows.length > 64) deny();
const configuredTargets = rows.map(target).filter(Boolean);
exporters.push({ host, version: resource.version, enabled, configuredTargets });
}
const [first, second] = exporters;
const sameEndpoint = (a, b) => a.destination === b.destination && a.port === b.port;
const common = first.enabled && second.enabled
? first.configuredTargets.filter(a => second.configuredTargets.some(b => sameEndpoint(a, b)))
: [];
const unique = common.length === 1 && second.configuredTargets.filter(b => sameEndpoint(common[0], b)).length === 1;
return {
status: common.length === 0 ? 'no-common-active-ipfix-target' : unique ? 'configured-endpoint' : 'ambiguous-endpoint',
configuredEndpoint: unique ? { destination: common[0].destination, port: common[0].port } : null,
exporters,
ingressVerified: false,
capturePerformed: false,
mutationsPerformed: false,
};
}
async function main() {
const mode = process.argv.slice(2);
if (mode.length !== 1) deny();
const policy = mode[0] === '--check-policy' || mode[0] === '--read-pinned-policy';
const counters = mode[0] === '--check-counters' || mode[0] === '--read-pinned-counters';
const transport = counters ? await loadTransport(['/interface'], 4, 131072) : await loadPinnedNetFlowTransport(policy);
if (mode[0] === '--check-only' || mode[0] === '--check-policy') {
console.log(JSON.stringify({ transportSha256: reviewedTransportHash, loopbackPorts: ports, readPaths: transport.PATHS, networkUsed: false }));
return;
}
if (mode[0] === '--check-counters') {
const detail = await loadTransport(['/interface/*A'], 4, 16384);
if (detail.PATHS[0] !== '/interface/*A') deny();
console.log(JSON.stringify({ transportSha256: reviewedTransportHash, loopbackPorts: ports,
readPaths: ['/interface', '/interface/<observed-native-id>'], networkUsed: false }));
return;
}
if (!['--read-pinned', '--read-pinned-policy', '--read-pinned-counters'].includes(mode[0]) || process.stdin.isTTY) deny();
const chunks = [];
let length = 0;
for await (const chunk of process.stdin) {
length += chunk.length;
if (length > 4096) deny();
chunks.push(chunk);
}
const input = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(Buffer.concat(chunks)));
if (!input || input.attestation !== attestation ||
Object.keys(input).length !== 2 || !input.passwords || Object.keys(input.passwords).length !== 2) deny();
const passwords = Object.keys(ports).map(host => input.passwords[host]);
if (passwords.some(password => typeof password !== 'string' || !/^[^\u0000-\u001f\u007f]{1,512}$/u.test(password))) deny();
const authorizations = passwords.map(password => 'Basic ' + Buffer.from('admin:' + password).toString('base64'));
const secrets = [...passwords, ...authorizations, ...authorizations.map(value => value.slice(6))].map(value => Buffer.from(value));
const budget = { requests: 0, bytes: 0, rows: 0, deadline: Date.now() + 30000 };
const discovery = counters ? discoverPinnedInterfaceCounterShape : policy ? discoverPinnedNetFlowPolicy : discoverPinnedNetFlowEndpoints;
const report = await discovery(async (host, route) => {
const authorization = authorizations[Object.keys(ports).indexOf(host)];
let selected = transport;
if (counters && route !== '/interface') {
if (!route.startsWith('/interface/') || !nativeId(route.slice('/interface/'.length))) deny();
selected = await loadTransport([route], 4, 16384, 524288);
}
const response = await selected.readResponse(endpoint(selected, host), route, authorization, budget);
if (secrets.some(secret => response.body.includes(secret))) deny();
return response.rows;
});
const output = JSON.stringify(report);
if (secrets.some(secret => Buffer.from(output).includes(secret))) deny();
console.log(output);
}
if (process.argv[1] && pathToFileURL(process.argv[1]).href === import.meta.url) {
main().catch(() => {
console.error('NetFlow discovery refused');
process.exitCode = 1;
});
}
@@ -0,0 +1,102 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import { discoverPinnedInterfaceCounterShape, discoverPinnedNetFlowEndpoints, discoverPinnedNetFlowPolicy, loadPinnedNetFlowTransport } from './chr-netflow-endpoint-discovery.mjs';
const hosts = ['194.226.121.150', '104.165.244.7'];
const routes = ['/system/resource', '/ip/traffic-flow', '/ip/traffic-flow/target'];
const target = { disabled: 'false', version: 'ipfix', 'dst-address': '192.0.2.10', port: '2055', 'src-address': '0.0.0.0' };
function fixture(targets, enabled = ['true', 'true']) {
const calls = [];
const read = async (host, path) => {
calls.push([host, path]);
if (path === routes[0]) return [{ version: '7.24.5 (stable)' }];
if (path === routes[1]) return [{ enabled: enabled[hosts.indexOf(host)] }];
assert.equal(path, routes[2]);
return targets[hosts.indexOf(host)];
};
return { read, calls };
}
test('loads the reviewed source with the exact read-only path and relay fence', async () => {
const transport = await loadPinnedNetFlowTransport();
assert.deepEqual(transport.PATHS, routes);
assert.throws(() => transport.readResponse('http://127.0.0.1:19082', '/ip/address', '', {}), /request-budget/);
assert.throws(() => transport.readResponse('http://127.0.0.1:19083', routes[0], '', {}), /non-whitelisted-endpoint/);
});
test('reports only a common configured endpoint, with no ingress or capture claim', async () => {
const { read, calls } = fixture([[target], [{ ...target, 'src-address': '192.0.2.20' }]]);
const report = await discoverPinnedNetFlowEndpoints(read);
assert.deepEqual(calls, hosts.flatMap(host => routes.map(path => [host, path])));
assert.equal(report.status, 'configured-endpoint');
assert.deepEqual(report.configuredEndpoint, { destination: '192.0.2.10', port: 2055 });
assert.deepEqual(report.exporters.map(item => item.configuredTargets[0].configuredSource), [null, '192.0.2.20']);
assert.equal(report.ingressVerified, false);
assert.equal(report.capturePerformed, false);
assert.equal(report.mutationsPerformed, false);
});
test('returns successful absence for missing or disabled baseline', async () => {
for (const input of [
fixture([[], [target]]),
fixture([[target], [target]], [true, false]),
fixture([[target], [{ ...target, disabled: true }]]),
fixture([[target], [{ ...target, version: '9' }]]),
]) {
const result = await discoverPinnedNetFlowEndpoints(input.read);
assert.equal(result.status, 'no-common-active-ipfix-target');
assert.equal(result.configuredEndpoint, null);
}
});
test('refuses malformed relevant rows and withholds ambiguous common endpoints', async () => {
const result = await discoverPinnedNetFlowEndpoints(fixture([[target], [target, target]]).read);
assert.equal(result.status, 'ambiguous-endpoint');
assert.equal(result.configuredEndpoint, null);
await assert.rejects(discoverPinnedNetFlowEndpoints(fixture([[target], [{ ...target, port: '65536' }]]).read), /^Error: NetFlow discovery refused$/);
});
test('reports preliminary global vetoes and counts with no claim on tuple policy or routes', async () => {
const transport = await loadPinnedNetFlowTransport(true);
const calls = [];
const report = await discoverPinnedNetFlowPolicy(async (host, path) => {
calls.push([host, path]);
return ({
'/system/resource': [{ version: '7.24.5 (stable)' }],
'/ip/settings': [{ 'ip-forward': 'yes', 'allow-fast-path': host === hosts[0] ? 'yes' : 'no' }],
'/ip/firewall/connection/tracking': [{ enabled: host === hosts[0] ? 'auto' : 'yes' }],
'/ip/firewall/filter': [{ action: 'fasttrack-connection' }, { action: 'drop', disabled: 'true' }],
'/ip/firewall/raw': [], '/ip/firewall/mangle': [], '/ip/firewall/nat': [],
'/routing/rule': host === hosts[0] ? [{}] : [],
'/ip/vrf': [{ name: 'main', interfaces: 'all' }],
})[path];
});
assert.deepEqual(calls, hosts.flatMap(host => transport.PATHS.map(path => [host, path])));
assert.equal(report.status, 'pre-topology-veto');
assert.deepEqual(report.exporters[0].vetoes, ['fast-path-not-confirmed-disabled', 'conntrack-not-explicitly-enabled', 'routing-policy-present']);
assert.deepEqual(report.exporters[1].vetoes, []);
assert.deepEqual(report.exporters[0].firewall.filter, { total: 2, notExplicitlyDisabled: 1, fastTrack: 1 });
assert.equal(report.routeSelectionVerified, false);
assert.equal(report.tuplePolicyVerified, false);
assert.equal(report.ingressVerified, false);
});
test('counter shape reads exact selected native IDs and emits no identities or counter values', async () => {
const ether = { '.id': '*A', name: 'private-ether', type: 'ether', running: 'true', disabled: 'false' };
const wg = { ...ether, '.id': '*B', name: 'private-wg', type: 'wg' };
const calls = [];
const report = await discoverPinnedInterfaceCounterShape(async (host, route) => {
calls.push([host, route]);
if (route === '/interface') return host === hosts[0] ? [ether, wg] : [ether];
return [{ ...(host === hosts[0] ? wg : ether), ifindex: '61455', 'rx-packet': 71922, 'fp-rx-byte': null }];
});
assert.deepEqual(calls, [[hosts[0], '/interface'], [hosts[0], '/interface/*B'], [hosts[1], '/interface'], [hosts[1], '/interface/*A']]);
assert.deepEqual(report.devices[0].fields.ifindex, { present: true, type: 'string' });
assert.deepEqual(report.devices[0].fields['rx-packet'], { present: true, type: 'number' });
assert.deepEqual(report.devices[0].fields['fp-rx-byte'], { present: true, type: 'null' });
assert.deepEqual(report.devices[0].fields['tx-packet'], { present: false, type: 'undefined' });
assert.doesNotMatch(JSON.stringify(report), /private|61455|71922|104\.165|194\.226|\*[AB]/);
await assert.rejects(discoverPinnedInterfaceCounterShape(async (_host, route) =>
route === '/interface' ? [ether] : [{ ...ether, '.id': '*C' }]), /discovery refused/);
});
@@ -0,0 +1,86 @@
import assert from 'node:assert/strict';
import { createHash } from 'node:crypto';
import { lstat, readFile } from 'node:fs/promises';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { decodeBody, SOURCES } from './chr-recursive-observation.mjs';
const reviewedReportSha256 = 'fccf5171c8e50730a3e7c1fcceeeb77f1e946589ac4a56c6e04668e0ff4663f9';
const sha256 = bytes => createHash('sha256').update(bytes).digest('hex');
const opaqueId = value => typeof value === 'string' && /^\*[a-f0-9]+$/i.test(value);
const decimalIndex = value => typeof value === 'string' && /^[1-9][0-9]{0,15}$/.test(value);
export function inspectDirectLinks(routes, nexthops, interfaces, tables) {
function keyed(rows, field, valid) {
const index = new Map();
for (const row of rows) {
const key = row[field];
assert(valid(key) && !index.has(key), 'Missing or ambiguous ' + field);
index.set(key, row);
}
return index;
}
const byNexthopId = keyed(nexthops, '.id', opaqueId);
const byInterfaceIndex = keyed(interfaces, 'ifindex', decimalIndex);
const byTableName = keyed(tables, 'name', value => typeof value === 'string' && value !== '' && !/^[0-9]+$/.test(value));
let opaqueReferences = 0, namedInterfaceCorroborations = 0, interfaceIdSubstitutionRefusals = 0;
for (const route of routes) {
assert(byTableName.has(route['routing-table']), 'Missing named routing table');
if (!Object.hasOwn(route, 'nexthop-id')) continue;
const nexthop = byNexthopId.get(route['nexthop-id']);
assert(nexthop, 'No exact opaque nexthop match');
opaqueReferences++;
const gateway = route['immediate-gw'];
const name = typeof gateway === 'string' ? /%([^%@]+)$/.exec(gateway)?.[1] : undefined;
if (!name) continue;
const index = nexthop['immediate-gw.interface-idx'];
const observed = byInterfaceIndex.get(index);
assert(observed?.name === name && interfaces.filter(row => row.name === name).length === 1,
'No exact named interface corroboration for ifindex');
namedInterfaceCorroborations++;
if (!interfaces.some(row => row.id === index && row.name === name)) interfaceIdSubstitutionRefusals++;
}
assert(opaqueReferences && namedInterfaceCorroborations && interfaceIdSubstitutionRefusals, 'Capture lacks discriminating direct links');
return { opaqueReferences, namedInterfaceCorroborations, interfaceIdSubstitutionRefusals,
tableNames: byTableName.size, recursiveLinkRows: nexthops.filter(row => Object.keys(row).some(key => key === 'links' || key.startsWith('links.'))).length };
}
async function readPinned(directory, filename, digest) {
const file = path.join(directory, filename), stat = await lstat(file);
assert(stat.isFile() && !stat.isSymbolicLink() && stat.size <= 1048576, 'Unavailable bounded raw file');
const bytes = await readFile(file);
assert(bytes.length === stat.size && sha256(bytes) === digest, 'Raw capture hash changed');
return bytes;
}
export async function checkReviewedDirectLinks(directory) {
const report = JSON.parse(await readPinned(directory, 'report.json', reviewedReportSha256));
const sources = [];
for (const source of report.sources) {
assert(source.complete && source.versionBracketEqual && SOURCES[source.source]?.serverId === source.serverId);
const read = async (index, resource) => {
const record = source.records[index];
assert(record.resource === resource && record.status === 200 && record.version === '7.24.5 (stable)');
assert(record.file === `server${source.serverId}-${String(index + 1).padStart(2, '0')}-${resource.slice(1).replaceAll('/', '-')}.json`);
return decodeBody(await readPinned(directory, record.file, record.rawSha256)).rows;
};
const routes = await read(1, '/routing/route'), nexthops = await read(2, '/routing/nexthop');
assert.deepEqual(await read(7, '/routing/route'), routes);
assert.deepEqual(await read(6, '/routing/nexthop'), nexthops);
assert.equal(source.records[1].rawSha256, source.records[7].rawSha256);
assert.equal(source.records[2].rawSha256, source.records[6].rawSha256);
const interfaces = await read(3, '/interface'), tables = await read(4, '/routing/table');
sources.push({ serverId: source.serverId, ...inspectDirectLinks(routes, nexthops, interfaces, tables) });
}
return { reviewedReportSha256, sources, recursiveIdentity: 'unknown', semanticProof: false };
}
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
try {
assert(process.argv.length === 3, 'Supply the reviewed offline capture directory');
process.stdout.write(JSON.stringify(await checkReviewedDirectLinks(process.argv[2])) + '\n');
} catch {
process.stderr.write('Reviewed direct-link corroboration refused.\n');
process.exitCode = 1;
}
}
@@ -0,0 +1,17 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import { inspectDirectLinks } from './chr-recursive-direct-links.mjs';
test('direct evidence requires exact opaque reference and corroborated ifindex namespace', () => {
const route = { 'routing-table': 'main', 'nexthop-id': '*A', 'immediate-gw': '192.0.2.1%ether1' };
const nexthop = { '.id': '*A', 'immediate-gw.interface-idx': '4' };
const iface = { id: '9', ifindex: '4', name: 'ether1' };
const table = { '.id': '*0', name: 'main' };
assert.deepEqual(inspectDirectLinks([route], [nexthop], [iface], [table]), {
opaqueReferences: 1, namedInterfaceCorroborations: 1, interfaceIdSubstitutionRefusals: 1, tableNames: 1, recursiveLinkRows: 0,
});
assert.throws(() => inspectDirectLinks([{ ...route, 'nexthop-id': '*a' }], [nexthop], [iface], [table]), /exact opaque/);
assert.throws(() => inspectDirectLinks([{ ...route, 'routing-table': '0' }], [nexthop], [iface], [table]), /named routing table/);
assert.throws(() => inspectDirectLinks([route], [nexthop], [{ ...iface, id: '4', ifindex: '9' }], [table]), /corroboration/);
assert.throws(() => inspectDirectLinks([route], [nexthop], [iface, { ...iface, id: '3' }], [table]), /ambiguous ifindex/);
});
@@ -111,7 +111,7 @@ export async function acquire(config, credentials) {
const authorization = 'Basic ' + Buffer.from(credentials.username + ':' + credentials.password).toString('base64'); const authorization = 'Basic ' + Buffer.from(credentials.username + ':' + credentials.password).toString('base64');
const report = { format: 'chr-recursive-raw-acquisition-v1', source: fixed.source, serverId: fixed.serverId, const report = { format: 'chr-recursive-raw-acquisition-v1', source: fixed.source, serverId: fixed.serverId,
transport: fixed.transport, tunnelAttestation: fixed.tunnelAttestation, startedAt: new Date().toISOString(), transport: fixed.transport, tunnelAttestation: fixed.tunnelAttestation, startedAt: new Date().toISOString(),
semanticProof: false, complete: false, records: [], limits: LIMITS }; semanticProof: false, complete: false, snapshotBracket: null, records: [], limits: LIMITS };
let version, attemptedResource; let version, attemptedResource;
try { try {
for (const [index, resource] of PATHS.entries()) { for (const [index, resource] of PATHS.entries()) {
@@ -130,6 +130,13 @@ export async function acquire(config, credentials) {
report.records.push({ file, resource, startedAt, finishedAt: new Date().toISOString(), version, report.records.push({ file, resource, startedAt, finishedAt: new Date().toISOString(), version,
status: response.status, contentType: response.contentType, bytes: response.body.length, rows: response.rows.length, rawSha256: sha(response.body) }); status: response.status, contentType: response.contentType, bytes: response.body.length, rows: response.rows.length, rawSha256: sha(response.body) });
} }
const hashFor = resource => report.records.filter(record => record.resource === resource).map(record => record.rawSha256);
const [firstRoute, lastRoute] = hashFor('/routing/route');
const [firstNexthop, lastNexthop] = hashFor('/routing/nexthop');
report.snapshotBracket = {
routeByteEqual: firstRoute === lastRoute,
nexthopByteEqual: firstNexthop === lastNexthop,
};
report.complete = true; report.complete = true;
} catch (error) { } catch (error) {
report.failure = 'acquisition-incomplete'; report.failure = 'acquisition-incomplete';
@@ -163,7 +170,8 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me
const config = configuration(process.argv.slice(2)); const config = configuration(process.argv.slice(2));
const report = await acquire(config, await privateStdin()); const report = await acquire(config, await privateStdin());
// Stdout contains metadata only; no native bodies, credentials or errors. // Stdout contains metadata only; no native bodies, credentials or errors.
process.stdout.write(JSON.stringify({ complete: report.complete, semanticProof: false, source: report.source, records: report.records.length }) + '\n'); process.stdout.write(JSON.stringify({ complete: report.complete, snapshotBracket: report.snapshotBracket,
semanticProof: false, source: report.source, records: report.records.length }) + '\n');
if (!report.complete) process.exitCode = 1; if (!report.complete) process.exitCode = 1;
} catch { process.stderr.write('Read-only acquisition refused or incomplete.\n'); process.exitCode = 1; } } catch { process.stderr.write('Read-only acquisition refused or incomplete.\n'); process.exitCode = 1; }
} }
@@ -17,11 +17,13 @@ test('source/transport allowlist refuses arbitrary hosts, plaintext external, mi
test('full own fixture saves nine exact immutable captures and metadata; reflected errors never enter reports', async () => { test('full own fixture saves nine exact immutable captures and metadata; reflected errors never enter reports', async () => {
const output = fileURLToPath(new URL('../../../tmp/chr-recursive-own-fixture-' + randomUUID(), import.meta.url)), seen = []; const output = fileURLToPath(new URL('../../../tmp/chr-recursive-own-fixture-' + randomUUID(), import.meta.url)), seen = [];
let reflect = false; let reflect = false, driftingResource;
const server = createServer((req, res) => { const server = createServer((req, res) => {
seen.push(req.url); res.setHeader('Content-Type', 'application/json'); seen.push(req.url); res.setHeader('Content-Type', 'application/json');
if (reflect) { res.statusCode = 401; res.end('{"message":"own-fixture-secret-only"}'); return; } if (reflect) { res.statusCode = 401; res.end('{"message":"own-fixture-secret-only"}'); return; }
res.end(req.url === '/rest/system/resource' ? '[{"version":"7.26"}]\n' : '[{".id":"*1"}]\n'); if (req.url === '/rest/system/resource') res.end('[{"version":"7.26"}]\n');
else if (req.url === driftingResource && seen.indexOf(req.url) !== seen.length - 1) res.end('[{".id":"*2"}]\n');
else res.end('[{".id":"*1"}]\n');
}); });
await new Promise((resolve, reject) => { server.once('error', reject); server.listen(19081, '127.0.0.1', resolve); }); await new Promise((resolve, reject) => { server.once('error', reject); server.listen(19081, '127.0.0.1', resolve); });
const makeConfig = destination => configuration(['--source', '194.226.121.150', '--transport', 'ssh-loopback', '--output', destination, const makeConfig = destination => configuration(['--source', '194.226.121.150', '--transport', 'ssh-loopback', '--output', destination,
@@ -29,6 +31,7 @@ test('full own fixture saves nine exact immutable captures and metadata; reflect
try { try {
const report = await acquire(makeConfig(output), { username: 'own-fixture', password: 'own-fixture-secret-only' }); const report = await acquire(makeConfig(output), { username: 'own-fixture', password: 'own-fixture-secret-only' });
assert.equal(report.complete, true); assert.equal(report.semanticProof, false); assert.equal(report.complete, true); assert.equal(report.semanticProof, false);
assert.deepEqual(report.snapshotBracket, { routeByteEqual: true, nexthopByteEqual: true });
assert.deepEqual(seen, PATHS.map(resource => '/rest' + resource)); assert.deepEqual(seen, PATHS.map(resource => '/rest' + resource));
for (const record of report.records) { for (const record of report.records) {
const body = await readFile(output + '/' + record.file); const body = await readFile(output + '/' + record.file);
@@ -38,10 +41,22 @@ test('full own fixture saves nine exact immutable captures and metadata; reflect
await assert.rejects(acquire(makeConfig(output), { username: 'own-fixture', password: 'own-fixture-secret-only' })); await assert.rejects(acquire(makeConfig(output), { username: 'own-fixture', password: 'own-fixture-secret-only' }));
assert.equal(seen.length, 9); assert.equal(seen.length, 9);
await assert.rejects(privateDirectory('../outside-tmp')); await assert.rejects(privateDirectory('../outside-tmp'));
for (const resource of ['route', 'nexthop']) {
seen.length = 0;
driftingResource = '/rest/routing/' + resource;
const driftOutput = output + '-' + resource;
const drift = await acquire(makeConfig(driftOutput), { username: 'own-fixture', password: 'own-fixture-secret-only' });
assert.equal(drift.complete, true);
assert.equal(drift.semanticProof, false);
assert.deepEqual(drift.snapshotBracket, { routeByteEqual: resource !== 'route', nexthopByteEqual: resource !== 'nexthop' });
assert.equal(drift.records.length, 9);
assert.deepEqual(JSON.parse(await readFile(driftOutput + '/report.json', 'utf8')).snapshotBracket, drift.snapshotBracket);
}
reflect = true; reflect = true;
const failedOutput = output + '-failed'; const failedOutput = output + '-failed';
const failed = await acquire(makeConfig(failedOutput), { username: 'own-fixture', password: 'own-fixture-secret-only' }); const failed = await acquire(makeConfig(failedOutput), { username: 'own-fixture', password: 'own-fixture-secret-only' });
assert.equal(failed.complete, false); assert.equal(failed.records.length, 0); assert.equal(failed.complete, false); assert.equal(failed.records.length, 0);
assert.equal(failed.snapshotBracket, null);
assert.equal(failed.failedResource, '/system/resource'); assert.equal(failed.failedHttpStatus, 401); assert.equal(failed.failedResource, '/system/resource'); assert.equal(failed.failedHttpStatus, 401);
assert.deepEqual((await readdir(failedOutput)).sort(), ['capture.claim', 'report.json']); assert.deepEqual((await readdir(failedOutput)).sort(), ['capture.claim', 'report.json']);
assert(!String(await readFile(failedOutput + '/report.json')).includes('own-fixture-secret-only')); assert(!String(await readFile(failedOutput + '/report.json')).includes('own-fixture-secret-only'));
@@ -0,0 +1,58 @@
import assert from 'node:assert/strict'
import { setTimeout as delay } from 'node:timers/promises'
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client'
import { resumeMcpSteps } from './mcp-step-journal.mjs'
const [phase, port, planId, connectionId] = process.argv.slice(2)
assert(process.send && process.env.MCP_FIXTURE_TOKEN && ['dispatch', 'resume'].includes(phase))
const uuid = /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i
assert.match(planId, uuid)
assert.match(connectionId, uuid)
const client = new Client({ name: 'owned-routing-observer', version: '1.0.0' })
async function call(name, args) {
const reply = await client.callTool({ name, arguments: args })
assert(!reply.isError, 'MCP fixture call failed: ' + name)
return reply.structuredContent?.result ?? JSON.parse(reply.content[0].text)
}
try {
await client.connect(new StreamableHTTPClientTransport(new URL(`http://127.0.0.1:${port}/mcp`), {
requestInit: { headers: { Authorization: 'Bearer ' + process.env.MCP_FIXTURE_TOKEN } },
}))
let operationId
const result = await resumeMcpSteps({ journal: 'routing-forward.jsonl', fixture: `routing-scoped-forward:${connectionId}:${planId}`, steps: [{
id: 'forward-apply', kind: 'apply',
async run({ idempotencyKey, accept }) {
assert.equal(phase, 'dispatch', 'A resumed observer cannot send apply')
const receipt = await call('mm_change_apply', { planId, idempotencyKey })
assert.deepEqual([receipt.plan_id, receipt.connection_id], [planId, connectionId])
accept(receipt.id)
// The supervisor terminates this process after the journal fsync.
process.send(receipt.id)
await new Promise(resolve => process.once('disconnect', resolve))
throw new Error('Observer was disconnected by its supervisor')
},
async reconcile({ accepted }) {
assert.equal(phase, 'resume')
assert.ok(accepted)
const deadline = Date.now() + 60_000
while (Date.now() < deadline) {
const receipt = await call('mm_operation_get', { operationId: accepted })
assert.deepEqual([receipt.id, receipt.plan_id, receipt.connection_id], [accepted, planId, connectionId])
if (!['pending', 'running'].includes(receipt.state)) {
assert.deepEqual([receipt.state, receipt.verification], ['applied', 'passed'])
operationId = accepted
return { state: 'verified', evidence: accepted }
}
await delay(400)
}
return { state: 'unknown' }
},
}] })
assert.deepEqual(result, { status: 'passed' })
assert.ok(operationId)
await new Promise((resolve, reject) => process.send(operationId, error => error ? reject(error) : resolve()))
} finally {
await client.close()
if (process.connected) process.disconnect()
}
@@ -0,0 +1,84 @@
import assert from 'node:assert/strict'
import { resumeMcpSteps } from './mcp-step-journal.mjs'
const uuid = /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i
function isProtocolStorageBusy(error) {
const text = error?.data?.text
if (error?.name !== 'SdkHttpError' || error.status !== 503 ||
typeof text !== 'string' || Buffer.byteLength(text) > 1024) return false
try {
const body = JSON.parse(text)
return body?.code === 'PROTOCOL_STORAGE_BUSY'
} catch {
return false
}
}
/** The caller supplies an already registered synthetic test server and owner review. */
export function resumeServerPoll({ journal, fixture, serverId, connectionId, call, findPlan, findAcceptedOperation, assertApproved }) {
assert(Number.isSafeInteger(serverId) && serverId > 0)
assert.match(connectionId, uuid)
const find = async args => {
const planId = await findPlan?.({ ...args, connectionId, serverId })
return planId ? { state: 'verified', evidence: planId } : { state: 'unknown' }
}
return resumeMcpSteps({ journal, fixture: `${fixture}:server-${serverId}:connection-${connectionId}`, steps: [
{ id: 'mm_server_poll_plan', kind: 'plan', reconcile: find, async run({ accept }) {
const result = await call('mm_server_poll_plan', { serverId })
accept(result.planId)
return result.planId
} },
{ id: 'manager.plan-approved', kind: 'read', async run({ evidence }) {
const planId = evidence.get('mm_server_poll_plan')
await assertApproved(planId)
return planId
} },
{ id: 'mm_change_apply', kind: 'apply',
async reconcile(args) {
const id = args.accepted ?? await findAcceptedOperation?.({
...args, connectionId, planId: args.evidence.get('mm_server_poll_plan'),
})
return id ? { state: 'verified', evidence: id } : { state: 'unknown' }
},
async run({ evidence, idempotencyKey, accept }) {
const planId = evidence.get('mm_server_poll_plan')
const result = await call('mm_change_apply', { planId, idempotencyKey })
accept(result.id)
return result.id
} },
{ id: 'mm_operation_get', kind: 'read', async run({ evidence }) {
const operationId = evidence.get('mm_change_apply')
let result
try {
result = await call('mm_operation_get', { operationId })
} catch (error) {
if (!isProtocolStorageBusy(error)) throw error
throw Object.assign(new Error('MCP протокольное хранилище занято', { cause: error }), {
code: 'PROTOCOL_STORAGE_BUSY',
})
}
assert.equal(result.id, operationId)
assert.equal(result.plan_id, evidence.get('mm_server_poll_plan'))
assert.equal(result.connection_id, connectionId)
if (result.state !== 'applied' || result.verification !== 'passed') {
const code = ['pending', 'running'].includes(result.state) ? 'POLL_PENDING' : 'POLL_UNVERIFIED'
throw Object.assign(new Error('Poll terminal result is unverified'), { code })
}
assert.equal(result.steps.length, 1)
assert.equal(result.steps[0].state, 'verified')
const receipt = result.steps[0].result
assert.equal(receipt.operationId, operationId)
assert.match(receipt.receiptId, uuid)
assert.equal(receipt.nativeReads, 4)
assert.equal(receipt.complete, true)
assert.equal(receipt.maintenanceComplete, true)
assert.equal(receipt.configurationVerified, true)
assert.equal(receipt.automaticReplay, false)
assert(Number.isSafeInteger(receipt.completedPublications) && receipt.completedPublications >= 2)
assert.equal(receipt.confirmedPublications, receipt.completedPublications)
assert.equal(receipt.snapshot.serverId, serverId)
return operationId
} },
] })
}
@@ -0,0 +1,119 @@
import assert from 'node:assert/strict'
import { createHash } from 'node:crypto'
import { closeSync, constants, fstatSync, fsyncSync, openSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs'
import { isDeepStrictEqual } from 'node:util'
const key = /^[a-z0-9][a-z0-9_.:-]{0,127}$/i
const evidenceId = /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i
const errorCode = /^[A-Z][A-Z0-9_]{0,63}$/
const validEvidence = (receipt, kind) => receipt === null ? kind === 'read' : typeof receipt === 'string' && evidenceId.test(receipt)
/** A test journal only. The caller owns the fixture and all reconciliation reads. */
export async function resumeMcpSteps({ journal, fixture, steps }) {
assert(key.test(fixture))
const scope = steps.map(({ id, kind }) => ({ id, kind }))
assert(scope.length && new Set(scope.map(step => step.id)).size === scope.length)
assert(scope.every(({ id, kind }) => key.test(id) && ['read', 'plan', 'apply'].includes(kind)))
// One process owns a journal at a time. A leftover lock requires operator reconciliation.
const lock = openSync(journal + '.lock', 'wx', 0o600)
let records
try {
let fd
try {
fd = openSync(journal, constants.O_RDWR | constants.O_APPEND | constants.O_CREAT | (constants.O_NOFOLLOW ?? 0), 0o600)
assert(fstatSync(fd).isFile(), 'Test journal must be a regular file')
const raw = readFileSync(fd, 'utf8')
assert(!raw || raw.endsWith('\n'), 'Truncated test receipt')
records = raw.trimEnd().split('\n').filter(Boolean).map(line => JSON.parse(line))
const header = { phase: 'fixture', fixture, steps: scope }
const append = entry => {
writeFileSync(fd, JSON.stringify(entry) + '\n', 'utf8')
fsyncSync(fd)
records.push(entry)
}
if (!records.length) append(header)
assert(isDeepStrictEqual(records[0], header), 'Test fixture or ordered step list changed')
const state = new Map()
let cursor = 0
for (const entry of records.slice(1)) {
const previous = state.get(entry.id)
assert(scope[cursor]?.id === entry.id, 'Unexpected test receipt order')
if (entry.phase === 'started') {
assert(!previous || previous.phase === 'retryable', 'Unexpected resumed dispatch')
assert(entry.attempt === (previous?.attempt ?? 0) + 1, 'Unexpected test attempt')
} else {
assert(['started', 'accepted', 'failed'].includes(previous?.phase) && entry.attempt === previous.attempt, 'Unbound test receipt')
assert(['passed', 'retryable', 'accepted', 'failed'].includes(entry.phase), 'Unknown test receipt')
if (entry.phase === 'accepted') {
assert(previous.phase === 'started' && scope[cursor].kind !== 'read' &&
validEvidence(entry.evidence, scope[cursor].kind), 'Invalid MCP acceptance receipt')
}
if (entry.phase === 'failed') {
assert(previous.phase !== 'failed' && typeof entry.code === 'string' && errorCode.test(entry.code), 'Invalid failure receipt')
assert(entry.accepted === (previous.phase === 'accepted' ? previous.evidence : null), 'MCP acceptance receipt changed')
}
if (entry.phase === 'passed') {
assert(validEvidence(entry.evidence, scope[cursor].kind), 'Invalid stored MCP receipt ID')
const accepted = previous.phase === 'accepted' ? previous.evidence : previous.accepted
assert(!accepted || accepted === entry.evidence, 'MCP acceptance receipt changed')
cursor++
}
if (entry.phase === 'retryable') {
assert(entry.accepted === null && (previous.phase === 'started' ||
previous.phase === 'failed' && previous.accepted === null), 'Cannot retry an accepted MCP step')
}
}
state.set(entry.id, entry)
}
const evidence = new Map([...state].filter(([, entry]) => entry.phase === 'passed').map(([id, entry]) => [id, entry.evidence]))
const attemptKey = (step, attempt) => 'acceptance-' + createHash('sha256')
.update(JSON.stringify([fixture, step.id, step.kind, attempt])).digest('hex')
const record = (step, attempt, phase, details = {}) => append({ id: step.id, attempt, phase, ...details })
const complete = (step, attempt, receipt) => {
assert(validEvidence(receipt, step.kind), 'Invalid MCP receipt ID')
record(step, attempt, 'passed', { evidence: receipt })
evidence.set(step.id, receipt)
}
for (const step of steps.slice(cursor)) {
const previous = state.get(step.id)
let attempt = previous?.attempt ?? 0
if (previous && ['started', 'accepted', 'failed'].includes(previous.phase)) {
const accepted = previous.phase === 'accepted' ? previous.evidence : previous.accepted ?? null
const result = step.kind === 'read' ? { state: 'no-effect' } :
await step.reconcile?.({ attempt, accepted, idempotencyKey: attemptKey(step, attempt), evidence: new Map(evidence) })
if (result?.state === 'verified') {
assert(!accepted || accepted === result.evidence, 'Reconciled a different MCP receipt')
complete(step, attempt, result.evidence)
continue
}
if (accepted || result?.state !== 'no-effect') return { status: 'reconcile', step: step.id }
record(step, attempt, 'retryable', { accepted })
}
attempt++
record(step, attempt, 'started')
let receipt
let accepted = null
try {
receipt = await step.run({ attempt, idempotencyKey: attemptKey(step, attempt), evidence: new Map(evidence), accept(id) {
assert(accepted === null && step.kind !== 'read' && validEvidence(id, step.kind), 'Invalid MCP acceptance receipt')
record(step, attempt, 'accepted', { evidence: id })
accepted = id
} })
} catch (error) {
const code = typeof error?.code === 'string' && errorCode.test(error.code) ? error.code : 'TEST_STEP_FAILED'
record(step, attempt, 'failed', { code, accepted })
return { status: 'failed', step: step.id }
}
assert(!accepted || accepted === receipt, 'Verified a different MCP receipt')
complete(step, attempt, receipt)
}
return { status: 'passed' }
} finally {
if (fd !== undefined) closeSync(fd)
}
} finally {
closeSync(lock)
unlinkSync(journal + '.lock')
}
}
@@ -0,0 +1,176 @@
import assert from 'node:assert/strict'
import { appendFileSync, mkdtempSync, readFileSync, rmSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import test from 'node:test'
import { resumeMcpSteps } from './mcp-step-journal.mjs'
import { resumeServerPoll } from './mcp-server-poll-steps.mjs'
const uuid = 'ec4c6a09-3c3b-4a37-a370-c8821321807c'
const connectionId = 'd0d96834-948b-4cea-81d8-d8f9dc5e1429'
const operationId = 'c2cc9f5d-6d62-43b5-a6d2-ba7bedbd4fc1'
const pollReceipt = { operationId, receiptId: uuid, nativeReads: 4, complete: true,
maintenanceComplete: true, configurationVerified: true, automaticReplay: false,
confirmedPublications: 22, completedPublications: 22, snapshot: { serverId: 3, status: 'online' } }
function options(t, steps) {
const dir = mkdtempSync(join(tmpdir(), 'mm-mcp-step-test-'))
t.after(() => rmSync(dir, { recursive: true }))
return { journal: join(dir, 'history.jsonl'), fixture: 'owned-test', steps }
}
test('resumes the failed read and preserves successful reads and failed attempts', async t => {
const calls = []
const config = options(t, [
{ id: 'first', kind: 'read', run: async () => { calls.push('first'); return null } },
{ id: 'second', kind: 'read', run: async ({ attempt }) => {
calls.push('second:' + attempt)
if (attempt === 1) throw Error('test failure')
return null
} },
])
assert.deepEqual(await resumeMcpSteps(config), { status: 'failed', step: 'second' })
assert.deepEqual(await resumeMcpSteps(config), { status: 'passed' })
assert.deepEqual(await resumeMcpSteps(config), { status: 'passed' })
assert.deepEqual(calls, ['first', 'second:1', 'second:2'])
assert.deepEqual(readFileSync(config.journal, 'utf8').trim().split('\n').map(line => JSON.parse(line).phase),
['fixture', 'started', 'passed', 'started', 'failed', 'retryable', 'started', 'passed'])
})
test('unknown apply awaits reconciliation and a verified receipt advances without resending', async t => {
let sends = 0
let verified = false
let sentKey
const config = options(t, [
{ id: 'plan', kind: 'plan', run: async () => uuid },
{ id: 'apply', kind: 'apply', run: async ({ evidence, accept, idempotencyKey }) => {
assert.equal(evidence.get('plan'), uuid)
sentKey = idempotencyKey
sends++
accept(uuid)
throw Error('lost reply')
}, reconcile: async ({ accepted, idempotencyKey }) => {
assert.equal(accepted, uuid)
assert.equal(idempotencyKey, sentKey)
return verified ? { state: 'verified', evidence: uuid } : { state: 'no-effect' }
} },
{ id: 'next', kind: 'read', run: async ({ evidence }) => { assert.equal(evidence.get('apply'), uuid); return null } },
])
assert.deepEqual(await resumeMcpSteps(config), { status: 'failed', step: 'apply' })
assert.deepEqual(await resumeMcpSteps(config), { status: 'reconcile', step: 'apply' })
verified = true
assert.deepEqual(await resumeMcpSteps(config), { status: 'passed' })
assert.equal(sends, 1)
})
test('cannot resume a different fixture or an altered ordered step list', async t => {
const config = options(t, [{ id: 'read', kind: 'read', run: async () => null }])
await resumeMcpSteps(config)
await assert.rejects(resumeMcpSteps({ ...config, fixture: 'other' }), /fixture or ordered step/)
await assert.rejects(resumeMcpSteps({ ...config, steps: [{ ...config.steps[0], id: 'other' }] }), /fixture or ordered step/)
})
test('refuses a stored retry marker after an accepted apply', async t => {
const config = options(t, [{ id: 'apply', kind: 'apply', async run({ accept }) {
accept(uuid)
throw new Error('lost reply')
} }])
await resumeMcpSteps(config)
appendFileSync(config.journal, JSON.stringify({ id: 'apply', attempt: 1, phase: 'retryable', accepted: null }) + '\n')
await assert.rejects(resumeMcpSteps(config), /Cannot retry an accepted MCP step/)
})
test('the poll scenario resumes owner review and then reads the same accepted operation', async t => {
const { journal, fixture } = options(t, [])
const calls = []
let approved = false
let running = true
let storageBusy = true
const config = { journal, fixture, serverId: 3, connectionId, assertApproved: async id => {
assert.equal(id, uuid)
if (!approved) throw Error('approval not visible')
}, async call(tool, args) {
calls.push(tool)
if (tool === 'mm_server_poll_plan') { assert.deepEqual(args, { serverId: 3 }); return { planId: uuid } }
if (tool === 'mm_change_apply') {
assert.equal(args.planId, uuid)
assert.match(args.idempotencyKey, /^acceptance-[0-9a-f]{64}$/)
return { id: operationId }
}
assert.deepEqual(args, { operationId })
if (storageBusy) throw Object.assign(new Error('MCP storage busy'), {
name: 'SdkHttpError', status: 503, data: { text: '{"code":"PROTOCOL_STORAGE_BUSY"}' },
})
return { id: operationId, plan_id: uuid, connection_id: connectionId,
...(running ? { state: 'running' } : { state: 'applied', verification: 'passed',
steps: [{ state: 'verified', result: pollReceipt }] }) }
} }
assert.equal((await resumeServerPoll(config)).step, 'manager.plan-approved')
approved = true
assert.equal((await resumeServerPoll(config)).step, 'mm_operation_get')
storageBusy = false
assert.equal((await resumeServerPoll(config)).step, 'mm_operation_get')
running = false
assert.deepEqual(await resumeServerPoll(config), { status: 'passed' })
await assert.rejects(resumeServerPoll({ ...config, connectionId: uuid }), /fixture or ordered step/)
assert.deepEqual(calls, ['mm_server_poll_plan', 'mm_change_apply', 'mm_operation_get', 'mm_operation_get', 'mm_operation_get'])
const failures = readFileSync(journal, 'utf8').trim().split('\n').map(line => JSON.parse(line))
.filter(entry => entry.id === 'mm_operation_get' && entry.phase === 'failed')
assert.deepEqual(failures.map(entry => entry.code), ['PROTOCOL_STORAGE_BUSY', 'POLL_PENDING'])
})
test('recovers a lost poll apply response by the exact connection, plan and idempotency key', async t => {
const { journal, fixture } = options(t, [])
let key, sends = 0, wrongBinding = true
const config = { journal, fixture, serverId: 3, connectionId, assertApproved: async () => {},
async findAcceptedOperation(binding) {
assert.equal(binding.connectionId, connectionId)
assert.equal(binding.planId, uuid)
assert.equal(binding.idempotencyKey, key)
return operationId
},
async call(tool, args) {
if (tool === 'mm_server_poll_plan') return { planId: uuid }
if (tool === 'mm_change_apply') {
sends++
key = args.idempotencyKey
throw Error('apply response lost')
}
return { id: operationId, plan_id: uuid, connection_id: wrongBinding ? uuid : connectionId,
state: 'applied', verification: 'passed', steps: [{ state: 'verified', result: pollReceipt }] }
},
}
assert.equal((await resumeServerPoll(config)).step, 'mm_change_apply')
assert.equal((await resumeServerPoll(config)).step, 'mm_operation_get')
wrongBinding = false
assert.deepEqual(await resumeServerPoll(config), { status: 'passed' })
assert.equal(sends, 1)
})
test('rejects incomplete or misbound terminal poll receipts before recording success', async t => {
const { journal, fixture } = options(t, [])
const calls = []
const receipts = [
{ ...pollReceipt, operationId: uuid },
{ ...pollReceipt, receiptId: undefined },
{ ...pollReceipt, confirmedPublications: 21 },
{ ...pollReceipt, confirmedPublications: 0, completedPublications: 0 },
{ ...pollReceipt, maintenanceComplete: false },
{ ...pollReceipt, snapshot: { serverId: 4, status: 'online' } },
pollReceipt,
]
const config = { journal, fixture, serverId: 3, connectionId, assertApproved: async () => {},
async call(tool, args) {
calls.push(tool)
if (tool === 'mm_server_poll_plan') return { planId: uuid }
if (tool === 'mm_change_apply') return { id: operationId }
assert.deepEqual(args, { operationId })
return { id: operationId, plan_id: uuid, connection_id: connectionId, state: 'applied', verification: 'passed',
steps: [{ state: 'verified', result: receipts.shift() }] }
},
}
for (let i = 0; i < 6; i++) {
assert.deepEqual(await resumeServerPoll(config), { status: 'failed', step: 'mm_operation_get' })
}
assert.deepEqual(await resumeServerPoll(config), { status: 'passed' })
assert.deepEqual(calls, ['mm_server_poll_plan', 'mm_change_apply', ...Array(7).fill('mm_operation_get')])
})
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-require-imports -- standalone CommonJS Playwright script */
const fs = require('fs'), assert = require('node:assert/strict'), { createHash } = require('crypto'); const fs = require('fs'), assert = require('node:assert/strict'), { createHash } = require('crypto');
const { chromium, expect } = require('@playwright/test'); const { chromium, expect } = require('@playwright/test');
(async () => { (async () => {
@@ -20,7 +20,18 @@ test('fixed artifact is reproducible, resolves the compiled backend graph, and r
const packageJson=JSON.parse(await readFile(path.join(backend,'package.json'),'utf8')) const packageJson=JSON.parse(await readFile(path.join(backend,'package.json'),'utf8'))
await mkdir(projectBackend,{recursive:true});await writeFile(path.join(projectBackend,'package.json'),JSON.stringify({type:'module',dependencies:packageJson.dependencies})) await mkdir(projectBackend,{recursive:true});await writeFile(path.join(projectBackend,'package.json'),JSON.stringify({type:'module',dependencies:packageJson.dependencies}))
const first=await buildDatabaseOperator({backendDirectory:backend,outputDirectory:output}),second=await buildDatabaseOperator({backendDirectory:backend,outputDirectory:output}) const first=await buildDatabaseOperator({backendDirectory:backend,outputDirectory:output}),second=await buildDatabaseOperator({backendDirectory:backend,outputDirectory:output})
assert.deepEqual(first,second);assert.equal(first.modules.length,OPERATOR_SOURCES.length);assert.equal(first.modules.length,20);assert.deepEqual(first.runtimeDependencies,['dotenv','pg','zod']);assert.equal(first.backendDistModules.length,12) assert.deepEqual(first,second);assert.equal(first.modules.length,OPERATOR_SOURCES.length);assert.equal(first.modules.length,31);assert.deepEqual(first.runtimeDependencies,['dotenv','pg','zod']);assert.equal(first.backendDistModules.length,30)
assert(first.modules.some(item=>item.file==='writer-profile/registry-enrollment.mjs'))
assert(first.modules.some(item=>item.file==='writer-profile/marker-fence-enrollment.mjs'))
assert(first.modules.some(item=>item.file==='writer-profile/fixed58-build-definition.js'))
assert(first.backendDistImports.includes('db/database-restore-quarantine-profile.js'))
assert(first.backendDistImports.includes('db/database-source-activation-record.js'))
assert(first.backendDistImports.includes('services/server-probe-legacy-source-inventory.js'))
assert(first.backendDistImports.includes('services/server-probe-legacy-archive-approval.js'))
assert(first.backendDistImports.includes('services/server-probe-legacy-handoff-inspection.js'))
assert(first.backendDistImports.includes('db/legacy-probe-0037-body.js'))
assert(first.backendDistImports.includes('db/controlled-schema-reference-core.js'))
assert(first.backendDistImports.includes('services/database-dump-connection.js'))
const copied=new Set() const copied=new Set()
async function copyDist(relative){ async function copyDist(relative){
if(copied.has(relative))return;copied.add(relative) if(copied.has(relative))return;copied.add(relative)
@@ -39,7 +50,7 @@ test('fixed artifact is reproducible, resolves the compiled backend graph, and r
assert.equal(await stageDatabaseOperatorScripts(scripts,path.join(backend,'scripts')),OPERATOR_SOURCES.length+2) assert.equal(await stageDatabaseOperatorScripts(scripts,path.join(backend,'scripts')),OPERATOR_SOURCES.length+2)
const buildScript=path.join(scripts,'build-database-operator.mjs') const buildScript=path.join(scripts,'build-database-operator.mjs')
const built=spawnSync(process.execPath,[buildScript],{cwd:temporary,env:{...process.env,NODE_OPTIONS:''},encoding:'utf8',timeout:30000}) const built=spawnSync(process.execPath,[buildScript],{cwd:temporary,env:{...process.env,NODE_OPTIONS:''},encoding:'utf8',timeout:30000})
assert.equal(built.status,0,built.stderr);assert.equal(JSON.parse(built.stdout.trim()).modules,20) assert.equal(built.status,0,built.stderr);assert.equal(JSON.parse(built.stdout.trim()).modules,first.modules.length)
assert.deepEqual(JSON.parse(await readFile(path.join(output,'build-manifest.json'),'utf8')),first) assert.deepEqual(JSON.parse(await readFile(path.join(output,'build-manifest.json'),'utf8')),first)
const configFile=path.join(projectBackend,'dist','config.js'),originalConfig=await readFile(configFile,'utf8') const configFile=path.join(projectBackend,'dist','config.js'),originalConfig=await readFile(configFile,'utf8')
for(const injected of ["import 'tsx';","import '../src/config.js';","import '../outside.js';"]){ for(const injected of ["import 'tsx';","import '../src/config.js';","import '../outside.js';"]){
@@ -61,12 +72,30 @@ test('fixed artifact is reproducible, resolves the compiled backend graph, and r
const modulesToImport=first.modules.map(item=>path.join(output,item.file)) const modulesToImport=first.modules.map(item=>path.join(output,item.file))
const importer=path.join(temporary,'import-all.mjs');await writeFile(importer,`import {pathToFileURL} from 'node:url';for(const file of ${JSON.stringify(modulesToImport)})await import(pathToFileURL(file).href);console.log(JSON.stringify({imported:${modulesToImport.length},readyAuthorized:false}));`) const importer=path.join(temporary,'import-all.mjs');await writeFile(importer,`import {pathToFileURL} from 'node:url';for(const file of ${JSON.stringify(modulesToImport)})await import(pathToFileURL(file).href);console.log(JSON.stringify({imported:${modulesToImport.length},readyAuthorized:false}));`)
const imported=spawnSync(process.execPath,['--import',pathToFileURL(guard).href,importer],{cwd:temporary,env,encoding:'utf8',timeout:30000}) const imported=spawnSync(process.execPath,['--import',pathToFileURL(guard).href,importer],{cwd:temporary,env,encoding:'utf8',timeout:30000})
assert.equal(imported.status,0,imported.stderr);assert.equal(JSON.parse(imported.stdout.trim()).imported,20);assert.equal(JSON.parse(await readFile(telemetry,'utf8')).connections,0) assert.equal(imported.status,0,imported.stderr);assert.equal(JSON.parse(imported.stdout.trim()).imported,first.modules.length);assert.equal(JSON.parse(await readFile(telemetry,'utf8')).connections,0)
const refusals=[] const refusals=[]
for(const [entry,event,args] of [['database-writer-bootstrap-operator.mjs','application-writer-bootstrap-refused',['invalid']],['database-writer-profile-operator.mjs','application-writer-profile-publication-refused',['invalid']],['database-writer-profile-operator.mjs','database-maintenance-command-refused',['maintenance-inspect']],['database-writer-profile-operator.mjs','database-maintenance-command-refused',['maintenance-resolve']],['database-writer-profile-operator.mjs','database-source-activation-refused',['source-activate']]]){ for(const [entry,event,args] of [['database-writer-bootstrap-operator.mjs','application-writer-bootstrap-refused',['invalid']],['database-writer-profile-operator.mjs','application-writer-profile-publication-refused',['invalid']],['database-writer-profile-operator.mjs','database-maintenance-command-refused',['maintenance-inspect']],['database-writer-profile-operator.mjs','database-maintenance-command-refused',['maintenance-resolve']],['database-writer-profile-operator.mjs','database-source-activation-refused',['source-activate']],['database-writer-profile-operator.mjs','database-legacy-inspection-refused',['legacy-inspect']],['database-writer-profile-operator.mjs','application-writer-registry-enrollment-refused',['registry-enroll']],['database-writer-profile-operator.mjs','application-writer-marker-fence-enrollment-refused',['marker-fence-enroll']],['database-writer-profile-operator.mjs','application-writer-restore-profile-enrollment-refused',['restore-profile-enroll']]]){
const child=spawnSync(process.execPath,['--import',pathToFileURL(guard).href,path.join(output,entry),...args],{cwd:temporary,env,encoding:'utf8',timeout:30000}) const child=spawnSync(process.execPath,['--import',pathToFileURL(guard).href,path.join(output,entry),...args],{cwd:temporary,env,encoding:'utf8',timeout:30000})
assert.equal(child.status,1,child.stderr);assert.equal(child.stdout,'');assert.equal(JSON.parse(child.stderr.trim()).event,event);assert.equal(JSON.parse(await readFile(telemetry,'utf8')).connections,0);refusals.push(event) assert.equal(child.status,1,child.stderr);assert.equal(child.stdout,'');assert.equal(JSON.parse(child.stderr.trim()).event,event);assert.equal(JSON.parse(await readFile(telemetry,'utf8')).connections,0);refusals.push(event)
} }
const catalogue=spawnSync(process.execPath,['--import',pathToFileURL(guard).href,path.join(output,'database-writer-profile-operator.mjs'),'source-catalogue-inspect'],{cwd:temporary,env,encoding:'utf8',timeout:30000})
assert.equal(catalogue.status,1,catalogue.stderr);assert.equal(catalogue.stdout,'');assert.equal(JSON.parse(catalogue.stderr.trim()).event,'application-writer-source-catalogue-inspection-refused')
assert.equal(JSON.parse(await readFile(telemetry,'utf8')).connections,0);refusals.push('application-writer-source-catalogue-inspection-refused')
for(const command of ['legacy-export','legacy-custody','legacy-handoff-inspect','legacy-cold-verify','legacy-handoff-execute','legacy-handoff-adopt','legacy-handoff-release','legacy-control-reference','legacy-source58-preflight','source58-foundation-enroll','source57-admission-enroll']){
const invalid=spawnSync(process.execPath,['--import',pathToFileURL(guard).href,path.join(output,'database-writer-profile-operator.mjs'),command],{cwd:temporary,env,encoding:'utf8',timeout:30000})
const event={
'legacy-handoff-inspect':'database-legacy-handoff-inspection-refused','legacy-cold-verify':'database-legacy-cold-proof-refused',
'legacy-handoff-execute':'database-legacy-handoff-execution-refused',
'legacy-handoff-adopt':'database-legacy-handoff-adoption-refused',
'legacy-handoff-release':'database-legacy-handoff-release-refused',
'legacy-control-reference':'database-legacy-control-reference-refused',
'legacy-source58-preflight':'database-legacy-source58-preflight-refused',
'source58-foundation-enroll':'database-source58-foundation-refused',
'source57-admission-enroll':'database-source57-admission-refused',
}[command]??`database-${command}-refused`
assert.equal(invalid.status,1,invalid.stderr);assert.equal(invalid.stdout,'');assert.equal(JSON.parse(invalid.stderr.trim()).event,event)
assert.equal(JSON.parse(await readFile(telemetry,'utf8')).connections,0);refusals.push(event)
}
const receipt={node:process.version,projection:temporary,modules:first.modules.length,compiledBackendModules:copied.size,buildCliExitCode:built.status,importedModules:modulesToImport.length,invalidArgumentsRefused:refusals,developmentDependenciesBlocked:denied,networkConnections:0,productionActivated:false,readyAuthorized:false} const receipt={node:process.version,projection:temporary,modules:first.modules.length,compiledBackendModules:copied.size,buildCliExitCode:built.status,importedModules:modulesToImport.length,invalidArgumentsRefused:refusals,developmentDependenciesBlocked:denied,networkConnections:0,productionActivated:false,readyAuthorized:false}
await writeFile(path.join(temporary,'acceptance-receipt.json'),JSON.stringify(receipt,null,2)+'\n');console.log(JSON.stringify(receipt)) await writeFile(path.join(temporary,'acceptance-receipt.json'),JSON.stringify(receipt,null,2)+'\n');console.log(JSON.stringify(receipt))
}) })
@@ -3,8 +3,15 @@ export const OPERATOR_SOURCES=Object.freeze([
'database-writer-bootstrap-operator.mjs','database-writer-profile-operator.mts', 'database-writer-bootstrap-operator.mjs','database-writer-profile-operator.mts',
'writer-profile/operator-files.mjs','writer-profile/operator-contract.mjs','writer-profile/publisher.mjs','writer-profile/context.mjs', 'writer-profile/operator-files.mjs','writer-profile/operator-contract.mjs','writer-profile/publisher.mjs','writer-profile/context.mjs',
'writer-profile/protected-source-registry.mts','writer-profile/maintenance-resolution.mts','writer-profile/source-activation.mts', 'writer-profile/protected-source-registry.mts','writer-profile/maintenance-resolution.mts','writer-profile/source-activation.mts',
'writer-profile/legacy-cold-verification.mts',
'writer-profile/legacy-handoff-execution.mts',
'writer-profile/legacy-control-reference.mts',
'writer-profile/source58-foundation.mts',
'writer-profile/source57-admission-plan.mts',
'writer-profile/registry-enrollment.mts',
'writer-profile/marker-fence-enrollment.mts',
'writer-profile/catalogue.mts','writer-profile/catalogue-value-bridge.ts','writer-profile/catalogue-projection.ts','writer-profile/catalogue-leaves.ts', 'writer-profile/catalogue.mts','writer-profile/catalogue-value-bridge.ts','writer-profile/catalogue-projection.ts','writer-profile/catalogue-leaves.ts',
'writer-profile/application-writer-profile-catalogue.ts','writer-profile/application-writer-profile-catalogue-values.ts', 'writer-profile/application-writer-profile-catalogue.ts','writer-profile/application-writer-profile-catalogue-values.ts',
'writer-profile/application-writer-profile-catalogue-parent-policy.ts','writer-profile/application-writer-profile-canonical.ts', 'writer-profile/application-writer-profile-catalogue-parent-policy.ts','writer-profile/application-writer-profile-canonical.ts',
'writer-profile/fixed44-build-sql.ts','writer-profile/fixed44-build-definition.ts','writer-profile/expanded44-data-policy.ts', 'writer-profile/fixed44-build-sql.ts','writer-profile/fixed44-build-definition.ts','writer-profile/fixed56-build-definition.ts','writer-profile/fixed56-build-delta.ts','writer-profile/fixed57-build-definition.ts','writer-profile/fixed58-build-definition.ts','writer-profile/expanded44-data-policy.ts',
]) ])
@@ -2,20 +2,38 @@
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
import path from 'node:path' import path from 'node:path'
import {pathToFileURL} from 'node:url' import {pathToFileURL} from 'node:url'
import {createPublicKey} from 'node:crypto' import {createPrivateKey,createPublicKey,sign} from 'node:crypto'
import {readProtected,protectedDirectory,sha} from './writer-profile/operator-files.mjs' import {readdir} from 'node:fs/promises'
import {approval,reconciliationApproval,poolOptions,roleKeys,assertJsDriverEnvironment} from './writer-profile/operator-contract.mjs' import {readProtected,protectedDirectory,sha,withJournalLease,writeFile} from './writer-profile/operator-files.mjs'
import {approval,upgradeApproval,reconciliationApproval,poolOptions,roleKeys,assertJsDriverEnvironment} from './writer-profile/operator-contract.mjs'
import {deploymentRequest} from './database-writer-bootstrap-operator.mjs' import {deploymentRequest} from './database-writer-bootstrap-operator.mjs'
const hex=(v:unknown)=>typeof v==='string'&&/^[a-f0-9]{64}$/.test(v) const hex=(v:unknown)=>typeof v==='string'&&/^[a-f0-9]{64}$/.test(v)
const parse=(b:Buffer)=>JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(b)) const parse=(b:Buffer)=>JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(b))
const sourceCommands=['source-activate','source-revoke','source-status'] const sourceCommands=['source-activate','source-revoke','source-status']
export async function main(args:string[]){ export async function main(args:string[]){
if(args[0]==='legacy-cold-verify')return (await import('./writer-profile/legacy-cold-verification.mjs')).verifyLegacyColdMain(args)
if(args[0]==='source58-foundation-enroll'||args[0]==='source57-admission-enroll')return (await import('./writer-profile/source58-foundation.mjs')).source58FoundationMain(args)
if(args[0]==='legacy-control-reference'||args[0]==='legacy-source58-preflight')return (await import('./writer-profile/legacy-control-reference.mjs')).legacyControlReferenceMain(args)
if(['legacy-handoff-execute','legacy-handoff-adopt','legacy-handoff-release'].includes(args[0]))return (await import('./writer-profile/legacy-handoff-execution.mjs')).legacyHandoffExecuteMain(args)
if(['registry-enroll','registry-inspect','restore-profile-enroll'].includes(args[0]))return (await import('./writer-profile/registry-enrollment.mjs')).registryEnrollmentMain(args)
if(args[0]==='marker-fence-enroll')return (await import('./writer-profile/marker-fence-enrollment.mjs')).markerFenceEnrollmentMain(args)
if(sourceCommands.includes(args[0]))return (await import('./writer-profile/source-activation.mjs')).sourceActivationMain(args) if(sourceCommands.includes(args[0]))return (await import('./writer-profile/source-activation.mjs')).sourceActivationMain(args)
if(['maintenance-inspect','maintenance-resolve'].includes(args[0]))return (await import('./writer-profile/maintenance-resolution.mjs')).maintenanceMain(args) if(['maintenance-inspect','maintenance-resolve'].includes(args[0]))return (await import('./writer-profile/maintenance-resolution.mjs')).maintenanceMain(args)
const legacyCustody=args[0]==='legacy-custody'
const legacyHandoff=args[0]==='legacy-handoff-inspect'
const legacyExport=legacyCustody||args[0]==='legacy-export'
const legacyInspection=legacyExport||legacyHandoff||args[0]==='legacy-inspect'
const catalogueInspection=args[0]==='source-catalogue-inspect'
const activePreflight=args[0]==='source-preflight',preflight=activePreflight||args[0]==='preflight' const activePreflight=args[0]==='source-preflight',preflight=activePreflight||args[0]==='preflight'
const flags=['bootstrap','bootstrap-sha256','approval','approval-sha256','definition','definition-sha256','transport','transport-sha256','ca','source-registry','source-spki-sha256','journal'] const upgrade=args[0]==='upgrade'
if(activePreflight)flags.push('activation-directory','activation-sha256') const writes=upgrade||args[0]==='publish'
assert((preflight||['publish','reconcile'].includes(args[0]))&&args.length===1+2*flags.length) const flags=['bootstrap','bootstrap-sha256','transport','transport-sha256','ca','source-registry','source-spki-sha256']
if(!legacyInspection)flags.push('definition','definition-sha256')
if(!legacyInspection&&!catalogueInspection)flags.push('approval','approval-sha256','journal')
if(legacyInspection||catalogueInspection||activePreflight||writes)flags.push('activation-directory','activation-sha256')
if(legacyExport)flags.push('archive-directory','source-signing-key')
if(legacyHandoff)flags.push('archive-directory','handoff-intent-sha256')
assert((legacyInspection||catalogueInspection||preflight||writes||args[0]==='reconcile')&&args.length===1+2*flags.length)
assertJsDriverEnvironment(process.env) assertJsDriverEnvironment(process.env)
const values=new Map<string,string>() const values=new Map<string,string>()
for(let i=1;i<args.length;i+=2){assert(args[i].startsWith('--')&&flags.includes(args[i].slice(2))&&!values.has(args[i].slice(2))&&args[i+1]);values.set(args[i].slice(2),args[i+1])} for(let i=1;i<args.length;i+=2){assert(args[i].startsWith('--')&&flags.includes(args[i].slice(2))&&!values.has(args[i].slice(2))&&args[i+1]);values.set(args[i].slice(2),args[i+1])}
@@ -25,38 +43,78 @@ export async function main(args:string[]){
assert(bootstrap.format==='application-writer-bootstrap-v1'&&bootstrap.publicationAuthorized===false&&bootstrap.readyAuthorized===false) assert(bootstrap.format==='application-writer-bootstrap-v1'&&bootstrap.publicationAuthorized===false&&bootstrap.readyAuthorized===false)
const request=deploymentRequest(bootstrap.deploymentRequest),subject=bootstrap.verificationSubject const request=deploymentRequest(bootstrap.deploymentRequest),subject=bootstrap.verificationSubject
assert(subject.installationId===request.installationId&&hex(subject.publicKeySpkiSha256)&&sha(createPublicKey(subject.publicKeyPem).export({format:'der',type:'spki'}))===subject.publicKeySpkiSha256) assert(subject.installationId===request.installationId&&hex(subject.publicKeySpkiSha256)&&sha(createPublicKey(subject.publicKeyPem).export({format:'der',type:'spki'}))===subject.publicKeySpkiSha256)
const pinned=(args[0]==='reconcile'?reconciliationApproval:approval)(parse(await readProtected(get('approval'),16384,get('approval-sha256')))) const pinned=legacyInspection||catalogueInspection?undefined:(args[0]==='reconcile'?reconciliationApproval:upgrade?upgradeApproval:approval)(parse(await readProtected(get('approval'),16384,get('approval-sha256'))))
const definition=parse(await readProtected(get('definition'),4194304,get('definition-sha256'))) const definition=legacyInspection?undefined:parse(await readProtected(get('definition'),4194304,get('definition-sha256')))
const transport=parse(await readProtected(get('transport'),16384,get('transport-sha256'))) const transport=parse(await readProtected(get('transport'),16384,get('transport-sha256')))
const ca=await readProtected(get('ca'),65536,request.tls.caSha256) const ca=await readProtected(get('ca'),65536,request.tls.caSha256)
const options=poolOptions(transport,request,ca) const options=poolOptions(transport,request,ca)
await protectedDirectory(get('journal'));await protectedDirectory(get('source-registry')) if(!legacyInspection&&!catalogueInspection)await protectedDirectory(get('journal'))
await protectedDirectory(get('source-registry'))
const privateKeyFile=path.join(path.dirname(get('bootstrap')),'signing-private.pem') const privateKeyFile=path.join(path.dirname(get('bootstrap')),'signing-private.pem')
if(args[0]==='publish'){const key=await readProtected(privateKeyFile,8192);key.fill(0)} if(writes){const key=await readProtected(privateKeyFile,8192);key.fill(0)}
// All explicit trust files are checked before app helper/PG imports. No .env URL is used. // All explicit trust files are checked before app helper/PG imports. No .env URL is used.
// Existing source helper loads config/dotenv. Complete it BEFORE pg's first // Existing source helper loads config/dotenv. Complete it BEFORE pg's first
// import so a newly loaded NODE_PG_FORCE_NATIVE cannot select another driver. // import so a newly loaded NODE_PG_FORCE_NATIVE cannot select another driver.
const {createProtectedDatabaseSourceBindingVerifier}=await import('./writer-profile/protected-source-registry.mjs') const {createProtectedDatabaseSourceBindingVerifier}=await import('./writer-profile/protected-source-registry.mjs')
assertJsDriverEnvironment(process.env) assertJsDriverEnvironment(process.env)
const [{default:pg},{createConnectedPublisher,requireCurrentCatalogueDefinition},{collectSource44Catalogue,approvedDefinition}]=await Promise.all([ const [{default:pg},{createConnectedPublisher,requireCurrentCatalogueDefinition},{collectSource44Catalogue,collectSource56Catalogue,collectSource57Catalogue,collectSource58Catalogue,approvedDefinition}]=await Promise.all([
import('pg'),import('./writer-profile/publisher.mjs'),import('./writer-profile/catalogue.mjs')]) import('pg'),import('./writer-profile/publisher.mjs'),import('./writer-profile/catalogue.mjs')])
assertJsDriverEnvironment(process.env) assertJsDriverEnvironment(process.env)
const reviewedDefinition=approvedDefinition(definition) const reviewedDefinition=legacyInspection?undefined:approvedDefinition(definition)
assert.equal(reviewedDefinition.definitionSha256,pinned.definitionSha256) const collectCatalogues={44:collectSource44Catalogue,56:collectSource56Catalogue,57:collectSource57Catalogue,58:collectSource58Catalogue}
if(args[0]!=='reconcile')requireCurrentCatalogueDefinition(pinned,reviewedDefinition) const collectCatalogue=collectCatalogues[reviewedDefinition&&'edition' in reviewedDefinition?reviewedDefinition.edition:44]
if(!legacyInspection&&!catalogueInspection){
assert.equal(reviewedDefinition!.definitionSha256,pinned!.definitionSha256)
if(args[0]!=='reconcile')requireCurrentCatalogueDefinition(pinned,reviewedDefinition)
}
const installation=Object.freeze({...subject,roles:Object.fromEntries(roleKeys.map(k=>[k,request.roles[k].signedOid])),roleBindings:request.roles,expectedSource:request.source,tls:Object.freeze({...request.tls})}) const installation=Object.freeze({...subject,roles:Object.fromEntries(roleKeys.map(k=>[k,request.roles[k].signedOid])),roleBindings:request.roles,expectedSource:request.source,tls:Object.freeze({...request.tls})})
const sourcePin={registryDirectory:get('source-registry'),installationId:subject.installationId,publicKeySpkiSha256:get('source-spki-sha256'),currentHeadSha256:request.sourceHeadSha256} const sourcePin={registryDirectory:get('source-registry'),installationId:subject.installationId,publicKeySpkiSha256:get('source-spki-sha256'),currentHeadSha256:request.sourceHeadSha256}
const archiveDirectory=legacyExport?get('archive-directory'):undefined
let handoff
if(legacyHandoff){
const {verifyLegacyProbeHandoffIntent}=await import('../src/services/server-probe-legacy-handoff-inspection.js')
const directory=get('archive-directory'),maximum=64*1024*1024
const [archive,signedApproval,coldArchive,intent,operatorPublicKeyPem]=await Promise.all([
readProtected(path.join(directory,'legacy-probe.dump'),maximum),readProtected(path.join(directory,'legacy-probe-approval.json'),4096),
readProtected(path.join(directory,'legacy-probe-cold.dump'),maximum),
readProtected(path.join(directory,'legacy-probe-handoff-intent.json'),4096,get('handoff-intent-sha256')),
readProtected(path.join(sourcePin.registryDirectory,'operator-public.pem'),4096),
])
handoff=await verifyLegacyProbeHandoffIntent(sourcePin,{archive,signedApproval,coldArchive,intent,operatorPublicKeyPem})
}
// Use the same protected registry evidence for inspection and publication. // Use the same protected registry evidence for inspection and publication.
const verifier=createProtectedDatabaseSourceBindingVerifier(sourcePin) const verifier=createProtectedDatabaseSourceBindingVerifier(sourcePin)
async function connected(sourceVerifier:typeof verifier,deadlineAt:number){ async function connected(sourceVerifier:typeof verifier,deadlineAt:number){
const publisher=createConnectedPublisher(installation,(s:Parameters<typeof collectSource44Catalogue>[0])=>collectSource44Catalogue(s,installation),sourceVerifier,pinned,reviewedDefinition) const publisher=createConnectedPublisher(installation,(s:Parameters<typeof collectCatalogue>[0])=>collectCatalogue(s,installation),sourceVerifier,pinned,reviewedDefinition)
const pool=new pg.Pool(options) const pool=new pg.Pool(options)
// A pool-level async error never becomes raw stdout or a retry signal. // A pool-level async error never becomes raw stdout or a retry signal.
let asyncFailure=false;pool.on('error',()=>{asyncFailure=true}) let asyncFailure=false;pool.on('error',()=>{asyncFailure=true})
let result,primary:unknown,failed=false let result,primary:unknown,failed=false
try{result=preflight?await publisher.preflightCurrentProfile(pool,{deadlineAt}):args[0]==='reconcile'?await publisher.reconcilePendingPublication(pool,{journalDirectory:get('journal'),deadlineAt}):await publisher.publishCurrentProfile(pool,{privateKeyFile,expectedHeadSha256:pinned.expectedHeadSha256,journalDirectory:get('journal'),validityMs:pinned.validityMs,deadlineAt})} try{
const journalDirectory=get('journal')
if(legacyInspection)result=await publisher.inspectLegacyStorage(pool,{deadlineAt,archiveDirectory,custody:legacyCustody,handoff})
else if(catalogueInspection)result=await publisher.inspectCurrentCatalogue(pool,{deadlineAt})
else if(preflight)result=await publisher.preflightCurrentProfile(pool,{deadlineAt})
else if(args[0]==='reconcile')result=await publisher.reconcilePendingPublication(pool,{journalDirectory,deadlineAt})
else{
const publication={privateKeyFile,expectedHeadSha256:pinned.expectedHeadSha256,journalDirectory,validityMs:pinned.validityMs,deadlineAt}
result=upgrade?await publisher.upgradeCurrentProfile(pool,publication):await publisher.publishCurrentProfile(pool,publication)
}
}
catch(error){primary=error;failed=true} catch(error){primary=error;failed=true}
try{await pool.end()}catch(error){primary??=error;failed=true} try{await pool.end()}catch(error){primary??=error;failed=true}
if(legacyInspection&&result?.state==='observed'&&result.source.platformProtectionVerified===true&&!failed&&!asyncFailure){
const {installationId,sourceIdentityId,generation,ordinal,headSha256,bindingSha256}=result.source
if(legacyHandoff){assert(result.resolution);return {event:'database-legacy-handoff-inspection',...result.resolution,sourceActivationMatched:true,conversionAllowed:false}}
return {...(legacyExport?{archive:result.archive}:{}),...(result.lineageSnapshot?{lineageSnapshot:result.lineageSnapshot}:{}),event:'database-legacy-inspection',outcome:'observed',snapshot:result.snapshot,
source:{installationId,sourceIdentityId,generation,ordinal,headSha256,bindingSha256},sourceActivationMatched:true,
platformProtectionVerified:true,generationAuthenticated:false,allWriterDrainAuthenticated:false,
conversionAllowed:false,readyAuthorized:false,automaticReplay:false}
}
if(catalogueInspection&&result?.state==='observed'&&result.platformProtectionVerified===true&&!failed&&!asyncFailure){
const {state:_state,...catalogue}=result
return {event:'application-writer-source-catalogue-inspection',outcome:'observed',...catalogue,automaticReplay:false,writerAuthorized:false}
}
if(preflight&&result?.state==='matched'&&result.platformProtectionVerified===true&&!failed&&!asyncFailure)return {event:'application-writer-profile-preflight',outcome:'matched',epoch:result.epoch,headSha256:result.headSha256,notAfter:result.notAfter,sourceMatched:true,rolesMatched:true,catalogueMatched:true,platformProtectionVerified:true,writerAuthorized:false,cleanupUnconfirmed:false,automaticReplay:false,generationAuthenticated:false,readyAuthorized:false} if(preflight&&result?.state==='matched'&&result.platformProtectionVerified===true&&!failed&&!asyncFailure)return {event:'application-writer-profile-preflight',outcome:'matched',epoch:result.epoch,headSha256:result.headSha256,notAfter:result.notAfter,sourceMatched:true,rolesMatched:true,catalogueMatched:true,platformProtectionVerified:true,writerAuthorized:false,cleanupUnconfirmed:false,automaticReplay:false,generationAuthenticated:false,readyAuthorized:false}
if(result?.outcome==='committed')return {event:'application-writer-profile-publication',outcome:'committed',epoch:result.epoch,headSha256:result.headSha256,notAfter:result.notAfter, if(result?.outcome==='committed')return {event:'application-writer-profile-publication',outcome:'committed',epoch:result.epoch,headSha256:result.headSha256,notAfter:result.notAfter,
cleanupUnconfirmed:result.cleanupUnconfirmed||asyncFailure||failed,journalUnconfirmed:!!result.journalUnconfirmed,automaticReplay:false,generationAuthenticated:false,readyAuthorized:false} cleanupUnconfirmed:result.cleanupUnconfirmed||asyncFailure||failed,journalUnconfirmed:!!result.journalUnconfirmed,automaticReplay:false,generationAuthenticated:false,readyAuthorized:false}
@@ -64,12 +122,36 @@ export async function main(args:string[]){
throw primary??Error('Publisher terminal unconfirmed') throw primary??Error('Publisher terminal unconfirmed')
} }
const deadlineAt=Date.now()+120000 const deadlineAt=Date.now()+120000
if(!activePreflight)return connected(verifier,deadlineAt) if(!legacyInspection&&!catalogueInspection&&!activePreflight&&!writes)return connected(verifier,deadlineAt)
const {withActiveSourcePreflight}=await import('./writer-profile/source-activation.mjs') const {withActiveSource}=await import('./writer-profile/source-activation.mjs')
const publisherRole=request.roles.publisher.name const publisherRole=request.roles.publisher.name
const expectedSource={...request.source,databaseOid:Number(request.source.databaseOid),sessionUser:publisherRole,currentUser:publisherRole} const expectedSource={...request.source,databaseOid:Number(request.source.databaseOid),sessionUser:publisherRole,currentUser:publisherRole}
const result=await withActiveSourcePreflight({directory:get('activation-directory'),expectedSha256:get('activation-sha256'),sourcePin,expectedSource,tlsSpkiSha256:request.tls.spkiSha256,deadlineAt},verifier, const active=()=>withActiveSource({directory:get('activation-directory'),expectedSha256:get('activation-sha256'),sourcePin,expectedSource,tlsSpkiSha256:request.tls.spkiSha256,deadlineAt},verifier,
guardedVerifier=>connected(guardedVerifier,deadlineAt)) guardedVerifier=>connected(guardedVerifier,deadlineAt))
if(archiveDirectory)return withJournalLease(archiveDirectory,async()=>{
assert.deepEqual(await readdir(archiveDirectory),['publisher-lease.lock'],'Empty protected archive directory required')
const keyBytes=await readProtected(get('source-signing-key'),8192)
let key
try{key=createPrivateKey(keyBytes)}finally{keyBytes.fill(0)}
assert(key.asymmetricKeyType==='ed25519'&&sha(createPublicKey(key).export({type:'spki',format:'der'}))===sourcePin.publicKeySpkiSha256,'Source signer differs from deployment pin')
const {sourceBindingBytes,sourceBindingCanonical}=await import('../src/db/database-source-binding.js')
const {LEGACY_PROBE_ARCHIVE_APPROVAL_DOMAIN,LEGACY_PROBE_CUSTODY_APPROVAL_DOMAIN}=await import('../src/services/server-probe-legacy-archive-approval.js')
const result=await active()
assert(result.event==='database-legacy-inspection'&&Buffer.isBuffer(result.archive)&&Date.now()<deadlineAt)
const {archive,...receipt}=result
const base={...receipt.source,archiveSha256:sha(archive),storageSha256:receipt.snapshot.sha256}
assert(!legacyCustody||receipt.lineageSnapshot)
const body=legacyCustody?{format:'legacy-probe-custody-approval-v1',...base,lineageSha256:receipt.lineageSnapshot.sha256}
:{format:'legacy-probe-archive-approval-v1',...base}
const domain=legacyCustody?LEGACY_PROBE_CUSTODY_APPROVAL_DOMAIN:LEGACY_PROBE_ARCHIVE_APPROVAL_DOMAIN
const signedApproval=sourceBindingBytes({body,signature:sign(null,Buffer.from(domain+sourceBindingCanonical(body)),key).toString('base64url')})
const dumpFile='legacy-probe.dump',approvalFile='legacy-probe-approval.json'
await writeFile(path.join(archiveDirectory,dumpFile),archive,{flag:'wx',mode:0o600})
await writeFile(path.join(archiveDirectory,approvalFile),signedApproval,{flag:'wx',mode:0o600})
return {...receipt,event:legacyCustody?'database-legacy-custody':'database-legacy-export',outcome:'exported',dumpFile,approvalFile,archiveSha256:body.archiveSha256,approvalSha256:sha(signedApproval)}
})
const result=await active()
if(writes||legacyInspection||catalogueInspection)return result
assert.equal(result.event,'application-writer-profile-preflight') assert.equal(result.event,'application-writer-profile-preflight')
return {...result,event:'application-writer-profile-source-preflight',sourceActivationMatched:true} return {...result,event:'application-writer-profile-source-preflight',sourceActivationMatched:true}
} }
@@ -77,8 +159,28 @@ if(process.argv[1]&&import.meta.url===pathToFileURL(path.resolve(process.argv[1]
try{const result=await main(process.argv.slice(2));console.log(JSON.stringify(result));if(result.cleanupUnconfirmed||result.journalUnconfirmed)process.exitCode=2} try{const result=await main(process.argv.slice(2));console.log(JSON.stringify(result));if(result.cleanupUnconfirmed||result.journalUnconfirmed)process.exitCode=2}
catch(error){ catch(error){
const sourceCommand=sourceCommands.includes(process.argv[2]) const sourceCommand=sourceCommands.includes(process.argv[2])
const unknown=sourceCommand&&(error as NodeJS.ErrnoException|null)?.code==='SOURCE_ACTIVATION_TERMINAL_UNKNOWN' const command=process.argv[2], code=(error as NodeJS.ErrnoException|null)?.code
const unknown=sourceCommand&&code==='SOURCE_ACTIVATION_TERMINAL_UNKNOWN'||['registry-enroll','restore-profile-enroll'].includes(command)&&code==='WRITER_REGISTRY_TERMINAL_UNKNOWN'||
command==='marker-fence-enroll'&&code==='MARKER_FENCE_TERMINAL_UNKNOWN'||command==='legacy-handoff-execute'&&code==='LEGACY_HANDOFF_EXECUTION_UNKNOWN'||
command==='legacy-handoff-adopt'&&code==='LEGACY_HANDOFF_ADOPTION_UNKNOWN'||command==='legacy-handoff-release'&&code==='LEGACY_HANDOFF_RELEASE_UNKNOWN'||
command==='source58-foundation-enroll'&&code==='SOURCE58_FOUNDATION_UNKNOWN'||command==='source57-admission-enroll'&&code==='SOURCE57_ADMISSION_UNKNOWN'
console.error(JSON.stringify({event:sourceCommand?(unknown?'database-source-activation-unknown':'database-source-activation-refused'): console.error(JSON.stringify({event:sourceCommand?(unknown?'database-source-activation-unknown':'database-source-activation-refused'):
['maintenance-inspect','maintenance-resolve'].includes(process.argv[2])?'database-maintenance-command-refused':process.argv[2]==='source-preflight'?'application-writer-profile-source-preflight-refused':'application-writer-profile-publication-refused',automaticReplay:false,inspectPendingBeforeRetry:true,readyAuthorized:false}));process.exitCode=unknown?2:1 command==='registry-inspect'?'application-writer-registry-inspection-refused':
command==='registry-enroll'?(unknown?'application-writer-registry-enrollment-unknown':'application-writer-registry-enrollment-refused'):
command==='restore-profile-enroll'?(unknown?'application-writer-restore-profile-enrollment-unknown':'application-writer-restore-profile-enrollment-refused'):
command==='source-catalogue-inspect'?'application-writer-source-catalogue-inspection-refused':
command==='marker-fence-enroll'?(unknown?'application-writer-marker-fence-enrollment-unknown':'application-writer-marker-fence-enrollment-refused'):
command==='legacy-export'?'database-legacy-export-refused':
command==='legacy-custody'?'database-legacy-custody-refused':
command==='legacy-handoff-inspect'?'database-legacy-handoff-inspection-refused':
command==='legacy-cold-verify'?'database-legacy-cold-proof-refused':
command==='legacy-handoff-execute'?(unknown?'database-legacy-handoff-execution-unknown':'database-legacy-handoff-execution-refused'):
command==='legacy-handoff-adopt'?(unknown?'database-legacy-handoff-adoption-unknown':'database-legacy-handoff-adoption-refused'):
command==='legacy-handoff-release'?(unknown?'database-legacy-handoff-release-unknown':'database-legacy-handoff-release-refused'):
command==='legacy-control-reference'?'database-legacy-control-reference-refused':
command==='legacy-source58-preflight'?'database-legacy-source58-preflight-refused':
command==='source58-foundation-enroll'?(unknown?'database-source58-foundation-unknown':'database-source58-foundation-refused'):
command==='source57-admission-enroll'?(unknown?'database-source57-admission-unknown':'database-source57-admission-refused'):
['maintenance-inspect','maintenance-resolve'].includes(process.argv[2])?'database-maintenance-command-refused':process.argv[2]==='legacy-inspect'?'database-legacy-inspection-refused':process.argv[2]==='source-preflight'?'application-writer-profile-source-preflight-refused':'application-writer-profile-publication-refused',automaticReplay:false,inspectPendingBeforeRetry:true,readyAuthorized:false}));process.exitCode=unknown?2:1
} }
} }
@@ -1,9 +1,10 @@
/* eslint-disable @typescript-eslint/no-explicit-any -- loosely typed fixtures in an operator test */
import test from 'node:test' import test from 'node:test'
import assert from 'node:assert/strict' import assert from 'node:assert/strict'
import {generateKeyPairSync,createHash,X509Certificate,sign} from 'node:crypto' import {generateKeyPairSync,createHash,X509Certificate,sign} from 'node:crypto'
import {rootCertificates} from 'node:tls' import {rootCertificates} from 'node:tls'
import {createRequire} from 'node:module' import {createRequire} from 'node:module'
import {approval,reconciliationApproval,poolOptions,STARTUP_OPTIONS,assertJsDriverEnvironment} from './writer-profile/operator-contract.mjs' import {approval,upgradeApproval,reconciliationApproval,poolOptions,STARTUP_OPTIONS,assertJsDriverEnvironment,REBIND58_APPROVAL_FORMAT} from './writer-profile/operator-contract.mjs'
import {bytes,canonical,POLICY_DOMAIN,signedEnvelope} from '../src/db/application-writer-profile-format.ts' import {bytes,canonical,POLICY_DOMAIN,signedEnvelope} from '../src/db/application-writer-profile-format.ts'
const hash=(v:Buffer|string)=>createHash('sha256').update(v).digest('hex') const hash=(v:Buffer|string)=>createHash('sha256').update(v).digest('hex')
const pinned=()=>({format:'application-writer-publication-approval-v1',manifestSha256:'a'.repeat(64),definitionSha256:'b'.repeat(64),catalogSha256:'c'.repeat(64),expectedHeadSha256:null,validityMs:86400000,expiresAt:Date.now()+60000}) const pinned=()=>({format:'application-writer-publication-approval-v1',manifestSha256:'a'.repeat(64),definitionSha256:'b'.repeat(64),catalogSha256:'c'.repeat(64),expectedHeadSha256:null,validityMs:86400000,expiresAt:Date.now()+60000})
@@ -52,3 +53,11 @@ test('reconciliation keeps exact digest/head/schema and original lifetime bounds
test('publication expiry guard remains mandatory at the real clock boundary',()=>{ test('publication expiry guard remains mandatory at the real clock boundary',()=>{
const value=pinned();value.expiresAt=Date.now();assert.throws(()=>approval(value));assert.deepEqual(reconciliationApproval(value),value) const value=pinned();value.expiresAt=Date.now();assert.throws(()=>approval(value));assert.deepEqual(reconciliationApproval(value),value)
}) })
test('restore rebind requires a protected exact old head and changed approved catalogue',()=>{
const value={...pinned(),format:REBIND58_APPROVAL_FORMAT,previousCatalogSha256:'d'.repeat(64),expectedHeadSha256:'e'.repeat(64)}
assert.deepEqual(upgradeApproval(value),value)
assert.throws(()=>approval(value))
assert.throws(()=>upgradeApproval({...value,previousCatalogSha256:value.catalogSha256}))
assert.throws(()=>upgradeApproval({...value,expectedHeadSha256:null}))
assert.throws(()=>upgradeApproval({...value,expiresAt:1}))
})
@@ -6,7 +6,6 @@ import fs from 'node:fs/promises'
import {createRequire} from 'node:module' import {createRequire} from 'node:module'
import {runInNewContext} from 'node:vm' import {runInNewContext} from 'node:vm'
import {EventEmitter} from 'node:events' import {EventEmitter} from 'node:events'
import {generateKeyPairSync} from 'node:crypto'
import path from 'node:path' import path from 'node:path'
import * as format from '../src/db/application-writer-profile-format.ts' import * as format from '../src/db/application-writer-profile-format.ts'
import {MIGRATION_MANIFEST,migrationManifestDigest} from '../src/db/migration-manifest.ts' import {MIGRATION_MANIFEST,migrationManifestDigest} from '../src/db/migration-manifest.ts'
@@ -14,14 +13,20 @@ import {readCurrentApplicationWriterProfile} from '../src/db/application-writer-
import {syntheticFixture,stagedModelClient} from '../src/db/application-writer-profile-registry-read-model.test.ts' import {syntheticFixture,stagedModelClient} from '../src/db/application-writer-profile-registry-read-model.test.ts'
import {approvedDefinition} from './writer-profile/catalogue.mts' import {approvedDefinition} from './writer-profile/catalogue.mts'
import {BUILD44_PROVENANCE,FIXED44_ROLE_TEMPLATE} from './writer-profile/fixed44-build-definition.ts' import {BUILD44_PROVENANCE,FIXED44_ROLE_TEMPLATE} from './writer-profile/fixed44-build-definition.ts'
import {BUILD56_PROVENANCE} from './writer-profile/fixed56-build-definition.ts'
import {BUILD57_PROVENANCE,FIXED57_ROLE_TEMPLATE} from './writer-profile/fixed57-build-definition.ts'
import {approval as parseApproval,upgradeApproval,reconciliationApproval,isUpgradeApprovalFormat,UPGRADE_APPROVAL_FORMAT,UPGRADE57_APPROVAL_FORMAT} from './writer-profile/operator-contract.mjs'
const require=createRequire(new URL('../package.json',import.meta.url)),ts=require('typescript'),pg=require('pg') const require=createRequire(new URL('../package.json',import.meta.url)),ts=require('typescript'),pg=require('pg')
const candidate=await fs.readFile(new URL('./writer-profile/publisher.mjs',import.meta.url),'utf8') const candidate=await fs.readFile(new URL('./writer-profile/publisher.mjs',import.meta.url),'utf8')
interface PreflightDiagnostics {state:string;headSha256:string;sourceMatched:boolean;rolesMatched:boolean;catalogueMatched:boolean;platformProtectionVerified:boolean;writerAuthorized:boolean;generationAuthenticated:boolean;readyAuthorized:boolean} interface PreflightDiagnostics {state:string;headSha256:string;sourceMatched:boolean;rolesMatched:boolean;catalogueMatched:boolean;platformProtectionVerified:boolean;writerAuthorized:boolean;generationAuthenticated:boolean;readyAuthorized:boolean}
type PublishOptions={privateKeyFile:string;expectedHeadSha256:string|null;journalDirectory:string;deadlineAt:number;validityMs?:number}
interface PublisherModule { interface PublisherModule {
requireCurrentCatalogueDefinition(approval:unknown,definition:unknown):string requireCurrentCatalogueDefinition(approval:unknown,definition:unknown):string
createConnectedPublisher(installation:unknown,collect:()=>Promise<unknown>,sourceVerifier:{verify:()=>Promise<{platformProtectionVerified:boolean}>},approval:unknown,definition:unknown):{ createConnectedPublisher(installation:unknown,collect:()=>Promise<unknown>,sourceVerifier:{verify:()=>Promise<{platformProtectionVerified:boolean}>},approval:unknown,definition:unknown):{
inspectLegacyStorage(pool:unknown,options:{deadlineAt:number}):Promise<{state:string;snapshot:{rowCount:number}}>
preflightCurrentProfile(pool:unknown,options:{deadlineAt:number}):Promise<PreflightDiagnostics> preflightCurrentProfile(pool:unknown,options:{deadlineAt:number}):Promise<PreflightDiagnostics>
publishCurrentProfile(pool:unknown,options:{privateKeyFile:string;expectedHeadSha256:null;journalDirectory:string;deadlineAt:number}):Promise<{outcome:string}> publishCurrentProfile(pool:unknown,options:PublishOptions):Promise<{outcome:string}>
upgradeCurrentProfile(pool:unknown,options:PublishOptions):Promise<{outcome:string;epoch:string;headSha256:string}>
} }
} }
interface OperatorModule {main(args:string[]):Promise<{event:string;outcome:string;platformProtectionVerified:boolean;writerAuthorized:boolean;readyAuthorized:boolean;sourceActivationMatched?:boolean}>} interface OperatorModule {main(args:string[]):Promise<{event:string;outcome:string;platformProtectionVerified:boolean;writerAuthorized:boolean;readyAuthorized:boolean;sourceActivationMatched?:boolean}>}
@@ -34,11 +39,16 @@ function compile<T>(source:string,modules:Record<string,unknown>):T{
const frozenDefinition=approvedDefinition({format:'application-writer-source44-definition-approval-v1',provenance:BUILD44_PROVENANCE,template:FIXED44_ROLE_TEMPLATE}) const frozenDefinition=approvedDefinition({format:'application-writer-source44-definition-approval-v1',provenance:BUILD44_PROVENANCE,template:FIXED44_ROLE_TEMPLATE})
const frozenMigrations=MIGRATION_MANIFEST.slice(0,44),markerIds=frozenMigrations.map(pin=>pin.file.slice(0,-4)) const frozenMigrations=MIGRATION_MANIFEST.slice(0,44),markerIds=frozenMigrations.map(pin=>pin.file.slice(0,-4))
const markerSql='SELECT id FROM public.schema_migrations ORDER BY id COLLATE "C" LIMIT $1' const markerSql='SELECT id FROM public.schema_migrations ORDER BY id COLLATE "C" LIMIT $1'
function fixture(fault='',forPublication=false){ function fixture(fault='',forPublication=false,upgradeMode?:'upgrade'|'upgrade57'|'ordinary-renewal'){
const f=syntheticFixture('1'),catalogue={...frozenDefinition,catalogSha256:'f'.repeat(64),leafCount:117},security={sha256:'e'.repeat(64),roles:{...f.policy.roles}} const f=syntheticFixture('1'),security={sha256:'e'.repeat(64),roles:{...f.policy.roles}}
const predecessor=upgradeMode==='upgrade57'?BUILD56_PROVENANCE:BUILD44_PROVENANCE
const successor=upgradeMode==='upgrade57'?BUILD57_PROVENANCE:BUILD56_PROVENANCE
const target=upgradeMode?{definitionSha256:successor.templateSha256,manifestSha256:successor.manifestSha256}:frozenDefinition
const targetMigrations=MIGRATION_MANIFEST.slice(0,upgradeMode==='upgrade57'?57:56)
const catalogue={...target,catalogSha256:'f'.repeat(64),leafCount:117}
const currentBuild=fault==='current-build'||fault==='current-approved-frozen-definition' const currentBuild=fault==='current-build'||fault==='current-approved-frozen-definition'
f.policy.manifestSha256=frozenDefinition.manifestSha256;f.policy.definitionSha256=frozenDefinition.definitionSha256 f.policy.manifestSha256=predecessor.manifestSha256;f.policy.definitionSha256=predecessor.templateSha256
f.policy.catalogSha256=format.sha(format.canonical({base:catalogue.catalogSha256,security:security.sha256})) f.policy.catalogSha256=upgradeMode?'d'.repeat(64):format.sha(format.canonical({base:catalogue.catalogSha256,security:security.sha256}))
if(fault==='signed-source')f.policy.source.databaseOid='999' if(fault==='signed-source')f.policy.source.databaseOid='999'
if(fault==='signed-role')f.policy.roles.operator='99' if(fault==='signed-role')f.policy.roles.operator='99'
if(fault==='signed-catalogue')f.policy.catalogSha256='1'.repeat(64) if(fault==='signed-catalogue')f.policy.catalogSha256='1'.repeat(64)
@@ -48,52 +58,66 @@ function fixture(fault='',forPublication=false){
const raw=f.signBody(f.policy,format.POLICY_DOMAIN),hash=format.sha(raw),top=f.state.latest[0] const raw=f.signBody(f.policy,format.POLICY_DOMAIN),hash=format.sha(raw),top=f.state.latest[0]
top.policy_sha256=hash;top.head_bytes=f.signBody({format:'application-writer-head-v1',installationId:f.subject.installationId,epoch:'1',policySha256:hash,previousHeadSha256:null},format.HEAD_DOMAIN);top.head_sha256=format.sha(top.head_bytes) top.policy_sha256=hash;top.head_bytes=f.signBody({format:'application-writer-head-v1',installationId:f.subject.installationId,epoch:'1',policySha256:hash,previousHeadSha256:null},format.HEAD_DOMAIN);top.head_sha256=format.sha(top.head_bytes)
f.state.current[0].head_sha256=top.head_sha256;f.state.policy=[{policy_sha256:hash,policy_bytes:raw}] f.state.current[0].head_sha256=top.head_sha256;f.state.policy=[{policy_sha256:hash,policy_bytes:raw}]
const priorHead=top.head_sha256
if(fault==='tamper')f.state.policy[0].policy_bytes=Buffer.from(raw.toString().replace('synthetic','tampered')) if(fault==='tamper')f.state.policy[0].policy_bytes=Buffer.from(raw.toString().replace('synthetic','tampered'))
if(fault==='empty'){f.state.current=[];f.state.latest=[];f.state.policy=[]} if(fault==='empty'){f.state.current=[];f.state.latest=[];f.state.policy=[]}
const model=stagedModelClient(f.state),queries:string[]=[],events:string[]=[],markerLimits:unknown[][]=[] const model=stagedModelClient(f.state),queries:string[]=[],events:string[]=[],markerLimits:unknown[][]=[]
const writes:{sql:string;values?:unknown[]}[]=[]
let clocks=0,checkouts=0 let clocks=0,checkouts=0
const client=Object.assign(new EventEmitter(),{query:async(sql:string,values?:unknown[])=>{ const client=Object.assign(new EventEmitter(),{query:async(sql:string,values?:unknown[])=>{
queries.push(sql) queries.push(sql)
if(/^(INSERT|UPDATE) INTO |^UPDATE mmapp_control\./.test(sql))writes.push({sql,values})
if(sql.includes('clock_timestamp()')&&++clocks===2&&fault==='late-clock')return {rows:[{now:'1'}]} if(sql.includes('clock_timestamp()')&&++clocks===2&&fault==='late-clock')return {rows:[{now:'1'}]}
if(sql===markerSql){ if(sql===markerSql){
markerLimits.push(values??[]) markerLimits.push(values??[])
const ids=fault==='marker-missing'?markerIds.slice(0,-1):fault==='marker-extra'||fault==='marker-drift'&&markerLimits.length===2?[...markerIds,'9999_foreign']:markerIds const expected=upgradeMode?targetMigrations.map(pin=>pin.file.slice(0,-4)):markerIds
const ids=fault==='marker-missing'?expected.slice(0,-1):fault==='marker-extra'||fault==='marker-drift'&&markerLimits.length===2?[...expected,'9999_foreign']:expected
return {rows:ids.map(id=>({id}))} return {rows:ids.map(id=>({id}))}
} }
if(sql.startsWith('WITH')||sql.includes('clock_timestamp()'))return model.client.query(sql,values) if(sql.startsWith('WITH')||sql.includes('clock_timestamp()'))return model.client.query(sql,values)
if(sql.startsWith('SELECT pg_catalog.pg_advisory_unlock'))return {rows:[{released:true}]} if(sql.startsWith('SELECT pg_catalog.pg_advisory_unlock'))return {rows:[{released:true}]}
if(sql==='ROLLBACK')return {rows:[],command:fault==='rollback-ack'?'':'ROLLBACK'} if(sql==='ROLLBACK')return {rows:[],command:fault==='rollback-ack'?'':'ROLLBACK'}
if(sql.startsWith('INSERT INTO mmapp_control.current'))return {rows:[{id:1}]} if(sql.startsWith('INSERT INTO mmapp_control.current')||sql.startsWith('UPDATE mmapp_control.current'))return {rows:[{id:1}]}
return {rows:[],command:sql.split(' ')[0]} return {rows:[],command:sql.split(' ')[0]}
},release:(bad:boolean)=>{events.push('release:'+bad)}}) },release:(bad:boolean)=>{events.push('release:'+bad)}})
const pool=new pg.Pool();pool.connect=async()=>{checkouts++;return client} const pool=new pg.Pool();pool.connect=async()=>{checkouts++;return client}
const source={systemIdentifier:'123',databaseOid:'456',databaseName:'synthetic',serverVersionNum:180004,inRecovery:false} const source={systemIdentifier:'123',databaseOid:'456',databaseName:'synthetic',serverVersionNum:180004,inRecovery:false}
let contexts=0,verifications=0 let contexts=0,verifications=0
const fixtureKey=forPublication?generateKeyPairSync('ed25519'):null const installation={...f.subject,expectedSource:source,roleBindings:{publisher:{name:'publisher',signedOid:'14'}}}
const subject=fixtureKey?{...f.subject,publicKeyPem:fixtureKey.publicKey.export({format:'pem',type:'spki'}).toString(),publicKeySpkiSha256:format.sha(fixtureKey.publicKey.export({format:'der',type:'spki'}))}:f.subject const pinned={expiresAt:Date.now()+60000,manifestSha256:['approval-manifest','current-approved-frozen-definition'].includes(fault)?migrationManifestDigest():target.manifestSha256,definitionSha256:catalogue.definitionSha256,catalogSha256:format.sha(format.canonical({base:catalogue.catalogSha256,security:security.sha256})),...(upgradeMode==='upgrade'||upgradeMode==='upgrade57'?{
const installation={...subject,expectedSource:source,roleBindings:{publisher:{name:'publisher',signedOid:'14'}}} format:upgradeMode==='upgrade57'&&fault!=='wrong-transition'?UPGRADE57_APPROVAL_FORMAT:UPGRADE_APPROVAL_FORMAT,expectedHeadSha256:fault==='wrong-head'?'0'.repeat(64):priorHead,previousCatalogSha256:fault==='wrong-previous-catalogue'?'0'.repeat(64):'d'.repeat(64),validityMs:60000,
const approval={expiresAt:Date.now()+60000,manifestSha256:['approval-manifest','current-approved-frozen-definition'].includes(fault)?migrationManifestDigest():frozenDefinition.manifestSha256,definitionSha256:catalogue.definitionSha256,catalogSha256:format.sha(format.canonical({base:catalogue.catalogSha256,security:security.sha256}))} }:{})}
const definition=fault==='static-definition'?{...frozenDefinition,definitionSha256:'0'.repeat(64)}:frozenDefinition const definition=fault==='static-definition'?{...target,definitionSha256:'0'.repeat(64)}:target
const privateKeyFile=path.resolve('modeled-fixture-key.pem'),journalDirectory=path.resolve('modeled-journal'),files=new Map<string,Buffer>() const privateKeyFile=path.resolve('modeled-fixture-key.pem'),journalDirectory=path.resolve('modeled-journal'),files=new Map<string,Buffer>()
if(fixtureKey)files.set(privateKeyFile,Buffer.from(fixtureKey.privateKey.export({format:'pem',type:'pkcs8'}))) if(forPublication)files.set(privateKeyFile,Buffer.from(f.privateKey.export({format:'pem',type:'pkcs8'})))
function file(filename:string){const value=files.get(filename);if(!value)throw Object.assign(Error('Fixture file absent'),{code:'ENOENT'});return value} function file(filename:string){const value=files.get(filename);if(!value)throw Object.assign(Error('Fixture file absent'),{code:'ENOENT'});return value}
function stat(filename:string){return {size:file(filename).length,dev:1,ino:1,isFile:()=>true,isSymbolicLink:()=>false}} function stat(filename:string){return {size:file(filename).length,dev:1,ino:1,isFile:()=>true,isSymbolicLink:()=>false}}
const modules={ const modules={
pg,'node:crypto':require('node:crypto'),'node:fs/promises':{realpath:async(file:string)=>file,lstat:async(filename:string)=>stat(filename),unlink:async(filename:string)=>files.delete(filename),open:async(filename:string)=>({stat:async()=>stat(filename),readFile:async()=>Buffer.from(file(filename)),close:async()=>{}})},'node:path':path, pg,'node:crypto':require('node:crypto'),'node:fs/promises':{realpath:async(file:string)=>file,lstat:async(filename:string)=>stat(filename),unlink:async(filename:string)=>files.delete(filename),open:async(filename:string)=>({stat:async()=>stat(filename),readFile:async()=>Buffer.from(file(filename)),close:async()=>{}})},'node:path':path,
'./operator-contract.mjs':{retainPublisherTlsPeer:(actual:unknown)=>{ './fixed44-build-definition.js':{BUILD44_PROVENANCE},'./fixed56-build-definition.js':{BUILD56_PROVENANCE},'./fixed57-build-definition.js':{BUILD57_PROVENANCE},
'./operator-contract.mjs':{UPGRADE_APPROVAL_FORMAT,UPGRADE57_APPROVAL_FORMAT,isUpgradeApprovalFormat,upgradeApproval,retainPublisherTlsPeer:(actual:unknown)=>{
assert.equal(actual,client) assert.equal(actual,client)
if(fault==='initial-tls')throw Error('TLS peer refused') if(fault==='initial-tls')throw Error('TLS peer refused')
return ()=>{if(fault==='lost-tls'&&verifications===2)throw Error('Retained TLS lost')} return ()=>{if(fault==='lost-tls'&&verifications===2)throw Error('Retained TLS lost')}
}}, }},
'./operator-files.mjs':{withJournalLease:async(_directory:string,work:()=>Promise<unknown>)=>{assert(forPublication);events.push('journal-lease');return work()},writeFile:async(filename:string,value:Buffer)=>{assert(forPublication);files.set(filename,value)}}, './operator-files.mjs':{withJournalLease:async(_directory:string,work:()=>Promise<unknown>)=>{assert(forPublication);events.push('journal-lease');return work()},writeFile:async(filename:string,value:Buffer)=>{assert(forPublication);files.set(filename,value)}},
'../../src/db/database-source-observation.js':{captureDatabaseSourceObservation:async()=>{events.push('capture-source');return {}},assertDatabaseSourceObservationCurrent:async()=>{events.push('fresh-source');if(fault==='late-source')throw Error('Source changed')}}, '../../src/db/database-source-observation.js':{captureDatabaseSourceObservation:async()=>{events.push('capture-source');return {}},assertDatabaseSourceObservationCurrent:async()=>{events.push('fresh-source');if(fault==='late-source')throw Error('Source changed')}},
'../../src/db/migration-manifest.js':{MIGRATION_MANIFEST:currentBuild?MIGRATION_MANIFEST:frozenMigrations,migrationManifestDigest:()=>currentBuild?migrationManifestDigest():frozenDefinition.manifestSha256}, '../../src/services/server-probe-legacy-source-inventory.js':{captureLegacyProbeStorage:async()=>{events.push('capture-legacy');return {rowCount:1}}},
'../../src/db/migration-manifest.js':{MIGRATION_MANIFEST:currentBuild?MIGRATION_MANIFEST:upgradeMode?targetMigrations:frozenMigrations,migrationManifestDigest:()=>currentBuild?migrationManifestDigest():target.manifestSha256},
'../../src/db/application-writer-profile-format.js':format, '../../src/db/application-writer-profile-format.js':format,
'./context.mjs':{ownedContext:async()=>{contexts++;if(fault==='late-actor'&&contexts===2)throw Error('Actor changed');return {pid:1,source}},sameOwned:(a:unknown,b:unknown)=>assert.deepEqual(a,b),sourceCoordinates:(v:{source:typeof source})=>v.source,protectedStructure:async()=>{events.push('roles');if(fault==='role-structure')throw Error('Unsafe role');return security},readCurrent:forPublication?async()=>null:readCurrentApplicationWriterProfile,HISTORY:'history',CURRENT:'current'}, './context.mjs':{ownedContext:async()=>{contexts++;if(fault==='late-actor'&&contexts===2)throw Error('Actor changed');return {pid:1,source}},sameOwned:(a:unknown,b:unknown)=>assert.deepEqual(a,b),sourceCoordinates:(v:{source:typeof source})=>v.source,protectedStructure:async()=>{events.push('roles');if(fault==='role-structure')throw Error('Unsafe role');return security},readCurrent:forPublication&&!upgradeMode?async()=>null:readCurrentApplicationWriterProfile,HISTORY:'history',CURRENT:'current'},
} }
const api=compile<PublisherModule>(candidate,modules).createConnectedPublisher(installation,async()=>{events.push('catalogue');if(fault==='catalogue-eof')throw Error('Incomplete EOF');return fault==='catalogue-manifest'?{...catalogue,manifestSha256:migrationManifestDigest()}:fault==='catalogue-definition'?{...catalogue,definitionSha256:'0'.repeat(64)}:catalogue},{verify:async()=>{verifications++;events.push('verify-source');if(fault==='source-verifier')throw Error('Unsigned source');if(fault==='late-expiry'&&verifications===2)approval.expiresAt=1;return {platformProtectionVerified:!(fault==='initial-unprotected'&&verifications===1||fault==='terminal-unprotected'&&verifications===2)}}},approval,definition) const api=compile<PublisherModule>(candidate,modules).createConnectedPublisher(installation,async()=>{events.push('catalogue');if(fault==='catalogue-eof')throw Error('Incomplete EOF');return fault==='catalogue-manifest'?{...catalogue,manifestSha256:migrationManifestDigest()}:fault==='catalogue-definition'?{...catalogue,definitionSha256:'0'.repeat(64)}:catalogue},{verify:async()=>{verifications++;events.push('verify-source');if(fault==='source-verifier')throw Error('Unsigned source');if(fault==='late-expiry'&&verifications===2)pinned.expiresAt=1;return {platformProtectionVerified:!(fault==='initial-unprotected'&&verifications===1||fault==='terminal-unprotected'&&verifications===2)}}},pinned,definition)
return {run:()=>api.preflightCurrentProfile(pool,{deadlineAt:Date.now()+30000}),publish:()=>api.publishCurrentProfile(pool,{privateKeyFile,journalDirectory,expectedHeadSha256:null,deadlineAt:Date.now()+30000}),queries,events,markerLimits,files,get checkouts(){return checkouts},f} const publication=()=>({privateKeyFile,journalDirectory,expectedHeadSha256:upgradeMode?pinned.expectedHeadSha256??priorHead:null,deadlineAt:Date.now()+30000,validityMs:60000})
return {run:()=>api.preflightCurrentProfile(pool,{deadlineAt:Date.now()+30000}),inspectLegacy:()=>api.inspectLegacyStorage(pool,{deadlineAt:Date.now()+30000}),publish:()=>api.publishCurrentProfile(pool,publication()),upgrade:()=>api.upgradeCurrentProfile(pool,publication()),queries,events,markerLimits,files,writes,priorHead,pinned,get checkouts(){return checkouts},f}
} }
test('legacy inspection requires retained TLS, terminal source proof and acknowledged rollback',async()=>{
const valid=fixture(),result=await valid.inspectLegacy()
assert.equal(result.state,'observed');assert.equal(result.snapshot.rowCount,1);assert.equal(valid.checkouts,1)
assert.deepEqual(valid.events,['capture-source','verify-source','capture-legacy','verify-source','fresh-source','release:false'])
assert.equal(valid.queries.filter(q=>q==='ROLLBACK').length,1);assert(!valid.queries.includes('COMMIT'))
for(const fault of ['initial-tls','lost-tls','late-source','rollback-ack'])await assert.rejects(fixture(fault).inspectLegacy())
})
test('current44 preflight authenticates signed current and actual component inputs on one read-only lease',async()=>{ test('current44 preflight authenticates signed current and actual component inputs on one read-only lease',async()=>{
const f=fixture(),result=await f.run();assert.equal(result.state,'matched');assert.equal(result.headSha256,f.f.state.current[0].head_sha256) const f=fixture(),result=await f.run();assert.equal(result.state,'matched');assert.equal(result.headSha256,f.f.state.current[0].head_sha256)
assert.equal(result.sourceMatched,true);assert.equal(result.rolesMatched,true);assert.equal(result.catalogueMatched,true) assert.equal(result.sourceMatched,true);assert.equal(result.rolesMatched,true);assert.equal(result.catalogueMatched,true)
@@ -145,11 +169,73 @@ test('publication checks exact marker set on both retained transactions and refu
assert(!drift.queries.some(q=>/^(?:INSERT|UPDATE|DELETE)\b/.test(q))) assert(!drift.queries.some(q=>/^(?:INSERT|UPDATE|DELETE)\b/.test(q)))
assert([...drift.files.keys()].some(filename=>filename.endsWith('pending-publication.json'))) assert([...drift.files.keys()].some(filename=>filename.endsWith('pending-publication.json')))
}) })
test('explicit 44 to 56 upgrade pins the signed predecessor, exact catalogue and CAS',async()=>{
const f=fixture('',true,'upgrade')
const approved=upgradeApproval(f.pinned)
assert.equal(approved.expectedHeadSha256,f.priorHead)
assert.throws(()=>parseApproval(approved))
for(const changed of [{expectedHeadSha256:null},{previousCatalogSha256:undefined},{expiresAt:1}]) {
assert.throws(()=>upgradeApproval({...approved,...changed}))
}
assert.equal(reconciliationApproval({...approved,expiresAt:1}).expectedHeadSha256,f.priorHead)
const result=await f.upgrade()
assert.equal(result.outcome,'committed');assert.equal(result.epoch,'2')
assert.equal(format.canonical(f.markerLimits),'[[57],[57]]')
assert.equal(f.writes.length,2)
const [history,current]=f.writes
assert.match(history.sql,/INSERT INTO mmapp_control.history/)
assert.equal(format.canonical(history.values?.slice(0,6)),format.canonical([f.f.subject.installationId,'2',result.headSha256,f.f.subject.installationId,'1',f.priorHead]))
const policy=format.signedEnvelope(history.values![7] as Buffer,'policy',f.f.subject).body
const head=format.signedEnvelope(history.values![8] as Buffer,'head',f.f.subject).body
assert.deepEqual(policy.source,f.f.policy.source);assert.deepEqual(policy.roles,f.f.policy.roles)
assert.equal(policy.manifestSha256,BUILD56_PROVENANCE.manifestSha256);assert.equal(policy.definitionSha256,BUILD56_PROVENANCE.templateSha256)
assert.equal(head.previousHeadSha256,f.priorHead)
assert.equal(format.canonical(current.values),format.canonical(['2',result.headSha256,f.f.subject.installationId,'1',f.priorHead]))
})
test('upgrade refuses drift and ordinary renewal cannot perform the 44 to 56 transition',async()=>{
for(const fault of ['wrong-head','wrong-previous-catalogue','signed-manifest','signed-definition','signed-role','signed-source','marker-drift','initial-unprotected','terminal-unprotected']){
const f=fixture(fault,true,'upgrade')
await assert.rejects(f.upgrade())
assert.deepEqual(f.writes,[],fault)
}
const explicit=fixture('',true,'upgrade')
await assert.rejects(explicit.publish(),/explicit upgrade command/)
assert.equal(explicit.checkouts,0)
const renewal=fixture('',true,'ordinary-renewal')
await assert.rejects(renewal.publish(),error=>error instanceof Error&&/Renewal cannot adopt/.test((error.cause as Error).message))
assert.deepEqual(renewal.writes,[])
})
test('explicit 56 to 57 upgrade signs only the exact reviewed successor',async()=>{
const definition=approvedDefinition({format:'application-writer-source57-definition-approval-v1',provenance:BUILD57_PROVENANCE,template:FIXED57_ROLE_TEMPLATE})
assert.equal(definition.manifestSha256,migrationManifestDigest())
assert.throws(()=>approvedDefinition({format:'application-writer-source57-definition-approval-v1',provenance:BUILD57_PROVENANCE,template:FIXED44_ROLE_TEMPLATE}))
const f=fixture('',true,'upgrade57')
await assert.rejects(f.publish(),/explicit upgrade command/)
const result=await f.upgrade()
assert.equal(result.outcome,'committed')
assert.equal(format.canonical(f.markerLimits),'[[58],[58]]')
const history=f.writes[0]
const policy=format.signedEnvelope(history.values![7] as Buffer,'policy',f.f.subject).body
const head=format.signedEnvelope(history.values![8] as Buffer,'head',f.f.subject).body
assert.equal(policy.manifestSha256,definition.manifestSha256)
assert.equal(policy.definitionSha256,definition.definitionSha256)
assert.equal(head.previousHeadSha256,f.priorHead)
for(const fault of ['wrong-transition','wrong-previous-catalogue','signed-manifest','signed-definition']){
const refused=fixture(fault,true,'upgrade57')
await assert.rejects(refused.upgrade())
assert.deepEqual(refused.writes,[],fault)
}
})
test('operator requires the protected source verifier for preflight, publication and reconciliation',async()=>{ test('operator requires the protected source verifier for preflight, publication and reconciliation',async()=>{
const cli=await fs.readFile(new URL('./database-writer-profile-operator.mts',import.meta.url),'utf8'),f=syntheticFixture('1'),reads:string[]=[],events:string[]=[] const cli=await fs.readFile(new URL('./database-writer-profile-operator.mts',import.meta.url),'utf8'),f=syntheticFixture('1'),reads:string[]=[],events:string[]=[]
const request={installationId:f.subject.installationId,roles:Object.fromEntries(['runtime','operator','capture','publisher','control'].map((k,i)=>[k,{name:k,signedOid:String(i+11)}])),source:f.policy.source,sourceHeadSha256:'a'.repeat(64),tls:{caSha256:'a'.repeat(64),spkiSha256:'d'.repeat(64)}} const request={installationId:f.subject.installationId,roles:Object.fromEntries(['runtime','operator','capture','publisher','control'].map((k,i)=>[k,{name:k,signedOid:String(i+11)}])),source:f.policy.source,sourceHeadSha256:'a'.repeat(64),tls:{caSha256:'a'.repeat(64),spkiSha256:'d'.repeat(64)}}
const files:Record<string,unknown>={bootstrap:{format:'application-writer-bootstrap-v1',publicationAuthorized:false,readyAuthorized:false,deploymentRequest:request,verificationSubject:f.subject},approval:{expiresAt:Date.now()+60000,definitionSha256:'b'.repeat(64)},definition:{},transport:{},ca:'fixture','signing-private.pem':'fixture'} const files:Record<string,unknown>={bootstrap:{format:'application-writer-bootstrap-v1',publicationAuthorized:false,readyAuthorized:false,deploymentRequest:request,verificationSubject:f.subject},approval:{expiresAt:Date.now()+60000,definitionSha256:'b'.repeat(64)},definition:{},transport:{},ca:'fixture','signing-private.pem':'fixture'}
let failEnd=false,asyncError=false,protectedRefused=false,activationRefused=false,incompatibleDefinition=false let failEnd=false,asyncError=false,protectedRefused=false,activationRefused=false,incompatibleDefinition=false
let catalogueEdition:44|56|57=44
const catalogueCalls:number[]=[]
const retainedPools:Pool[]=[] const retainedPools:Pool[]=[]
class Pool extends EventEmitter{constructor(){super();retainedPools.push(this)}async end(){events.push('pool-end');if(failEnd)throw Error('Pool cleanup unconfirmed')}} class Pool extends EventEmitter{constructor(){super();retainedPools.push(this)}async end(){events.push('pool-end');if(failEnd)throw Error('Pool cleanup unconfirmed')}}
const result={state:'matched',epoch:'1',headSha256:'c'.repeat(64),notAfter:Date.now()+60000,platformProtectionVerified:true} const result={state:'matched',epoch:'1',headSha256:'c'.repeat(64),notAfter:Date.now()+60000,platformProtectionVerified:true}
@@ -158,25 +244,32 @@ test('operator requires the protected source verifier for preflight, publication
const modules={ const modules={
'node:assert/strict':assert,'node:path':require('node:path'),'node:url':require('node:url'),'node:crypto':require('node:crypto'), 'node:assert/strict':assert,'node:path':require('node:path'),'node:url':require('node:url'),'node:crypto':require('node:crypto'),
'./writer-profile/operator-files.mjs':{readProtected:async(file:string)=>{reads.push(file);assert(file in files);return Buffer.from(JSON.stringify(files[file]))},protectedDirectory:async()=>{},sha:format.sha}, './writer-profile/operator-files.mjs':{readProtected:async(file:string)=>{reads.push(file);assert(file in files);return Buffer.from(JSON.stringify(files[file]))},protectedDirectory:async()=>{},sha:format.sha},
'./writer-profile/operator-contract.mjs':{approval:(value:unknown)=>{events.push('approval');return value},reconciliationApproval:(value:unknown)=>{events.push('reconciliation-approval');return value},poolOptions:()=>{events.push('transport');return {}},roleKeys:['runtime','operator','capture','publisher','control'],assertJsDriverEnvironment:()=>{}}, './writer-profile/operator-contract.mjs':{approval:(value:unknown)=>{events.push('approval');return value},upgradeApproval:(value:unknown)=>{events.push('upgrade-approval');return upgradeApproval(value)},reconciliationApproval:(value:unknown)=>{events.push('reconciliation-approval');return value},poolOptions:()=>{events.push('transport');return {}},roleKeys:['runtime','operator','capture','publisher','control'],assertJsDriverEnvironment:()=>{}},
'./database-writer-bootstrap-operator.mjs':{deploymentRequest:(value:unknown)=>value}, './database-writer-bootstrap-operator.mjs':{deploymentRequest:(value:unknown)=>value},
'./writer-profile/protected-source-registry.mjs':{createProtectedDatabaseSourceBindingVerifier:(pin:{registryDirectory:string;currentHeadSha256:string})=>{events.push('protected-source');assert.equal(pin.registryDirectory,'source-registry');assert.equal(pin.currentHeadSha256,request.sourceHeadSha256);if(protectedRefused)throw Error('Protected source refused');return protectedVerifier}}, './writer-profile/protected-source-registry.mjs':{createProtectedDatabaseSourceBindingVerifier:(pin:{registryDirectory:string;currentHeadSha256:string})=>{events.push('protected-source');assert.equal(pin.registryDirectory,'source-registry');assert.equal(pin.currentHeadSha256,request.sourceHeadSha256);if(protectedRefused)throw Error('Protected source refused');return protectedVerifier}},
'./writer-profile/source-activation.mjs':{withActiveSourcePreflight:async(input:{directory:string;expectedSha256:string;sourcePin:{currentHeadSha256:string};expectedSource:unknown;tlsSpkiSha256:string;deadlineAt:number},verifier:unknown,work:(verifier:unknown)=>Promise<unknown>)=>{ './writer-profile/source-activation.mjs':{withActiveSource:async(input:{directory:string;expectedSha256:string;sourcePin:{currentHeadSha256:string};expectedSource:unknown;tlsSpkiSha256:string;deadlineAt:number},verifier:unknown,work:(verifier:unknown)=>Promise<unknown>)=>{
assert.equal(verifier,protectedVerifier);assert.equal(input.directory,'active-registry');assert.equal(input.expectedSha256,'e'.repeat(64)) assert.equal(verifier,protectedVerifier);assert.equal(input.directory,'active-registry');assert.equal(input.expectedSha256,'e'.repeat(64))
assert.equal(input.sourcePin.currentHeadSha256,request.sourceHeadSha256);assert.equal(input.tlsSpkiSha256,request.tls.spkiSha256);assert(input.deadlineAt>Date.now()) assert.equal(input.sourcePin.currentHeadSha256,request.sourceHeadSha256);assert.equal(input.tlsSpkiSha256,request.tls.spkiSha256);assert(input.deadlineAt>Date.now())
assert.equal(format.canonical(input.expectedSource),format.canonical({...request.source,databaseOid:Number(request.source.databaseOid),sessionUser:'publisher',currentUser:'publisher'})) assert.equal(format.canonical(input.expectedSource),format.canonical({...request.source,databaseOid:Number(request.source.databaseOid),sessionUser:'publisher',currentUser:'publisher'}))
events.push('activation-admission');if(activationRefused)throw Error('Activation refused') events.push('activation-admission');if(activationRefused)throw Error('Activation refused')
const value=await work(guardedVerifier);events.push('activation-terminal');return value const value=await work(guardedVerifier);events.push('activation-terminal');return value
}}, }},
pg:{Pool},'./writer-profile/publisher.mjs':{requireCurrentCatalogueDefinition:()=>{if(incompatibleDefinition)throw Error('Build manifest refused')},createConnectedPublisher:(_installation:unknown,_collect:unknown,verifier:unknown)=>{ pg:{Pool},'./writer-profile/publisher.mjs':{requireCurrentCatalogueDefinition:()=>{if(incompatibleDefinition)throw Error('Build manifest refused')},createConnectedPublisher:(_installation:unknown,collect:(session:unknown)=>Promise<unknown>,verifier:unknown)=>{
assert.equal(verifier,events.includes('activation-admission')?guardedVerifier:protectedVerifier) assert.equal(verifier,events.includes('activation-admission')?guardedVerifier:protectedVerifier)
return { return {
preflightCurrentProfile:async()=>{events.push('preflight');if(asyncError){const activePool=retainedPools.at(-1);assert(activePool);activePool.emit('error',Error('Async pool fault'))}return result}, inspectLegacyStorage:async()=>{events.push('legacy-inspect');return {state:'observed',snapshot:{rowCount:1,sha256:'9'.repeat(64)},source:{platformProtectionVerified:true,generation:'source-generation'}}},
publishCurrentProfile:async()=>{events.push('publish');return {...result,outcome:'committed'}}, preflightCurrentProfile:async()=>{await collect({});events.push('preflight');if(asyncError){const activePool=retainedPools.at(-1);assert(activePool);activePool.emit('error',Error('Async pool fault'))}return result},
publishCurrentProfile:async()=>{await collect({});events.push('publish');return {...result,outcome:'committed'}},
upgradeCurrentProfile:async()=>{await collect({});events.push('upgrade');return {...result,outcome:'committed'}},
reconcilePendingPublication:async()=>{events.push('reconcile');return {state:'confirmed',headSha256:result.headSha256}}, reconcilePendingPublication:async()=>{events.push('reconcile');return {state:'confirmed',headSha256:result.headSha256}},
} }
}}, }},
'./writer-profile/catalogue.mjs':{collectSource44Catalogue:()=>{},approvedDefinition:()=>({definitionSha256:'b'.repeat(64),manifestSha256:frozenDefinition.manifestSha256})}, './writer-profile/catalogue.mjs':{
collectSource44Catalogue:async()=>{catalogueCalls.push(44)},
collectSource56Catalogue:async()=>{catalogueCalls.push(56)},
collectSource57Catalogue:async()=>{catalogueCalls.push(57)},
approvedDefinition:()=>({...(catalogueEdition===44?{}:{edition:catalogueEdition}),definitionSha256:'b'.repeat(64),manifestSha256:frozenDefinition.manifestSha256}),
},
} }
const flags=['bootstrap','bootstrap-sha256','approval','approval-sha256','definition','definition-sha256','transport','transport-sha256','ca','source-registry','source-spki-sha256','journal'],args=['preflight',...flags.flatMap(flag=>['--'+flag,flag.endsWith('sha256')?'a'.repeat(64):flag])] const flags=['bootstrap','bootstrap-sha256','approval','approval-sha256','definition','definition-sha256','transport','transport-sha256','ca','source-registry','source-spki-sha256','journal'],args=['preflight',...flags.flatMap(flag=>['--'+flag,flag.endsWith('sha256')?'a'.repeat(64):flag])]
const output=await compile<OperatorModule>(cli,modules).main(args) const output=await compile<OperatorModule>(cli,modules).main(args)
@@ -187,8 +280,10 @@ test('operator requires the protected source verifier for preflight, publication
asyncError=false;result.platformProtectionVerified=false;await assert.rejects(compile<OperatorModule>(cli,modules).main(args),/Publisher terminal unconfirmed/) asyncError=false;result.platformProtectionVerified=false;await assert.rejects(compile<OperatorModule>(cli,modules).main(args),/Publisher terminal unconfirmed/)
result.platformProtectionVerified=true;protectedRefused=true;const before=retainedPools.length result.platformProtectionVerified=true;protectedRefused=true;const before=retainedPools.length
await assert.rejects(compile<OperatorModule>(cli,modules).main(args),/Protected source refused/);assert.equal(retainedPools.length,before,'Protection failure must not open a Pool or fall back') await assert.rejects(compile<OperatorModule>(cli,modules).main(args),/Protected source refused/);assert.equal(retainedPools.length,before,'Protection failure must not open a Pool or fall back')
const activationFlags=['--activation-directory','active-registry','--activation-sha256','e'.repeat(64)]
const activated=(command:string)=>[command,...args.slice(1),...activationFlags]
for(const [command,approvalEvent,outcome] of [['publish','approval','committed'],['reconcile','reconciliation-approval','confirmed']]){ for(const [command,approvalEvent,outcome] of [['publish','approval','committed'],['reconcile','reconciliation-approval','confirmed']]){
const commandArgs=[command,...args.slice(1)] const commandArgs=command==='publish'?activated(command):[command,...args.slice(1)]
const poolCount=retainedPools.length const poolCount=retainedPools.length
await assert.rejects(compile<OperatorModule>(cli,modules).main(commandArgs),/Protected source refused/) await assert.rejects(compile<OperatorModule>(cli,modules).main(commandArgs),/Protected source refused/)
assert.equal(retainedPools.length,poolCount) assert.equal(retainedPools.length,poolCount)
@@ -196,28 +291,65 @@ test('operator requires the protected source verifier for preflight, publication
events.length=0;reads.length=0 events.length=0;reads.length=0
const terminal=await compile<OperatorModule>(cli,modules).main(commandArgs) const terminal=await compile<OperatorModule>(cli,modules).main(commandArgs)
assert.equal(terminal.outcome,outcome);assert.equal(terminal.readyAuthorized,false) assert.equal(terminal.outcome,outcome);assert.equal(terminal.readyAuthorized,false)
assert.deepEqual(events,[approvalEvent,'transport','protected-source',command,'pool-end']) assert.deepEqual(events,command==='publish'
?[approvalEvent,'transport','protected-source','activation-admission',command,'pool-end','activation-terminal']
:[approvalEvent,'transport','protected-source',command,'pool-end'])
assert.equal(reads.includes('signing-private.pem'),command==='publish') assert.equal(reads.includes('signing-private.pem'),command==='publish')
protectedRefused=true protectedRefused=true
} }
const activeArgs=['source-preflight',...args.slice(1),'--activation-directory','active-registry','--activation-sha256','e'.repeat(64)] const activeArgs=activated('source-preflight')
protectedRefused=false;activationRefused=true;events.length=0;reads.length=0 protectedRefused=false;activationRefused=true;events.length=0;reads.length=0
const beforeActivation=retainedPools.length const beforeActivation=retainedPools.length
await assert.rejects(compile<OperatorModule>(cli,modules).main(activeArgs),/Activation refused/) await assert.rejects(compile<OperatorModule>(cli,modules).main(activeArgs),/Activation refused/)
assert.equal(retainedPools.length,beforeActivation) assert.equal(retainedPools.length,beforeActivation)
assert.deepEqual(events,['approval','transport','protected-source','activation-admission']) assert.deepEqual(events,['approval','transport','protected-source','activation-admission'])
await assert.rejects(compile<OperatorModule>(cli,modules).main(['publish',...args.slice(1)]))
await assert.rejects(compile<OperatorModule>(cli,modules).main(activated('publish')), /Activation refused/)
assert.equal(retainedPools.length,beforeActivation)
activationRefused=false;events.length=0;reads.length=0 activationRefused=false;events.length=0;reads.length=0
const active=await compile<OperatorModule>(cli,modules).main(activeArgs) const active=await compile<OperatorModule>(cli,modules).main(activeArgs)
assert.equal(active.event,'application-writer-profile-source-preflight');assert.equal(active.sourceActivationMatched,true) assert.equal(active.event,'application-writer-profile-source-preflight');assert.equal(active.sourceActivationMatched,true)
assert.equal(active.readyAuthorized,false);assert.equal(active.writerAuthorized,false) assert.equal(active.readyAuthorized,false);assert.equal(active.writerAuthorized,false)
assert.deepEqual(events,['approval','transport','protected-source','activation-admission','preflight','pool-end','activation-terminal']) assert.deepEqual(events,['approval','transport','protected-source','activation-admission','preflight','pool-end','activation-terminal'])
assert.deepEqual(reads,['bootstrap','approval','definition','transport','ca']) assert.deepEqual(reads,['bootstrap','approval','definition','transport','ca'])
const legacyFlags=['bootstrap','bootstrap-sha256','transport','transport-sha256','ca','source-registry','source-spki-sha256']
const legacyArgs=['legacy-inspect',...legacyFlags.flatMap(flag=>['--'+flag,flag.endsWith('sha256')?'a'.repeat(64):flag]),...activationFlags]
events.length=0;reads.length=0
const legacy=await compile<OperatorModule>(cli,modules).main(legacyArgs)
assert.equal(legacy.event,'database-legacy-inspection');assert.equal(legacy.outcome,'observed');assert.equal(legacy.readyAuthorized,false)
assert.deepEqual(events,['transport','protected-source','activation-admission','legacy-inspect','pool-end','activation-terminal'])
assert.deepEqual(reads,['bootstrap','transport','ca'])
await assert.rejects(compile<OperatorModule>(cli,modules).main(legacyArgs.slice(0,-2)))
activationRefused=true;await assert.rejects(compile<OperatorModule>(cli,modules).main(legacyArgs),/Activation refused/);activationRefused=false
assert(catalogueCalls.length>0&&catalogueCalls.every(edition=>edition===44))
catalogueEdition=56;catalogueCalls.length=0
for(const commandArgs of [args,activeArgs,activated('publish')]){
events.length=0
await compile<OperatorModule>(cli,modules).main(commandArgs)
}
assert.deepEqual(catalogueCalls,[56,56,56])
const publicationApproval=files.approval
files.approval={...fixture('',true,'upgrade').pinned,definitionSha256:'b'.repeat(64)}
events.length=0;reads.length=0;catalogueCalls.length=0
const upgraded=await compile<OperatorModule>(cli,modules).main(activated('upgrade'))
assert.equal(upgraded.outcome,'committed')
assert.deepEqual(events,['upgrade-approval','transport','protected-source','activation-admission','upgrade','pool-end','activation-terminal'])
assert.deepEqual(catalogueCalls,[56])
assert(reads.includes('signing-private.pem'))
catalogueEdition=57
files.approval={...fixture('',true,'upgrade57').pinned,definitionSha256:'b'.repeat(64)}
events.length=0;reads.length=0;catalogueCalls.length=0
assert.equal((await compile<OperatorModule>(cli,modules).main(activated('upgrade'))).outcome,'committed')
assert.deepEqual(catalogueCalls,[57])
files.approval=publicationApproval
catalogueEdition=44;catalogueCalls.length=0
incompatibleDefinition=true;events.length=0;reads.length=0 incompatibleDefinition=true;events.length=0;reads.length=0
const beforeBuildRefusal=retainedPools.length const beforeBuildRefusal=retainedPools.length
for(const incompatibleArgs of [args,activeArgs,['publish',...args.slice(1)]])await assert.rejects(compile<OperatorModule>(cli,modules).main(incompatibleArgs),/Build manifest refused/) for(const incompatibleArgs of [args,activeArgs,activated('publish')])await assert.rejects(compile<OperatorModule>(cli,modules).main(incompatibleArgs),/Build manifest refused/)
assert.equal(retainedPools.length,beforeBuildRefusal) assert.equal(retainedPools.length,beforeBuildRefusal)
assert(!events.some(event=>event==='protected-source'||event==='activation-admission')) assert(!events.some(event=>event==='protected-source'||event==='activation-admission'))
const historical=await compile<OperatorModule>(cli,modules).main(['reconcile',...args.slice(1)]) const historical=await compile<OperatorModule>(cli,modules).main(['reconcile',...args.slice(1)])
assert.equal(historical.outcome,'confirmed');assert.equal(historical.readyAuthorized,false) assert.equal(historical.outcome,'confirmed');assert.equal(historical.readyAuthorized,false)
assert.deepEqual(catalogueCalls,[])
}) })
+196
View File
@@ -0,0 +1,196 @@
import assert from 'node:assert/strict'
import {createPublicKey,generateKeyPairSync,randomBytes,randomUUID,sign,X509Certificate} from 'node:crypto'
import {readFile,mkdir,writeFile} from 'node:fs/promises'
import {basename,dirname,join,resolve} from 'node:path'
import {tmpdir} from 'node:os'
export async function verifyOwnedLegacy0037Handoff(pg,options,leafBytes,client,directory,inspectOnly=false){
assert.equal(dirname(directory),resolve(tmpdir()))
assert.match(basename(directory),/^mm-archive-leaf-tls-/)
const fixtureState=join(directory,'mm-mcp-test-legacy-0037','state')
await mkdir(fixtureState,{recursive:true,mode:0o700})
const tail=inspectOnly==='tail'?{user:'owned_commit_operator',password:randomBytes(24).toString('hex')}:null
const localLogin=tail??options
Object.assign(process.env,{MMAPP_OWN_PROBE_LEGACY_0037:'true',MMAPP_OWN_PROBE_LEGACY_ORPHANS:'true',
DATABASE_URL:`postgres://${localLogin.user}:${localLogin.password}@127.0.0.1:${options.port}/postgres`,MCP_STATE_DIR:fixtureState,AUTH_REQUIRED:'false'})
const [{applyLegacyProbeFixtureMigrations},{initialDatabaseSchemaControlState},{runOwnedLegacyProbe0037Handoff},
{captureLegacyProbeLineage,captureLegacyProbeStorage,LEGACY_PROBE_CUSTODY_LOCK,LEGACY_PROBE_RELATIONS},
{runPinnedDatabaseSnapshotDump,runPinnedLegacyProbeSnapshotDump},{LEGACY_PROBE_CUSTODY_APPROVAL_DOMAIN},
{sourceBindingBytes,sourceBindingCanonical,sourceBindingSha256,readDatabaseSourceBindingRegistry},
{provisionDatabaseSourceBindingOffline},{retainPublisherTlsPeer},security,{collectLegacyServerProbeSnapshot}]=await Promise.all([
import('../src/db/legacy-probe-fixture.ts'),import('../src/db/database-schema-control-model.ts'),import('../src/db/proposals/server-probe-legacy-0037-owned.ts'),
import('../src/services/server-probe-legacy-source-inventory.ts'),import('../src/services/database-dump-connection.ts'),import('../src/services/server-probe-legacy-archive-approval.ts'),
import('../src/db/database-source-binding.ts'),import('./database-source-binding-operator.ts'),import('./writer-profile/operator-contract.mjs'),
import('../src/modules/mcp/security.ts'),import('../src/services/server-probe-legacy-snapshot.ts'),
])
const live=new pg.Pool({...options,max:4}),coldDatabase='mm_owned_legacy_cold_'+randomUUID().replaceAll('-','')
let cold,coldAdmin
const store=async(name,value)=>{const file=join(directory,name);await writeFile(file,value,{flag:'wx',mode:0o600});return file}
const inspect=async(sql)=>{
await sql.query('BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY')
try {
let sqlState
const summary=await collectLegacyServerProbeSnapshot({query:async(text,values)=>{
try { return await sql.query(text,values) } catch(error) { sqlState=error.code;throw error }
}},{deadlineAt:Date.now()+30000})
assert.equal(summary.complete,true,JSON.stringify({reasons:summary.reasons,sqlState}))
const snapshot=await captureLegacyProbeStorage(sql),lineage=await captureLegacyProbeLineage(sql)
return {summary,snapshot,lineage}
} finally { await sql.query('ROLLBACK') }
}
try{
if(tail){
// Use the same canonical application owner from the first byte. The
// signed reference compares live owners and ACLs as part of its digest.
await live.query(`CREATE ROLE ${tail.user} LOGIN CREATEDB PASSWORD '${tail.password}';
ALTER DATABASE postgres OWNER TO ${tail.user}; COMMENT ON DATABASE postgres IS NULL`)
const application=new pg.Pool({...options,...tail,max:4})
try{await applyLegacyProbeFixtureMigrations(application)}finally{await application.end()}
}else await applyLegacyProbeFixtureMigrations(live)
await live.query(`CREATE SCHEMA mmapp_control; CREATE TABLE mmapp_control.database_schema_state(id smallint PRIMARY KEY CHECK(id=1),revision bigint NOT NULL CHECK(revision>=0),state jsonb NOT NULL);
CREATE TABLE mmapp_control.database_schema_intents(id uuid PRIMARY KEY,intent jsonb NOT NULL,terminal jsonb)`)
await live.query('INSERT INTO mmapp_control.database_schema_state VALUES(1,0,$1::jsonb)',[JSON.stringify(initialDatabaseSchemaControlState())])
const owner='owned-legacy-history-owner',generation=randomUUID(),connection=randomUUID(),credential=randomUUID(),plan=randomUUID(),operation=randomUUID()
const restReceipt=randomUUID(),restExecution=randomUUID(),mcpReceipt=randomUUID(),quarantine=randomUUID(),quarantinedExecution=randomUUID()
const expiresAt=Date.UTC(2000,0,1),issuedAt=expiresAt-3600000,expiry=new Date(expiresAt).toISOString(),bindingProof='a'.repeat(64)
await live.query("INSERT INTO mcp_connections(id,name,owner_id,owner_permissions,policy,generation) VALUES($1,'owned history',$2,'[]','{}',$3)",[connection,owner,generation])
await live.query("INSERT INTO mcp_credentials(id,connection_id,digest,kind,expires_at) VALUES($1,$2,$3,'bearer',$4)",[credential,connection,randomUUID(),expiry])
const binding={version:1,operation:'servers.probes.run',principal:{connectionId:connection,credentialId:credential,credentialExpiresAt:expiry},
ownerId:owner,issuedAt,authorityExpiresAt:expiresAt,prepared:{receiptId:mcpReceipt,serverId:1,tool:'ping',expiresAt:expiry,
bindingCiphertext:await security.encryptSecret('owned original provider request')},bindingProof,stageBudget:2}
const step={kind:'service',service:'servers.probes.run',input:{receiptId:mcpReceipt,serverId:1,
inputDigest:await security.privateSecretFingerprint(security.fingerprint(binding),'server-probe-mcp-binding-v1'),
bindingCiphertext:await security.encryptSecret(JSON.stringify(binding))}}
const evidence={sealed:await security.encryptSecret(JSON.stringify({steps:[step],target:{scope:'servers',serverIds:[1]},requiresHuman:true,
verificationScope:'acknowledgement',mutationCost:2,validUntil:expiry}))}
await live.query(`INSERT INTO mcp_plans(id,connection_id,operation_id,operation_version,policy_version,generation,payload,evidence,state,expires_at,approved_by)
VALUES($1,$2,'servers.probes.run',1,1,$3,'{}',$4::jsonb,'completed',$5,$6)`,[plan,connection,generation,JSON.stringify(evidence),expiry,owner])
await live.query("INSERT INTO mcp_operations(id,plan_id,connection_id,idempotency_key,state,finished_at) VALUES($1,$2,$3,$4,'applied',clock_timestamp())",[operation,plan,connection,randomUUID()])
await live.query("INSERT INTO mcp_operation_steps(operation_id,step_index,state,intended_state) VALUES($1,0,'intent',$2::jsonb)",[operation,JSON.stringify(security.redact(step))])
await live.query('INSERT INTO mcp_diagnostic_cancellations(operation_id,connection_id,actor_id) VALUES($1,$2,$3)',[operation,connection,owner])
const context={identity:{kind:'rest',ownerId:owner,executionId:restExecution,requestId:'owned-original-request',authentication:'jwt',issuedAt,expiresAt},sourceServerId:1,tool:'ping'}
await live.query(`INSERT INTO server_probe_executions(receipt_id,binding_proof,identity_kind,execution_id,actor_id,authentication,request_id,authority_issued_at,authority_expires_at,source_server_id,tool)
VALUES($1,$2,'rest',$3,$4,'jwt','owned-original-request',$5,$6,1,'ping')`,[restReceipt,bindingProof,restExecution,owner,issuedAt,expiry])
await live.query("INSERT INTO server_probe_execution_stages(receipt_id,stage_index,kind,timeout_ms,state,outcome,received_at) VALUES($1,1,'native-ping',1000,'received','received',clock_timestamp())",[restReceipt])
const receipt={receiptId:restReceipt,tool:'ping',serverId:1,state:'completed',httpStatus:200,output:'owned original result',data:{kind:'ping'},
attemptedStages:1,completedStages:1,automaticReplay:false,forwardingVerified:false}
const plaintext=JSON.stringify({version:1,context,bindingProof,receipt})
await live.query(`UPDATE server_probe_executions SET state='completed',attempted_stages=1,completed_stages=1,finished_at=clock_timestamp(),receipt_ciphertext=$2,receipt_proof=$3
WHERE receipt_id=$1`,[restReceipt,await security.encryptSecret(plaintext),await security.privateSecretFingerprint(security.fingerprint(plaintext),'server-probe-journal-v1:receipt')])
await live.query(`INSERT INTO server_probe_execution_quarantines(receipt_id,binding_proof,identity_kind,execution_id,identity_proof,error_code,attempted_stages,completed_stages)
VALUES($1,repeat('b',64),'rest',$2,repeat('c',64),'JOURNAL_UNKNOWN',0,0)`,[quarantine,quarantinedExecution])
const dependencySql=`SELECT jsonb_build_object('operation',to_jsonb(o),'plan',to_jsonb(p),'connection',to_jsonb(c),'step',to_jsonb(s),'credential',to_jsonb(k)) AS original
FROM public.mcp_operations o JOIN public.mcp_plans p ON p.id=o.plan_id JOIN public.mcp_connections c ON c.id=o.connection_id
JOIN public.mcp_operation_steps s ON s.operation_id=o.id JOIN public.mcp_credentials k ON k.connection_id=c.id WHERE o.id=$1 AND k.id=$2`
const dependencies=(await live.query(dependencySql,[operation,credential])).rows
assert.equal(dependencies.length,1)
const dependencyHash=sourceBindingSha256(sourceBindingBytes(dependencies))
const beforeClient=await live.connect()
let before
try { before=await inspect(beforeClient) } finally { beforeClient.release() }
assert.equal(before.snapshot.rowCount,4);assert.equal(before.lineage.rowCount,4)
assert.equal(before.summary.counts.verified,2,JSON.stringify(before.summary.reasons));assert.equal(before.summary.counts.unresolved,1)
const privateKey=generateKeyPairSync('ed25519').privateKey, signer=await store('owned-source-signer.pem',privateKey.export({type:'pkcs8',format:'pem'}))
const privatePassword=await store('owned-archive-password',options.password+'\n')
const peerLeaf=new X509Certificate(leafBytes),host='localhost',exporter=await live.connect()
let originalPin,archive,fullArchive,signedApproval
try{
retainPublisherTlsPeer(exporter,{serverName:host,spkiSha256:sourceBindingSha256(peerLeaf.publicKey.export({type:'spki',format:'der'}))})()
await exporter.query('BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY')
await exporter.query(LEGACY_PROBE_CUSTODY_LOCK)
const {rows:[identity]}=await exporter.query(`SELECT current_database() AS "databaseName",current_user::text AS "currentUser",session_user::text AS "sessionUser",
(pg_catalog.pg_control_system()).system_identifier::text AS "systemIdentifier",pg_catalog.pg_is_in_recovery() AS "inRecovery",
current_setting('server_version_num')::int AS "serverVersionNum",d.oid::int AS "databaseOid",r.oid::text AS "signedOid"
FROM pg_catalog.pg_database d,pg_catalog.pg_roles r WHERE d.datname=current_database() AND r.rolname=current_user`)
const {signedOid,...source}=identity
const installationId=randomUUID(),sourceIdentityId=randomUUID(),request={installationId,sourceIdentityId,generation,source}
;({deploymentPin:originalPin}=await provisionDatabaseSourceBindingOffline({request,privateKeyFile:signer,outputDirectory:join(directory,'owned-original-registry')}))
const registry=await readDatabaseSourceBindingRegistry(originalPin)
const storage=await captureLegacyProbeStorage(exporter),lineage=await captureLegacyProbeLineage(exporter)
assert.deepEqual(storage,before.snapshot);assert.deepEqual(lineage,before.lineage)
const {rows:[{snapshot}]}=await exporter.query('SELECT pg_catalog.pg_export_snapshot() AS snapshot')
const peer={host,port:options.port,database:'postgres',capture:{name:options.user,signedOid},leaf:peerLeaf.toString()}
archive=await runPinnedLegacyProbeSnapshotDump(peer,options.password,snapshot,directory,{})
fullArchive=await runPinnedDatabaseSnapshotDump(peer,privatePassword,snapshot,{})
const body={format:'legacy-probe-custody-approval-v1',installationId,sourceIdentityId,generation,ordinal:1,
headSha256:registry.headSha256,bindingSha256:registry.head.bindingSha256,archiveSha256:sourceBindingSha256(archive),
storageSha256:storage.sha256,lineageSha256:lineage.sha256}
signedApproval=sourceBindingBytes({body,signature:sign(null,Buffer.from(LEGACY_PROBE_CUSTODY_APPROVAL_DOMAIN+sourceBindingCanonical(body)),privateKey).toString('base64url')})
} finally { try { await exporter.query('ROLLBACK') } finally { exporter.release() } }
await store('owned-legacy-probe.dump',archive);await store('owned-legacy-probe-approval.json',signedApproval)
const archiveFile=await store('owned-full-cold.dump',fullArchive)
const {stdout:toc}=await client('pg_restore',['--list',archiveFile],'pinned')
assert.doesNotMatch(toc,/mmapp_control/)
await live.query(`CREATE DATABASE ${coldDatabase} TEMPLATE template0`)
coldAdmin=new pg.Client({...options,database:coldDatabase});await coldAdmin.connect()
if(/\bSCHEMA - public\b/.test(toc))await coldAdmin.query('DROP SCHEMA public RESTRICT')
try { await client('pg_restore',['--dbname='+coldDatabase,'--exit-on-error','--no-owner',archiveFile],'pinned') }
catch { throw Error('Owned full legacy cold restore failed') }
const coldPassword=randomUUID()
await coldAdmin.query(`CREATE ROLE owned_legacy_reader LOGIN PASSWORD '${coldPassword}'; GRANT USAGE ON SCHEMA public TO owned_legacy_reader; GRANT SELECT ON TABLE
${['schema_migrations','mcp_operations','mcp_operation_steps','mcp_plans','mcp_connections','mcp_credentials',...LEGACY_PROBE_RELATIONS].map(name=>`public.${name}`).join(', ')} TO owned_legacy_reader`)
cold=new pg.Client({...options,database:coldDatabase,user:'owned_legacy_reader',password:coldPassword});await cold.connect()
const coldState=join(directory,'owned-cold-key-state')
await mkdir(coldState,{mode:0o700})
const archivedKey=await readFile(join(fixtureState,'encryption-key'))
try { await writeFile(join(coldState,'encryption-key'),archivedKey,{flag:'wx',mode:0o600}) } finally { archivedKey.fill(0) }
const assertCold=async()=>{
let read
process.env.MCP_STATE_DIR=coldState
try { read=await inspect(cold) } finally { process.env.MCP_STATE_DIR=fixtureState }
assert.deepEqual(read,before)
assert.equal(sourceBindingSha256(sourceBindingBytes((await cold.query(dependencySql,[operation,credential])).rows)),dependencyHash)
assert((await cold.query('SELECT execution_id FROM public.server_probe_executions WHERE receipt_id=$1',[restReceipt])).rows[0]?.execution_id===restExecution,'Original receipt ID drift')
assert((await cold.query('SELECT execution_id FROM public.server_probe_execution_quarantines WHERE receipt_id=$1',[quarantine])).rows[0]?.execution_id===quarantinedExecution,'Original unresolved ID drift')
await assert.rejects(cold.query('DELETE FROM public.server_probe_execution_quarantines WHERE receipt_id=$1',[quarantine]),{code:'42501'})
}
await assertCold()
if(['cold','execute','adopt','release','tail'].includes(inspectOnly)){
const {verifyOwnedLegacyColdCommand}=await import('./legacy-probe-cold-verify-owned.mjs')
return await verifyOwnedLegacyColdCommand({live,coldAdmin,cold,options,directory,coldState,leafBytes,originalPin,archive,fullArchive,signedApproval,
execute:inspectOnly!=='cold',adopt:['adopt','release','tail'].includes(inspectOnly),release:['release','tail'].includes(inspectOnly),
tail,sourcePrivateKey:privateKey})
}
if(inspectOnly){
const {verifyOwnedHandoffInspector}=await import('./legacy-probe-handoff-inspect-owned.mjs')
return await verifyOwnedHandoffInspector({live,directory,options,leafBytes,originalPin,archive,fullArchive,signedApproval,privateKey,intentOnly:inspectOnly==='intent'})
}
const operatorPublicKeyPem=Buffer.from(createPublicKey(privateKey).export({type:'spki',format:'pem'}))
const archiveApproval={archive,signedApproval,operatorPublicKeyPem}, input={live,cold,coldDatabase,fixtureDirectory:directory,originalPin,archiveApproval}
const expectPre0037=async()=>{
const sql=await live.connect()
try { assert.deepEqual(await inspect(sql),before) } finally { sql.release() }
const {rows:[row]}=await live.query(`SELECT count(*)::int AS markers, to_regclass('public.server_probe_storage_admissions')::text AS v2
FROM public.schema_migrations`)
assert.deepEqual(row,{markers:36,v2:null})
}
await assert.rejects(runOwnedLegacyProbe0037Handoff({...input,archiveApproval:{...archiveApproval,archive:Buffer.concat([archive,Buffer.from('tamper')])}}),/approval refused/)
await coldAdmin.query("UPDATE public.mcp_operation_steps SET intended_state='{\"drift\":true}' WHERE operation_id=$1",[operation])
await assert.rejects(runOwnedLegacyProbe0037Handoff(input),{code:'ERR_ASSERTION'})
await coldAdmin.query('UPDATE public.mcp_operation_steps SET intended_state=$2::jsonb WHERE operation_id=$1',
[operation,JSON.stringify(dependencies[0].original.step.intended_state)])
await expectPre0037()
const competingWriter=await live.connect()
try{
await competingWriter.query('BEGIN')
await competingWriter.query('LOCK TABLE public.mcp_plans IN ROW EXCLUSIVE MODE')
await assert.rejects(runOwnedLegacyProbe0037Handoff(input),{code:'55P03'})
} finally { try { await competingWriter.query('ROLLBACK') } finally { competingWriter.release() } }
await assert.rejects(runOwnedLegacyProbe0037Handoff({...input,failAfterBody:true}),{code:'22012'})
await expectPre0037()
const outcome=await runOwnedLegacyProbe0037Handoff(input)
assert.deepEqual(outcome,{archivedRows:4,lineageRows:4,readyAuthorized:false})
await assertCold()
assert.equal(sourceBindingSha256(sourceBindingBytes((await live.query(dependencySql,[operation,credential])).rows)),dependencyHash)
const {rows:history}=await live.query("SELECT terminal->>'outcome' AS outcome FROM mmapp_control.database_schema_intents ORDER BY (intent->>'epoch')::int")
assert.deepEqual(history,[{outcome:'observed-failure'},{outcome:'observed-success'}])
return {ownedAtomicLegacy0037Handoff:true,coldArchiveRows:4,verifiedHistoricalIdentities:2,unresolvedHistoricalIdentities:1,readyAuthorized:false}
} finally {
await Promise.allSettled([cold?.end(),coldAdmin?.end(),live.end()])
if(inspectOnly){
const {closePool}=await import('../src/db/index.ts')
await closePool()
}
}
}
@@ -0,0 +1,78 @@
import assert from 'node:assert/strict'
import {createPublicKey,generateKeyPairSync,X509Certificate} from 'node:crypto'
import {mkdir,open,readFile,realpath,readdir,unlink,writeFile} from 'node:fs/promises'
import {dirname,join,sep} from 'node:path'
export async function modelOwnedOperatorFiles(directory,sha){
if(process.platform!=='win32')return
const {mock}=await import('node:test'),url=new URL('./writer-profile/operator-files.mjs',import.meta.url),files=await import(url.href)
const protectedDirectory=async path=>{assert(path===directory||path.startsWith(directory+sep));assert.equal(await realpath(path),path)}
return mock.module(url,{namedExports:{...files,protectedDirectory,async writeFile(path,blob,opts){
await protectedDirectory(dirname(path));const file=await open(path,opts.flag,opts.mode);try{await file.writeFile(blob);await file.sync()}finally{await file.close()}
},async readProtected(path,limit,hash){
await protectedDirectory(dirname(path));const bytes=await readFile(path);assert(bytes.length>0&&bytes.length<=limit);if(hash!==undefined)assert.equal(sha(bytes),hash);return bytes
},async withJournalLease(path,work){
await protectedDirectory(path);const lock=join(path,'publisher-lease.lock'),file=await open(lock,'wx',0o600)
try{return await work()}finally{await file.close();await unlink(lock)}
}}})
}
export async function verifyOwnedLegacyColdCommand({live,coldAdmin,cold,options,directory,coldState,leafBytes,originalPin,archive,fullArchive,signedApproval,execute,adopt,release,tail,sourcePrivateKey}){
assert.equal(process.env.MMAPP_OWN_PROBE_LEGACY_0037,'true')
const [{sourceBindingBytes,sourceBindingSha256},{captureLegacyProbeCredentialDigest,verifyLegacyColdProof},{captureLegacyProbeStorage,captureLegacyProbeLineage}]=await Promise.all([
import('../src/db/database-source-binding.ts'),import('../src/services/server-probe-legacy-cold-proof.ts'),import('../src/services/server-probe-legacy-source-inventory.ts'),
])
const sha=sourceBindingSha256,store=async(path,data)=>{await writeFile(path,data,{flag:'wx',mode:0o600});return path}
const archiveDirectory=join(directory,'cold-protected-archive'),outputDirectory=join(directory,'cold-proof-output')
await mkdir(archiveDirectory,{mode:0o700});await mkdir(outputDirectory,{mode:0o700})
for(const [name,data] of [['legacy-probe.dump',archive],['legacy-probe-approval.json',signedApproval],['legacy-probe-cold.dump',fullArchive]])await store(join(archiveDirectory,name),data)
await coldAdmin.query('GRANT EXECUTE ON FUNCTION pg_catalog.pg_control_system() TO owned_legacy_reader')
const {rows:[identity]}=await cold.query(`SELECT current_database() AS "databaseName", current_user::text AS "currentUser", session_user::text AS "sessionUser",
(pg_catalog.pg_control_system()).system_identifier::text AS "systemIdentifier",pg_catalog.pg_is_in_recovery() AS "inRecovery",
current_setting('server_version_num')::int AS "serverVersionNum",d.oid::int AS "databaseOid",r.oid::text AS "roleOid"
FROM pg_catalog.pg_database d,pg_catalog.pg_roles r WHERE d.datname=current_database() AND r.rolname=current_user`)
const {roleOid,...coldSource}=identity
const key=generateKeyPairSync('ed25519').privateKey,publicKey=createPublicKey(key),host='localhost'
const signerSpkiSha256=sha(publicKey.export({type:'spki',format:'der'}))
const storedKey=await readFile(join(coldState,'encryption-key'));const keySha256=sha(storedKey);storedKey.fill(0)
const approval=sourceBindingBytes({format:'legacy-probe-cold-verification-approval-v1',installationId:originalPin.installationId,
sourceHeadSha256:originalPin.currentHeadSha256,sourceSignerSpkiSha256:originalPin.publicKeySpkiSha256,custodySha256:sha(signedApproval),
coldArchiveSha256:sha(fullArchive),coldSignerSpkiSha256:signerSpkiSha256,keySha256,coldSource,coldRoleOid:roleOid,
tls:{serverName:host,caSha256:sha(leafBytes),spkiSha256:sha(new X509Certificate(leafBytes).publicKey.export({type:'spki',format:'der'}))},expiresAt:Date.now()+120000})
const transport=sourceBindingBytes({host,port:options.port,user:cold.user,password:cold.password,database:cold.database})
const argv=['legacy-cold-verify','--approval',await store(join(directory,'cold-verification.json'),approval),'--approval-sha256',sha(approval),
'--transport',await store(join(directory,'cold-transport.json'),transport),'--transport-sha256',sha(transport),
'--ca',await store(join(directory,'cold-ca.pem'),leafBytes),'--source-registry',originalPin.registryDirectory,'--archive-directory',archiveDirectory,
'--legacy-key-directory',coldState,'--cold-signing-key',await store(join(directory,'cold-signing.pem'),key.export({type:'pkcs8',format:'pem'})),
'--output-directory',outputDirectory]
const modeledFiles=await modelOwnedOperatorFiles(directory,sha)
try{
const {main}=await import('./database-writer-profile-operator.mts')
if(!execute){
await coldAdmin.query('GRANT UPDATE ON public.mcp_credentials TO owned_legacy_reader')
try{await assert.rejects(main(argv),/read-only privileges/)}finally{await coldAdmin.query('REVOKE UPDATE ON public.mcp_credentials FROM owned_legacy_reader')}
assert.deepEqual(await readdir(outputDirectory),[])
}
const result=await main(argv),proof=await readFile(join(outputDirectory,result.proofFile))
assert.equal(result.event,'database-legacy-cold-proof');assert.equal(result.proofSha256,sha(proof));assert.equal(result.conversionAllowed,false)
const source=await live.connect()
try{
await source.query('BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY')
const storage=await captureLegacyProbeStorage(source),lineage=await captureLegacyProbeLineage(source)
const pinned={publicKeyPem:Buffer.from(publicKey.export({type:'spki',format:'pem'})),signerSpkiSha256,
sourceSignerSpkiSha256:originalPin.publicKeySpkiSha256,approvalSha256:sha(approval),coldArchiveSha256:sha(fullArchive),custodySha256:sha(signedApproval),
storageSha256:storage.sha256,lineageSha256:lineage.sha256}
const verified=verifyLegacyColdProof(proof,pinned)
assert.equal(verified.credentialSha256,await captureLegacyProbeCredentialDigest(source));assert.equal(verified.keySha256,keySha256)
assert.deepEqual(verified.coldSource,coldSource)
assert.throws(()=>verifyLegacyColdProof(proof,{...pinned,coldArchiveSha256:'0'.repeat(64)}),/proof refused/)
assert.throws(()=>verifyLegacyColdProof(proof,{...pinned,sourceSignerSpkiSha256:signerSpkiSha256}),/proof refused/)
}finally{try{await source.query('ROLLBACK')}finally{source.release()}}
if(execute){
const {verifyOwnedLegacyExecution}=await import('./legacy-probe-handoff-execute-owned.mjs')
return await verifyOwnedLegacyExecution({main,live,options,directory,archiveDirectory,coldState,leafBytes,originalPin,fullArchive,signedApproval,
adopt,release,tail,sourcePrivateKey,coldPrivateKey:key,coldPublicKey:publicKey,proof,coldApprovalSha256:sha(approval)})
}
return {coldProofIssued:true,distinctIssuerVerified:true,credentialDigestMatched:true,writePrivilegedRoleRefused:true,readyAuthorized:false}
}finally{modeledFiles?.restore()}
}
@@ -0,0 +1,259 @@
import assert from 'node:assert/strict'
import {randomBytes,randomUUID,sign,X509Certificate} from 'node:crypto'
import {mkdir,readFile,writeFile} from 'node:fs/promises'
import {join} from 'node:path'
import pg from 'pg'
export async function verifyOwnedLegacyExecution({main,live,options,directory,archiveDirectory,coldState,leafBytes,originalPin,fullArchive,signedApproval,
adopt,release,tail,sourcePrivateKey,coldPrivateKey,coldPublicKey,proof,coldApprovalSha256}){
assert.equal(process.env.MMAPP_OWN_PROBE_LEGACY_0037,'true')
const [{sourceBindingBytes,sourceBindingCanonical,sourceBindingSha256,readDatabaseSourceBindingRegistry},{readReviewedLegacyProbe0037},
{LEGACY_HANDOFF_EXECUTION_DOMAIN,LEGACY_HANDOFF_RELEASE_DOMAIN},{captureLegacyHandoffSchema},{LEGACY_PROBE_RELATIONS},{acquireDatabaseSchemaControl},{observation,exactHistory},
{MIGRATION_MANIFEST,migrationManifestDigest},{DATABASE_RESTORE_QUARANTINE_DDL},{createBootstrapMaterial}]=await Promise.all([
import('../src/db/database-source-binding.ts'),import('../src/db/legacy-probe-0037-body.ts'),import('./writer-profile/legacy-handoff-execution.mts'),
import('../src/services/server-probe-legacy-handoff-inspection.ts'),import('../src/services/server-probe-legacy-source-inventory.ts'),
import('../src/db/database-schema-control.ts'),import('../src/db/controlled-migration-history.ts'),import('../src/db/migration-manifest.ts'),
import('../src/db/database-restore-quarantine.ts'),import('./database-writer-bootstrap-operator.mjs'),
])
const sha=sourceBindingSha256,store=async(path,data)=>{await writeFile(path,data,{flag:'wx',mode:0o600});return path}
const publisher=options.user,operator='owned_commit_operator',control='owned_commit_control'
const appPassword=tail?.password??randomBytes(24).toString('hex'),controlPassword=randomBytes(24).toString('hex')
await live.query(DATABASE_RESTORE_QUARANTINE_DDL)
if(tail)assert.equal(tail.user,operator)
else await live.query(`CREATE ROLE ${operator} LOGIN PASSWORD '${appPassword}'; GRANT ${publisher} TO ${operator}; ALTER SCHEMA public OWNER TO ${operator}`)
await live.query(`CREATE ROLE ${control} LOGIN PASSWORD '${controlPassword}';
CREATE ROLE owned_commit_runtime NOLOGIN; CREATE ROLE owned_commit_capture NOLOGIN;
GRANT EXECUTE ON FUNCTION pg_catalog.pg_control_system() TO ${control},${operator}; GRANT pg_read_all_stats TO ${control};
GRANT USAGE ON SCHEMA mmapp_control TO ${control},${operator}; GRANT SELECT, UPDATE ON mmapp_control.database_schema_state,mmapp_control.database_restore_quarantine TO ${control},${operator};
GRANT SELECT, INSERT, UPDATE ON mmapp_control.database_schema_intents TO ${control},${operator}`)
let runTail
if(tail){
const [{pool},{executeControlledSqlMigrations},{LEGACY_CONTROL_REFERENCE_DOMAIN,readControlledSchemaReference},{verifyControlledSchemaCurrentState}]=await Promise.all([
import('../src/db/index.ts'),import('../src/db/controlled-migrations.ts'),import('../src/db/controlled-schema-reference-core.ts'),
import('../src/db/controlled-schema-verification.ts'),
])
runTail=async(quarantined,handoff)=>{
const files=[],fileHashes=new Map(MIGRATION_MANIFEST.map(pin=>[pin.sha256,pin.file]))
const originalConnect=pool.connect
pool.connect=async()=>{
const owned=await originalConnect.call(pool),query=owned.query,release=owned.release
owned.query=function(text,...args){
const file=typeof text==='string'&&fileHashes.get(sha(Buffer.from(text)))
if(file)files.push(file)
return query.call(this,text,...args)
}
owned.release=function(...args){owned.query=query;owned.release=release;return release.apply(this,args)}
return owned
}
try{
if(quarantined){
await assert.rejects(executeControlledSqlMigrations(),error=>error.cause?.message==='Authenticated legacy migration release required')
assert.deepEqual(files,[])
return
}
const result=await executeControlledSqlMigrations()
assert.equal(result.completedFiles,MIGRATION_MANIFEST.length);assert.equal(result.ready,false)
assert.deepEqual(files,MIGRATION_MANIFEST.slice(37).map(pin=>pin.file))
}finally{pool.connect=originalConnect}
const referenceRoles={publisher:request.roles.publisher,operator:request.roles.operator,control:request.roles.control}
const approvalBody={format:'legacy-control-reference-approval-v1',manifestSha256,sourceHeadSha256:source.headSha256,
sourceTlsSpkiSha256:tls.spkiSha256,...referenceRoles,expiresAt:Date.now()+90000}
const referenceArgs=async(body,filename)=>{
const bytes=sourceBindingBytes({body,signature:sign(null,Buffer.from(LEGACY_CONTROL_REFERENCE_DOMAIN+sourceBindingCanonical(body)),coldPrivateKey).toString('base64url')})
const flags=['--bootstrap','--bootstrap-sha256','--publisher-transport','--publisher-transport-sha256','--operator-transport','--operator-transport-sha256',
'--ca','--source-registry','--source-spki-sha256','--activation-directory','--activation-sha256','--cold-public-key','--cold-spki-sha256']
return ['legacy-control-reference',...flags.flatMap(flag=>[flag,args[args.indexOf(flag)+1]]),
'--approval',await store(join(directory,filename),bytes),'--approval-sha256',sha(bytes)]
}
await assert.rejects(main(await referenceArgs({...approvalBody,control:referenceRoles.operator},'wrong-control-reference.json')),/independent split-control approval/)
const approved=await referenceArgs(approvalBody,'control-reference.json')
const reference=await main(approved),current=await verifyControlledSchemaCurrentState()
assert.equal(reference.splitControlApprovalSha256,approved.at(-1));assert.equal(reference.referenceDatabaseDropped,true)
assert.equal((await readControlledSchemaReference()).sha256,current.schemaSha256)
assert.equal(current.schemaSha256,reference.logicalSchemaSha256);assert.equal(current.referenceStatus,'matched');assert.equal(current.ready,false)
assert.equal(current.currentPristineDataInvariants,false)
await live.query('GRANT USAGE ON SCHEMA mmapp_control TO owned_commit_runtime')
try{
const extra=await verifyControlledSchemaCurrentState()
assert.equal(extra.referenceStatus,'different');assert.equal(extra.ready,false);assert.equal(extra.dataFacts.length,0)
}finally{await live.query('REVOKE USAGE ON SCHEMA mmapp_control FROM owned_commit_runtime')}
const [{LEGACY_SOURCE58_PREFLIGHT_DOMAIN},{RESTORE_WRITER_PROFILE_DEFINITION_SHA256}]=await Promise.all([
import('../src/db/legacy-source58-transition.ts'),import('../src/db/database-restore-quarantine-profile.ts'),
])
const targetCatalogueSha256=sha(Buffer.from('owned signed intended Source58 target; installation outside this preflight'))
const target={format:'legacy-source58-preflight-approval-v1',manifestSha256,sourceHeadSha256:source.headSha256,
sourceTlsSpkiSha256:tls.spkiSha256,currentSchemaSha256:reference.logicalSchemaSha256,...handoff,
targetDefinitionSha256:RESTORE_WRITER_PROFILE_DEFINITION_SHA256,targetCatalogueSha256,roles:request.roles,expiresAt:Date.now()+90000}
const preflightArgs=async(body,name)=>{
const bytes=sourceBindingBytes({body,signature:sign(null,Buffer.from(LEGACY_SOURCE58_PREFLIGHT_DOMAIN+sourceBindingCanonical(body)),coldPrivateKey).toString('base64url')})
const flags=approved.slice(1,-4),operatorAt=flags.indexOf('--operator-transport')
flags.splice(operatorAt,4)
return ['legacy-source58-preflight',...flags,'--approval',await store(join(directory,name),bytes),'--approval-sha256',sha(bytes)]
}
await assert.rejects(main(await preflightArgs({...target,releaseApprovalSha256:'0'.repeat(64)},'wrong-source58-target.json')),/exact authenticated release/)
const observed=await main(await preflightArgs(target,'source58-target.json'))
assert.equal(observed.authenticatedFiles,MIGRATION_MANIFEST.length);assert.equal(observed.transitionAuthorized,false);assert.equal(observed.readyAuthorized,false)
assert.equal(observed.approvedTargetCatalogueSha256,targetCatalogueSha256)
const expectedBlockers=['CONTROL_NAMESPACE_OWNER','QUARANTINE_OWNER','WRITER_REGISTRY_MISSING','REVIEWED_MARKER_FENCE_MISSING',
'ROLE_PROFILE_OPERATOR','ROLE_PROFILE_PUBLISHER','ROLE_PROFILE_RUNTIME','ROLE_PROFILE_CAPTURE']
assert.deepEqual(observed.blockers,expectedBlockers)
return {manifestSha256,logicalSchemaSha256:current.schemaSha256,referenceLogicalSchemaSha256:reference.logicalSchemaSha256,
referenceStatus:current.referenceStatus,splitControlApprovalSha256:reference.splitControlApprovalSha256,exactSplitControlCatalogueMatched:true,
invalidRoleRefused:true,excessNamespaceAclRefused:true,
referenceDatabaseDropped:reference.referenceDatabaseDropped,
files,legacySource58PredecessorAttested:true,wrongReleasePinRefused:true,source58Blockers:observed.blockers,
source58TransitionAuthorized:false,readyAuthorized:current.ready,historicalDataEquivalent:current.historicalDataEquivalent}
}
}
const manifestSha256=migrationManifestDigest(),controller=await acquireDatabaseSchemaControl(live)
try{
for(const migration of MIGRATION_MANIFEST.slice(0,36)){
const id=randomUUID(),begun=await controller.transition({type:'begin',id,kind:'migration',manifestSha256,artifactSha256:migration.sha256})
await controller.transition({type:'terminal',id,outcome:'observed-success',observationSha256:await observation(begun.state.intent,migration)})
}
}finally{await controller.close()}
const {body,pin}=await readReviewedLegacyProbe0037(),preview=new pg.Client({...options,user:operator,password:appPassword})
await preview.connect()
let preSchemaSha256,postSchemaSha256
try{
await preview.query('BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY')
preSchemaSha256=await captureLegacyHandoffSchema(preview,Date.now()+30000);await preview.query('ROLLBACK')
await preview.query('BEGIN ISOLATION LEVEL REPEATABLE READ READ WRITE')
await preview.query(`TRUNCATE TABLE ${LEGACY_PROBE_RELATIONS.map(name=>`ONLY public.${name}`).join(', ')} CONTINUE IDENTITY RESTRICT`)
await preview.query(body);await preview.query('SET TRANSACTION READ ONLY')
postSchemaSha256=await captureLegacyHandoffSchema(preview,Date.now()+30000)
}finally{try{await preview.query('ROLLBACK')}finally{await preview.end()}}
assert.notEqual(preSchemaSha256,postSchemaSha256)
const source=await readDatabaseSourceBindingRegistry(originalPin),host='localhost',tls={serverName:host,caSha256:sha(leafBytes),
spkiSha256:sha(new X509Certificate(leafBytes).publicKey.export({type:'spki',format:'der'}))}
const names={publisher,operator,control,runtime:'owned_commit_runtime',capture:'owned_commit_capture'}
const {rows:rows}=await live.query('SELECT rolname AS name,oid::text AS "signedOid" FROM pg_catalog.pg_roles WHERE rolname=ANY($1)',[Object.values(names)])
const request={format:'application-writer-bootstrap-request-v1',installationId:originalPin.installationId,sourceHeadSha256:originalPin.currentHeadSha256,tls,
roles:Object.fromEntries(Object.entries(names).map(([scope,name])=>[scope,rows.find(role=>role.name===name)])),source:{systemIdentifier:source.body.source.systemIdentifier,
databaseOid:String(source.body.source.databaseOid),databaseName:source.body.source.databaseName,serverVersionNum:source.body.source.serverVersionNum,inRecovery:false}}
const bootstrap=sourceBindingBytes(createBootstrapMaterial(request,sha(sourceBindingBytes(request))).bootstrap)
const activeDirectory=join(directory,'owned-execute-activation');await mkdir(activeDirectory,{mode:0o700})
const activation=sourceBindingBytes({format:'database-source-activation-v1',activationDirectory:activeDirectory,installationId:originalPin.installationId,
sourceIdentityId:source.body.sourceIdentityId,status:'active',publicKeySpkiSha256:originalPin.publicKeySpkiSha256,
generations:[{generation:source.body.generation,headSha256:source.headSha256,bindingSha256:source.head.bindingSha256,tlsSpkiSha256:tls.spkiSha256}]})
await store(join(activeDirectory,'source-activation.json'),activation)
const operationId=randomUUID(),approvalBody={format:'legacy-probe-0037-execution-approval-v1',decision:'execute-and-commit',operationId,
sourceHeadSha256:originalPin.currentHeadSha256,sourceTlsSpkiSha256:tls.spkiSha256,custodySha256:sha(signedApproval),coldArchiveSha256:sha(fullArchive),
coldProofSha256:sha(proof),coldApprovalSha256,preSchemaSha256,postSchemaSha256,manifestSha256,migrationSha256:pin.sha256,protectedRuntimePaused:true,expiresAt:Date.now()+90000}
const approved=sourceBindingBytes({body:approvalBody,signature:sign(null,Buffer.from(LEGACY_HANDOFF_EXECUTION_DOMAIN+sourceBindingCanonical(approvalBody)),coldPrivateKey).toString('base64url')})
await store(join(archiveDirectory,'legacy-probe-cold-proof.json'),proof)
const shared=['--bootstrap',await store(join(directory,'execute-bootstrap.json'),bootstrap),'--bootstrap-sha256',sha(bootstrap),
'--ca',await store(join(directory,'execute-ca.pem'),leafBytes),'--source-registry',originalPin.registryDirectory,'--source-spki-sha256',originalPin.publicKeySpkiSha256,
'--activation-directory',activeDirectory,'--activation-sha256',sha(activation),'--archive-directory',archiveDirectory]
const args=['legacy-handoff-execute',...shared,'--legacy-key-directory',coldState,'--source-signing-key',await store(join(directory,'execute-source-key.pem'),sourcePrivateKey.export({type:'pkcs8',format:'pem'})),
'--approval',await store(join(directory,'execute-approval.json'),approved),'--approval-sha256',sha(approved),'--cold-public-key',await store(join(directory,'execute-cold-pub.pem'),coldPublicKey.export({type:'spki',format:'pem'})),
'--cold-spki-sha256',sha(coldPublicKey.export({type:'spki',format:'der'}))]
let publisherTransport,publisherSha
for(const [scope,user,password] of [['publisher',publisher,options.password],['operator',operator,appPassword],['control',control,controlPassword]]){
const transport=sourceBindingBytes({host,port:options.port,database:options.database,user,password})
const file=await store(join(directory,'execute-'+scope+'.json'),transport);args.push('--'+scope+'-transport',file,'--'+scope+'-transport-sha256',sha(transport))
if(scope==='publisher'){publisherTransport=file;publisherSha=sha(transport)}
}
const {rows:[credential]}=await live.query('SELECT id,digest FROM public.mcp_credentials LIMIT 1')
await live.query('UPDATE public.mcp_credentials SET digest=$2 WHERE id=$1',[credential.id,randomUUID()])
try{await assert.rejects(main(args),/Original credentials differ/)}finally{await live.query('UPDATE public.mcp_credentials SET digest=$2 WHERE id=$1',[credential.id,credential.digest])}
assert.equal((await live.query('SELECT operation_id FROM mmapp_control.database_restore_quarantine')).rows[0].operation_id,null)
const connect=pg.Pool.prototype.connect
let applicationCommits=0
pg.Pool.prototype.connect=function(...args){
const connection=connect.apply(this,args)
if(args.length||this.options.application_name!=='mmapp-legacy-handoff-owner')return connection
return connection.then(client=>{
const query=client.query
client.query=function(text,...params){
const result=query.call(this,text,...params)
if(text!=='COMMIT')return result
return result.then(()=>{applicationCommits++;throw Error('owned application COMMIT ACK lost')})
}
return client
})
}
try{await assert.rejects(main(args),{code:'LEGACY_HANDOFF_EXECUTION_UNKNOWN'})}finally{pg.Pool.prototype.connect=connect}
assert.equal(applicationCommits,1)
const intent=await readFile(join(archiveDirectory,'legacy-probe-handoff-intent.json'))
const unknown=JSON.parse(await readFile(join(archiveDirectory,'legacy-probe-handoff-application-unknown.json'),'utf8'))
assert.equal(unknown.operationId,operationId);assert.equal(unknown.automaticReplay,false)
const inspectArgs=['legacy-handoff-inspect',...shared,'--transport',publisherTransport,'--transport-sha256',publisherSha,'--handoff-intent-sha256',sha(intent)]
const inspected=await main(inspectArgs)
assert.equal(inspected.outcome,'committed');assert.equal(inspected.operationId,operationId);assert.equal(inspected.quarantineActive,true)
assert.equal((await live.query('SELECT operation_id FROM mmapp_control.database_restore_quarantine')).rows[0].operation_id,operationId)
await assert.rejects(main(args),{code:'DATABASE_RESTORE_QUARANTINE_UNAVAILABLE'})
assert.equal(applicationCommits,1)
if(adopt){
assert.equal(inspected.adoptionRecorded,false)
const adoptArgs=[...args];adoptArgs[0]='legacy-handoff-adopt'
adoptArgs.splice(adoptArgs.indexOf('--source-signing-key'),2,'--handoff-intent-sha256',sha(intent))
let action=adoptArgs,unknownCode='LEGACY_HANDOFF_ADOPTION_UNKNOWN',releaseApprovalSha256
if(release){
const adopted=await main(adoptArgs)
assert.equal(adopted.quarantineActive,true)
if(runTail)await runTail(true)
const signedRelease=async(adoptionSha256,name)=>{
const body={format:'legacy-probe-0037-release-approval-v1',decision:'release-migration-quarantine',operationId,intentSha256:sha(intent),adoptionSha256,
sourceHeadSha256:originalPin.currentHeadSha256,sourceTlsSpkiSha256:tls.spkiSha256,coldArchiveSha256:sha(fullArchive),
coldProofSha256:sha(proof),postSchemaSha256,manifestSha256,migrationSha256:pin.sha256,protectedRuntimePaused:true,expiresAt:Date.now()+90000}
const bytes=sourceBindingBytes({body,signature:sign(null,Buffer.from(LEGACY_HANDOFF_RELEASE_DOMAIN+sourceBindingCanonical(body)),coldPrivateKey).toString('base64url')})
return ['legacy-handoff-release',...adoptArgs.slice(1),'--release-approval',await store(join(directory,name),bytes),'--release-approval-sha256',sha(bytes)]
}
await assert.rejects(main(await signedRelease('0'.repeat(64),'wrong-release.json')),/Exact committed legacy handoff phase/)
assert.equal((await main(inspectArgs)).quarantineActive,true)
action=await signedRelease(adopted.observationSha256,'release.json')
releaseApprovalSha256=action.at(-1);unknownCode='LEGACY_HANDOFF_RELEASE_UNKNOWN'
}
let controlCommits=0
pg.Pool.prototype.connect=function(...parameters){
const connection=connect.apply(this,parameters)
if(parameters.length||this.options.application_name!=='mmapp-writer-registry-enroll')return connection
return connection.then(client=>{
const query=client.query
client.query=function(text,...params){
const result=query.call(this,text,...params)
if(text!=='COMMIT')return result
return result.then(ack=>{if(++controlCommits===2)throw Error('owned adoption COMMIT ACK lost');return ack})
}
return client
})
}
try{await assert.rejects(main(action),{code:unknownCode})}finally{pg.Pool.prototype.connect=connect}
assert.equal(controlCommits,2)
const readback=await main(inspectArgs)
assert.equal(readback.adoptionRecorded,true);assert.equal(readback.outcome,'committed');assert.equal(readback.readyAuthorized,false)
const {rows:[gate]}=await live.query('SELECT q.operation_id::text AS active,s.state FROM mmapp_control.database_restore_quarantine q CROSS JOIN mmapp_control.database_schema_state s WHERE q.id=1 AND s.id=1')
const {rows:history}=await live.query('SELECT id::text,intent,terminal FROM mmapp_control.database_schema_intents')
assert.equal(gate.active,release?null:operationId);assert.equal(gate.state.intent,null)
assert.equal(gate.state.terminal.intent.artifactSha256,sha(intent))
assert.equal(await exactHistory(history,gate.state,manifestSha256,true),37)
if(release){
assert.equal(readback.releaseRecorded,true);assert.equal(readback.quarantineActive,false);assert.equal(readback.releaseApprovalSha256,releaseApprovalSha256)
assert.equal(gate.state.terminal.legacyRelease.approvalSha256,releaseApprovalSha256)
const {rows:[head]}=await live.query('SELECT journal_prefix_bytes,journal_prefix_sha256 FROM mmapp_control.database_restore_quarantine')
assert.deepEqual(head,{journal_prefix_bytes:null,journal_prefix_sha256:null})
const unknown=JSON.parse(await readFile(join(archiveDirectory,'legacy-probe-handoff-release-unknown.json'),'utf8'))
assert.deepEqual(unknown,{format:'legacy-probe-0037-release-unknown-v1',operationId,intentSha256:sha(intent),automaticReplay:false})
await assert.rejects(main(action),/Legacy release attempt requires inspection/)
if(runTail){
const markers=()=>live.query('SELECT id,xmin::text AS xmin,applied_at::text FROM public.schema_migrations ORDER BY id').then(result=>result.rows)
const ledger=()=>live.query('SELECT id::text,xmin::text AS xmin,intent,terminal FROM mmapp_control.database_schema_intents ORDER BY id').then(result=>result.rows)
const beforeMarkers=await markers(),beforeLedger=await ledger()
const result=await runTail(false,{operationId,intentSha256:sha(intent),releaseApprovalSha256})
assert.deepEqual((await markers()).slice(0,37),beforeMarkers)
const afterLedger=new Map((await ledger()).map(row=>[row.id,row]))
assert(beforeLedger.every(row=>JSON.stringify(row)===JSON.stringify(afterLedger.get(row.id))))
assert.equal((await main(inspectArgs)).releaseRecorded,true)
return {controlledLegacyTailCompleted:true,quarantinedDispatchRefused:true,originalReceiptsAndMarkersPreserved:true,...result}
}
return {legacyHandoffReleased:true,wrongAdoptionRefused:true,releaseAckLossObserved:true,exactAuthenticatedPrefix:37,
replayRefused:true,restoreJournalUnchanged:true,readyAuthorized:false}
}
const unknown=JSON.parse(await readFile(join(archiveDirectory,'legacy-probe-handoff-adoption-unknown.json'),'utf8'))
assert.deepEqual(unknown,{format:'legacy-probe-0037-adoption-unknown-v1',operationId,intentSha256:sha(intent),automaticReplay:false})
await assert.rejects(main(adoptArgs),/Legacy adoption attempt requires inspection/)
return {legacyHandoffAdopted:true,adoptionAckLossObserved:true,exactAuthenticatedPrefix:37,replayRefused:true,quarantineCleared:false,readyAuthorized:false}
}
return {legacyHandoffExecuted:true,credentialDriftRefused:true,applicationAckLossObserved:true,committedReconciled:true,quarantineCleared:false,readyAuthorized:false}
}
@@ -0,0 +1,177 @@
import assert from 'node:assert/strict'
import {randomUUID,sign,X509Certificate} from 'node:crypto'
import {mkdir,open,readFile,realpath,unlink,writeFile} from 'node:fs/promises'
import {dirname,join,sep} from 'node:path'
export async function verifyOwnedHandoffInspector({live,directory,options,leafBytes,originalPin,archive,fullArchive,signedApproval,privateKey,intentOnly=false}){
assert.equal(process.env.MMAPP_OWN_PROBE_LEGACY_0037,'true')
const [{acquireDatabaseSchemaControl},{observation},{MIGRATION_MANIFEST,migrationManifestDigest},
{captureMigrationSchema},{ownedLegacyProbe0037Body},{sourceBindingBytes,sourceBindingCanonical,sourceBindingSha256,readDatabaseSourceBindingRegistry},
{LEGACY_PROBE_HANDOFF_DOMAIN},{createBootstrapMaterial},{LEGACY_PROBE_RELATIONS,LEGACY_PROBE_CUSTODY_RELATIONS},{DATABASE_RESTORE_QUARANTINE_DDL,beginDatabaseRestoreQuarantine}]=await Promise.all([
import('../src/db/database-schema-control.ts'),import('../src/db/controlled-migration-history.ts'),import('../src/db/migration-manifest.ts'),
import('../src/db/migration-schema-inventory.ts'),import('../src/db/proposals/server-probe-legacy-0037-owned.ts'),import('../src/db/database-source-binding.ts'),
import('../src/services/server-probe-legacy-handoff-inspection.ts'),import('./database-writer-bootstrap-operator.mjs'),
import('../src/services/server-probe-legacy-source-inventory.ts'),import('../src/db/database-restore-quarantine.ts'),
])
const store=async(path,data)=>{await writeFile(path,data,{flag:'wx',mode:0o600});return path}
const {body:migrationBody,pin}=await ownedLegacyProbe0037Body(),manifestSha256=migrationManifestDigest()
const truncate=`TRUNCATE TABLE ${LEGACY_PROBE_RELATIONS.map(name=>`ONLY public.${name}`).join(', ')} CONTINUE IDENTITY RESTRICT`
const base=await live.connect()
let before,after
const schema=async sql=>{
await sql.query("SET LOCAL search_path=pg_catalog; SET LOCAL TimeZone='UTC'; SET LOCAL DateStyle='ISO, YMD'")
return (await captureMigrationSchema(sql,{scope:{applicationNamespaces:['public'],excludedControlNamespaces:['mmapp_control']},deadlineAt:Date.now()+30000})).sha256
}
try {
await base.query('BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY');before=await schema(base);await base.query('ROLLBACK')
await base.query('BEGIN ISOLATION LEVEL REPEATABLE READ READ WRITE')
await base.query(truncate);await base.query(migrationBody);await base.query('SET TRANSACTION READ ONLY');after=await schema(base)
} finally { try { await base.query('ROLLBACK') } finally { base.release() } }
assert.notEqual(before,after)
await live.query(DATABASE_RESTORE_QUARANTINE_DDL)
const control=await acquireDatabaseSchemaControl(live)
try {
// The guarded fixture already installed exactly these 36 files on the owned DB.
for(const migration of MIGRATION_MANIFEST.slice(0,36)){
const id=randomUUID(), begun=await control.transition({type:'begin',id,kind:'migration',manifestSha256,artifactSha256:migration.sha256})
await control.transition({type:'terminal',id,outcome:'observed-success',observationSha256:await observation(begun.state.intent,migration)})
}
} finally { await control.close() }
const baseline=(await live.query('SELECT state FROM mmapp_control.database_schema_state WHERE id=1')).rows[0].state
const registry=await readDatabaseSourceBindingRegistry(originalPin),record=registry.body.source,host='localhost'
const tls={serverName:host,caSha256:sourceBindingSha256(leafBytes),spkiSha256:sourceBindingSha256(new X509Certificate(leafBytes).publicKey.export({type:'spki',format:'der'}))}
const names={publisher:options.user,runtime:'owned_handoff_runtime',operator:'owned_handoff_operator',control:'owned_handoff_control',capture:'owned_handoff_capture'}
await live.query(Object.values(names).filter(name=>name!==options.user).map(name=>`CREATE ROLE ${name} NOLOGIN`).join(';'))
const {rows:roles}=await live.query('SELECT rolname AS name,oid::text AS "signedOid" FROM pg_catalog.pg_roles WHERE rolname=ANY($1)',[Object.values(names)])
const request={format:'application-writer-bootstrap-request-v1',installationId:originalPin.installationId,sourceHeadSha256:originalPin.currentHeadSha256,tls,
roles:Object.fromEntries(Object.entries(names).map(([scope,name])=>[scope,roles.find(role=>role.name===name)])),
source:{systemIdentifier:record.systemIdentifier,databaseOid:String(record.databaseOid),databaseName:record.databaseName,serverVersionNum:record.serverVersionNum,inRecovery:false}}
const boot=sourceBindingBytes(createBootstrapMaterial(request,sourceBindingSha256(sourceBindingBytes(request))).bootstrap)
const transport=sourceBindingBytes({host,port:options.port,user:options.user,password:options.password,database:options.database})
const activationDirectory=join(directory,'owned-handoff-active');await mkdir(activationDirectory,{mode:0o700})
const activation=sourceBindingBytes({format:'database-source-activation-v1',activationDirectory,installationId:originalPin.installationId,
sourceIdentityId:registry.body.sourceIdentityId,status:'active',publicKeySpkiSha256:originalPin.publicKeySpkiSha256,
generations:[{generation:registry.body.generation,headSha256:registry.headSha256,bindingSha256:registry.head.bindingSha256,tlsSpkiSha256:tls.spkiSha256}]})
await store(join(activationDirectory,'source-activation.json'),activation)
const argv=['legacy-handoff-inspect','--bootstrap',await store(join(directory,'owned-handoff-bootstrap.json'),boot),'--bootstrap-sha256',sourceBindingSha256(boot),
'--transport',await store(join(directory,'owned-handoff-transport.json'),transport),'--transport-sha256',sourceBindingSha256(transport),
'--ca',await store(join(directory,'owned-handoff-ca.pem'),leafBytes),'--source-registry',originalPin.registryDirectory,'--source-spki-sha256',originalPin.publicKeySpkiSha256,
'--activation-directory',activationDirectory,'--activation-sha256',sourceBindingSha256(activation)]
let modeledFiles
if(process.platform==='win32'){
const {mock}=await import('node:test'),url=new URL('./writer-profile/operator-files.mjs',import.meta.url),files=await import(url.href)
const protectedDirectory=async path=>{assert(path===directory||path.startsWith(directory+sep));assert.equal(await realpath(path),path)}
modeledFiles=mock.module(url,{namedExports:{...files,protectedDirectory,async writeFile(path,blob,options){
await protectedDirectory(dirname(path));const file=await open(path,options.flag,options.mode)
try{await file.writeFile(blob);await file.sync()}finally{await file.close()}
},async readProtected(path,limit,hash){
await protectedDirectory(dirname(path));const bytes=await readFile(path);assert(bytes.length>0&&bytes.length<=limit);if(hash!==undefined)assert.equal(sourceBindingSha256(bytes),hash);return bytes
},async withJournalLease(path,work){
await protectedDirectory(path);const lock=join(path,'publisher-lease.lock'),file=await open(lock,'wx',0o600)
try{return await work()}finally{await file.close();await unlink(lock)}
}}})
}
try{
const {main}=await import('./database-writer-profile-operator.mts')
const {publishLegacyHandoffIntent}=await import('./writer-profile/publisher.mjs')
if(intentOnly){
const cases=['no-drain','control-refusal','acknowledged','lost-ack']
for(const testCase of cases){
const operationId=randomUUID(),archiveDirectory=join(directory,operationId);await mkdir(archiveDirectory,{mode:0o700})
for(const [name,blob] of [['legacy-probe.dump',archive],['legacy-probe-approval.json',signedApproval],['legacy-probe-cold.dump',fullArchive]])await store(join(archiveDirectory,name),blob)
const application=await live.connect()
if(testCase==='control-refusal')await live.query(`CREATE FUNCTION mmapp_control.owned_refuse_quarantine() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN RAISE EXCEPTION 'owned control refusal'; END $$;
CREATE TRIGGER owned_refuse_quarantine BEFORE UPDATE ON mmapp_control.database_restore_quarantine FOR EACH ROW EXECUTE FUNCTION mmapp_control.owned_refuse_quarantine()`)
let control,commits=0
try{
if(testCase!=='no-drain')for(const key of [8723130,8723102,8723110])await application.query('SELECT pg_advisory_lock($1::bigint)',[key])
await application.query('BEGIN ISOLATION LEVEL REPEATABLE READ READ WRITE')
if(testCase!=='no-drain')await application.query(`LOCK TABLE ${[...LEGACY_PROBE_CUSTODY_RELATIONS,'mcp_settings'].map(name=>`public.${name}`).join(', ')} IN ACCESS EXCLUSIVE MODE NOWAIT`)
const {rows:[{xid}]}=await application.query('SELECT pg_current_xact_id()::text AS xid')
const intent={format:'legacy-probe-0037-handoff-intent-v1',operationId,applicationXid:xid,approvalSha256:sourceBindingSha256(signedApproval),
coldArchiveSha256:sourceBindingSha256(fullArchive),preSchemaSha256:before,postSchemaSha256:after,manifestSha256,migrationSha256:pin.sha256}
const signedIntent=sourceBindingBytes({body:intent,signature:sign(null,Buffer.from(LEGACY_PROBE_HANDOFF_DOMAIN+sourceBindingCanonical(intent)),privateKey).toString('base64url')})
control=await acquireDatabaseSchemaControl({async connect(){
const client=await live.connect()
return {release:bad=>client.release(bad),async query(text,values){
const result=await client.query(text,values)
if(text==='COMMIT'&&++commits===2&&testCase==='lost-ack')throw Error('owned control COMMIT ACK lost')
return result
}}
}})
const publish=()=>publishLegacyHandoffIntent({application,control,sourcePin:originalPin,tlsPin:tls,archiveDirectory,signedIntent,deadlineAt:Date.now()+30000})
const intentFile=join(archiveDirectory,'legacy-probe-handoff-intent.json'), unknownFile=join(archiveDirectory,'legacy-probe-handoff-control-unknown.json')
if(testCase==='acknowledged'){
const receipt=await publish();assert.equal(receipt.intentRecorded,true);assert.equal(receipt.readyAuthorized,false)
}else if(testCase==='no-drain'){
await assert.rejects(publish(),/exclusive drain no longer held/)
await assert.rejects(readFile(intentFile),{code:'ENOENT'})
}else await assert.rejects(publish(),{outcomeUnknown:testCase==='lost-ack'})
if(testCase!=='no-drain')assert.equal(sourceBindingSha256(await readFile(intentFile)),sourceBindingSha256(signedIntent))
if(testCase==='lost-ack'){
const observation=JSON.parse(await readFile(unknownFile,'utf8'))
assert.equal(observation.operationId,operationId);assert.equal(observation.automaticReplay,false)
await assert.rejects(publish(),{code:'EEXIST'})
assert.equal(commits,2)
}else await assert.rejects(readFile(unknownFile),{code:'ENOENT'})
const recorded=testCase==='acknowledged'||testCase==='lost-ack'
const {rows:[facts]}=await live.query(`SELECT q.operation_id,s.state->'intent'->>'id' AS pending,
(SELECT count(*)::int FROM mmapp_control.database_schema_intents) AS history
FROM mmapp_control.database_restore_quarantine q CROSS JOIN mmapp_control.database_schema_state s WHERE q.id=1 AND s.id=1`)
assert.deepEqual(facts,{operation_id:recorded?operationId:null,pending:recorded?operationId:null,history:recorded?37:36})
await application.query('ROLLBACK')
await application.query('SELECT pg_advisory_unlock_all()')
if(recorded){
const result=await main([...argv,'--archive-directory',archiveDirectory,'--handoff-intent-sha256',sourceBindingSha256(signedIntent)])
assert.equal(result.outcome,'rolled-back');assert.equal(result.operationId,operationId);assert.equal(result.quarantineActive,true)
}
if(recorded&&testCase!=='lost-ack'){
await live.query('DELETE FROM mmapp_control.database_schema_intents WHERE id=$1',[operationId])
await live.query('UPDATE mmapp_control.database_schema_state SET state=$1::jsonb WHERE id=1',[JSON.stringify(baseline)])
await live.query('UPDATE mmapp_control.database_restore_quarantine SET operation_id=NULL WHERE id=1')
}
}finally{
try{await control?.close()}finally{application.release(true)}
if(testCase==='control-refusal')await live.query('DROP TRIGGER owned_refuse_quarantine ON mmapp_control.database_restore_quarantine; DROP FUNCTION mmapp_control.owned_refuse_quarantine()')
}
}
return {legacyHandoffIntentPublished:true,controlRefusalAtomic:true,controlAckLossRecordedUnknown:true,applicationCommit:false,readyAuthorized:false}
}
for(const commits of [false,true]){
const operationId=randomUUID(),archiveDirectory=join(directory,operationId);await mkdir(archiveDirectory,{mode:0o700})
for(const [name,blob] of [['legacy-probe.dump',archive],['legacy-probe-approval.json',signedApproval],['legacy-probe-cold.dump',fullArchive]])await store(join(archiveDirectory,name),blob)
const application=await live.connect()
try{
await application.query('BEGIN');const {rows:[{xid}]}=await application.query('SELECT pg_current_xact_id()::text AS xid')
const body={format:'legacy-probe-0037-handoff-intent-v1',operationId,applicationXid:xid,approvalSha256:sourceBindingSha256(signedApproval),
coldArchiveSha256:sourceBindingSha256(fullArchive),preSchemaSha256:before,postSchemaSha256:after,manifestSha256,migrationSha256:pin.sha256}
const intent=sourceBindingBytes({body,signature:sign(null,Buffer.from(LEGACY_PROBE_HANDOFF_DOMAIN+sourceBindingCanonical(body)),privateKey).toString('base64url')})
const file=await open(join(archiveDirectory,'legacy-probe-handoff-intent.json'),'wx',0o600)
try { await file.writeFile(intent);await file.sync() } finally { await file.close() }
const input=[...argv,'--archive-directory',archiveDirectory,'--handoff-intent-sha256',sourceBindingSha256(intent)]
const controller=await acquireDatabaseSchemaControl(live)
try{await controller.transition({type:'begin',id:operationId,kind:'migration',manifestSha256,artifactSha256:sourceBindingSha256(intent)})}finally{await controller.close()}
await beginDatabaseRestoreQuarantine(live,operationId)
const inspect=async expected=>{
const result=await main(input)
assert.deepEqual({outcome:result.outcome,operationId:result.operationId,quarantine:result.quarantineActive,ready:result.readyAuthorized},
{outcome:expected,operationId,quarantine:true,ready:false})
const {rows:[gates]}=await live.query(`SELECT q.operation_id,s.state->'intent'->>'id' AS pending
FROM mmapp_control.database_restore_quarantine q CROSS JOIN mmapp_control.database_schema_state s WHERE q.id=1 AND s.id=1`)
assert.deepEqual(gates,{operation_id:operationId,pending:operationId})
}
await inspect('unknown')
if(commits){await application.query(truncate);await application.query(migrationBody)}
await application.query(commits?'COMMIT':'ROLLBACK')
await inspect(commits?'committed':'rolled-back')
if(!commits){
// Own harness resets its control-only fixture for the independent COMMIT case.
await live.query('DELETE FROM mmapp_control.database_schema_intents WHERE id=$1',[operationId])
await live.query('UPDATE mmapp_control.database_schema_state SET state=$1::jsonb WHERE id=1',[JSON.stringify(baseline)])
await live.query('UPDATE mmapp_control.database_restore_quarantine SET operation_id=NULL WHERE id=1')
}
}finally{try{await application.query('ROLLBACK')}finally{application.release()}}
}
} finally { modeledFiles?.restore() }
return {legacyHandoffInspection:true,unknownObserved:true,rollbackObserved:true,commitObserved:true,quarantineCleared:false,readyAuthorized:false}
}
+135 -3
View File
@@ -64,6 +64,47 @@ async function scoped(client) {
} }
try { try {
assert.notEqual(process.pid, Number(process.env.OWN_SERVER_PID)) assert.notEqual(process.pid, Number(process.env.OWN_SERVER_PID))
phase = 'http:owner-logs-lifecycle'
{
const headers = { authorization: 'Bearer ' + process.env.OWN_PORTAL_JWT, 'content-type': 'application/json' }
const allowedServer = Number(process.env.OWN_ALLOWED_SERVER), forbiddenServer = Number(process.env.OWN_FORBIDDEN_SERVER)
const issuedResponse = await boundedFetch(origin + '/api/mcp/connections', {
method: 'POST', headers,
body: JSON.stringify({ name: 'Owned portal log reader', mode: 'observer', expiresAt: new Date(Date.now() + 600000).toISOString(),
permissions: ['mm:servers:read'], scope: { serverIds: [allowedServer], operationIds: ['logs.query'], allowGlobal: false } }),
})
assert.equal(issuedResponse.status, 200)
const { connection, token } = await issuedResponse.json()
const client = await opened('http', token)
const queryLogs = serverId => client.callTool({
name: 'mm_logs_query', arguments: { serverId, q: 'external-sdk-log-', limit: 1 },
}, undefined, { timeout: 5000 })
try {
assert.deepEqual((await client.listTools({}, { timeout: 5000 })).tools.map(tool => tool.name), ['mm_logs_query'])
const result = content(await queryLogs(allowedServer))
assert.deepEqual(result.entries.map(entry => entry.serverId), [allowedServer])
await denied(() => queryLogs(forbiddenServer))
const monitor = await boundedFetch(origin + '/api/mcp/requests?' + new URLSearchParams({
connectionId: connection.id, tool: 'mm_logs_query',
}), { headers })
assert.equal(monitor.status, 200)
const body = await monitor.text()
assert(!body.includes(token))
const { items } = JSON.parse(body)
assert.equal(items.length, 2)
assert(items.every(row => row.connection_id === connection.id && row.tool === 'mm_logs_query'))
assert(items.some(row => row.status === 'denied'))
assert(items.some(row => row.error_code === null && row.finished_at && row.result?.entries?.[0]?.serverId === allowedServer))
const revoke = await boundedFetch(origin + '/api/mcp/connections/' + connection.id + '/status', {
method: 'POST', headers, body: JSON.stringify({ status: 'revoked' }),
})
assert.equal(revoke.status, 200)
await denied(() => queryLogs(allowedServer))
await assert.rejects(opened('http', token))
cases.push('http: owner API issues restricted log access, monitors allow/deny and revokes the same SDK connection')
} finally { await client.close().catch(() => {}) }
}
for (const mode of ['http', 'stdio']) { for (const mode of ['http', 'stdio']) {
phase = mode + ':issue'; const initial = await control('new-connection'); let token = initial.token phase = mode + ':issue'; const initial = await control('new-connection'); let token = initial.token
phase = mode + ':initialize'; let client = await opened(mode, token) phase = mode + ':initialize'; let client = await opened(mode, token)
@@ -117,9 +158,24 @@ try {
} finally { await client.close().catch(() => {}) } } finally { await client.close().catch(() => {}) }
} }
phase = 'http:body-bound'; const bound = await control('new-connection') phase = 'http:body-bound'; const bound = await control('new-connection')
const oversized = await fetch(endpoint, { method: 'POST', headers: { authorization: 'Bearer ' + bound.token, 'content-type': 'application/json', accept: 'application/json,text/event-stream', connection: 'close' }, // Exercise the declared length check without racing the rejected upload.
body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'mm_servers_list', arguments: { padding: 'x'.repeat(1048576) } } }), signal: AbortSignal.timeout(5000) }) const { request } = await import('node:http')
assert.equal(oversized.status, 413); assert((await oversized.text()).length < 65536) const oversized = await new Promise((resolve, reject) => {
const req = request(endpoint, { method: 'POST', headers: { authorization: 'Bearer ' + bound.token,
'content-type': 'application/json', accept: 'application/json,text/event-stream', connection: 'close',
'content-length': '1048577' }, signal: AbortSignal.timeout(5000) }, response => {
let bytes = 0
response.on('data', chunk => {
bytes += chunk.length
if (bytes >= 65536) req.destroy(Error('Oversized refusal response'))
})
response.once('error', reject)
response.once('end', () => resolve(response.statusCode))
})
req.once('error', reject)
req.flushHeaders()
})
assert.equal(oversized, 413)
cases.push('actual HTTP request envelope over1MiB refused before tool execution; successful client results remain bounded') cases.push('actual HTTP request envelope over1MiB refused before tool execution; successful client results remain bounded')
phase = 'sdk:pkce'; const grant = await control('new-connection') phase = 'sdk:pkce'; const grant = await control('new-connection')
@@ -251,6 +307,82 @@ try {
assert.equal(management.status, 200) assert.equal(management.status, 200)
cases.push('portal owner revocation blocks an existing unexpired log artifact even with refreshed owner login') cases.push('portal owner revocation blocks an existing unexpired log artifact even with refreshed owner login')
} finally { await exportClient.close().catch(() => {}) } } finally { await exportClient.close().catch(() => {}) }
phase = 'portal:approved-plan-apply'
{
const headers = { authorization: 'Bearer ' + process.env.OWN_PORTAL_JWT, 'content-type': 'application/json' }
const settings = async () => {
const response = await boundedFetch(origin + '/api/logs/settings', { headers })
assert.equal(response.status, 200)
return response.json()
}
const before = await settings()
const intervalSec = before.intervalSec === 60 ? 61 : 60
const issued = await boundedFetch(origin + '/api/mcp/connections', {
method: 'POST', headers,
body: JSON.stringify({ name: 'Owned portal log settings approval', mode: 'approval',
expiresAt: new Date(Date.now() + 600000).toISOString(), permissions: ['mm:settings:admin'],
scope: { serverIds: [Number(process.env.OWN_ALLOWED_SERVER), Number(process.env.OWN_FORBIDDEN_SERVER)],
operationIds: ['logs.settings.update', 'changes.apply', 'operations.read'], allowGlobal: true } }),
})
assert.equal(issued.status, 200)
const { connection, token } = await issued.json()
const client = await opened('http', token)
try {
phase = 'portal:read-approved-plan-preview'
const call = (name, arguments_) => client.callTool({ name, arguments: arguments_ }, undefined, { timeout: 5000 })
const plan = content(await call('mm_logs_settings_update_plan', { settings: { intervalSec } }))
assert.equal(plan.state, 'awaiting-approval')
const planUrl = origin + '/api/mcp/plans/' + plan.planId
const review = await boundedFetch(planUrl, { headers })
assert.equal(review.status, 200)
const preview = await review.json()
assert.equal(preview.id, plan.planId)
assert.equal(preview.connectionId, connection.id)
assert.equal(preview.operationId, 'logs.settings.update')
assert.equal(preview.state, 'awaiting-approval')
assert.deepEqual(preview.input.settings, { intervalSec })
phase = 'portal:refuse-unapproved-plan'
const idempotencyKey = randomUUID()
const apply = () => call('mm_change_apply', { planId: plan.planId, idempotencyKey })
await denied(apply)
assert.deepEqual(await settings(), before)
phase = 'portal:approve-exact-plan'
const decision = await boundedFetch(planUrl + '/decision', {
method: 'POST', headers, body: JSON.stringify({ approve: true }),
})
assert.equal(decision.status, 200)
phase = 'portal:apply-and-read-settings'
const operation = content(await apply())
assert.match(operation.id, /^[a-f0-9-]{36}$/)
let terminal
const deadline = Date.now() + 10000
do {
terminal = content(await call('mm_operation_get', { operationId: operation.id }))
if (!['pending', 'running'].includes(terminal.state)) break
await new Promise(resolve => setTimeout(resolve, 100))
} while (Date.now() < deadline)
assert.equal(terminal.state, 'applied')
assert.equal(terminal.verification, 'passed')
assert.deepEqual(await settings(), { ...before, intervalSec })
assert.equal(content(await apply()).id, operation.id)
phase = 'portal:monitor-applied-plan'
const list = await boundedFetch(origin + '/api/mcp/operations?' + new URLSearchParams({ connectionId: connection.id }), { headers })
assert.equal(list.status, 200)
const { items } = await list.json()
assert.deepEqual(items.map(({ id, plan_id, state, verification }) => ({ id, plan_id, state, verification })), [
{ id: operation.id, plan_id: plan.planId, state: 'applied', verification: 'passed' },
])
phase = 'portal:revoke-after-apply'
const revoked = await boundedFetch(origin + '/api/mcp/connections/' + connection.id + '/status', {
method: 'POST', headers, body: JSON.stringify({ status: 'revoked' }),
})
assert.equal(revoked.status, 200)
await denied(apply)
await assert.rejects(opened('http', token))
cases.push('portal API approves the exact log settings plan; SDK applies once and owner sees the verified operation')
} finally { await client.close().catch(() => {}) }
}
phase = 'portal:revoke-approved-plan' phase = 'portal:revoke-approved-plan'
const planAccess = await control('new-revocable-plan-connection') const planAccess = await control('new-revocable-plan-connection')
const planClient = await opened('http', planAccess.token) const planClient = await opened('http', planAccess.token)
@@ -0,0 +1,205 @@
import assert from 'node:assert/strict'
import { createHash } from 'node:crypto'
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client'
import { resumeMcpSteps } from '../acceptance/mcp-step-journal.mjs'
async function withClient(endpoint, token, run) {
const client = new Client({ name: 'owned-logs-sdk', version: '1.0.0' })
try {
await client.connect(new StreamableHTTPClientTransport(endpoint, {
requestInit: { headers: { authorization: 'Bearer ' + token } },
}), { timeout: 5000 })
return await run(async (name, args = {}) => {
const reply = await client.callTool({ name, arguments: args }, undefined, { timeout: 5000 })
assert(!reply.isError, name + ' failed')
return reply.structuredContent.result
})
} finally {
await client.close()
}
}
export async function verifyLogsHistory(endpoint, token, serverId, entries, journal, fixture, appendEvent) {
assert.equal(endpoint.hostname, '127.0.0.1')
const [newest, oldest] = entries
const filters = { serverId, q: 'external-sdk-log-', levels: ['info'] }
const config = { journal, fixture, steps: [
{ id: 'mm_logs_query', async check(call) {
const first = await call('mm_logs_query', { ...filters, limit: 1 })
assert.deepEqual(first.entries.map(entry => entry.id), [newest.id])
assert.ok(first.nextCursor)
const next = await call('mm_logs_query', { ...filters, limit: 1, cursor: first.nextCursor })
assert.deepEqual(next.entries.map(entry => entry.id), [oldest.id])
assert.equal(next.nextCursor, null)
} },
{ id: 'mm_logs_summary_get', async check(call) {
const summary = await call('mm_logs_summary_get', filters)
assert.equal(summary.total, 2)
assert.equal(summary.levels.info, 2)
} },
{ id: 'mm_logs_get', async check(call) {
const entry = await call('mm_logs_get', { serverId, id: newest.id })
assert.equal(entry.id, newest.id)
assert.equal(entry.serverId, serverId)
assert.equal(entry.message, newest.message)
} },
{ id: 'mm_logs_context_get', async check(call) {
const context = await call('mm_logs_context_get', { serverId, id: newest.id })
assert.equal(context.entry.id, newest.id)
assert.deepEqual(context.before.map(entry => [entry.serverId, entry.id]), [[serverId, oldest.id]])
assert.deepEqual(context.after, [])
} },
{ id: 'mm_logs_follow', async check(call) {
const args = { ...filters, limit: 1, waitSeconds: 0 }
const first = await call('mm_logs_follow', args)
assert.deepEqual(first.entries, [], 'Initial follow starts at the current watermark')
assert.ok(first.cursor)
const id = await appendEvent()
const next = await call('mm_logs_follow', { ...args, cursor: first.cursor })
assert.deepEqual(next.entries.map(entry => entry.id), [id])
const end = await call('mm_logs_follow', { ...args, cursor: next.cursor })
assert.deepEqual(end.entries, [])
} },
].map(({ id, check }) => ({ id, kind: 'read', async run() {
await withClient(endpoint, token, check)
return null
} })) }
const result = await resumeMcpSteps(config)
assert.equal(result.status, 'passed', JSON.stringify(result))
return config.steps.map(step => step.id)
}
export async function verifyLogsSettingsPlan(endpoint, token, connectionId, ownerJwt, journal, fixture) {
assert.equal(endpoint.hostname, '127.0.0.1')
const owner = async (path, body) => {
const response = await fetch(new URL(path, endpoint), {
headers: { authorization: 'Bearer ' + ownerJwt, 'content-type': 'application/json' },
redirect: 'error',
signal: AbortSignal.timeout(5000),
...(body && { method: 'POST', body: JSON.stringify(body) }),
})
assert.equal(response.status, 200, path)
return response.json()
}
const settingsPath = '/api/logs/settings'
const before = await owner(settingsPath)
const intervalSec = before.intervalSec === 60 ? 61 : 60
return withClient(endpoint, token, async call => {
const planStep = 'mm_logs_settings_update_plan'
const applyStep = 'mm_change_apply'
const config = { journal, fixture, steps: [
{ id: planStep, kind: 'plan', async run({ accept }) {
const plan = await call(planStep, { settings: { intervalSec } })
accept(plan.planId)
assert.equal(plan.state, 'awaiting-approval')
return plan.planId
} },
{ id: 'owner.decision', kind: 'apply', async run({ evidence, accept }) {
const planId = evidence.get(planStep)
const path = '/api/mcp/plans/' + planId
const plan = await owner(path)
assert.equal(plan.id, planId)
assert.equal(plan.operationId, 'logs.settings.update')
assert.equal(plan.connectionId, connectionId)
assert.equal(plan.state, 'awaiting-approval')
assert.deepEqual(plan.input.settings, { intervalSec })
assert.deepEqual(await owner(settingsPath), before)
assert.deepEqual(await owner(path + '/decision', { approve: true }), { ok: true })
accept(planId)
return planId
}, async reconcile({ evidence }) {
const planId = evidence.get(planStep)
const plan = await owner('/api/mcp/plans/' + planId)
return plan.state === 'approved' && plan.connectionId === connectionId
? { state: 'verified', evidence: planId } : { state: 'unknown' }
} },
{ id: applyStep, kind: 'apply', async run({ evidence, idempotencyKey, accept }) {
const operation = await call(applyStep, { planId: evidence.get(planStep), idempotencyKey })
accept(operation.id)
return operation.id
} },
{ id: 'mm_operation_get', kind: 'read', async run({ evidence, attempt }) {
if (attempt === 1) throw Object.assign(new Error('Simulated interruption before status read'), { code: 'FIXTURE_INTERRUPTED' })
const operationId = evidence.get(applyStep)
const deadline = Date.now() + 10000
let operation
do {
operation = await call('mm_operation_get', { operationId })
assert.equal(operation.id, operationId)
assert.equal(operation.plan_id, evidence.get(planStep))
assert.equal(operation.connection_id, connectionId)
if (!['pending', 'running'].includes(operation.state)) break
await new Promise(resolve => setTimeout(resolve, 100))
} while (Date.now() < deadline)
assert.equal(operation.state, 'applied')
assert.equal(operation.verification, 'passed')
assert.deepEqual(await owner(settingsPath), { ...before, intervalSec })
return operationId
} },
] }
assert.deepEqual(await resumeMcpSteps(config), { status: 'failed', step: 'mm_operation_get' }, journal)
assert.deepEqual(await resumeMcpSteps(config), { status: 'passed' }, journal)
return config.steps.map(step => step.id)
})
}
export async function verifyLogsReads(endpoint, serverId, exportToken, settingsToken, ownerJwt, journal, fixture) {
assert.equal(endpoint.hostname, '127.0.0.1')
const publish = async (call, accept) => {
const artifact = await call('mm_logs_export', { serverId, q: 'external-sdk-log-1', format: 'json' })
accept(artifact.artifactId)
assert.equal(artifact.rows, 1)
return artifact.artifactId
}
const read = async (call, artifactId) => {
const first = await call('mm_logs_export_read', { artifactId, limit: 16 })
assert(Number.isSafeInteger(first.bytes) && first.bytes > 16 && first.bytes <= 8192)
assert.equal(first.offset, 0)
assert.equal(first.nextOffset, 16)
assert.equal(first.complete, false)
const last = await call('mm_logs_export_read', { artifactId, offset: first.nextOffset })
assert.equal(last.offset, 16)
assert.equal(last.nextOffset, null)
assert.equal(last.complete, true)
for (const part of [first, last]) {
assert.equal(part.artifactId, artifactId)
assert.equal(part.sha256, first.sha256)
assert.equal(part.bytes, first.bytes)
}
const content = Buffer.concat([first, last].map(part => Buffer.from(part.dataBase64, 'base64')))
assert.equal(content.length, first.bytes)
assert.equal(createHash('sha256').update(content).digest('hex'), first.sha256)
assert.match(content.toString('utf8'), /external-sdk-log-1/)
assert.doesNotMatch(content.toString('utf8'), /external-sdk-log-2/)
return artifactId
}
const config = { journal, fixture, steps: [
{ id: 'mm_logs_export', kind: 'apply',
run: ({ accept }) => withClient(endpoint, exportToken, call => publish(call, accept)),
// An unknown publication has no idempotency key. Stop for reconciliation.
},
{ id: 'mm_logs_export_read', kind: 'read',
run: ({ evidence }) => withClient(endpoint, exportToken, call => read(call, evidence.get('mm_logs_export'))),
},
{ id: 'mm_logs_settings_get', kind: 'read', async run({ attempt }) {
if (attempt === 1) throw Object.assign(new Error('Simulated interruption before settings read'), {
code: 'FIXTURE_INTERRUPTED',
})
await withClient(endpoint, settingsToken, async call => {
const response = await fetch(new URL('/api/logs/settings', endpoint), {
headers: { authorization: 'Bearer ' + ownerJwt },
redirect: 'error',
signal: AbortSignal.timeout(5000),
})
assert.equal(response.status, 200)
const expected = await response.json()
assert.equal(expected.enabled, false)
assert.deepEqual(await call('mm_logs_settings_get'), expected)
})
return null
} },
] }
assert.deepEqual(await resumeMcpSteps(config), { status: 'failed', step: 'mm_logs_settings_get' }, journal)
assert.deepEqual(await resumeMcpSteps(config), { status: 'passed' }, journal)
return config.steps.map(step => step.id)
}
@@ -0,0 +1,147 @@
import assert from 'node:assert/strict'
import { createServer } from 'node:http'
import { join } from 'node:path'
import { setTimeout as delay } from 'node:timers/promises'
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client'
import { resumeServerPoll } from '../acceptance/mcp-server-poll-steps.mjs'
export async function verifyPollSteps(endpoint, pool, jwt, output) {
assert.equal(endpoint.hostname, '127.0.0.1')
const replies = {
'/rest/system/identity': { name: 'Owned synthetic router' },
'/rest/system/resource': { version: '7.owned', 'board-name': 'Owned', uptime: '1h', 'cpu-load': '2', 'free-memory': '1024', 'total-memory': '2048' },
'/rest/interface': [{ name: 'ether1', type: 'ether' }],
'/rest/ip/address': [{ interface: 'ether1', address: '192.0.2.1/24' }],
}
const native = []
const router = createServer((request, response) => {
native.push(request.url)
if (request.method !== 'GET' || !Object.hasOwn(replies, request.url)) return response.writeHead(403).end()
response.setHeader('content-type', 'application/json')
response.end(JSON.stringify(replies[request.url]))
})
let client
try {
await new Promise((resolve, reject) => router.once('error', reject).listen(0, '127.0.0.1', resolve))
const { rows: [server] } = await pool.query(`INSERT INTO servers(name,host,port,use_ssl,verify_ssl,enabled,username,password)
VALUES('Owned poll','127.0.0.1',$1,false,false,true,'owned-router','fixture') RETURNING id`, [router.address().port])
const serverId = Number(server.id)
const { rows: catalogue } = await pool.query('SELECT id FROM servers ORDER BY id')
const owner = async (path, body) => {
const response = await fetch(new URL(path, endpoint), {
headers: { authorization: 'Bearer ' + jwt, 'content-type': 'application/json' },
...(body && { method: 'POST', body: JSON.stringify(body) }),
redirect: 'error', signal: AbortSignal.timeout(5000),
})
assert.equal(response.status, 200, path)
return response.json()
}
const { connection, token } = await owner('/api/mcp/connections', {
name: 'Owned poll steps', mode: 'approval', expiresAt: new Date(Date.now() + 180000).toISOString(),
permissions: ['mm:servers:read', 'mm:servers:write', 'mm:settings:admin'],
scope: { serverIds: catalogue.map(row => Number(row.id)), operationIds: ['servers.poll', 'changes.apply', 'operations.read'], allowGlobal: true },
limits: { callsPerMinute: 120, mutationsPerHour: 10000, objectsPerPlan: 10000 },
})
const connect = async () => {
await client?.close()
client = new Client({ name: 'owned-poll-steps', version: '1.0.0' })
await client.connect(new StreamableHTTPClientTransport(endpoint, {
requestInit: { headers: { authorization: 'Bearer ' + token } },
}), { timeout: 5000 })
}
await connect()
const journal = join(output, 'poll-' + connection.id + '.jsonl')
let planId
let approvedExpiresAt
let operationId
let operation
let interruptStatus = true
let applyKey
const config = {
journal, fixture: 'owned-poll', serverId, connectionId: connection.id,
async findAcceptedOperation({ connectionId: scope, planId: plan, idempotencyKey }) {
assert.equal(operationId, undefined)
assert.equal(scope, connection.id)
assert.equal(plan, planId)
assert.equal(idempotencyKey, applyKey)
const { rows } = await pool.query(`SELECT id FROM mcp_operations
WHERE connection_id=$1 AND plan_id=$2 AND idempotency_key=$3`, [scope, plan, idempotencyKey])
assert.equal(rows.length, 1)
operationId = rows[0].id
return operationId
},
async call(name, args) {
if (name === 'mm_operation_get' && interruptStatus) {
interruptStatus = false
assert.equal(args.operationId, operationId)
throw Object.assign(new Error('Simulated interruption before reading status'), { code: 'FIXTURE_INTERRUPTED' })
}
const reply = await client.callTool({ name, arguments: args }, undefined, { timeout: name === 'mm_server_poll_plan' ? 45000 : 5000 })
if (reply.isError) {
const error = JSON.parse(reply.content.find(item => item.type === 'text').text)
const code = /^[A-Z0-9_]{1,64}$/.test(error.code) ? error.code : 'POLL_SDK_ERROR'
console.error('Owned SDK tool refused:', name, code)
throw Object.assign(new Error(name + ' failed'), { code })
}
const result = reply.structuredContent.result
if (name === 'mm_server_poll_plan') planId = result.planId
if (name === 'mm_change_apply') {
assert.equal(applyKey, undefined, 'Apply cannot be sent twice')
applyKey = args.idempotencyKey
// The endpoint accepted the request, but the journal never sees its response.
throw Object.assign(new Error('Simulated lost apply response'), { code: 'FIXTURE_LOST_APPLY' })
}
if (name === 'mm_operation_get') operation = result
return result
},
async assertApproved(id) {
const plan = await owner('/api/mcp/plans/' + id)
assert.equal(plan.connectionId, connection.id)
assert.equal(plan.operationId, 'servers.poll')
if (plan.state !== 'approved') throw Object.assign(new Error('Waiting for owner approval'), { code: 'POLL_AWAITING_APPROVAL' })
const expiresAt = Date.parse(plan.expiresAt)
assert(expiresAt > Date.now(), 'Approved poll must have a live expiry')
approvedExpiresAt = expiresAt
},
}
assert.deepEqual(await resumeServerPoll(config), { status: 'failed', step: 'manager.plan-approved' }, journal)
assert.ok(planId)
assert.deepEqual(await owner('/api/mcp/plans/' + planId + '/decision', { approve: true }), { ok: true })
assert.deepEqual(await resumeServerPoll(config), { status: 'failed', step: 'mm_change_apply' }, journal)
assert.ok(applyKey)
assert.equal(operationId, undefined)
await connect()
assert.deepEqual(await resumeServerPoll(config), { status: 'failed', step: 'mm_operation_get' }, journal)
assert.ok(operationId)
await connect()
const observationStartedAt = Date.now()
let state
while (true) {
const { rows } = await pool.query('SELECT state FROM mcp_operations WHERE id=$1 AND connection_id=$2', [operationId, connection.id])
state = rows[0]?.state
const remaining = approvedExpiresAt - Date.now()
if (!['pending', 'running'].includes(state) || remaining <= 0) break
await delay(Math.min(500, remaining))
}
const observedMs = Date.now() - observationStartedAt
const approvedLifetimeRemainingAtStartMs = approvedExpiresAt - observationStartedAt
assert.deepEqual(await resumeServerPoll(config), { status: 'passed' },
`${journal} DB state ${state} after ${observedMs} ms (original approval window ${approvedLifetimeRemainingAtStartMs} ms at start)`)
assert.equal(operation.id, operationId)
const receipt = operation.steps[0].result
assert.equal(receipt.snapshot.status, 'online')
assert.deepEqual(native.sort(), Object.keys(replies).sort())
const { rows } = await pool.query(`SELECT tool,count(*)::int AS count FROM mcp_requests
WHERE connection_id=$1 AND tool IN ('mm_server_poll_plan','mm_change_apply','mm_operation_get') GROUP BY tool`, [connection.id])
const calls = Object.fromEntries(rows.map(row => [row.tool, row.count]))
assert.equal(calls.mm_server_poll_plan, 1)
assert.equal(calls.mm_change_apply, 1)
assert.equal(calls.mm_operation_get, 1)
return { journal, operationId, calls, reconciledLostApply: true, sdkReconnects: 2, nativeReads: native.length, publications: receipt.completedPublications,
state: operation.state, verification: operation.verification, localPostgres: true, sdkHttp: true,
approvedExpiresAt: new Date(approvedExpiresAt).toISOString(), approvedLifetimeRemainingAtStartMs, observedMs }
} finally {
await client?.close()
if (router.listening) await new Promise((resolve, reject) => router.close(error => error ? reject(error) : resolve()))
}
}
@@ -0,0 +1,138 @@
import assert from 'node:assert/strict'
import { randomUUID } from 'node:crypto'
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client'
import { StdioClientTransport } from '@modelcontextprotocol/client/stdio'
const limit = 1024 * 1024
const budgetMeta = 'io.mikrotikmanager/result-budget'
const comment = 'Ж'.repeat(11000)
const payloadBytes = value => Buffer.byteLength(JSON.stringify(value), 'utf8')
const tools = ['mm_servers_list', 'mm_logs_settings_update_plan', 'mm_change_apply', 'mm_operation_get']
export async function verifyResultEnvelope(endpoint, pool, jwt, bridgeFile) {
assert.equal(new URL(endpoint).hostname, '127.0.0.1')
const { rows: [{ count: existingServers }] } = await pool.query('SELECT count(*)::int AS count FROM servers')
await pool.query(`
INSERT INTO servers(name,host,enabled,comment)
SELECT 'owned-envelope-'||n, '192.0.2.'||(10+n), false, $1 FROM generate_series(1,24) AS n
`, [comment])
const { rows: servers } = await pool.query('SELECT id FROM servers ORDER BY id')
// Independently observe actual writes, including an accidental repeat with unchanged settings.
await pool.query(`
CREATE TABLE owned_log_settings_writes (interval_sec integer NOT NULL);
CREATE FUNCTION owned_count_log_settings_write() RETURNS trigger LANGUAGE plpgsql AS $$
BEGIN
INSERT INTO owned_log_settings_writes VALUES (NEW.interval_sec);
RETURN NEW;
END $$;
CREATE TRIGGER owned_count_log_settings_write AFTER UPDATE ON router_log_settings
FOR EACH ROW EXECUTE FUNCTION owned_count_log_settings_write()`)
const headers = { authorization: 'Bearer ' + jwt, 'content-type': 'application/json' }
const json = async (path, body) => {
const response = await fetch(new URL(path, endpoint), {
headers, signal: AbortSignal.timeout(10000), ...(body ? { method: 'POST', body: JSON.stringify(body) } : {}),
})
assert.equal(response.status, 200, path)
return response.json()
}
const cases = []
for (const mode of ['http', 'stdio']) {
const { connection, token } = await json('/api/mcp/connections', {
name: 'Owned result envelope ' + mode, mode: 'approval', expiresAt: new Date(Date.now() + 600000).toISOString(),
permissions: ['mm:servers:read', 'mm:settings:admin'],
limits: { serversPerPlan: servers.length, mutationsPerHour: servers.length },
scope: { serverIds: servers.map(row => Number(row.id)), allowGlobal: true,
operationIds: ['servers.list', 'logs.settings.update', 'changes.apply', 'operations.read'] },
})
const client = new Client({ name: 'owned-result-envelope-' + mode, version: '1.0.0' })
const transport = mode === 'http'
? new StreamableHTTPClientTransport(new URL(endpoint), { requestInit: { headers: { authorization: 'Bearer ' + token } } })
: new StdioClientTransport({ command: process.execPath, args: ['--import', import.meta.resolve('tsx'), bridgeFile],
cwd: process.cwd(), env: { MCP_URL: endpoint, MCP_TOKEN: token }, maxBufferSize: limit + 65536, stderr: 'pipe' })
transport.stderr?.on('data', () => {})
try {
await client.connect(transport, { timeout: 10000 })
const observedTools = (await client.listTools({}, { timeout: 5000 })).tools.map(tool => tool.name)
assert.deepEqual(observedTools.sort(), [...tools].sort())
const call = async (name, args) => {
const result = await client.callTool({ name, arguments: args }, undefined, { timeout: 10000 })
assert(payloadBytes(result) <= limit, mode + ' ' + name)
return result
}
const output = result => {
if (result.isError) assert.fail(JSON.parse(result.content[0].text).code)
const text = JSON.parse(result.content[0].text)
assert.deepEqual(result.structuredContent.result, text)
return text
}
const accepted = await call('mm_servers_list', { limit: 23, offset: existingServers })
const page = output(accepted)
assert.equal(page.items.length, 23)
assert(page.items.every(item => item.comment === comment))
assert(payloadBytes(accepted) >= 1000000)
// Even without field names and framing this page's duplicated UTF-8 text exceeds 1 MiB.
assert(24 * Buffer.byteLength(comment, 'utf8') * 2 > limit)
const refused = await call('mm_servers_list', { limit: 24, offset: existingServers })
assert.equal(refused.isError, true)
assert.equal(refused.structuredContent, undefined)
assert.equal(JSON.parse(refused.content[0].text).code, 'RESULT_TOO_LARGE')
assert.deepEqual(refused._meta[budgetMeta], {
version: 1, detailsOmitted: true, reason: 'byte-budget', automaticReplay: false,
})
const before = await json('/api/logs/settings')
const intervalSec = before.intervalSec === 60 ? 61 : 60
const plan = output(await call('mm_logs_settings_update_plan', { settings: { intervalSec } }))
assert.equal(plan.state, 'awaiting-approval')
await json('/api/mcp/plans/' + plan.planId + '/decision', { approve: true })
const applyArgs = { planId: plan.planId, idempotencyKey: randomUUID() }
const operation = output(await call('mm_change_apply', applyArgs))
let terminal
for (const end = Date.now() + 10000; Date.now() < end;) {
terminal = output(await call('mm_operation_get', { operationId: operation.id }))
if (!['pending', 'running'].includes(terminal.state)) break
await new Promise(resolve => setTimeout(resolve, 100))
}
assert.equal(terminal.state, 'applied')
assert.equal(terminal.verification, 'passed')
const writes = async () => (await pool.query('SELECT count(*)::int AS n FROM owned_log_settings_writes')).rows[0].n
const checkEffect = async () => {
assert.equal(await writes(), cases.length + 1)
assert.deepEqual(await json('/api/logs/settings'), { ...before, intervalSec })
}
await checkEffect()
// Supply namespaced synthetic optional details to the actual, already applied operation.
// The ordinary runtime read and duplicate-apply paths must keep its original outcome.
const oversizedDetails = JSON.stringify(Array(24).fill(comment))
const staged = await pool.query(`
UPDATE mcp_operations SET result=jsonb_set(COALESCE(result, '{}'::jsonb), '{ownedEnvelopeDetails}', $2::jsonb)
WHERE id=$1 AND state='applied' RETURNING id`, [operation.id, oversizedDetails])
assert.equal(staged.rowCount, 1)
const compactRead = await call('mm_operation_get', { operationId: operation.id })
const compactApply = await call('mm_change_apply', applyArgs)
for (const compact of [compactRead, compactApply]) {
assert(payloadBytes(compact) < 2048)
assert.deepEqual(compact._meta[budgetMeta], refused._meta[budgetMeta])
assert.deepEqual(output(compact), {
id: operation.id, plan_id: plan.planId, state: 'applied', verification: 'passed', error_code: null,
})
}
await checkEffect()
const { rows: [counts] } = await pool.query(`
SELECT
(SELECT count(*)::int FROM mcp_operations WHERE connection_id=$1) AS operations,
(SELECT count(*)::int FROM mcp_operation_steps WHERE operation_id=$2 AND state='verified') AS verified_steps,
(SELECT count(*)::int FROM mcp_requests WHERE connection_id=$1 AND tool='mm_change_apply') AS apply_requests
`, [connection.id, operation.id])
assert.deepEqual(counts, { operations: 1, verified_steps: 1, apply_requests: 2 })
cases.push({ mode, nearLimitBytes: payloadBytes(accepted), refusalBytes: payloadBytes(refused),
compactReadBytes: payloadBytes(compactRead), compactApplyBytes: payloadBytes(compactApply),
...counts, settingsWrites: 1 })
} finally {
await client.close()
}
}
return { scope: 'complete CallToolResult from HTTP SDK and production stdio bridge on owned PostgreSQL',
limitBytes: limit, wholeGenericResultEnvelopeLimitAccepted: true, cases }
}
@@ -7,15 +7,28 @@ import { createServer } from 'node:net'
import { spawn } from 'node:child_process' import { spawn } from 'node:child_process'
const sourceRoot = resolve(process.argv[2] ?? fileURLToPath(new URL('../../../', import.meta.url))) const sourceRoot = resolve(process.argv[2] ?? fileURLToPath(new URL('../../../', import.meta.url)))
const scenario = process.argv[3] ?? 'acceptance' const scenario = process.argv[3] ?? 'acceptance'
if (!['acceptance', 'bridge-vlan'].includes(scenario)) throw Error('Unsupported owned external scenario') if (!['acceptance', 'bridge-vlan', 'logs-read', 'logs-history', 'logs-settings', 'poll-steps', 'result-envelope'].includes(scenario)) throw Error('Unsupported owned external scenario')
const output = resolve(sourceRoot, scenario === 'bridge-vlan' ? 'tmp/mcp-bridge-vlan-sdk-20261105' : 'tmp/mcp-external-process-acceptance'); await mkdir(output, { recursive: true }) const logsScenario = scenario.startsWith('logs-')
const envelopeScenario = scenario === 'result-envelope'
const reportRoot = resolve(sourceRoot, scenario === 'bridge-vlan' ? 'tmp/mcp-bridge-vlan-sdk-20261105' :
logsScenario || scenario === 'poll-steps' || envelopeScenario ? 'tmp/mcp-external-' + scenario : 'tmp/mcp-external-process-acceptance')
await mkdir(reportRoot, { recursive: true })
const output = scenario === 'poll-steps' || envelopeScenario ? await mkdtemp(join(reportRoot, 'run-')) : reportRoot
const paths = ['backend/src/scripts/mcp-stdio.ts', 'backend/src/routes/mcp-transport.ts', 'backend/src/routes/mcp-oauth.ts', 'backend/src/modules/mcp/store.ts', const paths = ['backend/src/scripts/mcp-stdio.ts', 'backend/src/routes/mcp-transport.ts', 'backend/src/routes/mcp-oauth.ts', 'backend/src/modules/mcp/store.ts',
'backend/src/modules/mcp/runtime.ts', 'backend/src/modules/mcp/actions.ts', 'backend/src/modules/mcp/security.ts', 'backend/src/modules/mcp/protocol-limits.ts', 'backend/src/modules/mcp/runtime.ts', 'backend/src/modules/mcp/actions.ts', 'backend/src/modules/mcp/security.ts', 'backend/src/modules/mcp/protocol-limits.ts',
'backend/src/modules/mcp/portal-revocation.ts', 'backend/src/plugins/auth.ts', 'backend/src/index.ts', 'node_modules/@modelcontextprotocol/client/package.json', 'node_modules/@modelcontextprotocol/server/package.json'] 'backend/src/modules/mcp/portal-revocation.ts', 'backend/src/plugins/auth.ts', 'backend/src/index.ts', 'node_modules/@modelcontextprotocol/client/package.json', 'node_modules/@modelcontextprotocol/server/package.json']
if (scenario === 'acceptance') paths.push('backend/scripts/mcp-external-process/client.mjs', 'backend/scripts/mcp-external-process/server-fixture.ts', if (scenario !== 'bridge-vlan') paths.push('backend/scripts/mcp-external-process/client.mjs', 'backend/scripts/mcp-external-process/server-fixture.ts',
'backend/src/routes/mcp-portal.ts', 'backend/src/modules/mcp/portal-revocation-event.ts', 'backend/src/services/router-logs-query.ts') 'backend/src/routes/mcp-portal.ts', 'backend/src/modules/mcp/portal-revocation-event.ts', 'backend/src/services/router-logs-query.ts')
else paths.push('backend/scripts/mcp-external-process/bridge-vlan-client.mjs', 'backend/scripts/mcp-external-process/bridge-vlan-fixture.ts', else paths.push('backend/scripts/mcp-external-process/bridge-vlan-client.mjs', 'backend/scripts/mcp-external-process/bridge-vlan-fixture.ts',
'backend/src/modules/mcp/bridge-vlan-actions.ts', 'backend/src/services/bridge-vlan-configuration.ts', 'packages/contracts/src/bridge-vlan.ts') 'backend/src/modules/mcp/bridge-vlan-actions.ts', 'backend/src/services/bridge-vlan-configuration.ts', 'packages/contracts/src/bridge-vlan.ts')
if (logsScenario) paths.push('backend/scripts/mcp-external-process/logs-read-client.mjs',
'backend/scripts/acceptance/mcp-step-journal.mjs', 'backend/src/modules/mcp/log-artifacts.ts')
if (scenario === 'poll-steps') paths.push('backend/scripts/mcp-external-process/poll-steps-fixture.mjs',
'backend/scripts/acceptance/mcp-step-journal.mjs', 'backend/scripts/acceptance/mcp-server-poll-steps.mjs',
'backend/src/modules/mcp/server-poll-production.ts', 'backend/src/services/server-poll-execution.ts')
if (envelopeScenario) paths.push('backend/scripts/mcp-external-process/run-owned.mjs', 'backend/scripts/mcp-external-process/result-envelope-fixture.mjs',
'backend/src/modules/mcp/result-budget.ts', 'backend/src/modules/mcp/result-delivery.ts', 'backend/src/modules/mcp/flow-envelope-allowance.ts',
'backend/src/modules/mcp/sdk-terminal-budget.ts', 'backend/src/modules/mcp/stdio-terminal-budget.ts')
async function pins() { const result = []; for (const path of paths) result.push({ path, sha256: createHash('sha256').update(await readFile(resolve(sourceRoot, path))).digest('hex') }); return result } async function pins() { const result = []; for (const path of paths) result.push({ path, sha256: createHash('sha256').update(await readFile(resolve(sourceRoot, path))).digest('hex') }); return result }
const before = await pins(), directory = await mkdtemp(join(resolve(sourceRoot, 'tmp'), 'mm-mcp-external-')), state = join(directory, 'state'); await mkdir(state) const before = await pins(), directory = await mkdtemp(join(resolve(sourceRoot, 'tmp'), 'mm-mcp-external-')), state = join(directory, 'state'); await mkdir(state)
const listener = createServer(); await new Promise(resolve => listener.listen(0, '127.0.0.1', resolve)); const port = listener.address().port; await new Promise(resolve => listener.close(resolve)) const listener = createServer(); await new Promise(resolve => listener.listen(0, '127.0.0.1', resolve)); const port = listener.address().port; await new Promise(resolve => listener.close(resolve))
@@ -27,12 +40,17 @@ try {
process.exitCode = await new Promise((done, reject) => { process.exitCode = await new Promise((done, reject) => {
const child = spawn(process.execPath, ['--import', import.meta.resolve('tsx'), fileURLToPath(new URL(scenario === 'bridge-vlan' ? './bridge-vlan-fixture.ts' : './server-fixture.ts', import.meta.url))], { cwd: directory, const child = spawn(process.execPath, ['--import', import.meta.resolve('tsx'), fileURLToPath(new URL(scenario === 'bridge-vlan' ? './bridge-vlan-fixture.ts' : './server-fixture.ts', import.meta.url))], { cwd: directory,
windowsHide: true, stdio: 'inherit', env: { ...Object.fromEntries(['SystemRoot', 'WINDIR', 'TEMP', 'TMP', 'PATH', 'Path'].filter(k => process.env[k]).map(k => [k, process.env[k]])), windowsHide: true, stdio: 'inherit', env: { ...Object.fromEntries(['SystemRoot', 'WINDIR', 'TEMP', 'TMP', 'PATH', 'Path'].filter(k => process.env[k]).map(k => [k, process.env[k]])),
OWN_EXTERNAL_CLEANUP_FAULT: process.env.OWN_EXTERNAL_CLEANUP_FAULT, OWN_EXTERNAL_SOURCE_ROOT: sourceRoot, OWN_EXTERNAL_RESULT_FILE: join(output, 'result.json'), NODE_ENV: 'test', OWN_EXTERNAL_PROCESS_PG: 'true', DATABASE_URL: `postgresql://mcp_test:${password}@127.0.0.1:${port}/postgres`, DATABASE_PATH: join(directory, 'no-legacy.sqlite'), OWN_EXTERNAL_CLEANUP_FAULT: process.env.OWN_EXTERNAL_CLEANUP_FAULT, OWN_EXTERNAL_LOGS_SCENARIO: logsScenario ? scenario : '',
OWN_EXTERNAL_POLL_STEPS: scenario === 'poll-steps' ? 'true' : '',
OWN_EXTERNAL_RESULT_ENVELOPE: envelopeScenario ? 'true' : '',
OWN_EXTERNAL_SOURCE_ROOT: sourceRoot, OWN_EXTERNAL_RESULT_FILE: join(output, 'result.json'), NODE_ENV: 'test', OWN_EXTERNAL_PROCESS_PG: 'true', DATABASE_URL: `postgresql://mcp_test:${password}@127.0.0.1:${port}/postgres`, DATABASE_PATH: join(directory, 'no-legacy.sqlite'),
MCP_STATE_DIR: state, AUTH_REQUIRED: 'true', AUTH_JWT_SECRET: 'owned-external-synthetic-issuer-test-only', AUTH_ISSUER: 'https://synthetic-portal.invalid', AUTH_PORTAL_URL: 'https://synthetic-portal.invalid' } }) MCP_STATE_DIR: state, AUTH_REQUIRED: 'true', AUTH_JWT_SECRET: 'owned-external-synthetic-issuer-test-only', AUTH_ISSUER: 'https://synthetic-portal.invalid', AUTH_PORTAL_URL: 'https://synthetic-portal.invalid' } })
child.once('error', reject); child.once('exit', code => done(code ?? 1)) child.once('error', reject); child.once('exit', code => done(code ?? 1))
}) })
const after = await pins(), unchanged = JSON.stringify(before) === JSON.stringify(after) const after = await pins(), unchanged = JSON.stringify(before) === JSON.stringify(after)
await writeFile(join(output, 'source-pins.json'), JSON.stringify({ before, after, unchanged, exitCode: process.exitCode }, null, 2)) await writeFile(join(output, 'source-pins.json'), JSON.stringify({ before, after, unchanged, exitCode: process.exitCode }, null, 2))
if (scenario === 'poll-steps') console.log('Poll checkpoint evidence:', output)
if (envelopeScenario) console.log('Result envelope evidence:', output)
console.log('External-client source/SDK pins unchanged:', unchanged); if (!unchanged) process.exitCode = 1 console.log('External-client source/SDK pins unchanged:', unchanged); if (!unchanged) process.exitCode = 1
} finally { } finally {
await postgres.stop(); const target = resolve(directory), rel = relative(resolve(resolve(sourceRoot, 'tmp')), target) await postgres.stop(); const target = resolve(directory), rel = relative(resolve(resolve(sourceRoot, 'tmp')), target)
Loaded 100 of 1512 files, more files were not shown because too many files have changed in this diff. Show more