Compare commits
No commits in common. "main" and "task/pep-217" have entirely different histories.
main
...
task/pep-2
@ -3,12 +3,12 @@
|
|||||||
# Old Postgres database: only the source of `peppa db migrate-to-sqlite` (PEP-36)
|
# Old Postgres database: only the source of `peppa db migrate-to-sqlite` (PEP-36)
|
||||||
# DATABASE_URL=postgres://peppa:peppa@127.0.0.1:5433/peppa
|
# DATABASE_URL=postgres://peppa:peppa@127.0.0.1:5433/peppa
|
||||||
|
|
||||||
# Gitea (git.vibe42.kz) — token of peppa-bot with repo scope
|
# Gitea (git.telecom.quest) — token with repo + org scope
|
||||||
GITEA_URL=https://git.vibe42.kz
|
GITEA_URL=https://git.telecom.quest
|
||||||
GITEA_TOKEN=
|
GITEA_TOKEN=
|
||||||
GITEA_TEMPLATE_REPO=peppa-bot/template
|
GITEA_TEMPLATE_REPO=peppa/template
|
||||||
# Peppa's own repo (footer link, scripts/ci.sh --pr, scripts/peppa-release.sh)
|
# Peppa's own repo (footer link, scripts/ci.sh --pr, scripts/peppa-release.sh)
|
||||||
# GITEA_PLATFORM_REPO=peppa-bot/peppa
|
# GITEA_PLATFORM_REPO=peppa/peppa
|
||||||
|
|
||||||
# Where project repos are cloned and sessions run
|
# Where project repos are cloned and sessions run
|
||||||
PEPPA_WORKSPACES=~/peppa/workspaces
|
PEPPA_WORKSPACES=~/peppa/workspaces
|
||||||
|
|||||||
@ -20,7 +20,7 @@ jobs:
|
|||||||
# The runner has the host's docker.sock: only branches of this repository, never forks.
|
# The runner has the host's docker.sock: only branches of this repository, never forks.
|
||||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
||||||
runs-on: peppa-trusted
|
runs-on: peppa-trusted
|
||||||
timeout-minutes: 45
|
timeout-minutes: 30
|
||||||
env:
|
env:
|
||||||
# Peppa's data is SQLite (a temp file per test file). Postgres on the host is only the source
|
# Peppa's data is SQLite (a temp file per test file). Postgres on the host is only the source
|
||||||
# for the Postgres → SQLite migration test, which makes and drops its own database.
|
# for the Postgres → SQLite migration test, which makes and drops its own database.
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-250
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Access Hub (PEP-250): сервис агенту — `request_access`; форму отказа `callConnection` не менять, автозапрос — `refusedCallService`.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-260
|
|
||||||
|
|
||||||
## Решения
|
|
||||||
- Access Hub (PEP-260): агенту — только текст (`isTextResponse`) + `TEXT_TYPES`.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-261
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Тесты с агентом-моком (access-requests, bot) в песочнице молча висят по 25 с на Node 22 — нужен Node 26 из tarball и tmux из .deb в PATH/LD_LIBRARY_PATH (PEP-261).
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-272
|
|
||||||
|
|
||||||
## Решения
|
|
||||||
- `/api/health` анониму — только `{ok}` (PEP-272); сводку читать с `healthHeaders()` / `scripts/lib/health-token.sh`.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-273
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Ссылки веба — только `Link` из `@/components/Link` (предзагрузка выкл., PEP-273; тест no-prefetch); медленная страница из-за Gitea — кэш в globalThis, как `giteaServerOverview`.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-274
|
|
||||||
|
|
||||||
## Решения
|
|
||||||
- Заголовок вкладки (PEP-274) — `pageTitle`/`projectTitle`/`taskTitle` (apps/web/lib/title.ts); page.tsx без `generateMetadata` роняет page-titles.test.ts.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-279
|
|
||||||
|
|
||||||
## Решения
|
|
||||||
- Старые вопросы (PEP-279) закрываются только `default_option`; без него — без выбора: варианты фабрики (бюджет, подписка) за человека не выбираем.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-281
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Git — только git.vibe42.kz; старый адрес в репо ловит old-git-cleanup.test.ts (PEP-281).
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-282
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Таймаут запроса в процессе с моком-сервером: синхронная пауза дольше таймаута обрывает готовый ответ (таймеры libuv раньше сокетов) — `responsiveTimeout` (core, PEP-282), не `AbortSignal.timeout`.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-283
|
|
||||||
|
|
||||||
## Решения
|
|
||||||
- Стек новых проектов — docs/standards/default-stack.md (PEP-283).
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-284
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Стандарт стека в шаблоне (PEP-284): template/docs/standards/default-stack.md — побайтная копия docs/standards/default-stack.md (тест template-default-stack); правишь стандарт — копируй в template/.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-285
|
|
||||||
|
|
||||||
## Решения
|
|
||||||
- Аудит стека (PEP-285): docs/standards/forge-stack-audit.md — основа FORGE (TS/Node 26, Next.js, SQLite, Drizzle, целые id) сохраняется как обоснованное отклонение; условия пересмотра PostgreSQL — там же. Новый слой в default-stack.md = строка и раздел в аудите (тест stack-audit-doc).
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-291
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Песочница раннера: Node 22.23 тянет одиночные тесты (PEP-291).
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-292
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- В образе платформы нет `.git` (PEP-292): `git` в коде службы не звать; коммит — `PEPPA_COMMIT`, история main — Gitea API.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-294
|
|
||||||
|
|
||||||
## Решения
|
|
||||||
- Суперадмины (PEP-294): `platform.admins` — id учёток (строка = логин без учётки, привязывается при чтении); проверка — `superadminIds`/`platformAdminUsers`, не сравнение логинов.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-298
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Конфликт PR с main: первая просьба — после второго наблюдения через 2 мин (PEP-298, в тестах `PEPPA_CONFLICT_SETTLE_MIN=0`).
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-302
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- mock-intake `dedup` считает похожие названия («Идея 1»/«Идея 2») повтором — в тестах приёмки бери разные слова.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-303
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Сторож экрана (PEP-303): строки — через `screen-lines.ts` (`isQuotedLine`/`ownLines`), фразу CLI якорить к началу строки, нажимать только на неизменном экране (`still`). Мок `say` печатает «⏺ » перед текстом.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-304
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Время людям (PEP-304) — только `platformTime`/`platformDayTime`/`platformZone` из `@peppa/shared/time`; `toLocale*String` для дат без `timeZone` не писать. Лимит в `claudePrint` — `limited`/`limitedUntil`, не «нет подписки».
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# Память: PEP-314
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Go/PostgreSQL проектов (PEP-314): в проверках — только `source .gitea/peppa-tools.sh go postgres` шаблона (образ задания общий с платформой, не трогать); база стенда — `deploy.database` + `deploy/compose.postgres.yml`, пароль в томе базы, без `deploy.database` `peppa-deploy.sh` обязан вести себя как раньше (тест «Проект без базы — как раньше»).
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Агент в контейнере идёт от --user <uid> без записи в /etc/passwd: initdb и всё, что ищет пользователя, падает — нужен libnss-wrapper (LD_PRELOAD + NSS_WRAPPER_PASSWD). Файл шаблона *.go, который не код Go, ломает go vet/build у проекта — заготовка называется Dockerfile.golang (тест в stack-tools).
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-315
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Строка `connection_grants` остаётся после конца срока и после снятия «без дела»: читая «прошлую выдачу», проверяй `grantState(row, now) === "active"`, иначе вернёшь права, которых уже нет (PEP-315: «Дать: чтение» возвращало запись).
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
# Память: PEP-316
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Гонку двух процессов за базу тест в одном процессе не ловит: `node:sqlite` синхронный, два вызова идут по очереди. Нужен настоящий второй процесс — `packages/testkit/src/mock-db-writer.ts` держит блокировку записи (PEP-313 «починил» гонку тестом в одном процессе, на проде она осталась).
|
|
||||||
- Транзакция, начатая как читающая (`BEGIN`), получает «database is locked» на первой записи сразу, без ожидания `busy_timeout`. Поэтому `db.transaction` всегда `BEGIN IMMEDIATE` (PEP-316).
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-317
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Список «Gitea» (PEP-317): отдаётся сразу при любом возрасте, хранится в `settings` `gitea.overview`, прогрев — `warmGiteaOverview` в instrumentation.ts; ждёт Gitea только `fresh`. В тестах — `giteaOverviewSettled()`, медленная Gitea — `MockGitea.searchDelayMs`.
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# Память: PEP-318
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- «Принять всё» (PEP-318) — только очередь: `startAcceptAll` + `processAcceptQueue` (runner/accept-queue.ts; `accept.queue:<taskId>`, ход `accept.run:<projectId>`, аренда `accept.worker:<projectId>` 3 мин), веб — через `after()`, вачдог — `acceptQueueTick`. Синхронный `acceptAll` в вебе не звать. Медленный Gitea в тесте — `MockGitea.delayMs`.
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- В песочнице без tmux тесты приёмки падают «spawn tmux ENOENT», а на Node 22 висят по 25 с: нужны оба — tmux из .deb bookworm и Node 26 (`nodejs.org/dist/index.json` → tarball в /tmp).
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# Память: PEP-319
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Состав задач в сообщении о версии (`storiesIn`, runner/platform-build.ts) — только ключ в начале заголовка коммита («PEP-318: …», «PEP-284, PEP-285: …») или названия слитого PR. Упоминание другой задачи в тексте коммита версию не «выпускает».
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- 27.11.2026 канал дважды назвал задачи, вышедшие раньше: PEP-281 и PEP-282 (утро), PEP-127 (вечер) — их ключи стояли в тексте коммитов других задач. Сообщение из канала не отозвать.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-320
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Сценарии infra/act-runner — busybox ash (в песочнице только dash): проверять тест act-runner-supervise с PATH на каталог апплетов статического busybox (busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl). Новый supervise.sh действует только после `docker restart peppa-act-runner`.
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
# Память: PEP-321
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Упавшее задание проверок (PEP-321): `checksQueueTick` до порога очереди через 2 мин (`EARLY_JOB_MS`) переоткрывает PR (`reopenFailedJob`, общий счётчик `reopened` с поздним путём, ≤2 на коммит, пауза 10 мин) — без `stuck`, задержки, сообщения суперадмину и агенту; `pending` до порога не трогается.
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
# Память: PEP-322
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Папку, которую писал агент, удаляй через `removeSandbox` (runner/disk-cleanup.ts): обычный `rmSync` не берёт дерево с каталогами без права записи. Права возвращаются только настоящим каталогам внутри папки, по ссылкам не ходим.
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Go делает каталоги кэша модулей (`~/go/pkg/mod`) только для чтения. 27.11.2026, в день выхода PEP-314, папка агента первой же задачи на Go (722 МБ, 2776 таких каталогов) не убралась: уборка падала каждые 10 минут.
|
|
||||||
- Один и тот же отказ `rmSync` читается по-разному: на Linux — `EACCES`, на macOS — `ENOTEMPTY`. Ветвиться по коду ошибки нельзя.
|
|
||||||
- Проверки в CI идут от root, ему права каталогов не мешают: тест на это падает без правки только у обычного пользователя (локальный прогон).
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
# Память: PEP-324
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Id серверных действий Next (и Turbopack) — хэш с солью NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: без постоянного ключа каждая сборка образа ломает кнопки открытых вкладок (Bugsink #23). Ключ — в .env сервера, в сборку — секретом BuildKit next_actions_key; проверка на деле: две `next build` с одним ключом → одинаковые ключи server-reference-manifest.json.
|
|
||||||
- Next печатает ошибку, пойманную своей границей (`app/error.tsx`), тем `console.error`, который взял при старте, — обёртка `ErrorReporter` её не слышит. Граница сама поднимает такую ошибку через `reportError` (`reportCaughtError`), иначе ошибки страниц не доходят до «Ошибок из прода».
|
|
||||||
- На одной странице много полей с одним `name` (карточки вопросов — «answer», «Что поправить» — «text»): возвращать сохранённый текст по имени нельзя — он попадёт в чужую карточку. Адрес поля — его `id`, имя годится, только когда оно одно на странице.
|
|
||||||
- Секреты вводятся и в `textarea` (секрет проекта, ключ сервера): правило «не пароль» их не отсекает — отсекать по имени поля.
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- apps/web/lib/* для node-тестов — без импорта `next/navigation` (в ESM без exports-карты node его не находит): проверку Next передавать параметром из клиентского компонента, как `isStaleAction(err, unstable_isUnrecognizedActionError)`.
|
|
||||||
- Поведение страницы в браузере проверять на рабочей сборке настоящим браузером (подмена заголовка `next-action` даёт «такого действия нет»): тесты на моках DOM не увидели ни чужую карточку, ни пропавшие ошибки.
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
# Память: PEP-326
|
|
||||||
|
|
||||||
## Соглашения
|
|
||||||
- Сайт запускается только через свой сервер веба: `node server.ts` (`apps/web/server.ts`) — и в `infra/docker-compose.yml`, и в launchd, и в `pnpm start`. Он принимает постоянное соединение страниц `/api/ws`.
|
|
||||||
- После смены способа запуска сайта проверяй соединение, а не только страницы: `. scripts/lib/ws-check.sh; ws_answers http://127.0.0.1:3100` (0 — соединение принято). Выкатка делает это сама и откатывает версию без ответа.
|
|
||||||
|
|
||||||
## Грабли
|
|
||||||
- Голый `next start` на запрос WebSocket не отвечает и не отказывает. Браузер ждёт, пока запрос не оборвёт Cloudflare (524, около 125 секунд). Страницы и `/api/health` при этом в порядке, поэтому проверки выкатки ничего не замечали.
|
|
||||||
- С 21 по 28.11.2026 свежая вкладка около шести минут показывала «подключение…» и не обновлялась сама: три попытки по 125 секунд, потом запасной поток. Заметили по экрану «Приёмка»: «Принимается…» висело, хотя сервер принял задачу за секунду.
|
|
||||||
- Две задачи одного дня могут не встретиться: PEP-222 завёл compose с `next start`, PEP-225 через полтора часа поменял запуск сайта в launchd и `package.json`. В compose его никто не внёс.
|
|
||||||
- Тест проверки на подставном сервере прошёл бы и с неверным ключом запроса: настоящий сервер соединений отклоняет ключ не из 16 байт (так и было в первой версии `ws-check.sh`, выкатка откатывалась бы каждый раз). Проверку живого сервера тестируй настоящим `createLiveWs`.
|
|
||||||
|
|
||||||
## Решения
|
|
||||||
- Клиент не ждёт зависший запрос соединения дольше 4 секунд (`WS_OPEN_TIMEOUT_MS` в `apps/web/lib/live.ts`) и сразу идёт на запасной поток `/api/live`; WebSocket пробуется раз в минуту. Отклонённый запрос — по-прежнему три попытки.
|
|
||||||
- Проверка по внешнему адресу версию не откатывает: путь до сайта (Cloudflare, край) от версии не зависит, страницы при нём работают через запасной поток.
|
|
||||||
@ -80,8 +80,8 @@ import {
|
|||||||
} from "@peppa/core";
|
} from "@peppa/core";
|
||||||
import { projects, tasks, type Db } from "@peppa/db";
|
import { projects, tasks, type Db } from "@peppa/db";
|
||||||
import { formatTaskKey, voiceStoriesEnabled } from "@peppa/shared";
|
import { formatTaskKey, voiceStoriesEnabled } from "@peppa/shared";
|
||||||
import { delayAction, denyAccessRequestAndTell, grantAccessRequestByButton, resolveTaskById } from "@peppa/runner";
|
import { delayAction, resolveTaskById } from "@peppa/runner";
|
||||||
import { accessButtonTarget, accessRequestKeyboard, decideIdleGrant, GRANT_TERM_TEXT, NO_CONNECTION_TEXT, parseAccessCallback, parseDelayCallback, parseIdleGrantCallback } from "@peppa/core";
|
import { decideIdleGrant, parseDelayCallback, parseIdleGrantCallback } from "@peppa/core";
|
||||||
import { acceptTask, answerAndDeliver, classifyMessage, decideIncident, decideProposals, moveTask, postToChat, REQUEST_SENT_TEXT, requestSubscription, resumeSession, stopSession } from "@peppa/runner";
|
import { acceptTask, answerAndDeliver, classifyMessage, decideIncident, decideProposals, moveTask, postToChat, REQUEST_SENT_TEXT, requestSubscription, resumeSession, stopSession } from "@peppa/runner";
|
||||||
import { INTENT_TEXT, statusAnswer } from "@peppa/core";
|
import { INTENT_TEXT, statusAnswer } from "@peppa/core";
|
||||||
import { AsyncLocalStorage } from "node:async_hooks";
|
import { AsyncLocalStorage } from "node:async_hooks";
|
||||||
@ -978,39 +978,6 @@ export function createBot(o: BotOptions) {
|
|||||||
return "done";
|
return "done";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PEP-261: «Дать: чтение / полные права» → term → grant; «Назад»; «Отказать». The owner only (core: accessRequestForUser). */
|
|
||||||
async function onAccessButton(user: User, c: TgCallbackQuery): Promise<string> {
|
|
||||||
const b = parseAccessCallback(c.data ?? "");
|
|
||||||
if (!b) return tr("Неизвестная кнопка");
|
|
||||||
const keyboard = (inline_keyboard: unknown[]) =>
|
|
||||||
c.message ? api.call("editMessageReplyMarkup", { chat_id: c.message.chat.id, message_id: c.message.message_id, reply_markup: { inline_keyboard } }).catch(() => {}) : Promise.resolve();
|
|
||||||
if (b.action === "no") {
|
|
||||||
await denyAccessRequestAndTell(db, user.id, b.id, null);
|
|
||||||
await keyboard([]);
|
|
||||||
return tr("Отказано. Агент узнает об этом.");
|
|
||||||
}
|
|
||||||
if (b.action === "back") {
|
|
||||||
const canGrant = await accessButtonTarget(db, user.id, b.id).then(
|
|
||||||
() => true,
|
|
||||||
(e) => {
|
|
||||||
if (e instanceof PeppaError && e.message === NO_CONNECTION_TEXT) return false;
|
|
||||||
throw e;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
await keyboard(accessRequestKeyboard(b.id, { step: "rights", canGrant }));
|
|
||||||
return tr("Выберите, что дать агенту");
|
|
||||||
}
|
|
||||||
if (b.action === "rights") {
|
|
||||||
await accessButtonTarget(db, user.id, b.id); // not the owner, decided already or no connection → the refusal is the toast
|
|
||||||
await keyboard(accessRequestKeyboard(b.id, { step: "term", rights: b.rights }));
|
|
||||||
return tr("Выберите срок");
|
|
||||||
}
|
|
||||||
await grantAccessRequestByButton(db, user.id, b.id, { rights: b.rights, term: b.term });
|
|
||||||
await keyboard([]);
|
|
||||||
const what = b.rights === "full" ? tr("полные права") : tr("чтение");
|
|
||||||
return tr("Готово: {what}, {term}. Агент узнает об этом.", { what, term: GRANT_TERM_TEXT[b.term] });
|
|
||||||
}
|
|
||||||
|
|
||||||
async function onDelayButton(user: User, data: string): Promise<string> {
|
async function onDelayButton(user: User, data: string): Promise<string> {
|
||||||
const b = parseDelayCallback(data);
|
const b = parseDelayCallback(data);
|
||||||
if (!b || !(await isSuperadmin(db, user))) return tr("Неизвестная кнопка");
|
if (!b || !(await isSuperadmin(db, user))) return tr("Неизвестная кнопка");
|
||||||
@ -1052,13 +1019,6 @@ export function createBot(o: BotOptions) {
|
|||||||
await api.answerCallbackQuery(c.id, toast.slice(0, 190)).catch((e) => log(`answerCallbackQuery: ${e.message}`));
|
await api.answerCallbackQuery(c.id, toast.slice(0, 190)).catch((e) => log(`answerCallbackQuery: ${e.message}`));
|
||||||
return "done";
|
return "done";
|
||||||
}
|
}
|
||||||
// PEP-250/261: buttons under an agent's access request — `ar:<id>:no` (refuse), `ar:<id>:r|f` (rights →
|
|
||||||
// term buttons), `ar:<id>:r|f:<term>` (grant), `ar:<id>:back`. Only the project's owner (core checks).
|
|
||||||
if (parts[0] === "ar") {
|
|
||||||
const toast = await onAccessButton(user, c).catch((e) => (e instanceof PeppaError ? e.message : (log(`access request: ${(e as Error).stack ?? e}`), tr("Ошибка"))));
|
|
||||||
await api.answerCallbackQuery(c.id, toast.slice(0, 190)).catch((e) => log(`answerCallbackQuery: ${e.message}`));
|
|
||||||
return "done";
|
|
||||||
}
|
|
||||||
// PEP-259: the owner's answer to «агенты давно не пользуются разрешением — снять?»: `cg:<grantId>:r|k`.
|
// PEP-259: the owner's answer to «агенты давно не пользуются разрешением — снять?»: `cg:<grantId>:r|k`.
|
||||||
if (parts[0] === "cg") {
|
if (parts[0] === "cg") {
|
||||||
const b = parseIdleGrantCallback(c.data ?? "");
|
const b = parseIdleGrantCallback(c.data ?? "");
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
import { createDb } from "@peppa/db";
|
import { createDb } from "@peppa/db";
|
||||||
import { loadEnv } from "@peppa/shared";
|
import { loadEnv } from "@peppa/shared";
|
||||||
import { setRunnerClient } from "@peppa/runner";
|
import { setRunnerClient } from "@peppa/runner";
|
||||||
import { installCrashReporting, installServiceLog } from "@peppa/core";
|
import { installCrashReporting } from "@peppa/core";
|
||||||
import { createBot } from "./bot.ts";
|
import { createBot } from "./bot.ts";
|
||||||
import { TelegramApi } from "./telegram.ts";
|
import { TelegramApi } from "./telegram.ts";
|
||||||
|
|
||||||
@ -16,8 +16,6 @@ const db = createDb(env.PEPPA_DB);
|
|||||||
setRunnerClient(true, db);
|
setRunnerClient(true, db);
|
||||||
// PEP-91: a crash of the bot goes to Bugsink before launchd restarts it.
|
// PEP-91: a crash of the bot goes to Bugsink before launchd restarts it.
|
||||||
installCrashReporting(db, "bot");
|
installCrashReporting(db, "bot");
|
||||||
// PEP-291: the log also goes to $PEPPA_HOME/logs/bot.log — it survives a redeploy.
|
|
||||||
installServiceLog("bot");
|
|
||||||
const bot = createBot({
|
const bot = createBot({
|
||||||
db,
|
db,
|
||||||
api: new TelegramApi(env.TELEGRAM_BOT_TOKEN, process.env.TELEGRAM_API_URL),
|
api: new TelegramApi(env.TELEGRAM_BOT_TOKEN, process.env.TELEGRAM_API_URL),
|
||||||
|
|||||||
@ -1,15 +1,13 @@
|
|||||||
// Entry point: `peppa-observer` (launchd agent quest.telecom.peppa.observer), PEP-202.
|
// Entry point: `peppa-observer` (launchd agent quest.telecom.peppa.observer), PEP-202.
|
||||||
import { createDb } from "@peppa/db";
|
import { createDb } from "@peppa/db";
|
||||||
import { loadEnv } from "@peppa/shared";
|
import { loadEnv } from "@peppa/shared";
|
||||||
import { installCrashReporting, installServiceLog, setDefaultActor } from "@peppa/core";
|
import { installCrashReporting, setDefaultActor } from "@peppa/core";
|
||||||
import { runObserver } from "./observer.ts";
|
import { runObserver } from "./observer.ts";
|
||||||
|
|
||||||
const env = loadEnv();
|
const env = loadEnv();
|
||||||
const db = createDb(env.PEPPA_DB);
|
const db = createDb(env.PEPPA_DB);
|
||||||
setDefaultActor({ kind: "system" });
|
setDefaultActor({ kind: "system" });
|
||||||
installCrashReporting(db, "observer");
|
installCrashReporting(db, "observer");
|
||||||
// PEP-291: the log also goes to $PEPPA_HOME/logs/observer.log — it survives a redeploy.
|
|
||||||
installServiceLog("observer");
|
|
||||||
const ac = new AbortController();
|
const ac = new AbortController();
|
||||||
for (const sig of ["SIGINT", "SIGTERM"] as const) process.on(sig, () => (ac.abort(), setTimeout(() => process.exit(0), 200)));
|
for (const sig of ["SIGINT", "SIGTERM"] as const) process.on(sig, () => (ac.abort(), setTimeout(() => process.exit(0), 200)));
|
||||||
await runObserver(db, { log: (m) => console.log(`${new Date().toISOString()} ${m}`) }, ac.signal);
|
await runObserver(db, { log: (m) => console.log(`${new Date().toISOString()} ${m}`) }, ac.signal);
|
||||||
|
|||||||
@ -71,13 +71,12 @@ import {
|
|||||||
} from "@peppa/core";
|
} from "@peppa/core";
|
||||||
import { checkConnection, createConnection, decideIdleGrant, deleteConnection, DEFAULT_GRANT_TERM, extendGrant, grantConnection, isGatewayProtocol, isGrantTerm, replaceConnectionSecret, resetHostKey, revokeConnection, revokeGrant, setConnectionIdleHours, type CatalogAuth, type ConnectionCheckResult, type GrantMode, type GrantTerm } from "@peppa/core";
|
import { checkConnection, createConnection, decideIdleGrant, deleteConnection, DEFAULT_GRANT_TERM, extendGrant, grantConnection, isGatewayProtocol, isGrantTerm, replaceConnectionSecret, resetHostKey, revokeConnection, revokeGrant, setConnectionIdleHours, type CatalogAuth, type ConnectionCheckResult, type GrantMode, type GrantTerm } from "@peppa/core";
|
||||||
import { attachmentLabel, fixFeedback, linkAttachments, linkFeedback, parseAttachmentIds, rejectFeedback, restoreProject } from "@peppa/core";
|
import { attachmentLabel, fixFeedback, linkAttachments, linkFeedback, parseAttachmentIds, rejectFeedback, restoreProject } from "@peppa/core";
|
||||||
import { deleteProject, decideProposals, mergeProposals, connectAndGrantAccessRequest, denyAccessRequestAndTell, grantAccessRequestByButton, grantAccessRequestFromExisting, decideDeferred } from "@peppa/runner";
|
import { deleteProject, decideProposals, mergeProposals } from "@peppa/runner";
|
||||||
import { bugsinkFromEnv } from "@peppa/bugsink";
|
import { bugsinkFromEnv } from "@peppa/bugsink";
|
||||||
import { loadEnv } from "@peppa/shared";
|
import { loadEnv } from "@peppa/shared";
|
||||||
import { pauseProject, resumeProject, startAcceptAll, processAcceptQueue, acceptStory, autoPublish, fixStory, confirmTaskDecision, changeTaskDecision, undoSplit, budgetChanged, resolveTaskById, deployProd, bugsinkWebhookBase, connectErrorTracking, decideIncident, resolveIncident, acceptTask, answerAndDeliver, grantRepoAccess, moveTask, provisionProjectOnce, projectNamespace, setProjectVisibility, shareProject, unshareProject, type BoardColumn, resumeSession, sendToSession, syncSessionAttachments, startSession, stopSession, type Provider, startFreeRunner, renameRunner, promoteRunner, queueTaskOnRunner, managesProject, saveAgentsMd, cancelOwnLogin, finishOwnClaudeLogin, connectOwnSubscription, removeOwnSubscription, type OwnSubscriptionKind, chooseSharedSubscription, requestSubscription } from "@peppa/runner";
|
import { pauseProject, resumeProject, acceptAll, acceptStory, autoPublish, fixStory, confirmTaskDecision, changeTaskDecision, undoSplit, budgetChanged, resolveTaskById, deployProd, bugsinkWebhookBase, connectErrorTracking, decideIncident, resolveIncident, acceptTask, answerAndDeliver, grantRepoAccess, moveTask, provisionProjectOnce, projectNamespace, setProjectVisibility, shareProject, unshareProject, type BoardColumn, resumeSession, sendToSession, syncSessionAttachments, startSession, stopSession, type Provider, startFreeRunner, renameRunner, promoteRunner, queueTaskOnRunner, managesProject, saveAgentsMd, cancelOwnLogin, finishOwnClaudeLogin, connectOwnSubscription, removeOwnSubscription, type OwnSubscriptionKind, chooseSharedSubscription, requestSubscription } from "@peppa/runner";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { after } from "next/server";
|
|
||||||
import { asWebActor, requireUser, words } from "@/lib/auth";
|
import { asWebActor, requireUser, words } from "@/lib/auth";
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
@ -212,9 +211,8 @@ export async function acceptStoryAction(f: FormData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PEP-209: «Принять» / «Принять всё» on the acceptance page. PEP-318: the decision is queued and
|
* PEP-209: «Принять» / «Принять всё» on the acceptance page — one by one, a failure of one doesn't
|
||||||
* the page answers at once; the stories are accepted one by one in the background (after the
|
* stop the others; the page shows the result («Принято 6, на доработке 1…»).
|
||||||
* answer here, else by the watchdog), the page shows the progress and the result.
|
|
||||||
*/
|
*/
|
||||||
export async function acceptAllAction(f: FormData) {
|
export async function acceptAllAction(f: FormData) {
|
||||||
const user = asWebActor(await requireUser());
|
const user = asWebActor(await requireUser());
|
||||||
@ -229,10 +227,8 @@ export async function acceptAllAction(f: FormData) {
|
|||||||
if (ref.task.status === "review") refs.push(ref);
|
if (ref.task.status === "review") refs.push(ref);
|
||||||
}
|
}
|
||||||
if (!refs.length) throw new PeppaError(m("Принимать нечего: задачи уже приняты или вернулись в работу"));
|
if (!refs.length) throw new PeppaError(m("Принимать нечего: задачи уже приняты или вернулись в работу"));
|
||||||
startAcceptAll(db, refs, user.id, "web");
|
const r = await acceptAll(db, refs, "web");
|
||||||
const projectId = refs[0]!.project.id;
|
return `${base}?ok=${r.accepted.length}&pending=${r.pending.length}&failed=${r.failed.length}`;
|
||||||
after(() => processAcceptQueue(db, projectId).catch(() => 0));
|
|
||||||
return base;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,7 +392,7 @@ export async function createProjectAction(f: FormData) {
|
|||||||
key: str(f, "key"),
|
key: str(f, "key"),
|
||||||
name: str(f, "name"),
|
name: str(f, "name"),
|
||||||
existing: str(f, "mode") === "existing",
|
existing: str(f, "mode") === "existing",
|
||||||
visibility: str(f, "visibility") === "public" ? "public" : "private", // PEP-280: closed unless chosen
|
visibility: str(f, "visibility") === "private" ? "private" : "public",
|
||||||
ownerId: user.id,
|
ownerId: user.id,
|
||||||
});
|
});
|
||||||
return `/p/${p.key}?created=1`;
|
return `/p/${p.key}?created=1`;
|
||||||
@ -547,16 +543,6 @@ export async function proposalAction(f: FormData) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PEP-302: «Делать» / «Не надо» at a finding put aside until the weekly digest. */
|
|
||||||
export async function deferredAction(f: FormData) {
|
|
||||||
const user = asWebActor(await requireUser());
|
|
||||||
await attempt(f, async () => {
|
|
||||||
const choice = str(f, "choice");
|
|
||||||
if (choice !== "do" && choice !== "no") throw new PeppaError(m("Эта кнопка уже не работает."));
|
|
||||||
await decideDeferred(db, user, Number(str(f, "projectId")), str(f, "title"), choice);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** PEP-197: «Принимать сами» — whose stories are accepted without the owner. */
|
/** PEP-197: «Принимать сами» — whose stories are accepted without the owner. */
|
||||||
export async function setAcceptOwnAction(f: FormData) {
|
export async function setAcceptOwnAction(f: FormData) {
|
||||||
const user = asWebActor(await requireUser());
|
const user = asWebActor(await requireUser());
|
||||||
@ -1145,58 +1131,6 @@ export async function setConnectionIdleAction(f: FormData) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// PEP-261: rights and term chosen by the owner («Дать: чтение / полные права», срок — 1 день по умолчанию).
|
|
||||||
function grantChoice(f: FormData): { rights?: "read" | "full"; term: GrantTerm } {
|
|
||||||
const rights = str(f, "rights");
|
|
||||||
return { rights: rights === "full" || rights === "read" ? rights : undefined, term: isGrantTerm(str(f, "term")) ? (str(f, "term") as GrantTerm) : DEFAULT_GRANT_TERM };
|
|
||||||
}
|
|
||||||
|
|
||||||
// PEP-250: an agent's access request — only its project's owner decides (core checks).
|
|
||||||
export async function connectAccessRequestAction(f: FormData) {
|
|
||||||
const user = asWebActor(await requireUser());
|
|
||||||
await attempt(f, async () => {
|
|
||||||
const id = Number(str(f, "requestId"));
|
|
||||||
const kind = str(f, "authKind") as CatalogAuth;
|
|
||||||
const { connection } = await connectAndGrantAccessRequest(db, user.id, id, {
|
|
||||||
name: str(f, "name"),
|
|
||||||
baseUrl: str(f, "baseUrl") || undefined,
|
|
||||||
secret: String(f.get("secret") ?? "").trim(),
|
|
||||||
authKind: AUTH_KINDS.includes(kind) ? kind : "bearer",
|
|
||||||
authHeader: str(f, "authHeader") || null,
|
|
||||||
}, grantChoice(f));
|
|
||||||
const r = await checkConnection(db, user.id, connection.id).catch(() => null);
|
|
||||||
return `/connections/requests/${id}?done=granted&check=${checkWord(r)}`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function grantAccessRequestAction(f: FormData) {
|
|
||||||
const user = asWebActor(await requireUser());
|
|
||||||
await attempt(f, async () => {
|
|
||||||
const id = Number(str(f, "requestId"));
|
|
||||||
await grantAccessRequestFromExisting(db, user.id, id, Number(str(f, "connectionId")), grantChoice(f));
|
|
||||||
return `/connections/requests/${id}?done=granted`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/** PEP-261: «Дать: чтение / полные права» with a term in «Агенты просят доступ». */
|
|
||||||
export async function grantAccessButtonAction(f: FormData) {
|
|
||||||
const user = asWebActor(await requireUser());
|
|
||||||
await attempt(f, async () => {
|
|
||||||
const id = Number(str(f, "requestId"));
|
|
||||||
await grantAccessRequestByButton(db, user.id, id, grantChoice(f));
|
|
||||||
return `/connections/requests/${id}?done=granted`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function denyAccessRequestAction(f: FormData) {
|
|
||||||
const user = asWebActor(await requireUser());
|
|
||||||
await attempt(f, async () => {
|
|
||||||
const id = Number(str(f, "requestId"));
|
|
||||||
await denyAccessRequestAndTell(db, user.id, id, str(f, "reason") || null);
|
|
||||||
return `/connections/requests/${id}?done=denied`;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function revokeGrantAction(f: FormData) {
|
export async function revokeGrantAction(f: FormData) {
|
||||||
const user = asWebActor(await requireUser());
|
const user = asWebActor(await requireUser());
|
||||||
await attempt(f, async () => {
|
await attempt(f, async () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { ArrowLeft, Bot, Link2, MessagesSquare, Send, Unlink, User as UserIcon } from "lucide-react";
|
import { ArrowLeft, Bot, Link2, MessagesSquare, Send, Unlink, User as UserIcon } from "lucide-react";
|
||||||
import { ANALYST_NAME, analystPending, attachmentsByMessage, chatStatusLine, isSuperadmin, chatGroupBotName, chatMessagesView, chatTtlMs, discussionMessages, discussionUnread, getSetting, listChats, markDiscussionRead, markThreadRead, masterFeed, projectThreadList, splitForDisplay, syncChats, threadTitle, THREAD_KEY, type AttachmentView, type ChatMessageView, type Question } from "@peppa/core";
|
import { ANALYST_NAME, analystPending, attachmentsByMessage, chatStatusLine, isSuperadmin, chatGroupBotName, chatMessagesView, chatTtlMs, discussionMessages, discussionUnread, getSetting, listChats, markDiscussionRead, markThreadRead, masterFeed, projectThreadList, splitForDisplay, syncChats, threadTitle, THREAD_KEY, type AttachmentView, type ChatMessageView, type Question } from "@peppa/core";
|
||||||
@ -21,13 +21,12 @@ import { AttachField } from "@/components/AttachField";
|
|||||||
import { Workspace } from "@/components/Workspace";
|
import { Workspace } from "@/components/Workspace";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Textarea } from "@/components/ui/input";
|
import { Textarea } from "@/components/ui/input";
|
||||||
import { currentUser, requireUser, words } from "@/lib/auth";
|
import { requireUser, words } from "@/lib/auth";
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { cleanText, messageLink, STUCK_NOTICE } from "@/lib/chat-text";
|
import { cleanText, messageLink, STUCK_NOTICE } from "@/lib/chat-text";
|
||||||
import { chatOfferAction, linkChatAction, postChatAction, unlinkChatAction } from "../actions";
|
import { chatOfferAction, linkChatAction, postChatAction, unlinkChatAction } from "../actions";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
type Params = { error?: string; thread?: string; link?: string; q?: string; list?: string };
|
type Params = { error?: string; thread?: string; link?: string; q?: string; list?: string };
|
||||||
|
|
||||||
@ -35,16 +34,6 @@ const CHANNEL = "channel";
|
|||||||
/** PEP-106: `?thread=feed` — the agents' events; no `thread` — the people's discussion. */
|
/** PEP-106: `?thread=feed` — the agents' events; no `thread` — the people's discussion. */
|
||||||
const FEED = "feed";
|
const FEED = "feed";
|
||||||
|
|
||||||
// PEP-274: «Чат KEY — FORGE» (the chat list of the viewer — no names of chats they cannot see).
|
|
||||||
export async function generateMetadata({ params }: { params: Promise<{ chat: string }> }) {
|
|
||||||
const t = await getT();
|
|
||||||
const user = await currentUser();
|
|
||||||
const slug = (await params).chat;
|
|
||||||
const chat = user ? (await listChats(db, user)).find((c) => c.slug.toLowerCase() === slug.toLowerCase()) : null;
|
|
||||||
if (!chat) return pageTitle(t, t("Чаты"));
|
|
||||||
return pageTitle(t, chat.kind === "master" ? t("Все события") : t("Чат {key}", { key: chat.slug.toUpperCase() }));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** «Чаты» (PEP-62): the master chat and project chats with threads; a linked Telegram group mirrors them. */
|
/** «Чаты» (PEP-62): the master chat and project chats with threads; a linked Telegram group mirrors them. */
|
||||||
export default async function ChatPage({ params, searchParams }: { params: Promise<{ chat: string }>; searchParams: Promise<Params> }) {
|
export default async function ChatPage({ params, searchParams }: { params: Promise<{ chat: string }>; searchParams: Promise<Params> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
@ -349,12 +338,11 @@ export default async function ChatPage({ params, searchParams }: { params: Promi
|
|||||||
{writable && (
|
{writable && (
|
||||||
<form action={postChatAction} data-chat-composer className="sticky bottom-[calc(4rem+env(safe-area-inset-bottom))] z-20 -mx-1 flex flex-col gap-1 rounded-lg border bg-card p-2 shadow-md md:bottom-3">
|
<form action={postChatAction} data-chat-composer className="sticky bottom-[calc(4rem+env(safe-area-inset-bottom))] z-20 -mx-1 flex flex-col gap-1 rounded-lg border bg-card p-2 shadow-md md:bottom-3">
|
||||||
<Hidden fields={{ chatId: chat.id, thread: thread ?? "", back: here }} />
|
<Hidden fields={{ chatId: chat.id, thread: thread ?? "", back: here }} />
|
||||||
{/* PEP-274 (F-12): on a phone the field takes the whole row (the hint is not cut), the buttons go below, each ≥ 44 px. */}
|
<div className="flex items-end gap-1.5">
|
||||||
<div className="flex flex-wrap items-end gap-1.5 md:flex-nowrap">
|
<Textarea id="chat-text" name="text" rows={1} maxLength={60000} placeholder={placeholder} aria-label={t("Сообщение")} className="max-h-40 min-h-9 flex-1 resize-y py-1.5" />
|
||||||
<Textarea id="chat-text" name="text" rows={1} maxLength={60000} placeholder={placeholder} aria-label={t("Сообщение")} className="max-h-40 min-h-[4.25rem] flex-1 basis-full resize-y py-1.5 [field-sizing:content] md:min-h-9 md:basis-0" data-chat-text />
|
{chat.projectId && <AttachField projectId={chat.projectId} target="chat-text" className="shrink-0" />}
|
||||||
{chat.projectId && <AttachField projectId={chat.projectId} target="chat-text" className="shrink-0" touch />}
|
<Dictate target="chat-text" compact />
|
||||||
<Dictate target="chat-text" compact touch />
|
<Button size="sm" aria-label={t("Отправить")} title={t("Отправить")} className="h-9">
|
||||||
<Button size="sm" aria-label={t("Отправить")} title={t("Отправить")} className="ml-auto size-11 md:ml-0 md:h-9 md:w-auto" data-chat-send>
|
|
||||||
<Send />
|
<Send />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { ArrowRight, MessagesSquare } from "lucide-react";
|
import { ArrowRight, MessagesSquare } from "lucide-react";
|
||||||
import { chatOverview, isRoleName, syncChats } from "@peppa/core";
|
import { chatOverview, isRoleName, syncChats } from "@peppa/core";
|
||||||
import { LiveRefresh } from "@/components/LiveRefresh";
|
import { LiveRefresh } from "@/components/LiveRefresh";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { ExternalLink, PlugZap, Search } from "lucide-react";
|
import { ExternalLink, PlugZap, Search } from "lucide-react";
|
||||||
import {
|
import {
|
||||||
CATALOG_KIND_TEXT,
|
CATALOG_KIND_TEXT,
|
||||||
@ -17,8 +17,6 @@ import {
|
|||||||
grantableAgents,
|
grantableAgents,
|
||||||
listConnections,
|
listConnections,
|
||||||
listUserProjects,
|
listUserProjects,
|
||||||
ownerAccessRequests,
|
|
||||||
connectionsForRequest,
|
|
||||||
oauthOffer,
|
oauthOffer,
|
||||||
scopeLabel,
|
scopeLabel,
|
||||||
searchCatalog,
|
searchCatalog,
|
||||||
@ -32,7 +30,6 @@ import {
|
|||||||
type GatewayProtocol,
|
type GatewayProtocol,
|
||||||
GATEWAY_PROTOCOLS,
|
GATEWAY_PROTOCOLS,
|
||||||
} from "@peppa/core";
|
} from "@peppa/core";
|
||||||
import { AccessRequestList } from "@/components/AccessRequests";
|
|
||||||
import { Hidden } from "@/components/cards";
|
import { Hidden } from "@/components/cards";
|
||||||
import { intlLocale } from "@peppa/shared/i18n";
|
import { intlLocale } from "@peppa/shared/i18n";
|
||||||
import { ago, Empty, Flash, Notice, PageHeader, Section } from "@/components/common";
|
import { ago, Empty, Flash, Notice, PageHeader, Section } from "@/components/common";
|
||||||
@ -239,8 +236,6 @@ function GrantForm({ c, projects, agents, engineer, t }: { c: ConnectionView; pr
|
|||||||
{c.protocol === "http" ? t("Чтение — смотреть данные, ничего не меняя. Запись — создавать, менять, удалять и отправлять. «Спрашивать меня» пока означает отказ: подтверждение запросов появится позже.") : t.text(PROTOCOL_TEXT[c.protocol as GatewayProtocol].modes)}
|
{c.protocol === "http" ? t("Чтение — смотреть данные, ничего не меняя. Запись — создавать, менять, удалять и отправлять. «Спрашивать меня» пока означает отказ: подтверждение запросов появится позже.") : t.text(PROTOCOL_TEXT[c.protocol as GatewayProtocol].modes)}
|
||||||
{c.protocol !== "http" && <> {t("«Спрашивать меня» пока означает отказ: подтверждение запросов появится позже.")}</>}
|
{c.protocol !== "http" && <> {t("«Спрашивать меня» пока означает отказ: подтверждение запросов появится позже.")}</>}
|
||||||
</p>
|
</p>
|
||||||
{/* PEP-260: an «echo» operation can hand the key back in a form masking doesn't know. */}
|
|
||||||
{c.protocol === "http" && <p className="m-0 text-xs text-muted-foreground">{t("Не разрешайте агенту действия, которые возвращают присланное обратно: проверку, отладку, «кто я» с ключом. Через них сервис может показать агенту ключ.")}</p>}
|
|
||||||
{engineer && c.protocol === "http" && (
|
{engineer && c.protocol === "http" && (
|
||||||
<details className="text-sm">
|
<details className="text-sm">
|
||||||
<summary className="cursor-pointer text-muted-foreground">{t("Тонкая настройка")}</summary>
|
<summary className="cursor-pointer text-muted-foreground">{t("Тонкая настройка")}</summary>
|
||||||
@ -557,7 +552,6 @@ function AddSteps({ s, t }: { s: CatalogService | null; t: Translator }) {
|
|||||||
<Input name="authHeader" placeholder="X-Api-Key" aria-label={t("Имя заголовка или параметра")} className="max-w-48 font-mono" spellCheck={false} />
|
<Input name="authHeader" placeholder="X-Api-Key" aria-label={t("Имя заголовка или параметра")} className="max-w-48 font-mono" spellCheck={false} />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{!s && <p className="m-0 text-xs text-muted-foreground">{t("Не разрешайте агенту действия, которые возвращают присланное обратно: проверку, отладку, «кто я» с ключом. Через них сервис может показать агенту ключ.")}</p>}
|
|
||||||
<Button size="sm" className="self-start">{t("Подключить и проверить")}</Button>
|
<Button size="sm" className="self-start">{t("Подключить и проверить")}</Button>
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
@ -652,9 +646,7 @@ export default async function ConnectionsPage({ searchParams }: { searchParams:
|
|||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
const engineer = (await uiMode()) === "engineer";
|
const engineer = (await uiMode()) === "engineer";
|
||||||
const [list, journal, projects, agents, requests] = await Promise.all([listConnections(db, user.id), connectionJournal(db, user.id, { limit: 50 }), listUserProjects(db, user.id), grantableAgents(db), ownerAccessRequests(db, user.id)]);
|
const [list, journal, projects, agents] = await Promise.all([listConnections(db, user.id), connectionJournal(db, user.id, { limit: 50 }), listUserProjects(db, user.id), grantableAgents(db)]);
|
||||||
// PEP-261: «Дать» right in the list — only where a fitting connection exists.
|
|
||||||
const grantable = new Set((await Promise.all(requests.map(async (r) => ((await connectionsForRequest(db, user.id, r)).fit.length ? r.id : 0)))).filter(Boolean));
|
|
||||||
const proto = q.service?.startsWith("proto:") ? (GATEWAY_PROTOCOLS as string[]).find((p) => `proto:${p}` === q.service) as GatewayProtocol | undefined : undefined;
|
const proto = q.service?.startsWith("proto:") ? (GATEWAY_PROTOCOLS as string[]).find((p) => `proto:${p}` === q.service) as GatewayProtocol | undefined : undefined;
|
||||||
const chosen = q.service === "custom" ? "custom" : catalogService(q.service);
|
const chosen = q.service === "custom" ? "custom" : catalogService(q.service);
|
||||||
const kind = q.kind && (CATALOG_KINDS as string[]).includes(q.kind) ? q.kind : null;
|
const kind = q.kind && (CATALOG_KINDS as string[]).includes(q.kind) ? q.kind : null;
|
||||||
@ -669,12 +661,6 @@ export default async function ConnectionsPage({ searchParams }: { searchParams:
|
|||||||
</p>
|
</p>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
|
||||||
{requests.length > 0 && (
|
|
||||||
<Section id="requests" title={t("Агенты просят доступ")} count={requests.length}>
|
|
||||||
<AccessRequestList list={requests} grantable={grantable} t={t} />
|
|
||||||
</Section>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{list.length > 0 && (
|
{list.length > 0 && (
|
||||||
<Section title={t("Ваши подключения")} count={list.length}>
|
<Section title={t("Ваши подключения")} count={list.length}>
|
||||||
{list.map((c) => (
|
{list.map((c) => (
|
||||||
|
|||||||
@ -1,195 +0,0 @@
|
|||||||
import Link from "@/components/Link";
|
|
||||||
import { notFound } from "next/navigation";
|
|
||||||
import { ExternalLink, KeyRound } from "lucide-react";
|
|
||||||
import { accessRequestForUser, catalogService, connectionsForRequest, type AccessRequestView, type CatalogService, type ConnectionView } from "@peppa/core";
|
|
||||||
import type { Translator } from "@peppa/shared/i18n";
|
|
||||||
import { AccessStatus, accessModeText, GrantRightsSelect, GrantTermSelect } from "@/components/AccessRequests";
|
|
||||||
import { Hidden } from "@/components/cards";
|
|
||||||
import { Flash, Notice, PageHeader, Section } from "@/components/common";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { Card } from "@/components/ui/card";
|
|
||||||
import { Input, Textarea } from "@/components/ui/input";
|
|
||||||
import { Workspace } from "@/components/Workspace";
|
|
||||||
import { requireUser } from "@/lib/auth";
|
|
||||||
import { db } from "@/lib/db";
|
|
||||||
import { getT } from "@/lib/i18n";
|
|
||||||
import { connectAccessRequestAction, denyAccessRequestAction, grantAccessRequestAction } from "../../../actions";
|
|
||||||
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return { title: t("Запрос доступа — FORGE") };
|
|
||||||
}
|
|
||||||
|
|
||||||
const SELECT = "h-9 rounded-md border border-input bg-background px-2 text-sm";
|
|
||||||
|
|
||||||
function Fact({ label, children }: { label: string; children: React.ReactNode }) {
|
|
||||||
return (
|
|
||||||
<div className="flex flex-col gap-0.5 sm:flex-row sm:gap-3">
|
|
||||||
<span className="w-32 shrink-0 text-muted-foreground">{label}</span>
|
|
||||||
<span className="min-w-0 break-words">{children}</span>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function DoneNotice({ done, check, t }: { done?: string; check?: string; t: Translator }) {
|
|
||||||
if (done === "denied") return <Notice>{t("Отказано. Агент получит вашу причину и продолжит без этого сервиса.")}</Notice>;
|
|
||||||
if (done !== "granted") return null;
|
|
||||||
const tail = check === "bad_key" ? t("Но сервис не принял ключ: замените его в разделе «Подключения».") : check === "down" ? t("Сервис сейчас не отвечает — ключ проверится при первом запросе агента.") : "";
|
|
||||||
return (
|
|
||||||
<Notice>
|
|
||||||
{t("Доступ выдан. Агент получил сообщение и продолжит работу; ключ доступа он не видит.")} {tail}
|
|
||||||
</Notice>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** PEP-261: rights and term of the grant (1 day by default). */
|
|
||||||
function GrantFields({ r, t }: { r: AccessRequestView; t: Translator }) {
|
|
||||||
return (
|
|
||||||
<div className="flex flex-wrap items-center gap-2 text-sm">
|
|
||||||
<GrantRightsSelect r={r} t={t} />
|
|
||||||
<span className="text-muted-foreground">{t("на срок")}</span>
|
|
||||||
<GrantTermSelect t={t} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ConnectForm({ r, card, t }: { r: AccessRequestView; card: CatalogService | null; t: Translator }) {
|
|
||||||
const back = `/connections/requests/${r.id}`;
|
|
||||||
return (
|
|
||||||
<ol className="m-0 flex list-decimal flex-col gap-4 pl-5 text-sm">
|
|
||||||
<li className="flex flex-col gap-1">
|
|
||||||
<span className="font-medium">{t("Возьмите ключ доступа")}</span>
|
|
||||||
{card ? (
|
|
||||||
<>
|
|
||||||
<span className="text-muted-foreground">{t.text(card.keyHint)}</span>
|
|
||||||
<a href={card.keyUrl} target="_blank" rel="noreferrer noopener" className="inline-flex items-center gap-1 self-start text-primary underline-offset-2 hover:underline">
|
|
||||||
{t("Открыть страницу, где берут ключ")} <ExternalLink className="size-3" />
|
|
||||||
</a>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<span className="text-muted-foreground">{t("Он есть в описании сервиса для разработчиков или у того, кто его сделал.")}</span>
|
|
||||||
)}
|
|
||||||
</li>
|
|
||||||
<li className="flex flex-col gap-2">
|
|
||||||
<span className="font-medium">{t("Вставьте его сюда")}</span>
|
|
||||||
<form action={connectAccessRequestAction} className="flex max-w-xl flex-col gap-2" autoComplete="off">
|
|
||||||
<Hidden fields={{ back, requestId: r.id }} />
|
|
||||||
{(!card || card.baseEditable) && <Input name="baseUrl" required type="url" defaultValue={r.host ?? ""} placeholder={card?.baseUrl ?? "https://api.example.com/v1"} aria-label={t("Адрес сервиса")} className="font-mono" spellCheck={false} />}
|
|
||||||
<Input name="secret" required type="password" placeholder={card?.auth === "basic" ? t("логин:пароль — после сохранения их не увидит никто") : t("Ключ доступа — после сохранения его не увидит никто")} aria-label={t("Ключ доступа")} autoComplete="new-password" />
|
|
||||||
{!card && (
|
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
|
||||||
<select name="authKind" aria-label={t("Как передавать ключ")} className={SELECT} defaultValue="bearer">
|
|
||||||
<option value="bearer">{t("Как «Authorization: Bearer …»")}</option>
|
|
||||||
<option value="header">{t("В своём заголовке")}</option>
|
|
||||||
<option value="query">{t("В адресе запроса (параметр)")}</option>
|
|
||||||
<option value="basic">{t("Логин и пароль")}</option>
|
|
||||||
</select>
|
|
||||||
<Input name="authHeader" placeholder="X-Api-Key" aria-label={t("Имя заголовка или параметра")} className="max-w-48 font-mono" spellCheck={false} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<GrantFields r={r} t={t} />
|
|
||||||
<Button size="sm" className="self-start">{t("Подключить и разрешить")}</Button>
|
|
||||||
</form>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ExistingForm({ r, fit, other, t }: { r: AccessRequestView; fit: ConnectionView[]; other: ConnectionView[]; t: Translator }) {
|
|
||||||
const all = [...fit, ...other];
|
|
||||||
if (!all.length) return null;
|
|
||||||
return (
|
|
||||||
<form action={grantAccessRequestAction} className="flex flex-wrap items-center gap-2 text-sm">
|
|
||||||
<Hidden fields={{ back: `/connections/requests/${r.id}`, requestId: r.id }} />
|
|
||||||
<select name="connectionId" required aria-label={t("Подключение")} className={SELECT} defaultValue={fit[0]?.id ?? ""}>
|
|
||||||
{!fit.length && <option value="">{t("Выберите подключение")}</option>}
|
|
||||||
{all.map((c) => (
|
|
||||||
<option key={c.id} value={c.id}>
|
|
||||||
{c.name}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
<GrantFields r={r} t={t} />
|
|
||||||
<Button size="sm" variant="secondary">{t("Разрешить из уже подключённого")}</Button>
|
|
||||||
</form>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** PEP-250: the card of an agent's access request — its project's owner only (others: 404). */
|
|
||||||
export default async function AccessRequestPage({ params, searchParams }: { params: Promise<{ id: string }>; searchParams: Promise<{ error?: string; done?: string; check?: string }> }) {
|
|
||||||
const [{ id }, q] = await Promise.all([params, searchParams]);
|
|
||||||
const user = await requireUser();
|
|
||||||
const t = await getT();
|
|
||||||
const r = /^\d+$/.test(id) ? await accessRequestForUser(db, user.id, Number(id)) : null;
|
|
||||||
if (!r) notFound();
|
|
||||||
const card = catalogService(r.catalogId);
|
|
||||||
const { fit, other } = r.status === "open" ? await connectionsForRequest(db, user.id, r) : { fit: [], other: [] };
|
|
||||||
return (
|
|
||||||
<Workspace>
|
|
||||||
<Flash error={q.error} />
|
|
||||||
<DoneNotice done={q.done} check={q.check} t={t} />
|
|
||||||
<PageHeader
|
|
||||||
title={<><KeyRound className="mr-1 inline size-5 text-primary" />{t("Агент просит доступ к {service}", { service: r.service })}</>}
|
|
||||||
crumbs={<Link href="/connections" className="hover:underline">{t("Подключения")}</Link>}
|
|
||||||
>
|
|
||||||
<p className="m-0 text-sm text-muted-foreground">
|
|
||||||
{r.status === "open"
|
|
||||||
? t("Агенту нужен этот сервис для работы над задачей. Ключ доступа вы вводите один раз, агент его не увидит: запросы выполняет FORGE и записывает их в журнал. Можно и отказать — агент продолжит без сервиса.")
|
|
||||||
: t("По этому запросу уже есть решение.")}
|
|
||||||
</p>
|
|
||||||
</PageHeader>
|
|
||||||
|
|
||||||
<Card className="flex flex-col gap-2 p-4 text-sm">
|
|
||||||
<div className="mb-1 flex flex-wrap items-center gap-2">
|
|
||||||
<AccessStatus r={r} t={t} />
|
|
||||||
{r.repeats > 0 && <span className="text-xs text-muted-foreground">{t("агент просил ещё раз: {n}", { n: r.repeats })}</span>}
|
|
||||||
</div>
|
|
||||||
<Fact label={t("Агент")}>{r.agentName ?? "—"}</Fact>
|
|
||||||
<Fact label={t("Задача")}>{r.taskKey ? <Link href={`/t/${r.taskKey}`} className="text-primary hover:underline">{r.taskKey}{r.taskTitle ? ` — ${r.taskTitle}` : ""}</Link> : "—"}</Fact>
|
|
||||||
<Fact label={t("Проект")}>{r.projectName}</Fact>
|
|
||||||
<Fact label={t("Сервис")}>
|
|
||||||
{r.service}
|
|
||||||
{card && (
|
|
||||||
<a href={card.docsUrl} target="_blank" rel="noreferrer noopener" className="ml-2 inline-flex items-center gap-1 text-xs text-muted-foreground hover:underline">
|
|
||||||
{t("Документация сервиса")} <ExternalLink className="size-3" />
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
{!card && r.host && <span className="ml-2 font-mono text-xs text-muted-foreground">{r.host}</span>}
|
|
||||||
</Fact>
|
|
||||||
<Fact label={t("Что можно")}>{accessModeText(r.mode, t)}</Fact>
|
|
||||||
{/* The agent's own words: shown as is, never as instructions. */}
|
|
||||||
<Fact label={t("Зачем")}>{r.purpose}</Fact>
|
|
||||||
{r.status === "denied" && <Fact label={t("Причина отказа")}>{r.reason ?? t("без причины")}</Fact>}
|
|
||||||
</Card>
|
|
||||||
|
|
||||||
{r.status === "open" && (
|
|
||||||
<>
|
|
||||||
<Section title={t("Подключить и разрешить")}>
|
|
||||||
<Card className="p-4">
|
|
||||||
<ConnectForm r={r} card={card} t={t} />
|
|
||||||
<p className="m-0 mt-3 text-xs text-muted-foreground">
|
|
||||||
{t("Агенты проекта получат выбранный доступ на выбранный срок. Изменить, продлить или отозвать доступ можно в разделе «Подключения».")}
|
|
||||||
</p>
|
|
||||||
</Card>
|
|
||||||
</Section>
|
|
||||||
{fit.length + other.length > 0 && (
|
|
||||||
<Section title={t("Или разрешить из уже подключённого")}>
|
|
||||||
<Card className="p-4">
|
|
||||||
<ExistingForm r={r} fit={fit} other={other} t={t} />
|
|
||||||
</Card>
|
|
||||||
</Section>
|
|
||||||
)}
|
|
||||||
<Section title={t("Отказать")}>
|
|
||||||
<Card className="p-4">
|
|
||||||
<form action={denyAccessRequestAction} className="flex max-w-xl flex-col gap-2">
|
|
||||||
<Hidden fields={{ back: `/connections/requests/${r.id}`, requestId: r.id }} />
|
|
||||||
<Textarea name="reason" rows={2} maxLength={500} placeholder={t("Причина — агент её получит, например «используйте тестовые данные»")} aria-label={t("Причина отказа")} />
|
|
||||||
<Button size="sm" variant="destructive" className="self-start">{t("Отказать")}</Button>
|
|
||||||
</form>
|
|
||||||
</Card>
|
|
||||||
</Section>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Workspace>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,8 +1,8 @@
|
|||||||
"use server";
|
"use server";
|
||||||
// PEP-209: the superadmin's buttons on a delay card («Дашборд → Задержки»); PEP-279: old questions.
|
// PEP-209: the superadmin's buttons on a delay card («Дашборд → Задержки»).
|
||||||
|
|
||||||
import { DELAY_REASON_NAMES, PeppaError, requireSuperadmin, type DelayAction, type DelayReason } from "@peppa/core";
|
import { DELAY_REASON_NAMES, PeppaError, requireSuperadmin, type DelayAction, type DelayReason } from "@peppa/core";
|
||||||
import { closeStaleQuestions, delayAction } from "@peppa/runner";
|
import { delayAction } from "@peppa/runner";
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { asWebActor, requireUser } from "@/lib/auth";
|
import { asWebActor, requireUser } from "@/lib/auth";
|
||||||
@ -31,19 +31,3 @@ export async function delayActionForm(f: FormData) {
|
|||||||
revalidatePath("/", "layout");
|
revalidatePath("/", "layout");
|
||||||
redirect(`${BASE}?${params}`);
|
redirect(`${BASE}?${params}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PEP-279: «Закрыть все» on the old questions page — their default option, one summary per person. */
|
|
||||||
export async function closeStaleQuestionsAction() {
|
|
||||||
const user = asWebActor(await requireUser());
|
|
||||||
const params = new URLSearchParams();
|
|
||||||
const t = await getT();
|
|
||||||
try {
|
|
||||||
await requireSuperadmin(db, user);
|
|
||||||
const r = await closeStaleQuestions(db);
|
|
||||||
params.set("ok", t("Закрыто вопросов: {n}. Итоговое сообщение получили людей: {m}.", { n: r.closed.length, m: r.told }) + (r.failed ? " " + t("Не удалось закрыть: {n}.", { n: r.failed }) : ""));
|
|
||||||
} catch (e) {
|
|
||||||
params.set("error", (e instanceof PeppaError ? t.text(e.message) : t("Ошибка: {message}", { message: (e as Error).message })).slice(0, 300));
|
|
||||||
}
|
|
||||||
revalidatePath("/", "layout");
|
|
||||||
redirect(`/dashboard/questions?${params}`);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { Hourglass } from "lucide-react";
|
import { Hourglass } from "lucide-react";
|
||||||
import { isSuperadmin, platformDelayOverview } from "@peppa/core";
|
import { isSuperadmin, platformDelayOverview } from "@peppa/core";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { Gauge } from "lucide-react";
|
import { Gauge } from "lucide-react";
|
||||||
import { isSuperadmin, platformDashboard, platformDelayCounts, type DashboardCounts } from "@peppa/core";
|
import { isSuperadmin, platformDashboard, platformDelayCounts, type DashboardCounts } from "@peppa/core";
|
||||||
@ -11,7 +11,6 @@ import { requireUser } from "@/lib/auth";
|
|||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { m } from "@peppa/shared/i18n";
|
import { m } from "@peppa/shared/i18n";
|
||||||
import { STALE_DAYS, staleQuestions } from "@peppa/runner";
|
|
||||||
|
|
||||||
export async function generateMetadata() {
|
export async function generateMetadata() {
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
@ -56,7 +55,6 @@ export default async function Dashboard() {
|
|||||||
const d = await platformDashboard(db);
|
const d = await platformDashboard(db);
|
||||||
const x = d.totals;
|
const x = d.totals;
|
||||||
const delays = await platformDelayCounts(db);
|
const delays = await platformDelayCounts(db);
|
||||||
const stale = (await staleQuestions(db)).length;
|
|
||||||
return (
|
return (
|
||||||
<Workspace>
|
<Workspace>
|
||||||
<LiveRefresh scope="home" />
|
<LiveRefresh scope="home" />
|
||||||
@ -78,13 +76,6 @@ export default async function Dashboard() {
|
|||||||
{delays.total ? t("Задержки на платформе: {n}, требуют вас: {m}", { n: delays.total, m: delays.admin }) : t("Задержек на платформе нет")} →
|
{delays.total ? t("Задержки на платформе: {n}, требуют вас: {m}", { n: delays.total, m: delays.admin }) : t("Задержек на платформе нет")} →
|
||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
{stale > 0 && (
|
|
||||||
<p className="mb-4 text-sm" data-dashboard-stale>
|
|
||||||
<Link href="/dashboard/questions" className="text-primary">
|
|
||||||
{t("Вопросы без ответа дольше {days} дней: {n} — закрыть вариантом по умолчанию", { days: STALE_DAYS, n: stale })} →
|
|
||||||
</Link>
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Section title={t("Требует внимания")} count={d.attention.length} id="attention">
|
<Section title={t("Требует внимания")} count={d.attention.length} id="attention">
|
||||||
{d.attention.length === 0 ? (
|
{d.attention.length === 0 ? (
|
||||||
|
|||||||
@ -1,62 +0,0 @@
|
|||||||
import Link from "@/components/Link";
|
|
||||||
import { notFound } from "next/navigation";
|
|
||||||
import { MessageCircleQuestion } from "lucide-react";
|
|
||||||
import { isSuperadmin } from "@peppa/core";
|
|
||||||
import { asIs } from "@peppa/shared/i18n";
|
|
||||||
import { STALE_DAYS, staleQuestions } from "@peppa/runner";
|
|
||||||
import { ago, Empty, Flash, Notice, PageHeader } from "@/components/common";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { Workspace } from "@/components/Workspace";
|
|
||||||
import { requireUser } from "@/lib/auth";
|
|
||||||
import { db } from "@/lib/db";
|
|
||||||
import { getT } from "@/lib/i18n";
|
|
||||||
import { closeStaleQuestionsAction } from "../actions";
|
|
||||||
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return { title: t("Старые вопросы — FORGE") };
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PEP-279: questions nobody answered for a week — the list is the preview, the button closes them
|
|
||||||
* all with their default option (no default — closed with no choice). Superadmin only.
|
|
||||||
*/
|
|
||||||
export default async function StaleQuestions({ searchParams }: { searchParams: Promise<{ error?: string; ok?: string }> }) {
|
|
||||||
const user = await requireUser();
|
|
||||||
if (!(await isSuperadmin(db, user))) notFound();
|
|
||||||
const { error, ok } = await searchParams;
|
|
||||||
const t = await getT();
|
|
||||||
const list = await staleQuestions(db);
|
|
||||||
return (
|
|
||||||
<Workspace>
|
|
||||||
<Flash error={error} />
|
|
||||||
{ok && <Notice>{t.text(ok)}</Notice>}
|
|
||||||
<PageHeader title={<><MessageCircleQuestion className="mr-1 inline size-5 text-primary" />{t("Вопросы без ответа дольше {n} дней", { n: STALE_DAYS })}</>}>
|
|
||||||
{t("Агенты давно продолжили по рекомендованному варианту. Закройте эти вопросы этим вариантом: владельцы получат одно итоговое сообщение. Карточки «готово» не трогаются — «Принять» нажимают сами владельцы.")}{" "}
|
|
||||||
<Link href="/dashboard" className="text-primary">{t("← Дашборд")}</Link>
|
|
||||||
</PageHeader>
|
|
||||||
{list.length === 0 ? (
|
|
||||||
<Empty>{t("Старых вопросов нет.")}</Empty>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<form action={closeStaleQuestionsAction} className="mb-4 flex flex-wrap items-center gap-3" data-stale-close>
|
|
||||||
<input type="hidden" name="expect" value={list.length} />
|
|
||||||
<Button type="submit">{t("Закрыть все: {n}", { n: list.length })}</Button>
|
|
||||||
<span className="text-sm text-muted-foreground">{t("Ниже — что будет закрыто и каким вариантом.")}</span>
|
|
||||||
</form>
|
|
||||||
<ul className="divide-y rounded-lg border text-sm" data-stale-list>
|
|
||||||
{list.map((x) => (
|
|
||||||
<li key={x.id} className="flex flex-col gap-1 px-3 py-2" data-stale-question={x.id}>
|
|
||||||
<span className="text-xs text-muted-foreground">
|
|
||||||
<Link href={x.where.includes("-") ? `/t/${x.where}` : `/p/${x.projectKey}`} className="text-primary">{x.where}</Link> · {ago(x.createdAt, t)}
|
|
||||||
</span>
|
|
||||||
<span className="line-clamp-2">{t.text(x.freeText ? asIs(x.text) : x.text)}</span>
|
|
||||||
<span className="text-xs">{x.answer ? t("Закроется вариантом: {answer}", { answer: asIs(x.answer) }) : t("Закроется без выбора варианта")}</span>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</Workspace>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,8 +1,7 @@
|
|||||||
// PEP-218: the card of one production error, read from Bugsink on the server. The superadmin
|
// PEP-218: the card of one production error, read from Bugsink on the server. The superadmin
|
||||||
// opens any error, a project's owner or member — errors of that project only (else 404).
|
// opens any error, a project's owner or member — errors of that project only (else 404).
|
||||||
// «Инженер» and the superadmin see the stack, tags, events and the link to Bugsink.
|
// «Инженер» and the superadmin see the stack, tags, events and the link to Bugsink.
|
||||||
import { platformZone } from "@peppa/shared/time";
|
import Link from "next/link";
|
||||||
import Link from "@/components/Link";
|
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { Bug, ExternalLink } from "lucide-react";
|
import { Bug, ExternalLink } from "lucide-react";
|
||||||
import { errorDetail, errorScope } from "@peppa/core";
|
import { errorDetail, errorScope } from "@peppa/core";
|
||||||
@ -47,8 +46,8 @@ export default async function ErrorPage({ params, searchParams }: { params: Prom
|
|||||||
<ErrorStateBadge state={r.state} t={t} />
|
<ErrorStateBadge state={r.state} t={t} />
|
||||||
<span>{t.n(r.events, "{n} раз", "{n} раза", "{n} раз")}</span>
|
<span>{t.n(r.events, "{n} раз", "{n} раза", "{n} раз")}</span>
|
||||||
{d.users != null ? <span>{t.n(d.users, "у {n} пользователя", "у {n} пользователей", "у {n} пользователей")}</span> : null}
|
{d.users != null ? <span>{t.n(d.users, "у {n} пользователя", "у {n} пользователей", "у {n} пользователей")}</span> : null}
|
||||||
<span className="text-muted-foreground" title={r.firstSeen.toLocaleString(undefined, { timeZone: platformZone() })}>{t("впервые {ago}", { ago: ago(r.firstSeen, t) })}</span>
|
<span className="text-muted-foreground" title={r.firstSeen.toLocaleString()}>{t("впервые {ago}", { ago: ago(r.firstSeen, t) })}</span>
|
||||||
<span className="text-muted-foreground" title={r.lastSeen.toLocaleString(undefined, { timeZone: platformZone() })}>{t("последний раз {ago}", { ago: ago(r.lastSeen, t) })}</span>
|
<span className="text-muted-foreground" title={r.lastSeen.toLocaleString()}>{t("последний раз {ago}", { ago: ago(r.lastSeen, t) })}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-sm">
|
<div className="text-sm">
|
||||||
{r.taskKey ? (
|
{r.taskKey ? (
|
||||||
@ -110,7 +109,7 @@ export default async function ErrorPage({ params, searchParams }: { params: Prom
|
|||||||
<ul className="m-0 flex list-none flex-col gap-1 p-0 text-sm">
|
<ul className="m-0 flex list-none flex-col gap-1 p-0 text-sm">
|
||||||
{d.events.map((e) => (
|
{d.events.map((e) => (
|
||||||
<li key={e.id} className="flex gap-3">
|
<li key={e.id} className="flex gap-3">
|
||||||
<span className="tabular-nums">{e.at.toLocaleString(t.locale === "en" ? "en-GB" : "ru-RU", { dateStyle: "short", timeStyle: "medium", timeZone: platformZone() })}</span>
|
<span className="tabular-nums">{e.at.toLocaleString(t.locale === "en" ? "en-GB" : "ru-RU", { dateStyle: "short", timeStyle: "medium" })}</span>
|
||||||
<span className="font-mono text-xs text-muted-foreground">{e.id.slice(0, 8)}</span>
|
<span className="font-mono text-xs text-muted-foreground">{e.id.slice(0, 8)}</span>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { FEEDBACK_ADMIN_STATUS, FEEDBACK_STATUSES, isFeedbackStatus, isSuperadmin, listAllFeedback, listUserFeedback } from "@peppa/core";
|
import { FEEDBACK_ADMIN_STATUS, FEEDBACK_STATUSES, isFeedbackStatus, isSuperadmin, listAllFeedback, listUserFeedback } from "@peppa/core";
|
||||||
import { AdminFeedbackCard, MyFeedbackCard } from "@/components/Feedback";
|
import { AdminFeedbackCard, MyFeedbackCard } from "@/components/Feedback";
|
||||||
import { Empty, Flash, PageHeader, Section } from "@/components/common";
|
import { Empty, Flash, PageHeader, Section } from "@/components/common";
|
||||||
@ -7,14 +7,11 @@ import { requireUser } from "@/lib/auth";
|
|||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Обращения"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PEP-143: «Обращения». Everybody sees their own reports and where they stand; the superadmin
|
||||||
|
* also sees everybody's, filtered by status, and decides on them.
|
||||||
|
*/
|
||||||
export default async function FeedbackPage({ searchParams }: { searchParams: Promise<{ error?: string; status?: string; id?: string }> }) {
|
export default async function FeedbackPage({ searchParams }: { searchParams: Promise<{ error?: string; status?: string; id?: string }> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
@ -53,8 +50,3 @@ export default async function FeedbackPage({ searchParams }: { searchParams: Pro
|
|||||||
</Workspace>
|
</Workspace>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* PEP-143: «Обращения». Everybody sees their own reports and where they stand; the superadmin
|
|
||||||
* also sees everybody's, filtered by status, and decides on them.
|
|
||||||
*/
|
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
"use server";
|
|
||||||
// «Gitea» (PEP-280): the superadmin closes one public repository at a time.
|
|
||||||
|
|
||||||
import { PeppaError, requireSuperadmin } from "@peppa/core";
|
|
||||||
import { makeRepoPrivate } from "@peppa/runner";
|
|
||||||
import { revalidatePath } from "next/cache";
|
|
||||||
import { redirect } from "next/navigation";
|
|
||||||
import { asWebActor, requireUser } from "@/lib/auth";
|
|
||||||
import { db } from "@/lib/db";
|
|
||||||
import { getT } from "@/lib/i18n";
|
|
||||||
|
|
||||||
const str = (f: FormData, k: string) => String(f.get(k) ?? "").trim();
|
|
||||||
|
|
||||||
/** «Сделать закрытым»: back to the same list with what was closed, or the reason it was not. */
|
|
||||||
export async function makeRepoPrivateAction(f: FormData) {
|
|
||||||
const user = asWebActor(await requireUser());
|
|
||||||
const back = new URLSearchParams();
|
|
||||||
for (const k of ["q", "show"]) if (str(f, k)) back.set(k, str(f, k));
|
|
||||||
try {
|
|
||||||
await requireSuperadmin(db, user);
|
|
||||||
const r = await makeRepoPrivate(db, user, str(f, "repo"));
|
|
||||||
back.set("closed", r.fullName);
|
|
||||||
// The list is cached (PEP-273): without a fresh one the repository would still show as public for a minute.
|
|
||||||
back.set("fresh", "1");
|
|
||||||
} catch (e) {
|
|
||||||
const t = await getT();
|
|
||||||
const msg = e instanceof PeppaError ? t.text(e.message) : t("Ошибка: {message}", { message: (e as Error).message });
|
|
||||||
back.set("error", msg.slice(0, 300));
|
|
||||||
}
|
|
||||||
revalidatePath("/gitea");
|
|
||||||
redirect(`/gitea${back.size ? `?${back}` : ""}`);
|
|
||||||
}
|
|
||||||
@ -1,16 +1,15 @@
|
|||||||
// glossary-ignore-file: superadmin-only page about the platform's git server — «репозиторий» is the literal object here
|
// glossary-ignore-file: superadmin-only page about the platform's git server — «репозиторий» is the literal object here
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { ExternalLink, GitBranch, Lock } from "lucide-react";
|
import { ExternalLink, GitBranch, Lock } from "lucide-react";
|
||||||
import { giteaServerOverview, isSuperadmin, type GiteaServerRepo } from "@peppa/core";
|
import { giteaServerOverview, isSuperadmin, type GiteaServerRepo } from "@peppa/core";
|
||||||
import { ago, Empty, Flash, Notice, PageHeader, Section } from "@/components/common";
|
import { ago, Empty, Notice, PageHeader, Section } from "@/components/common";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Workspace } from "@/components/Workspace";
|
import { Workspace } from "@/components/Workspace";
|
||||||
import { requireUser } from "@/lib/auth";
|
import { requireUser } from "@/lib/auth";
|
||||||
import { makeRepoPrivateAction } from "./actions";
|
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import type { Translator } from "@peppa/shared/i18n";
|
import type { Translator } from "@peppa/shared/i18n";
|
||||||
@ -20,13 +19,9 @@ export async function generateMetadata() {
|
|||||||
return { title: t("Gitea — FORGE") };
|
return { title: t("Gitea — FORGE") };
|
||||||
}
|
}
|
||||||
|
|
||||||
type Params = { q?: string; show?: string; closed?: string; error?: string; page?: string; fresh?: string };
|
type Params = { q?: string; show?: string };
|
||||||
type Show = "all" | "linked" | "unlinked" | "public";
|
|
||||||
|
|
||||||
/** Rows per page (PEP-273: the whole list made the page over 1 MB). */
|
function RepoRow({ r, t }: { r: GiteaServerRepo; t: Translator }) {
|
||||||
const PAGE_SIZE = 50;
|
|
||||||
|
|
||||||
function RepoRow({ r, t, q, show }: { r: GiteaServerRepo; t: Translator; q: string; show: Show }) {
|
|
||||||
return (
|
return (
|
||||||
<li className="flex flex-col gap-1 border-b border-border px-4 py-3 last:border-b-0">
|
<li className="flex flex-col gap-1 border-b border-border px-4 py-3 last:border-b-0">
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
@ -54,18 +49,6 @@ function RepoRow({ r, t, q, show }: { r: GiteaServerRepo; t: Translator; q: stri
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{r.description && <div className="text-sm text-muted-foreground">{r.description}</div>}
|
{r.description && <div className="text-sm text-muted-foreground">{r.description}</div>}
|
||||||
{!r.private && (
|
|
||||||
// PEP-280: one repository at a time; opening it again is the owner's decision in the project settings.
|
|
||||||
<form action={makeRepoPrivateAction} className="mt-1">
|
|
||||||
<input type="hidden" name="repo" value={r.fullName} />
|
|
||||||
{q && <input type="hidden" name="q" value={q} />}
|
|
||||||
{show !== "all" && <input type="hidden" name="show" value={show} />}
|
|
||||||
<Button type="submit" size="sm" variant="outline">
|
|
||||||
<Lock className="size-3" />
|
|
||||||
{t("Сделать закрытым")}
|
|
||||||
</Button>
|
|
||||||
</form>
|
|
||||||
)}
|
|
||||||
<div className="text-xs text-muted-foreground">
|
<div className="text-xs text-muted-foreground">
|
||||||
{t("ветка {branch} · обновлён {when} · {size}", { branch: r.defaultBranch || "—", when: ago(r.updatedAt, t), size: r.sizeKb >= 1024 ? `${(r.sizeKb / 1024).toFixed(1)} MB` : `${r.sizeKb} KB` })}
|
{t("ветка {branch} · обновлён {when} · {size}", { branch: r.defaultBranch || "—", when: ago(r.updatedAt, t), size: r.sizeKb >= 1024 ? `${(r.sizeKb / 1024).toFixed(1)} MB` : `${r.sizeKb} KB` })}
|
||||||
</div>
|
</div>
|
||||||
@ -78,26 +61,12 @@ export default async function GiteaPage({ searchParams }: { searchParams: Promis
|
|||||||
const t = await getT();
|
const t = await getT();
|
||||||
if (!(await isSuperadmin(db, user))) notFound();
|
if (!(await isSuperadmin(db, user))) notFound();
|
||||||
const q = await searchParams;
|
const q = await searchParams;
|
||||||
const o = await giteaServerOverview(db, { fresh: q.fresh === "1" });
|
const o = await giteaServerOverview(db);
|
||||||
const needle = (q.q ?? "").trim().toLowerCase();
|
const needle = (q.q ?? "").trim().toLowerCase();
|
||||||
const show: Show = q.show === "linked" || q.show === "unlinked" || q.show === "public" ? q.show : "all";
|
const show = q.show === "linked" || q.show === "unlinked" ? q.show : "all";
|
||||||
const repos = o.repos.filter(
|
const repos = o.repos.filter(
|
||||||
(r) =>
|
(r) => (!needle || r.fullName.toLowerCase().includes(needle) || r.description.toLowerCase().includes(needle)) && (show === "all" || (show === "linked") === !!r.project),
|
||||||
(!needle || r.fullName.toLowerCase().includes(needle) || r.description.toLowerCase().includes(needle)) &&
|
|
||||||
(show === "all" || (show === "public" ? !r.private : (show === "linked") === !!r.project)),
|
|
||||||
);
|
);
|
||||||
const open = o.repos.filter((r) => !r.private).length;
|
|
||||||
const pages = Math.max(1, Math.ceil(repos.length / PAGE_SIZE));
|
|
||||||
const page = Math.min(pages, Math.max(1, Number.parseInt(q.page ?? "1", 10) || 1));
|
|
||||||
const shown = repos.slice((page - 1) * PAGE_SIZE, page * PAGE_SIZE);
|
|
||||||
const href = (extra: Record<string, string>) => {
|
|
||||||
const sp = new URLSearchParams();
|
|
||||||
if (q.q) sp.set("q", q.q);
|
|
||||||
if (show !== "all") sp.set("show", show);
|
|
||||||
for (const [k, v] of Object.entries(extra)) sp.set(k, v);
|
|
||||||
const s = sp.toString();
|
|
||||||
return s ? `/gitea?${s}` : "/gitea";
|
|
||||||
};
|
|
||||||
const owners = new Map<string, number>();
|
const owners = new Map<string, number>();
|
||||||
for (const r of o.repos) owners.set(r.owner, (owners.get(r.owner) ?? 0) + 1);
|
for (const r of o.repos) owners.set(r.owner, (owners.get(r.owner) ?? 0) + 1);
|
||||||
const linked = o.repos.filter((r) => r.project).length;
|
const linked = o.repos.filter((r) => r.project).length;
|
||||||
@ -125,39 +94,16 @@ export default async function GiteaPage({ searchParams }: { searchParams: Promis
|
|||||||
{t("Бот")}: <span className="font-mono">{o.bot?.login ?? "—"}</span>
|
{t("Бот")}: <span className="font-mono">{o.bot?.login ?? "—"}</span>
|
||||||
{o.bot && (o.bot.admin ? <Badge variant="ok" className="ml-2">{t("админ сервера — видит все репозитории")}</Badge> : <Badge variant="warn" className="ml-2">{t("не админ — видит публичные и свои репозитории")}</Badge>)}
|
{o.bot && (o.bot.admin ? <Badge variant="ok" className="ml-2">{t("админ сервера — видит все репозитории")}</Badge> : <Badge variant="warn" className="ml-2">{t("не админ — видит публичные и свои репозитории")}</Badge>)}
|
||||||
</div>
|
</div>
|
||||||
{o.fetchedAt && (
|
|
||||||
<div className="text-muted-foreground">
|
|
||||||
{t("Список получен {when}", { when: ago(o.fetchedAt, t) })} ·{" "}
|
|
||||||
<a href={href({ fresh: "1" })}>{t("Получить заново")}</a>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{o.repos.length > 0 && (
|
{o.repos.length > 0 && (
|
||||||
<div className="text-muted-foreground">
|
<div className="text-muted-foreground">
|
||||||
{t("Репозиториев: {n} · подключены к проектам: {linked}", { n: o.repos.length, linked })} ·{" "}
|
{t("Репозиториев: {n} · подключены к проектам: {linked}", { n: o.repos.length, linked })} ·{" "}
|
||||||
{[...owners].sort((a, b) => b[1] - a[1]).map(([owner, n]) => `${owner} ${n}`).join(", ")}
|
{[...owners].sort((a, b) => b[1] - a[1]).map(([owner, n]) => `${owner} ${n}`).join(", ")}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{o.repos.length > 0 && (
|
|
||||||
<div>
|
|
||||||
{open > 0 ? (
|
|
||||||
<Link href="/gitea?show=public">{t("Публичных: {n} — их видит любой, у кого есть доступ к Gitea", { n: open })}</Link>
|
|
||||||
) : (
|
|
||||||
<span className="text-muted-foreground">{t("Публичных нет")}</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Card>
|
</Card>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
{q.closed && <Notice>{t("{repo} теперь закрытый: его видят только владелец, участники и бот", { repo: q.closed })}</Notice>}
|
|
||||||
<Flash error={q.error} />
|
|
||||||
{o.error && <Notice>{t("Gitea не ответила: {error}", { error: o.error })}</Notice>}
|
{o.error && <Notice>{t("Gitea не ответила: {error}", { error: o.error })}</Notice>}
|
||||||
{o.loading && (
|
|
||||||
// PEP-317: the page does not wait for the Git server — the list is loaded in the background.
|
|
||||||
<Notice>
|
|
||||||
{t("Список репозиториев загружается — это может занять несколько секунд.")} <a href={href({})}>{t("Обновить")}</a>
|
|
||||||
</Notice>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Section title={t("Репозитории")} count={repos.length}>
|
<Section title={t("Репозитории")} count={repos.length}>
|
||||||
<form className="mb-3 flex flex-wrap items-center gap-2" action="/gitea">
|
<form className="mb-3 flex flex-wrap items-center gap-2" action="/gitea">
|
||||||
@ -166,30 +112,22 @@ export default async function GiteaPage({ searchParams }: { searchParams: Promis
|
|||||||
<option value="all">{t("все")}</option>
|
<option value="all">{t("все")}</option>
|
||||||
<option value="linked">{t("подключённые к проектам")}</option>
|
<option value="linked">{t("подключённые к проектам")}</option>
|
||||||
<option value="unlinked">{t("без проекта")}</option>
|
<option value="unlinked">{t("без проекта")}</option>
|
||||||
<option value="public">{t("публичные")}</option>
|
|
||||||
</select>
|
</select>
|
||||||
<Button type="submit" size="sm">
|
<Button type="submit" size="sm">
|
||||||
{t("Показать")}
|
{t("Показать")}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
{o.loading ? null : repos.length === 0 ? (
|
{repos.length === 0 ? (
|
||||||
<Empty>{t("Репозиториев не найдено.")}</Empty>
|
<Empty>{t("Репозиториев не найдено.")}</Empty>
|
||||||
) : (
|
) : (
|
||||||
<Card className="p-0">
|
<Card className="p-0">
|
||||||
<ul>
|
<ul>
|
||||||
{shown.map((r) => (
|
{repos.map((r) => (
|
||||||
<RepoRow key={r.fullName} r={r} t={t} q={q.q ?? ""} show={show} />
|
<RepoRow key={r.fullName} r={r} t={t} />
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
{pages > 1 && (
|
|
||||||
<nav className="mt-3 flex items-center gap-3 text-sm">
|
|
||||||
{page > 1 ? <a href={href({ page: String(page - 1) })}>{t("‹ Назад")}</a> : <span className="text-muted-foreground">{t("‹ Назад")}</span>}
|
|
||||||
<span className="text-muted-foreground">{t("Страница {page} из {pages}", { page, pages })}</span>
|
|
||||||
{page < pages ? <a href={href({ page: String(page + 1) })}>{t("Дальше ›")}</a> : <span className="text-muted-foreground">{t("Дальше ›")}</span>}
|
|
||||||
</nav>
|
|
||||||
)}
|
|
||||||
</Section>
|
</Section>
|
||||||
</div>
|
</div>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { CONNECT_HELP, featureGateView } from "@peppa/core";
|
import { CONNECT_HELP, featureGateView } from "@peppa/core";
|
||||||
import { FeatureGate } from "@/components/FeatureGate";
|
import { FeatureGate } from "@/components/FeatureGate";
|
||||||
import { LiveRefresh } from "@/components/LiveRefresh";
|
import { LiveRefresh } from "@/components/LiveRefresh";
|
||||||
@ -7,14 +7,8 @@ import { CopyText } from "@/components/CopyText";
|
|||||||
import { Workspace } from "@/components/Workspace";
|
import { Workspace } from "@/components/Workspace";
|
||||||
import { publicOrigin } from "@/lib/auth";
|
import { publicOrigin } from "@/lib/auth";
|
||||||
import { getLocale, getT } from "@/lib/i18n";
|
import { getLocale, getT } from "@/lib/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, (CONNECT_HELP[t.locale] ?? CONNECT_HELP.ru).title);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/** PEP-135: how to connect FORGE to one's own Claude or ChatGPT — step by step; texts live in core/connect-texts.ts. */
|
||||||
export default async function ConnectHelp() {
|
export default async function ConnectHelp() {
|
||||||
const t = CONNECT_HELP[await getLocale()] ?? CONNECT_HELP.ru;
|
const t = CONNECT_HELP[await getLocale()] ?? CONNECT_HELP.ru;
|
||||||
const address = `${await publicOrigin()}/mcp`;
|
const address = `${await publicOrigin()}/mcp`;
|
||||||
@ -78,5 +72,3 @@ export default async function ConnectHelp() {
|
|||||||
</Workspace>
|
</Workspace>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PEP-135: how to connect FORGE to one's own Claude or ChatGPT — step by step; texts live in core/connect-texts.ts. */
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { CONNECT_HELP, featureGateView, PRODUCT_HELP } from "@peppa/core";
|
import { CONNECT_HELP, featureGateView, PRODUCT_HELP } from "@peppa/core";
|
||||||
import { FeatureGate } from "@/components/FeatureGate";
|
import { FeatureGate } from "@/components/FeatureGate";
|
||||||
@ -9,7 +9,6 @@ import { publicOrigin, uiMode } from "@/lib/auth";
|
|||||||
import { Workspace } from "@/components/Workspace";
|
import { Workspace } from "@/components/Workspace";
|
||||||
import { voiceStoriesEnabled } from "@peppa/shared";
|
import { voiceStoriesEnabled } from "@peppa/shared";
|
||||||
import { PageHeader, Section } from "@/components/common";
|
import { PageHeader, Section } from "@/components/common";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
const TOOLS: Array<[string, string]> = [
|
const TOOLS: Array<[string, string]> = [
|
||||||
["get_started", m("правила работы для ИИ-клиента: вызывается первым, коротко и без кода")],
|
["get_started", m("правила работы для ИИ-клиента: вызывается первым, коротко и без кода")],
|
||||||
@ -56,7 +55,7 @@ const CASES: Array<{ title: string; say: string; how: string }> = [
|
|||||||
{ title: m("Работать вместе"), say: m("Добавь в PAY участника dana"), how: m("add_member (только владелец). Участник видит доску и входящие, двигает карточки, отвечает агентам и получает доступ к репозиторию. Тот, кто ещё не входил в FORGE, получит приглашение — оно сработает при первом входе") },
|
{ title: m("Работать вместе"), say: m("Добавь в PAY участника dana"), how: m("add_member (только владелец). Участник видит доску и входящие, двигает карточки, отвечает агентам и получает доступ к репозиторию. Тот, кто ещё не входил в FORGE, получит приглашение — оно сработает при первом входе") },
|
||||||
{ title: m("Автономность"), say: m("Пусть PAY делается сам: бери стори из бэклога и мержи зелёные PR"), how: m("update_project_settings level=auto. «С подсказками» (assisted) — только пуш, когда агенты простаивают. То же — «⋯ Настройки проекта» → «Автономность»") },
|
{ title: m("Автономность"), say: m("Пусть PAY делается сам: бери стори из бэклога и мержи зелёные PR"), how: m("update_project_settings level=auto. «С подсказками» (assisted) — только пуш, когда агенты простаивают. То же — «⋯ Настройки проекта» → «Автономность»") },
|
||||||
{ title: m("Модель агента"), say: m("Рутину в PAY делай на sonnet, а если проверки дважды красные — переходи на opus"), how: m("update_project_settings agent={model: sonnet, escalate_model: opus, escalate_after: 2}. Для одной стори — update_task с agent. То же — «⋯ Настройки проекта» → «Модель агента» и раздел «Агент» на странице стори") },
|
{ title: m("Модель агента"), say: m("Рутину в PAY делай на sonnet, а если проверки дважды красные — переходи на opus"), how: m("update_project_settings agent={model: sonnet, escalate_model: opus, escalate_after: 2}. Для одной стори — update_task с agent. То же — «⋯ Настройки проекта» → «Модель агента» и раздел «Агент» на странице стори") },
|
||||||
{ title: m("Видимость репозитория"), say: m("Сделай репозиторий PAY публичным"), how: m("set_project_visibility (только владелец). Новые проекты закрытые по умолчанию; то же — в вебе: «⋯ Настройки проекта» → «Репозиторий»") },
|
{ title: m("Видимость репозитория"), say: m("Сделай репозиторий PAY приватным"), how: m("set_project_visibility (только владелец). Новые проекты публичные по умолчанию; то же — в вебе: «⋯ Настройки проекта» → «Репозиторий»") },
|
||||||
{ title: m("Ошибки из прода"), say: m("Какие ошибки ждут решения в PAY? · Ошибку #7 — в работу"), how: m("list_incidents → decide_incident. Подключение — на странице проекта «⋯ Настройки проекта → Баги»") },
|
{ title: m("Ошибки из прода"), say: m("Какие ошибки ждут решения в PAY? · Ошибку #7 — в работу"), how: m("list_incidents → decide_incident. Подключение — на странице проекта «⋯ Настройки проекта → Баги»") },
|
||||||
{ title: m("Политика инцидентов"), say: m("В PAY пусть ошибки разбирает триажёр: падения оплаты — сразу в работу, косметику — в бэклог, остальное спроси"), how: m("set_incident_policy policy=triage, triage_prompt — ваши слова. Не уверен — спросит кнопками в Telegram") },
|
{ title: m("Политика инцидентов"), say: m("В PAY пусть ошибки разбирает триажёр: падения оплаты — сразу в работу, косметику — в бэклог, остальное спроси"), how: m("set_incident_policy policy=triage, triage_prompt — ваши слова. Не уверен — спросит кнопками в Telegram") },
|
||||||
{ title: m("Выкатить в прод"), say: m("Что сейчас на staging в PAY? · Выкати PAY в прод"), how: m("list_releases → deploy. Тот же образ, что прошёл staging; не поднялся — FORGE сама откатит и напишет") },
|
{ title: m("Выкатить в прод"), say: m("Что сейчас на staging в PAY? · Выкати PAY в прод"), how: m("list_releases → deploy. Тот же образ, что прошёл staging; не поднялся — FORGE сама откатит и напишет") },
|
||||||
@ -141,12 +140,6 @@ async function ProductHelp() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Помощь"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Help() {
|
export default async function Help() {
|
||||||
if ((await uiMode()) === "product") return <ProductHelp />;
|
if ((await uiMode()) === "product") return <ProductHelp />;
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
|
|||||||
@ -1,17 +1,11 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { ShortcutsList } from "@/components/CommandPalette";
|
import { ShortcutsList } from "@/components/CommandPalette";
|
||||||
import { PageHeader, Section } from "@/components/common";
|
import { PageHeader, Section } from "@/components/common";
|
||||||
import { Workspace } from "@/components/Workspace";
|
import { Workspace } from "@/components/Workspace";
|
||||||
import { PALETTE_KEYS } from "@/lib/shortcuts";
|
import { PALETTE_KEYS } from "@/lib/shortcuts";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Горячие клавиши"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/** PEP-52: list of keyboard shortcuts (the same list as the «?» dialog). */
|
||||||
export default async function Shortcuts() {
|
export default async function Shortcuts() {
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
return (
|
return (
|
||||||
@ -32,5 +26,3 @@ export default async function Shortcuts() {
|
|||||||
</Workspace>
|
</Workspace>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PEP-52: list of keyboard shortcuts (the same list as the «?» dialog). */
|
|
||||||
|
|||||||
@ -6,14 +6,8 @@ import { Workspace } from "@/components/Workspace";
|
|||||||
import { requireUser } from "@/lib/auth";
|
import { requireUser } from "@/lib/auth";
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Журнал действий"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/** Superadmin only (PEP-48): who did what — people (web, Telegram, MCP clients, CLI), agents, Peppa. */
|
||||||
export default async function Journal({ searchParams }: { searchParams: Promise<{ project?: string; actor?: string; channel?: string; all?: string }> }) {
|
export default async function Journal({ searchParams }: { searchParams: Promise<{ project?: string; actor?: string; channel?: string; all?: string }> }) {
|
||||||
const me = await requireUser();
|
const me = await requireUser();
|
||||||
if (!(await isSuperadmin(db, me))) notFound();
|
if (!(await isSuperadmin(db, me))) notFound();
|
||||||
@ -41,5 +35,3 @@ export default async function Journal({ searchParams }: { searchParams: Promise<
|
|||||||
</Workspace>
|
</Workspace>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Superadmin only (PEP-48): who did what — people (web, Telegram, MCP clients, CLI), agents, Peppa. */
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { accountUsageForUser, agentsLine, getNotifyPrefs, httpsAvatar, isSuperadmin, pendingFeedbackCount } from "@peppa/core";
|
import { accountUsageForUser, agentsLine, getNotifyPrefs, isSuperadmin, pendingFeedbackCount } from "@peppa/core";
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { subscriptionRequestOffers } from "@peppa/runner";
|
import { subscriptionRequestOffers } from "@peppa/runner";
|
||||||
import { requireUser, uiMode } from "@/lib/auth";
|
import { requireUser, uiMode } from "@/lib/auth";
|
||||||
@ -35,7 +35,7 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
|
|||||||
<WordsProvider mode={mode}>
|
<WordsProvider mode={mode}>
|
||||||
<div className="min-h-dvh md:grid md:grid-cols-[232px_minmax(0,1fr)]">
|
<div className="min-h-dvh md:grid md:grid-cols-[232px_minmax(0,1fr)]">
|
||||||
<AttentionBadge count={counts.questions + counts.waitingRunners} sound={sound} />
|
<AttentionBadge count={counts.questions + counts.waitingRunners} sound={sound} />
|
||||||
<Sidebar login={user.login} avatarUrl={httpsAvatar(user.avatarUrl)} counts={{ ...counts, feedback }} superadmin={superadmin} engineer={engineer} />
|
<Sidebar login={user.login} avatarUrl={user.avatarUrl} counts={{ ...counts, feedback }} superadmin={superadmin} engineer={engineer} />
|
||||||
<div className="flex min-w-0 flex-col pb-16 md:pb-0">
|
<div className="flex min-w-0 flex-col pb-16 md:pb-0">
|
||||||
<VersionWatch boot={bootId()} />
|
<VersionWatch boot={bootId()} />
|
||||||
{line ? <AgentsStrip line={line} offers={offers} /> : <UsageStrip accounts={accounts} admin={superadmin} />}
|
{line ? <AgentsStrip line={line} offers={offers} /> : <UsageStrip accounts={accounts} admin={superadmin} />}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
// glossary-ignore-file: the section is for the superadmin only.
|
// glossary-ignore-file: the section is for the superadmin only.
|
||||||
import { platformZone } from "@peppa/shared/time";
|
import Link from "next/link";
|
||||||
import Link from "@/components/Link";
|
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { Activity, Pause, Play, Trash2 } from "lucide-react";
|
import { Activity, Pause, Play, Trash2 } from "lucide-react";
|
||||||
import { describeTarget, FEATURES, observeRemindMin, getMonitor, isSuperadmin, monitorChecks, monitorIncidents, monitorView } from "@peppa/core";
|
import { describeTarget, FEATURES, observeRemindMin, getMonitor, isSuperadmin, monitorChecks, monitorIncidents, monitorView } from "@peppa/core";
|
||||||
@ -16,18 +15,11 @@ import { requireUser } from "@/lib/auth";
|
|||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { deleteMonitorAction, pauseMonitorAction, updateMonitorAction } from "../actions";
|
import { deleteMonitorAction, pauseMonitorAction, updateMonitorAction } from "../actions";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
const PAGE = 100;
|
const PAGE = 100;
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
const when = (iso: string) => new Date(iso).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit" });
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Мониторинг"));
|
|
||||||
}
|
|
||||||
|
|
||||||
const when = (iso: string) => new Date(iso).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZone: platformZone() });
|
|
||||||
|
|
||||||
export default async function MonitorPage({ params, searchParams }: { params: Promise<{ id: string }>; searchParams: Promise<{ error?: string; page?: string }> }) {
|
export default async function MonitorPage({ params, searchParams }: { params: Promise<{ id: string }>; searchParams: Promise<{ error?: string; page?: string }> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
// glossary-ignore-file: the section is for the superadmin only.
|
// glossary-ignore-file: the section is for the superadmin only.
|
||||||
import { platformZone } from "@peppa/shared/time";
|
import Link from "next/link";
|
||||||
import Link from "@/components/Link";
|
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { Activity, Pause, Play, Plus } from "lucide-react";
|
import { Activity, Pause, Play, Plus } from "lucide-react";
|
||||||
import { describeTarget, observeRemindMin, PROVIDER_LABEL, smokeStatus, smokeTimeoutMin, type SmokeRun, type SmokeStatus, egovLoginSummary, errorScope, errorsOverview, FEATURE_NAMES, FEATURES, featureLog, featureStatuses, getLastRetention, isSuperadmin, listErrors, listMonitorViews, requestSummary, isBadVital, vitalsSummary, type VitalDevice, type VitalMetric } from "@peppa/core";
|
import { describeTarget, observeRemindMin, PROVIDER_LABEL, smokeStatus, smokeTimeoutMin, type SmokeRun, type SmokeStatus, egovLoginSummary, errorScope, errorsOverview, FEATURE_NAMES, FEATURES, featureLog, featureStatuses, getLastRetention, isSuperadmin, listErrors, listMonitorViews, requestSummary, isBadVital, vitalsSummary, type VitalDevice, type VitalMetric } from "@peppa/core";
|
||||||
@ -84,7 +83,7 @@ async function SmokeSection({ t }: { t: Awaited<ReturnType<typeof getT>> }) {
|
|||||||
skipped: [t("не проверен"), "text-muted-foreground"],
|
skipped: [t("не проверен"), "text-muted-foreground"],
|
||||||
};
|
};
|
||||||
const TRIGGER = { deploy: t("после выкатки"), hourly: t("плановая"), manual: t("по запросу") } as const;
|
const TRIGGER = { deploy: t("после выкатки"), hourly: t("плановая"), manual: t("по запросу") } as const;
|
||||||
const when = (r: SmokeRun) => new Date(r.at).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit", timeZone: platformZone() });
|
const when = (r: SmokeRun) => new Date(r.at).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit" });
|
||||||
return (
|
return (
|
||||||
<Section
|
<Section
|
||||||
title={t("Запуск агентов")}
|
title={t("Запуск агентов")}
|
||||||
@ -288,7 +287,7 @@ export default async function Observability({ searchParams }: { searchParams: Pr
|
|||||||
<ul className="m-0 flex list-none flex-col gap-1 p-0 text-sm">
|
<ul className="m-0 flex list-none flex-col gap-1 p-0 text-sm">
|
||||||
{flog.map((e) => (
|
{flog.map((e) => (
|
||||||
<li key={e.id} className="flex flex-wrap gap-2">
|
<li key={e.id} className="flex flex-wrap gap-2">
|
||||||
<span className="text-muted-foreground">{new Date(e.at).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit", timeZone: platformZone() })}</span>
|
<span className="text-muted-foreground">{new Date(e.at).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit" })}</span>
|
||||||
<span className={e.state === "unavailable" ? "text-destructive" : "text-ok"}>{e.state === "unavailable" ? t("отключена") : t("снова включена")}</span>
|
<span className={e.state === "unavailable" ? "text-destructive" : "text-ok"}>{e.state === "unavailable" ? t("отключена") : t("снова включена")}</span>
|
||||||
<span className="font-medium">{t(FEATURES[e.name].label)}</span>
|
<span className="font-medium">{t(FEATURES[e.name].label)}</span>
|
||||||
{e.reason && <span className="text-muted-foreground">{e.reason}</span>}
|
{e.reason && <span className="text-muted-foreground">{e.reason}</span>}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { acceptAllSummary, acceptRunLine, acceptScreen, type AcceptItem } from "@peppa/core";
|
import { acceptAllSummary, acceptScreen, type AcceptItem } from "@peppa/core";
|
||||||
import { acceptAllAction, fixStoryAction } from "@/app/(app)/actions";
|
import { acceptAllAction, fixStoryAction } from "@/app/(app)/actions";
|
||||||
import { Empty, Flash, Key, Notice, PageHeader } from "@/components/common";
|
import { Empty, Flash, Key, Notice, PageHeader } from "@/components/common";
|
||||||
import { LiveRefresh } from "@/components/LiveRefresh";
|
import { LiveRefresh } from "@/components/LiveRefresh";
|
||||||
@ -32,8 +32,7 @@ export default async function AcceptPage({ params, searchParams }: { params: Pro
|
|||||||
if (!p) notFound();
|
if (!p) notFound();
|
||||||
const screen = await acceptScreen(db, p);
|
const screen = await acceptScreen(db, p);
|
||||||
const back = `/p/${p.key}/accept`;
|
const back = `/p/${p.key}/accept`;
|
||||||
// PEP-318: stories already queued are not offered again.
|
const all = screen.groups.flatMap((g) => g.items);
|
||||||
const all = screen.groups.flatMap((g) => g.items).filter((it) => !it.queued);
|
|
||||||
const done = sp.ok != null ? { accepted: Number(sp.ok) || 0, pending: Number(sp.pending) || 0, failed: Number(sp.failed) || 0 } : null;
|
const done = sp.ok != null ? { accepted: Number(sp.ok) || 0, pending: Number(sp.pending) || 0, failed: Number(sp.failed) || 0 } : null;
|
||||||
return (
|
return (
|
||||||
<Workspace>
|
<Workspace>
|
||||||
@ -43,20 +42,13 @@ export default async function AcceptPage({ params, searchParams }: { params: Pro
|
|||||||
{screen.total ? t("Работа, которая ждёт вашего решения: посмотрите и примите или напишите, что поправить.") : t("Принимать пока нечего: агенты пришлют задачи, когда работа будет готова.")}
|
{screen.total ? t("Работа, которая ждёт вашего решения: посмотрите и примите или напишите, что поправить.") : t("Принимать пока нечего: агенты пришлют задачи, когда работа будет готова.")}
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
|
||||||
{screen.run ? (
|
{done && (
|
||||||
// PEP-318: «Принять всё» goes on in the background — its progress, then its result.
|
|
||||||
<Notice>
|
<Notice>
|
||||||
<span data-accept-result data-accept-running={screen.run.finishedAt ? undefined : ""}>{t.text(acceptRunLine(screen.run))}</span>
|
<span data-accept-result>{t.text(acceptAllSummary(done))}</span>
|
||||||
{screen.liveUrl && screen.run.finishedAt && screen.run.accepted.length + screen.run.pending.length > 0 && (
|
{screen.liveUrl && done.accepted + done.pending > 0 && (
|
||||||
<a href={screen.liveUrl} target="_blank" rel="noreferrer" className="text-primary">{t("Открыть продукт")} →</a>
|
<a href={screen.liveUrl} target="_blank" rel="noreferrer" className="text-primary">{t("Открыть продукт")} →</a>
|
||||||
)}
|
)}
|
||||||
</Notice>
|
</Notice>
|
||||||
) : (
|
|
||||||
done && (
|
|
||||||
<Notice>
|
|
||||||
<span data-accept-result>{t.text(acceptAllSummary(done))}</span>
|
|
||||||
</Notice>
|
|
||||||
)
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{screen.total > 0 && (
|
{screen.total > 0 && (
|
||||||
@ -66,7 +58,6 @@ export default async function AcceptPage({ params, searchParams }: { params: Pro
|
|||||||
{t("Открыть версию для проверки")}
|
{t("Открыть версию для проверки")}
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
{all.length > 0 && (
|
|
||||||
<details className="group w-full rounded-lg border bg-card sm:w-auto" data-accept-all>
|
<details className="group w-full rounded-lg border bg-card sm:w-auto" data-accept-all>
|
||||||
<summary className={`flex cursor-pointer list-none items-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground select-none [&::-webkit-details-marker]:hidden ${BIG}`}>
|
<summary className={`flex cursor-pointer list-none items-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground select-none [&::-webkit-details-marker]:hidden ${BIG}`}>
|
||||||
{t("Принять всё · {n}", { n: all.length })}
|
{t("Принять всё · {n}", { n: all.length })}
|
||||||
@ -89,11 +80,10 @@ export default async function AcceptPage({ params, searchParams }: { params: Pro
|
|||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
</details>
|
</details>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{screen.total === 0 && !done && !screen.run && <Empty>{t("Задач на приёмке нет.")}</Empty>}
|
{screen.total === 0 && !done && <Empty>{t("Задач на приёмке нет.")}</Empty>}
|
||||||
|
|
||||||
{screen.groups.map((g) => (
|
{screen.groups.map((g) => (
|
||||||
<section key={g.page || "-"} className="mb-8" data-accept-group={g.page || "-"}>
|
<section key={g.page || "-"} className="mb-8" data-accept-group={g.page || "-"}>
|
||||||
@ -125,7 +115,6 @@ async function AcceptCard({ it, back }: { it: AcceptItem; back: string }) {
|
|||||||
{t("Не принялась: {reason}", { reason: t.text(it.failed) })}
|
{t("Не принялась: {reason}", { reason: t.text(it.failed) })}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{it.queued && !it.pending && <p className="m-0 mb-3 text-sm text-muted-foreground" data-accept-queued>{t("Принимается — дождитесь, страница обновится сама.")}</p>}
|
|
||||||
{it.pending && <p className="m-0 mb-3 text-sm text-muted-foreground">{t("Вы уже приняли — изменения обновляются, задача закроется сама.")}</p>}
|
{it.pending && <p className="m-0 mb-3 text-sm text-muted-foreground">{t("Вы уже приняли — изменения обновляются, задача закроется сама.")}</p>}
|
||||||
{it.shots.length > 0 ? (
|
{it.shots.length > 0 ? (
|
||||||
// Scrolls sideways on a phone: one page per screen, «было» above «стало».
|
// Scrolls sideways on a phone: one page per screen, «было» above «стало».
|
||||||
@ -152,7 +141,7 @@ async function AcceptCard({ it, back }: { it: AcceptItem; back: string }) {
|
|||||||
<a href={it.previewUrl} target="_blank" rel="noreferrer" className="inline-flex min-h-11 items-center text-primary">{t("Открыть в версии для проверки")} →</a>
|
<a href={it.previewUrl} target="_blank" rel="noreferrer" className="inline-flex min-h-11 items-center text-primary">{t("Открыть в версии для проверки")} →</a>
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
{!it.pending && !it.queued && (
|
{!it.pending && (
|
||||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-start">
|
<div className="flex flex-col gap-2 sm:flex-row sm:items-start">
|
||||||
<form action={acceptAllAction}>
|
<form action={acceptAllAction}>
|
||||||
<input type="hidden" name="project" value={it.key.slice(0, it.key.lastIndexOf("-"))} />
|
<input type="hidden" name="project" value={it.key.slice(0, it.key.lastIndexOf("-"))} />
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { platformZone } from "@peppa/shared/time";
|
import Link from "next/link";
|
||||||
import Link from "@/components/Link";
|
|
||||||
import { Fragment } from "react";
|
import { Fragment } from "react";
|
||||||
import { ProductCard } from "@/components/ProductCard";
|
import { ProductCard } from "@/components/ProductCard";
|
||||||
import { PublishPanel } from "@/components/PublishPanel";
|
import { PublishPanel } from "@/components/PublishPanel";
|
||||||
@ -7,7 +6,7 @@ import { notFound } from "next/navigation";
|
|||||||
import { ExternalLink, Plus, Rocket, SquareTerminal } from "lucide-react";
|
import { ExternalLink, Plus, Rocket, SquareTerminal } from "lucide-react";
|
||||||
import { columnOf, currentReleases, peekRepo, isPlatform, listReleases, bugsinkWebhookBase, openPulls, platformReleaseCandidate, platformReleaseOffers, ownPendingLogins, readAgentsMd, repoOverview, type Release, sharedRequest, subscriptionRequestOffer } from "@peppa/runner";
|
import { columnOf, currentReleases, peekRepo, isPlatform, listReleases, bugsinkWebhookBase, openPulls, platformReleaseCandidate, platformReleaseOffers, ownPendingLogins, readAgentsMd, repoOverview, type Release, sharedRequest, subscriptionRequestOffer } from "@peppa/runner";
|
||||||
import { getProjectPause, getPublishMode, poolSubscriptions, PRODUCT_PROJECT_TABS, userProjectIds, projectProduct, discussionUnread, ensureProjectChat, listHosts, DEFAULT_RUNNER_SETTINGS, DEFAULT_AGENT_SETTINGS, getProjectAgentSettings, getSystemAgentSettings, getProjectRunnerSettings, getSystemRunnerSettings, blockedLabel, blockersMap, epicProgress, progressLabel, taskProgress, getProjectBudget, listJournal, listProjectSecrets, agentSecretsEnabled, secretsAgentReport, secretNameHints, projectMetrics, type ActorChannel, type ActorKind, getAutonomy, getIncidentSettings, getDirectOrigins, getReviewSettings, isSuperadmin, listEpics, listErrorSources, listIncidents, listMembers, listPools, listSpecs, taskAgentNames, getIntakeSettings, intakePendingTasks, projectAgentWarning, taskHoldReasons, memoryStats, readMemory, projectPool, sharedPool, ownPool, poolOverview, repoAudience, repoVisibilityLabel } from "@peppa/core";
|
import { getProjectPause, getPublishMode, poolSubscriptions, PRODUCT_PROJECT_TABS, userProjectIds, projectProduct, discussionUnread, ensureProjectChat, listHosts, DEFAULT_RUNNER_SETTINGS, DEFAULT_AGENT_SETTINGS, getProjectAgentSettings, getSystemAgentSettings, getProjectRunnerSettings, getSystemRunnerSettings, blockedLabel, blockersMap, epicProgress, progressLabel, taskProgress, getProjectBudget, listJournal, listProjectSecrets, agentSecretsEnabled, secretsAgentReport, secretNameHints, projectMetrics, type ActorChannel, type ActorKind, getAutonomy, getIncidentSettings, getDirectOrigins, getReviewSettings, isSuperadmin, listEpics, listErrorSources, listIncidents, listMembers, listPools, listSpecs, taskAgentNames, getIntakeSettings, intakePendingTasks, projectAgentWarning, taskHoldReasons, memoryStats, readMemory, projectPool, sharedPool, ownPool, poolOverview, repoAudience, repoVisibilityLabel } from "@peppa/core";
|
||||||
import { productNeeds, lastProductReview, deferredFindings } from "@peppa/core";
|
import { productNeeds, lastProductReview } from "@peppa/core";
|
||||||
import { LiveRefresh } from "@/components/LiveRefresh";
|
import { LiveRefresh } from "@/components/LiveRefresh";
|
||||||
import { PanelSection } from "@/components/ActivityAside";
|
import { PanelSection } from "@/components/ActivityAside";
|
||||||
import { Board, type Card } from "@/components/Board";
|
import { Board, type Card } from "@/components/Board";
|
||||||
@ -48,7 +47,6 @@ import { queuePositions, workLine } from "@peppa/core";
|
|||||||
import { WorkLine } from "@/components/WorkLine";
|
import { WorkLine } from "@/components/WorkLine";
|
||||||
import { deleteProjectAction } from "../../actions";
|
import { deleteProjectAction } from "../../actions";
|
||||||
import { DeleteProjectControl, mayDeleteProject, RestoreProjectButton } from "@/components/ProjectDelete";
|
import { DeleteProjectControl, mayDeleteProject, RestoreProjectButton } from "@/components/ProjectDelete";
|
||||||
import { projectTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
const RELEASE_STATUS: Record<Release["status"], { label: string; tone: "info" | "ok" | "warn" | "danger" | "muted" }> = {
|
const RELEASE_STATUS: Record<Release["status"], { label: string; tone: "info" | "ok" | "warn" | "danger" | "muted" }> = {
|
||||||
deploying: { label: m("выкатывается"), tone: "info" },
|
deploying: { label: m("выкатывается"), tone: "info" },
|
||||||
@ -72,14 +70,6 @@ const TABS = [
|
|||||||
{ id: "journal", label: m("Журнал") },
|
{ id: "journal", label: m("Журнал") },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
// PEP-274: «KEY · вкладка — FORGE».
|
|
||||||
export async function generateMetadata({ params, searchParams }: { params: Promise<{ key: string }>; searchParams: Promise<{ tab?: string }> }) {
|
|
||||||
const t = await getT();
|
|
||||||
const { tab: id } = await searchParams;
|
|
||||||
const tab = TABS.find((x) => x.id === id) ?? TABS[0]!;
|
|
||||||
return projectTitle(t, (await params).key, t.text(tab.label));
|
|
||||||
}
|
|
||||||
|
|
||||||
function EnvLine({ name, r, t }: { name: string; r: Release | null | undefined; t: Translator }) {
|
function EnvLine({ name, r, t }: { name: string; r: Release | null | undefined; t: Translator }) {
|
||||||
return (
|
return (
|
||||||
<div className="flex min-w-0 flex-1 flex-col gap-0.5 rounded-md border bg-background/40 px-3 py-2">
|
<div className="flex min-w-0 flex-1 flex-col gap-0.5 rounded-md border bg-background/40 px-3 py-2">
|
||||||
@ -218,7 +208,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
|
|||||||
const agentsMd = tab === "agents" ? await readAgentsMd(db, p) : null;
|
const agentsMd = tab === "agents" ? await readAgentsMd(db, p) : null;
|
||||||
const product = await projectProduct(db, p.id);
|
const product = await projectProduct(db, p.id);
|
||||||
const publish = await getPublishMode(db, p.id);
|
const publish = await getPublishMode(db, p.id);
|
||||||
const [productNeedList, productReview, deferred] = await Promise.all([productNeeds(db, p.id), lastProductReview(db, p.id), tab === "board" ? deferredFindings(db, p.id) : null]);
|
const [productNeedList, productReview] = await Promise.all([productNeeds(db, p.id), lastProductReview(db, p.id)]);
|
||||||
// The chat belongs to the project's people; a superadmin looking at someone else's project has none.
|
// The chat belongs to the project's people; a superadmin looking at someone else's project has none.
|
||||||
const canChat = (await userProjectIds(db, user.id)).includes(p.id);
|
const canChat = (await userProjectIds(db, user.id)).includes(p.id);
|
||||||
const sharedReq = await sharedRequest(db, p.id);
|
const sharedReq = await sharedRequest(db, p.id);
|
||||||
@ -710,7 +700,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
|
|||||||
</nav>
|
</nav>
|
||||||
)}
|
)}
|
||||||
{work && <WorkLine line={work} className="mb-2" />}
|
{work && <WorkLine line={work} className="mb-2" />}
|
||||||
<Board cards={cards} back={back} projectId={p.id} deferred={(deferred?.items ?? []).map((d) => ({ title: d.title, severity: d.severity }))} />
|
<Board cards={cards} back={back} />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -779,7 +769,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr
|
|||||||
))}
|
))}
|
||||||
</td>
|
</td>
|
||||||
<td className="px-3 py-2 text-right whitespace-nowrap text-muted-foreground">
|
<td className="px-3 py-2 text-right whitespace-nowrap text-muted-foreground">
|
||||||
{r.deployedBy} · {r.createdAt.toLocaleString(intlLocale(t.locale), { dateStyle: "short", timeStyle: "short", timeZone: platformZone() })}
|
{r.deployedBy} · {r.createdAt.toLocaleString(intlLocale(t.locale), { dateStyle: "short", timeStyle: "short" })}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
// PEP-42: plan an epic — the planner proposes stories with dependencies; the PM edits and approves.
|
// PEP-42: plan an epic — the planner proposes stories with dependencies; the PM edits and approves.
|
||||||
import { platformZone } from "@peppa/shared/time";
|
import Link from "next/link";
|
||||||
import Link from "@/components/Link";
|
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { Sparkles } from "lucide-react";
|
import { Sparkles } from "lucide-react";
|
||||||
import { getEpic, listTasks } from "@peppa/core";
|
import { getEpic, listTasks } from "@peppa/core";
|
||||||
@ -16,15 +15,8 @@ import { db } from "@/lib/db";
|
|||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { intlLocale } from "@peppa/shared/i18n";
|
import { intlLocale } from "@peppa/shared/i18n";
|
||||||
import { projectForUserByKey } from "@/lib/queries";
|
import { projectForUserByKey } from "@/lib/queries";
|
||||||
import { projectTitle } from "@/lib/title";
|
|
||||||
import { applyPlanAction, discardPlanAction, planEpicAction } from "../../../../board-actions";
|
import { applyPlanAction, discardPlanAction, planEpicAction } from "../../../../board-actions";
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata({ params }: { params: Promise<{ key: string }> }) {
|
|
||||||
const t = await getT();
|
|
||||||
return projectTitle(t, (await params).key, t("Эпик"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function PlanEpicPage({ params, searchParams }: { params: Promise<{ key: string; epic: string }>; searchParams: Promise<{ error?: string }> }) {
|
export default async function PlanEpicPage({ params, searchParams }: { params: Promise<{ key: string; epic: string }>; searchParams: Promise<{ error?: string }> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const { key, epic: epicParam } = await params;
|
const { key, epic: epicParam } = await params;
|
||||||
@ -110,7 +102,7 @@ export default async function PlanEpicPage({ params, searchParams }: { params: P
|
|||||||
<Button size="sm" variant="ghost">{t("Удалить черновик")}</Button>
|
<Button size="sm" variant="ghost">{t("Удалить черновик")}</Button>
|
||||||
</form>
|
</form>
|
||||||
<p className="m-0 text-xs text-muted-foreground">
|
<p className="m-0 text-xs text-muted-foreground">
|
||||||
{t("Черновик от {date}, {author}.", { date: new Date(draft.createdAt).toLocaleString(intlLocale(t.locale), { dateStyle: "short", timeStyle: "short", timeZone: platformZone() }), author: draft.createdBy })}
|
{t("Черновик от {date}, {author}.", { date: new Date(draft.createdAt).toLocaleString(intlLocale(t.locale), { dateStyle: "short", timeStyle: "short" }), author: draft.createdBy })}
|
||||||
</p>
|
</p>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
// Project page tabs «Код», «Спеки», «PR» and the epics block of «⋯ Настройки проекта» (PEP-66).
|
// Project page tabs «Код», «Спеки», «PR» and the epics block of «⋯ Настройки проекта» (PEP-66).
|
||||||
import { platformZone } from "@peppa/shared/time";
|
|
||||||
import type { Words } from "@peppa/shared/wording";
|
import type { Words } from "@peppa/shared/wording";
|
||||||
import { Archive, ExternalLink, GitBranch, GitPullRequest, Pencil } from "lucide-react";
|
import { Archive, ExternalLink, GitBranch, GitPullRequest, Pencil } from "lucide-react";
|
||||||
import type { Epic, SpecSummary } from "@peppa/core";
|
import type { Epic, SpecSummary } from "@peppa/core";
|
||||||
@ -14,7 +13,7 @@ import { Input, Textarea } from "@/components/ui/input";
|
|||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { intlLocale, type Translator } from "@peppa/shared/i18n";
|
import { intlLocale, type Translator } from "@peppa/shared/i18n";
|
||||||
|
|
||||||
const when = (iso: string | null, t: Translator) => (iso ? new Date(iso).toLocaleString(intlLocale(t.locale), { dateStyle: "short", timeStyle: "short", timeZone: platformZone() }) : "—");
|
const when = (iso: string | null, t: Translator) => (iso ? new Date(iso).toLocaleString(intlLocale(t.locale), { dateStyle: "short", timeStyle: "short" }) : "—");
|
||||||
|
|
||||||
export async function CodeTab({ code }: { code: RepoOverview }) {
|
export async function CodeTab({ code }: { code: RepoOverview }) {
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { Suspense } from "react";
|
import { Suspense } from "react";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { agentTaskSummary, claimWelcome, isSuperadmin, listUserProjects, onboardingChecklist, pendingFeedback, platformDelayCounts, progressOverview, proposedCount, reviewCounts } from "@peppa/core";
|
import { agentTaskSummary, claimWelcome, isSuperadmin, listUserProjects, onboardingChecklist, pendingFeedback, platformDelayCounts, progressOverview, proposedCount, reviewCounts } from "@peppa/core";
|
||||||
import { AdminFeedbackCard } from "@/components/Feedback";
|
import { AdminFeedbackCard } from "@/components/Feedback";
|
||||||
import { AgentTaskSummary } from "@/components/AgentTaskSummary";
|
import { AgentTaskSummary } from "@/components/AgentTaskSummary";
|
||||||
@ -16,7 +16,6 @@ import { requireUser, words } from "@/lib/auth";
|
|||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { acceptInbox, activeSessions, inbox } from "@/lib/queries";
|
import { acceptInbox, activeSessions, inbox } from "@/lib/queries";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
function BlockSkeleton() {
|
function BlockSkeleton() {
|
||||||
return <div className="h-24 animate-pulse rounded-md bg-muted/40" aria-hidden />;
|
return <div className="h-24 animate-pulse rounded-md bg-muted/40" aria-hidden />;
|
||||||
@ -36,12 +35,6 @@ async function AgentsBlock({ userId, engineer }: { userId: number; engineer: boo
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Главная"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Home({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
export default async function Home({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const { error } = await searchParams;
|
const { error } = await searchParams;
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import { requireUser, words } from "@/lib/auth";
|
|||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { createProjectAction } from "../../actions";
|
import { createProjectAction } from "../../actions";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
function Choice({ name, value, checked, children }: { name: string; value: string; checked?: boolean; children: React.ReactNode }) {
|
function Choice({ name, value, checked, children }: { name: string; value: string; checked?: boolean; children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
@ -21,12 +20,6 @@ function Choice({ name, value, checked, children }: { name: string; value: strin
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Новый проект"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function NewProject({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
export default async function NewProject({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
@ -70,8 +63,8 @@ export default async function NewProject({ searchParams }: { searchParams: Promi
|
|||||||
)}
|
)}
|
||||||
<fieldset className="m-0 flex flex-col gap-2 border-0 p-0">
|
<fieldset className="m-0 flex flex-col gap-2 border-0 p-0">
|
||||||
<legend className="mb-2 text-sm font-medium">{t("Кто может посмотреть код")}</legend>
|
<legend className="mb-2 text-sm font-medium">{t("Кто может посмотреть код")}</legend>
|
||||||
<Choice name="visibility" value="private" checked>{t("Закрытый — только вы и участники проекта")}</Choice>
|
<Choice name="visibility" value="public" checked>{t("Открытый — другие пользователи фабрики тоже могут его посмотреть")}</Choice>
|
||||||
<Choice name="visibility" value="public">{t("Открытый — другие пользователи фабрики тоже могут его посмотреть")}</Choice>
|
<Choice name="visibility" value="private">{t("Закрытый — только вы и участники проекта")}</Choice>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{w.product && <input type="hidden" name="mode" value="new" />}
|
{w.product && <input type="hidden" name="mode" value="new" />}
|
||||||
{w.engineer && (
|
{w.engineer && (
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { Plus } from "lucide-react";
|
import { Plus } from "lucide-react";
|
||||||
import { analystLinks, isSuperadmin, listOtherProjects, listUserProjects, projectTrashDays } from "@peppa/core";
|
import { analystLinks, isSuperadmin, listOtherProjects, listUserProjects, projectTrashDays } from "@peppa/core";
|
||||||
import { ProjectList } from "@/components/cards";
|
import { ProjectList } from "@/components/cards";
|
||||||
@ -8,13 +8,6 @@ import { Workspace } from "@/components/Workspace";
|
|||||||
import { requireUser, words } from "@/lib/auth";
|
import { requireUser, words } from "@/lib/auth";
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Проекты"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Projects({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
export default async function Projects({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { Search, SquareTerminal } from "lucide-react";
|
import { Search, SquareTerminal } from "lucide-react";
|
||||||
import { listUserProjects, runnerStories, listUserSessions, RUNNER_FILTERS, sessionSteps, type RunnerFilter, type SessionView } from "@peppa/core";
|
import { listUserProjects, runnerStories, listUserSessions, RUNNER_FILTERS, sessionSteps, type RunnerFilter, type SessionView } from "@peppa/core";
|
||||||
import { LiveRefresh } from "@/components/LiveRefresh";
|
import { LiveRefresh } from "@/components/LiveRefresh";
|
||||||
@ -14,7 +14,6 @@ import { inbox, sessionEvents } from "@/lib/queries";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { m } from "@peppa/shared/i18n";
|
import { m } from "@peppa/shared/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
const FILTERS: Array<{ key: RunnerFilter | undefined; label: string }> = [
|
const FILTERS: Array<{ key: RunnerFilter | undefined; label: string }> = [
|
||||||
{ key: undefined, label: m("все") },
|
{ key: undefined, label: m("все") },
|
||||||
@ -29,12 +28,6 @@ const matches = (s: SessionView, q: string) =>
|
|||||||
|
|
||||||
type Params = { error?: string; f?: string; q?: string; id?: string };
|
type Params = { error?: string; f?: string; q?: string; id?: string };
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Работа агентов"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Runners({ searchParams }: { searchParams: Promise<Params> }) {
|
export default async function Runners({ searchParams }: { searchParams: Promise<Params> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// «Сессии» (PEP-257): one place for the terminals of all live agent sessions of the user's
|
// «Сессии» (PEP-257): one place for the terminals of all live agent sessions of the user's
|
||||||
// projects. Left — the list, right — the terminal of the chosen one, open right away: the first
|
// projects. Left — the list, right — the terminal of the chosen one, open right away: the first
|
||||||
// of the list without `?id`, the given one with it (a story links here with its session).
|
// of the list without `?id`, the given one with it (a story links here with its session).
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { SquareTerminal } from "lucide-react";
|
import { SquareTerminal } from "lucide-react";
|
||||||
import { FINISHED_SESSION_STATUSES, listUserSessions, PROVIDER_NAMES, type SessionView } from "@peppa/core";
|
import { FINISHED_SESSION_STATUSES, listUserSessions, PROVIDER_NAMES, type SessionView } from "@peppa/core";
|
||||||
import { AgentBadge } from "@/components/AgentBadge";
|
import { AgentBadge } from "@/components/AgentBadge";
|
||||||
@ -17,13 +17,6 @@ import { inbox } from "@/lib/queries";
|
|||||||
import { SESSION_STATUS, TONE_BG, TONE_TEXT } from "@/lib/status";
|
import { SESSION_STATUS, TONE_BG, TONE_TEXT } from "@/lib/status";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Сессии"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Sessions({ searchParams }: { searchParams: Promise<{ id?: string }> }) {
|
export default async function Sessions({ searchParams }: { searchParams: Promise<{ id?: string }> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import { LanguageSwitcher } from "@/components/I18n";
|
|||||||
import { getLocale, getT } from "@/lib/i18n";
|
import { getLocale, getT } from "@/lib/i18n";
|
||||||
import { CopyText } from "@/components/CopyText";
|
import { CopyText } from "@/components/CopyText";
|
||||||
import { intlLocale } from "@peppa/shared/i18n";
|
import { intlLocale } from "@peppa/shared/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
const back = { back: "/settings" };
|
const back = { back: "/settings" };
|
||||||
|
|
||||||
@ -37,12 +36,6 @@ function Row({ title, children, actions }: { title: React.ReactNode; children?:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Настройки"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Settings({ searchParams }: { searchParams: Promise<{ error?: string; mode?: string; egov?: string; google?: string; notify?: string; bot?: string }> }) {
|
export default async function Settings({ searchParams }: { searchParams: Promise<{ error?: string; mode?: string; egov?: string; google?: string; notify?: string; bot?: string }> }) {
|
||||||
const user = await requireUser();
|
const user = await requireUser();
|
||||||
const { error, egov, google, notify, bot, mode: modeSaved } = await searchParams;
|
const { error, egov, google, notify, bot, mode: modeSaved } = await searchParams;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
// OpenSpec artifacts and the course of work (?tab=). Live updates — PEP-37, agent steps — PEP-33.
|
// OpenSpec artifacts and the course of work (?tab=). Live updates — PEP-37, agent steps — PEP-33.
|
||||||
import { queuePositions } from "@peppa/core";
|
import { queuePositions } from "@peppa/core";
|
||||||
import { Markdown } from "@/components/Markdown";
|
import { Markdown } from "@/components/Markdown";
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { Archive, ArchiveRestore, ChevronDown, ChevronRight, CircleCheck, CircleX, GitPullRequest, Hourglass, Lock, Pencil, Play, X } from "lucide-react";
|
import { Archive, ArchiveRestore, ChevronDown, ChevronRight, CircleCheck, CircleX, GitPullRequest, Hourglass, Lock, Pencil, Play, X } from "lucide-react";
|
||||||
import {
|
import {
|
||||||
@ -77,15 +77,9 @@ import { BudgetPanel } from "@/components/Accounting";
|
|||||||
import { ActivityTab, ArtifactTab, CommentsTab, MergeTab, ProgressBar, SpecsTab, STORY_TABS, TasksTab, TestsTab, type CheckRunRow, type StoryTab } from "./tabs";
|
import { ActivityTab, ArtifactTab, CommentsTab, MergeTab, ProgressBar, SpecsTab, STORY_TABS, TasksTab, TestsTab, type CheckRunRow, type StoryTab } from "./tabs";
|
||||||
import { archiveTaskAction, setDependenciesAction } from "../../board-actions";
|
import { archiveTaskAction, setDependenciesAction } from "../../board-actions";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { taskTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
const CI_ICON = { success: <CircleCheck className="size-4 text-ok" />, failure: <CircleX className="size-4 text-destructive" />, pending: <Hourglass className="size-4 text-warn" /> };
|
const CI_ICON = { success: <CircleCheck className="size-4 text-ok" />, failure: <CircleX className="size-4 text-destructive" />, pending: <Hourglass className="size-4 text-warn" /> };
|
||||||
|
|
||||||
// PEP-274: «KEY-N · название — FORGE».
|
|
||||||
export async function generateMetadata({ params }: { params: Promise<{ key: string }> }) {
|
|
||||||
return taskTitle(await getT(), (await params).key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Gitea behind Cloudflare can hang: the merge tab waits at most this long. */
|
/** Gitea behind Cloudflare can hang: the merge tab waits at most this long. */
|
||||||
async function gateWithTimeout(ref: Parameters<typeof prGate>[0]): Promise<GateResult | null> {
|
async function gateWithTimeout(ref: Parameters<typeof prGate>[0]): Promise<GateResult | null> {
|
||||||
return Promise.race([prGate(ref).catch(() => null), new Promise<null>((r) => setTimeout(() => r(null), 5000))]);
|
return Promise.race([prGate(ref).catch(() => null), new Promise<null>((r) => setTimeout(() => r(null), 5000))]);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// glossary-ignore-file: the page is for the superadmin only (accounts, repositories, Gitea spaces).
|
// glossary-ignore-file: the page is for the superadmin only (accounts, repositories, Gitea spaces).
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import { isSuperadmin, maskIin, mergePlan, PeppaError } from "@peppa/core";
|
import { isSuperadmin, maskIin, mergePlan, PeppaError } from "@peppa/core";
|
||||||
import { Hidden } from "@/components/cards";
|
import { Hidden } from "@/components/cards";
|
||||||
@ -11,14 +11,8 @@ import { requireUser } from "@/lib/auth";
|
|||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { mergeAccountsAction } from "../../actions";
|
import { mergeAccountsAction } from "../../actions";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Объединить учётки"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/** PEP-204: what moves from the old account to the main one — confirmed before anything changes. Superadmin only. */
|
||||||
export default async function MergeAccounts({ searchParams }: { searchParams: Promise<{ from?: string; to?: string; error?: string }> }) {
|
export default async function MergeAccounts({ searchParams }: { searchParams: Promise<{ from?: string; to?: string; error?: string }> }) {
|
||||||
const me = await requireUser();
|
const me = await requireUser();
|
||||||
if (!(await isSuperadmin(db, me))) notFound();
|
if (!(await isSuperadmin(db, me))) notFound();
|
||||||
@ -117,5 +111,3 @@ export default async function MergeAccounts({ searchParams }: { searchParams: Pr
|
|||||||
</Workspace>
|
</Workspace>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PEP-204: what moves from the old account to the main one — confirmed before anything changes. Superadmin only. */
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { canLogIn, isLocalUser, isSuperadmin, listUsers, maskIin, mergeHints, superadminIds } from "@peppa/core";
|
import { canLogIn, isLocalUser, isSuperadmin, listUsers, maskIin, mergeHints, platformAdmins } from "@peppa/core";
|
||||||
import { Hidden } from "@/components/cards";
|
import { Hidden } from "@/components/cards";
|
||||||
import { ago, Flash, PageHeader, Section } from "@/components/common";
|
import { ago, Flash, PageHeader, Section } from "@/components/common";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@ -12,23 +12,17 @@ import { requireUser } from "@/lib/auth";
|
|||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { setSuperadminAction, setUserDisabledAction } from "../actions";
|
import { setSuperadminAction, setUserDisabledAction } from "../actions";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
const back = { back: "/users" };
|
const back = { back: "/users" };
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
/** Superadmin only (PEP-68/71): who is registered, disable / enable. */
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Пользователи"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Users({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
export default async function Users({ searchParams }: { searchParams: Promise<{ error?: string }> }) {
|
||||||
const me = await requireUser();
|
const me = await requireUser();
|
||||||
if (!(await isSuperadmin(db, me))) notFound();
|
if (!(await isSuperadmin(db, me))) notFound();
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
const { error } = await searchParams;
|
const { error } = await searchParams;
|
||||||
const all = await listUsers(db);
|
const all = await listUsers(db);
|
||||||
const admins = await superadminIds(db);
|
const admins = new Set(await platformAdmins(db));
|
||||||
const hints = await mergeHints(db, all);
|
const hints = await mergeHints(db, all);
|
||||||
const mains = all.filter((u) => !u.disabledAt && canLogIn(u));
|
const mains = all.filter((u) => !u.disabledAt && canLogIn(u));
|
||||||
return (
|
return (
|
||||||
@ -46,7 +40,7 @@ export default async function Users({ searchParams }: { searchParams: Promise<{
|
|||||||
const local = isLocalUser(u);
|
const local = isLocalUser(u);
|
||||||
const hint = hints.get(u.id);
|
const hint = hints.get(u.id);
|
||||||
const targets = mains.filter((v) => v.id !== u.id);
|
const targets = mains.filter((v) => v.id !== u.id);
|
||||||
const isAdmin = admins.has(u.id);
|
const isAdmin = admins.has(u.login.toLowerCase());
|
||||||
return (
|
return (
|
||||||
<Card key={u.id} className="gap-3" data-user={u.login}>
|
<Card key={u.id} className="gap-3" data-user={u.login}>
|
||||||
<div className="flex flex-wrap items-center gap-2">
|
<div className="flex flex-wrap items-center gap-2">
|
||||||
@ -100,5 +94,3 @@ export default async function Users({ searchParams }: { searchParams: Promise<{
|
|||||||
</Workspace>
|
</Workspace>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Superadmin only (PEP-68/71): who is registered, disable / enable. */
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// PEP-92: the welcome page for everyone who signs in — why Peppa, how work goes, where to click.
|
// PEP-92: the welcome page for everyone who signs in — why Peppa, how work goes, where to click.
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { ArrowRight, Check } from "lucide-react";
|
import { ArrowRight, Check } from "lucide-react";
|
||||||
import { Workspace } from "@/components/Workspace";
|
import { Workspace } from "@/components/Workspace";
|
||||||
import { PageHeader, Section } from "@/components/common";
|
import { PageHeader, Section } from "@/components/common";
|
||||||
@ -8,7 +8,6 @@ import { requireUser, words } from "@/lib/auth";
|
|||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { m, type Translator } from "@peppa/shared/i18n";
|
import { m, type Translator } from "@peppa/shared/i18n";
|
||||||
import type { Words } from "@peppa/shared/wording";
|
import type { Words } from "@peppa/shared/wording";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
const WHY = [
|
const WHY = [
|
||||||
{ title: m("Программировать не нужно"), text: m("Вы пишете, что должно получиться, — как объяснили бы коллеге. Как это сделать, решают агенты.") },
|
{ title: m("Программировать не нужно"), text: m("Вы пишете, что должно получиться, — как объяснили бы коллеге. Как это сделать, решают агенты.") },
|
||||||
@ -31,12 +30,6 @@ const glossary = (w: Words, t: Translator): Array<[string, string]> => [
|
|||||||
[t("Ревью"), t("момент, когда агент закончил, а вы решаете: принять или вернуть")],
|
[t("Ревью"), t("момент, когда агент закончил, а вы решаете: принять или вернуть")],
|
||||||
];
|
];
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Добро пожаловать в FORGE"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Welcome() {
|
export default async function Welcome() {
|
||||||
await requireUser();
|
await requireUser();
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
|
|||||||
@ -1,20 +1,15 @@
|
|||||||
import { HEALTH_HEADER, healthBody, healthReport } from "@peppa/core";
|
import { healthReport } from "@peppa/core";
|
||||||
import { bootId } from "@/lib/boot";
|
import { bootId } from "@/lib/boot";
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
/**
|
/** Public health check (PEP-20): DB, version, service heartbeats. 503 if the DB is down. */
|
||||||
* Health check (PEP-20): DB, version, service heartbeats. 503 if the DB is down.
|
export async function GET() {
|
||||||
* PEP-272: without the internal key (`X-Peppa-Health`) only `{ok}` — no version, commit or services
|
|
||||||
* for strangers. Deploy scripts, container healthchecks and the watchdog send the key.
|
|
||||||
*/
|
|
||||||
export async function GET(req: Request) {
|
|
||||||
const r = await healthReport(db, {
|
const r = await healthReport(db, {
|
||||||
version: process.env.NEXT_PUBLIC_PEPPA_VERSION,
|
version: process.env.NEXT_PUBLIC_PEPPA_VERSION,
|
||||||
commit: process.env.NEXT_PUBLIC_PEPPA_COMMIT || null,
|
commit: process.env.NEXT_PUBLIC_PEPPA_COMMIT || null,
|
||||||
});
|
});
|
||||||
// PEP-114: `boot` changes when the web process restarts — the domain guard recognises FORGE by it.
|
// PEP-114: `boot` changes when the web process restarts — open pages compare it with their own.
|
||||||
const body = healthBody({ ...r, boot: bootId() }, req.headers.get(HEALTH_HEADER));
|
return Response.json({ ...r, boot: bootId() }, { status: r.ok ? 200 : 503, headers: { "Cache-Control": "no-store" } });
|
||||||
return Response.json(body, { status: r.ok ? 200 : 503, headers: { "Cache-Control": "no-store" } });
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,33 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { useEffect } from "react";
|
|
||||||
import { RefreshCw } from "lucide-react";
|
|
||||||
import { useT } from "@/components/I18n";
|
|
||||||
import { isStaleAction, reportStaleAction } from "@/components/StaleActionGuard";
|
|
||||||
import { reportCaughtError } from "@/lib/stale-action";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PEP-324: the error boundary of every page. Before it a failed form action (most often a button of a
|
|
||||||
* page opened before an update) left the person with Next's «Application error». An unknown action is
|
|
||||||
* handed to StaleActionGuard (keep the text, say FORGE was updated, reload); any other error gets a
|
|
||||||
* plain screen and is reported to «Ошибки из прода» from here: Next prints a caught error with the
|
|
||||||
* console.error it took before ErrorReporter wrapped it, so nobody else would report it.
|
|
||||||
*/
|
|
||||||
export default function PageError({ error }: { error: Error & { digest?: string } }) {
|
|
||||||
const t = useT();
|
|
||||||
const stale = isStaleAction(error);
|
|
||||||
useEffect(() => {
|
|
||||||
if (stale) reportStaleAction();
|
|
||||||
else reportCaughtError(error, window);
|
|
||||||
}, [stale, error]);
|
|
||||||
if (stale) return null;
|
|
||||||
return (
|
|
||||||
<div role="alert" className="mx-auto flex max-w-lg flex-col items-start gap-3 p-8">
|
|
||||||
<p className="text-base font-medium">{t("Страница не открылась из-за ошибки.")}</p>
|
|
||||||
<p className="text-sm text-muted-foreground">{t("Обновите страницу или вернитесь назад.")}</p>
|
|
||||||
<button type="button" onClick={() => window.location.reload()} className="inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground">
|
|
||||||
<RefreshCw className="size-3.5" /> {t("Обновить страницу")}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -7,7 +7,6 @@ import { cn } from "@/lib/utils";
|
|||||||
import { THEME_COOKIE } from "@/lib/theme";
|
import { THEME_COOKIE } from "@/lib/theme";
|
||||||
import { getLocale, getT } from "@/lib/i18n";
|
import { getLocale, getT } from "@/lib/i18n";
|
||||||
import { ErrorReporter } from "@/components/ErrorReporter";
|
import { ErrorReporter } from "@/components/ErrorReporter";
|
||||||
import { StaleActionGuard } from "@/components/StaleActionGuard";
|
|
||||||
import { I18nProvider } from "@/components/I18n";
|
import { I18nProvider } from "@/components/I18n";
|
||||||
import "./app.css";
|
import "./app.css";
|
||||||
|
|
||||||
@ -25,8 +24,6 @@ export default async function RootLayout({ children }: { children: ReactNode })
|
|||||||
<body>
|
<body>
|
||||||
<I18nProvider locale={locale} dict={locale === "ru" ? undefined : dictionary(locale)}>
|
<I18nProvider locale={locale} dict={locale === "ru" ? undefined : dictionary(locale)}>
|
||||||
<ErrorReporter />
|
<ErrorReporter />
|
||||||
{/* PEP-324: a button of a page opened before an update — keep the text and reload. */}
|
|
||||||
<StaleActionGuard />
|
|
||||||
{children}
|
{children}
|
||||||
</I18nProvider>
|
</I18nProvider>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import { PugMascot } from "@/components/PugMascot";
|
|||||||
import { LanguageSwitcher } from "@/components/I18n";
|
import { LanguageSwitcher } from "@/components/I18n";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { m } from "@peppa/shared/i18n";
|
import { m } from "@peppa/shared/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
@ -38,12 +37,7 @@ const NEED = [
|
|||||||
{ icon: Sparkles, text: m("Платная подписка Claude или ChatGPT — на ней работают агенты") },
|
{ icon: Sparkles, text: m("Платная подписка Claude или ChatGPT — на ней работают агенты") },
|
||||||
];
|
];
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
/** PEP-71: eGov QR is the only way in. PEP-83: the page first says why the factory and how it works. */
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Вход"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Login({ searchParams }: { searchParams: Promise<{ error?: string; next?: string }> }) {
|
export default async function Login({ searchParams }: { searchParams: Promise<{ error?: string; next?: string }> }) {
|
||||||
const { error, next } = await searchParams;
|
const { error, next } = await searchParams;
|
||||||
if (await currentUser()) redirect(safeNext(next));
|
if (await currentUser()) redirect(safeNext(next));
|
||||||
@ -128,5 +122,3 @@ export default async function Login({ searchParams }: { searchParams: Promise<{
|
|||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PEP-71: eGov QR is the only way in. PEP-83: the page first says why the factory and how it works. */
|
|
||||||
|
|||||||
@ -4,16 +4,10 @@ import { LiveRefresh } from "@/components/LiveRefresh";
|
|||||||
import { Brand } from "@/components/Brand";
|
import { Brand } from "@/components/Brand";
|
||||||
import { GuideCopy } from "@/components/GuideCopy";
|
import { GuideCopy } from "@/components/GuideCopy";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
/** PEP-190: public page (no sign-in) with the same guide that the MCP tool get_started returns. */
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Инструкция для ИИ"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function McpGuide() {
|
export default async function McpGuide() {
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
return (
|
return (
|
||||||
@ -28,5 +22,3 @@ export default async function McpGuide() {
|
|||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PEP-190: public page (no sign-in) with the same guide that the MCP tool get_started returns. */
|
|
||||||
|
|||||||
@ -7,18 +7,12 @@ import { Brand } from "@/components/Brand";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Card } from "@/components/ui/card";
|
import { Card } from "@/components/ui/card";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
import { pageTitle } from "@/lib/title";
|
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
type Params = Record<string, string | undefined>;
|
type Params = Record<string, string | undefined>;
|
||||||
|
|
||||||
// PEP-274: the browser tab says which page it is.
|
/** OAuth consent screen: who asks, what they get, allow / deny. */
|
||||||
export async function generateMetadata() {
|
|
||||||
const t = await getT();
|
|
||||||
return pageTitle(t, t("Доступ для приложения"));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function Authorize({ searchParams }: { searchParams: Promise<Params> }) {
|
export default async function Authorize({ searchParams }: { searchParams: Promise<Params> }) {
|
||||||
const p = await searchParams;
|
const p = await searchParams;
|
||||||
const user = await currentUser();
|
const user = await currentUser();
|
||||||
@ -82,5 +76,3 @@ function Hidden({ p }: { p: Params }) {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** OAuth consent screen: who asks, what they get, allow / deny. */
|
|
||||||
|
|||||||
@ -1,97 +0,0 @@
|
|||||||
import Link from "@/components/Link";
|
|
||||||
import { KeyRound } from "lucide-react";
|
|
||||||
import { DEFAULT_GRANT_TERM, GRANT_TERM_TEXT, GRANT_TERMS, type AccessRequestView } from "@peppa/core";
|
|
||||||
import type { Translator } from "@peppa/shared/i18n";
|
|
||||||
import { denyAccessRequestAction, grantAccessButtonAction } from "@/app/(app)/actions";
|
|
||||||
import { Hidden } from "@/components/cards";
|
|
||||||
import { ago } from "@/components/common";
|
|
||||||
import { Badge } from "@/components/ui/badge";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { Card } from "@/components/ui/card";
|
|
||||||
|
|
||||||
const SELECT = "h-9 rounded-md border border-input bg-background px-2 text-sm";
|
|
||||||
|
|
||||||
/** «читать» / «читать и менять». */
|
|
||||||
export function accessModeText(mode: AccessRequestView["mode"], t: Translator): string {
|
|
||||||
return mode === "write" ? t("читать и менять") : t("только читать");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function AccessStatus({ r, t }: { r: AccessRequestView; t: Translator }) {
|
|
||||||
if (r.status === "open") return <Badge variant="warn">{t("ждёт вашего решения")}</Badge>;
|
|
||||||
if (r.status === "granted") return <Badge variant="ok">{t("доступ выдан")}</Badge>;
|
|
||||||
if (r.status === "denied") return <Badge variant="danger">{t("отказано")}</Badge>;
|
|
||||||
return <Badge variant="outline">{t("агент отменил запрос")}</Badge>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** PEP-261: the term of a grant — 1 day by default. */
|
|
||||||
export function GrantTermSelect({ t }: { t: Translator }) {
|
|
||||||
return (
|
|
||||||
<select name="term" defaultValue={DEFAULT_GRANT_TERM} aria-label={t("Срок")} className={SELECT}>
|
|
||||||
{GRANT_TERMS.map((term) => (
|
|
||||||
<option key={term} value={term}>
|
|
||||||
{t.text(GRANT_TERM_TEXT[term])}
|
|
||||||
</option>
|
|
||||||
))}
|
|
||||||
</select>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** PEP-261: «чтение» / «полные права» — by default what the agent asked for. */
|
|
||||||
export function GrantRightsSelect({ r, t }: { r: AccessRequestView; t: Translator }) {
|
|
||||||
return (
|
|
||||||
<select name="rights" defaultValue={r.mode === "write" ? "full" : "read"} aria-label={t("Что можно")} className={SELECT}>
|
|
||||||
<option value="read">{t("Чтение")}</option>
|
|
||||||
<option value="full">{t("Полные права: чтение и изменения")}</option>
|
|
||||||
</select>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** PEP-250/261: «Агенты просят доступ» on «Подключения» — the owner's open requests with «Дать» buttons. `grantable` — requests with a fitting connection. */
|
|
||||||
export function AccessRequestList({ list, grantable, t }: { list: AccessRequestView[]; grantable: Set<number>; t: Translator }) {
|
|
||||||
return (
|
|
||||||
<ul className="m-0 flex list-none flex-col gap-2 p-0">
|
|
||||||
{list.map((r) => (
|
|
||||||
<li key={r.id}>
|
|
||||||
<Card className="flex flex-wrap items-center gap-x-3 gap-y-1 p-3 text-sm">
|
|
||||||
<KeyRound className="size-4 text-primary" />
|
|
||||||
<span className="font-medium">{r.service}</span>
|
|
||||||
<span className="text-muted-foreground">· {accessModeText(r.mode, t)}</span>
|
|
||||||
<span className="text-muted-foreground">
|
|
||||||
· {r.agentName ? t("агент {name}", { name: r.agentName }) : t("агент")} · {r.taskKey ?? r.projectKey}
|
|
||||||
</span>
|
|
||||||
<span className="basis-full truncate text-muted-foreground">{r.purpose}</span>
|
|
||||||
<span className="text-xs text-muted-foreground">{ago(r.updatedAt, t)}</span>
|
|
||||||
<Link href={`/connections/requests/${r.id}`} className="ml-auto text-primary underline-offset-2 hover:underline">
|
|
||||||
{t("Посмотреть и решить")}
|
|
||||||
</Link>
|
|
||||||
<div className="flex basis-full flex-wrap items-center gap-2 pt-1">
|
|
||||||
{grantable.has(r.id) ? (
|
|
||||||
<form action={grantAccessButtonAction} className="flex flex-wrap items-center gap-2">
|
|
||||||
<Hidden fields={{ back: "/connections#requests", requestId: r.id }} />
|
|
||||||
<Button size="sm" name="rights" value="read" data-access-grant="read">
|
|
||||||
{t("Дать: чтение")}
|
|
||||||
</Button>
|
|
||||||
<Button size="sm" variant="secondary" name="rights" value="full" data-access-grant="full">
|
|
||||||
{t("Дать: полные права")}
|
|
||||||
</Button>
|
|
||||||
<span className="text-muted-foreground">{t("на срок")}</span>
|
|
||||||
<GrantTermSelect t={t} />
|
|
||||||
</form>
|
|
||||||
) : (
|
|
||||||
<Button asChild size="sm">
|
|
||||||
<Link href={`/connections/requests/${r.id}`}>{t("Подключить")}</Link>
|
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
<form action={denyAccessRequestAction}>
|
|
||||||
<Hidden fields={{ back: "/connections#requests", requestId: r.id }} />
|
|
||||||
<Button size="sm" variant="outline">
|
|
||||||
{t("Отказать")}
|
|
||||||
</Button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
// Accounting blocks (PEP-5/43/47/48): the usage strip on top, story budget, project metrics, journal.
|
// Accounting blocks (PEP-5/43/47/48): the usage strip on top, story budget, project metrics, journal.
|
||||||
import { platformZone } from "@peppa/shared/time";
|
import Link from "next/link";
|
||||||
import Link from "@/components/Link";
|
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import { Gauge, Hourglass, Play } from "lucide-react";
|
import { Gauge, Hourglass, Play } from "lucide-react";
|
||||||
import {
|
import {
|
||||||
@ -75,7 +74,7 @@ function WindowCell({ label, w, t }: { label: string; w: WindowView | null; t: T
|
|||||||
function accountTitle(a: AccountUsage, t: Translator): string {
|
function accountTitle(a: AccountUsage, t: Translator): string {
|
||||||
const w = (l: string, v: WindowView | null) => (!v ? t("{label}: нет данных", { label: l }) : v.reset ? t("{label}: сброшено", { label: l }) : `${l}: ${Math.round(v.pct!)}%`);
|
const w = (l: string, v: WindowView | null) => (!v ? t("{label}: нет данных", { label: l }) : v.reset ? t("{label}: сброшено", { label: l }) : `${l}: ${Math.round(v.pct!)}%`);
|
||||||
const limited = a.limitedUntil ? ", " + t("в лимите") : "";
|
const limited = a.limitedUntil ? ", " + t("в лимите") : "";
|
||||||
const updated = a.at ? ", " + t("обновлено {at}", { at: a.at.toLocaleString(intlLocale(t.locale), { timeZone: platformZone() }) }) : "";
|
const updated = a.at ? ", " + t("обновлено {at}", { at: a.at.toLocaleString(intlLocale(t.locale)) }) : "";
|
||||||
return t.text(a.name) + " — " + w(t("5 ч"), a.fiveHour) + ", " + w(t("7 д"), a.sevenDay) + limited + updated;
|
return t.text(a.name) + " — " + w(t("5 ч"), a.fiveHour) + ", " + w(t("7 д"), a.sevenDay) + limited + updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { ago } from "@/components/common";
|
import { ago } from "@/components/common";
|
||||||
import { requireUser, words } from "@/lib/auth";
|
import { requireUser, words } from "@/lib/auth";
|
||||||
import { activeSessions, inbox } from "@/lib/queries";
|
import { activeSessions, inbox } from "@/lib/queries";
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import type { AgentTaskRow } from "@peppa/core";
|
import type { AgentTaskRow } from "@peppa/core";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
|
|||||||
@ -26,7 +26,7 @@ const fmt = (n: number) => (n < 1024 ? `${n} B` : n < 1048576 ? `${Math.round(n
|
|||||||
* picture (Ctrl+V). Each file goes up at once (`POST /api/attachments`); the form carries the
|
* picture (Ctrl+V). Each file goes up at once (`POST /api/attachments`); the form carries the
|
||||||
* returned ids as hidden `attachment` fields and the action links them to the message.
|
* returned ids as hidden `attachment` fields and the action links them to the message.
|
||||||
*/
|
*/
|
||||||
export function AttachField({ projectId, target, className, touch = false }: { projectId: number; /** id of the textarea that takes drops and pastes */ target?: string; className?: string; /** PEP-274: a 44 px target on a phone */ touch?: boolean }) {
|
export function AttachField({ projectId, target, className }: { projectId: number; /** id of the textarea that takes drops and pastes */ target?: string; className?: string }) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const inputId = useId();
|
const inputId = useId();
|
||||||
const picker = useRef<HTMLInputElement>(null);
|
const picker = useRef<HTMLInputElement>(null);
|
||||||
@ -139,7 +139,7 @@ export function AttachField({ projectId, target, className, touch = false }: { p
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => picker.current?.click()}
|
onClick={() => picker.current?.click()}
|
||||||
className={cn("inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-sm text-muted-foreground hover:bg-accent hover:text-foreground", touch && "h-11 min-w-11 justify-center md:h-8 md:min-w-0", over && "border-primary bg-accent text-foreground")}
|
className={cn("inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-sm text-muted-foreground hover:bg-accent hover:text-foreground", over && "border-primary bg-accent text-foreground")}
|
||||||
aria-label={t("Приложить файл")}
|
aria-label={t("Приложить файл")}
|
||||||
title={t("Картинки, PDF, текст, Word, Excel, PowerPoint — до 5 файлов, каждый до 20 МБ. Можно перетащить файл в поле или вставить картинку из буфера.")}
|
title={t("Картинки, PDF, текст, Word, Excel, PowerPoint — до 5 файлов, каждый до 20 МБ. Можно перетащить файл в поле или вставить картинку из буфера.")}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useWords } from "@/components/Words";
|
import { useWords } from "@/components/Words";
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { useEffect, useState, useTransition } from "react";
|
import { useEffect, useState, useTransition } from "react";
|
||||||
import { useLiveIsland } from "@/lib/live";
|
import { useLiveIsland } from "@/lib/live";
|
||||||
import { ChevronDown, ChevronRight, ChevronsDown, ChevronsUp, Lock } from "lucide-react";
|
import { ChevronDown, ChevronRight, ChevronsDown, ChevronsUp, Lock } from "lucide-react";
|
||||||
import { deferredAction, moveTaskCard, proposalAction } from "@/app/(app)/actions";
|
import { moveTaskCard, proposalAction } from "@/app/(app)/actions";
|
||||||
import { reorderTaskInline } from "@/app/(app)/board-actions";
|
import { reorderTaskInline } from "@/app/(app)/board-actions";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@ -100,13 +100,7 @@ const NEXT: Partial<Record<Column, { to: Column; label: string }>> = {
|
|||||||
* starts/stops agents; drag it onto a card of its own column to change the order (= priority
|
* starts/stops agents; drag it onto a card of its own column to change the order (= priority
|
||||||
* for the dispatcher, PEP-34). «Готово» can be collapsed (remembered in the browser).
|
* for the dispatcher, PEP-34). «Готово» can be collapsed (remembered in the browser).
|
||||||
*/
|
*/
|
||||||
/** PEP-302: a finding of the acceptance agent put aside until the weekly digest. */
|
export function Board({ cards: server, back }: { cards: Card[]; back: string }) {
|
||||||
export interface DeferredCard {
|
|
||||||
title: string;
|
|
||||||
severity: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Board({ cards: server, back, projectId, deferred = [] }: { cards: Card[]; back: string; projectId?: number; deferred?: DeferredCard[] }) {
|
|
||||||
// PEP-225: status and title changes from the live channel apply in place — a card moves to the
|
// PEP-225: status and title changes from the live channel apply in place — a card moves to the
|
||||||
// column of its new status at once; fresh server data (a re-render) replaces the patches.
|
// column of its new status at once; fresh server data (a re-render) replaces the patches.
|
||||||
const [patches, setPatches] = useState<Map<number, Pick<Card, "status" | "title" | "column">>>(() => new Map());
|
const [patches, setPatches] = useState<Map<number, Pick<Card, "status" | "title" | "column">>>(() => new Map());
|
||||||
@ -159,7 +153,7 @@ export function Board({ cards: server, back, projectId, deferred = [] }: { cards
|
|||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<Proposed cards={cards.filter((x) => x.proposed)} back={back} projectId={projectId} deferred={deferred} />
|
<Proposed cards={cards.filter((x) => x.proposed)} back={back} />
|
||||||
{error && (
|
{error && (
|
||||||
<p role="alert" className="m-0 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-1.5 text-sm text-destructive">
|
<p role="alert" className="m-0 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-1.5 text-sm text-destructive">
|
||||||
{t.text(error)}
|
{t.text(error)}
|
||||||
@ -321,16 +315,16 @@ const SEVERITY: Record<string, { label: string; variant: "danger" | "warn" | "mu
|
|||||||
* dispatcher takes nothing from here. «Делать» sends a story to the backlog, «Не надо» archives
|
* dispatcher takes nothing from here. «Делать» sends a story to the backlog, «Не надо» archives
|
||||||
* it and the acceptance agent will not suggest it again. Buttons are at least 44 px for a thumb.
|
* it and the acceptance agent will not suggest it again. Buttons are at least 44 px for a thumb.
|
||||||
*/
|
*/
|
||||||
function Proposed({ cards, back, projectId, deferred }: { cards: Card[]; back: string; projectId?: number; deferred: DeferredCard[] }) {
|
function Proposed({ cards, back }: { cards: Card[]; back: string }) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
if (!cards.length && !deferred.length) return null;
|
if (!cards.length) return null;
|
||||||
const ids = cards.map((c) => c.id).join(",");
|
const ids = cards.map((c) => c.id).join(",");
|
||||||
const important = cards.filter((c) => c.severity !== "minor");
|
const important = cards.filter((c) => c.severity !== "minor");
|
||||||
return (
|
return (
|
||||||
<details id="proposed" data-proposed className="rounded-lg border border-dashed bg-muted/30 p-2">
|
<details id="proposed" data-proposed className="rounded-lg border border-dashed bg-muted/30 p-2">
|
||||||
<summary className="flex min-h-11 cursor-pointer items-center gap-2 px-1.5 font-mono text-[11px] font-semibold tracking-wider text-muted-foreground uppercase">
|
<summary className="flex min-h-11 cursor-pointer items-center gap-2 px-1.5 font-mono text-[11px] font-semibold tracking-wider text-muted-foreground uppercase">
|
||||||
{t("Предложено")}
|
{t("Предложено")}
|
||||||
<span className="ml-auto tabular-nums">{cards.length}{deferred.length > 0 && ` + ${deferred.length}`}</span>
|
<span className="ml-auto tabular-nums">{cards.length}</span>
|
||||||
</summary>
|
</summary>
|
||||||
<p className="m-0 px-1.5 pb-2 text-xs text-muted-foreground">{t("Это придумала сама фабрика. Пока вы не нажмёте «Делать», агенты за эти задачи не возьмутся.")}</p>
|
<p className="m-0 px-1.5 pb-2 text-xs text-muted-foreground">{t("Это придумала сама фабрика. Пока вы не нажмёте «Делать», агенты за эти задачи не возьмутся.")}</p>
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
@ -368,7 +362,6 @@ function Proposed({ cards, back, projectId, deferred }: { cards: Card[]; back: s
|
|||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
)}
|
)}
|
||||||
{cards.length > 0 && (
|
|
||||||
<form action={proposalAction} className="mt-2 flex flex-wrap gap-2">
|
<form action={proposalAction} className="mt-2 flex flex-wrap gap-2">
|
||||||
<input type="hidden" name="ids" value={ids} />
|
<input type="hidden" name="ids" value={ids} />
|
||||||
<input type="hidden" name="back" value={back} />
|
<input type="hidden" name="back" value={back} />
|
||||||
@ -381,43 +374,6 @@ function Proposed({ cards, back, projectId, deferred }: { cards: Card[]; back: s
|
|||||||
{t("Отклонить всё")}
|
{t("Отклонить всё")}
|
||||||
</Button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
)}
|
|
||||||
{deferred.length > 0 && projectId != null && <Deferred items={deferred} projectId={projectId} back={back} />}
|
|
||||||
</details>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PEP-302: «Отложено» — what the acceptance agent found past the daily limit. It waits for the
|
|
||||||
* weekly message, but the owner sees it now and may send any item to work at once.
|
|
||||||
*/
|
|
||||||
function Deferred({ items, projectId, back }: { items: DeferredCard[]; projectId: number; back: string }) {
|
|
||||||
const t = useT();
|
|
||||||
return (
|
|
||||||
<details data-deferred className="mt-2 rounded-md border bg-card/60 p-2">
|
|
||||||
<summary className="flex min-h-11 cursor-pointer items-center gap-2 px-1.5 text-sm font-medium">
|
|
||||||
{t("Отложено")}
|
|
||||||
<span className="ml-auto font-mono text-xs tabular-nums">{items.length}</span>
|
|
||||||
</summary>
|
|
||||||
<p className="m-0 px-1.5 pb-2 text-xs text-muted-foreground">{t("Агент приёмки нашёл это сверх дневного предела. Пункты придут раз в неделю одним сообщением — или нажмите «Делать» сейчас.")}</p>
|
|
||||||
<div className="flex flex-col gap-2">
|
|
||||||
{items.map((item) => (
|
|
||||||
<article key={item.title} data-deferred-item className="flex flex-col gap-2 rounded-md border bg-card p-2.5 text-sm">
|
|
||||||
<span>{item.title}</span>
|
|
||||||
{SEVERITY[item.severity] && (
|
|
||||||
<Badge variant={SEVERITY[item.severity]!.variant} className="self-start">
|
|
||||||
{t(SEVERITY[item.severity]!.label)}
|
|
||||||
</Badge>
|
|
||||||
)}
|
|
||||||
<form action={deferredAction} className="flex flex-wrap gap-2">
|
|
||||||
<input type="hidden" name="projectId" value={String(projectId)} />
|
|
||||||
<input type="hidden" name="title" value={item.title} />
|
|
||||||
<input type="hidden" name="back" value={back} />
|
|
||||||
<ProposalButtons />
|
|
||||||
</form>
|
|
||||||
</article>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</details>
|
</details>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { Search, X } from "lucide-react";
|
import { Search, X } from "lucide-react";
|
||||||
import type { ThreadList, ThreadRow } from "@peppa/core";
|
import type { ThreadList, ThreadRow } from "@peppa/core";
|
||||||
import { AgentBadge } from "@/components/AgentBadge";
|
import { AgentBadge } from "@/components/AgentBadge";
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
import { voiceStoriesEnabled } from "@peppa/shared";
|
import { voiceStoriesEnabled } from "@peppa/shared";
|
||||||
import { DictateButton } from "@/components/DictateButton";
|
import { DictateButton } from "@/components/DictateButton";
|
||||||
|
|
||||||
export function Dictate(props: { target: string; className?: string; compact?: boolean; touch?: boolean }) {
|
export function Dictate(props: { target: string; className?: string; compact?: boolean }) {
|
||||||
return voiceStoriesEnabled() ? <DictateButton {...props} /> : null;
|
return voiceStoriesEnabled() ? <DictateButton {...props} /> : null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ function pickMime(): string | undefined {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DictateButton({ target, className, compact = false, touch = false }: { target: string; className?: string; compact?: boolean; /** PEP-274: a 44 px target on a phone */ touch?: boolean }) {
|
export function DictateButton({ target, className, compact = false }: { target: string; className?: string; compact?: boolean }) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const [supported, setSupported] = useState(false);
|
const [supported, setSupported] = useState(false);
|
||||||
const [state, setState] = useState<State>("idle");
|
const [state, setState] = useState<State>("idle");
|
||||||
@ -103,7 +103,6 @@ export function DictateButton({ target, className, compact = false, touch = fals
|
|||||||
aria-pressed={state === "recording"}
|
aria-pressed={state === "recording"}
|
||||||
title={state === "recording" ? t("Остановить запись и распознать") : t("Наговорить текст голосом")}
|
title={state === "recording" ? t("Остановить запись и распознать") : t("Наговорить текст голосом")}
|
||||||
data-dictate={target}
|
data-dictate={target}
|
||||||
className={cn(touch && "h-11 min-w-11 md:h-8 md:min-w-0")}
|
|
||||||
>
|
>
|
||||||
{state === "recording" ? <Square /> : state === "sending" ? <Loader2 className="animate-spin" /> : <Mic />}
|
{state === "recording" ? <Square /> : state === "sending" ? <Loader2 className="animate-spin" /> : <Mic />}
|
||||||
{!compact && label}
|
{!compact && label}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { isStaleAction } from "@/lib/stale-action";
|
|
||||||
|
|
||||||
const MAX_PER_PAGE = 10;
|
const MAX_PER_PAGE = 10;
|
||||||
|
|
||||||
@ -38,8 +37,6 @@ export function ErrorReporter() {
|
|||||||
let sent = 0;
|
let sent = 0;
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
const send = (type: string, message: string, stack?: string) => {
|
const send = (type: string, message: string, stack?: string) => {
|
||||||
// PEP-324: a button of a page opened before an update — not a bug; StaleActionGuard reloads the page.
|
|
||||||
if (type === "UnrecognizedActionError" || isStaleAction(message)) return;
|
|
||||||
// PEP-143: «Сообщить о проблеме» attaches the page's last errors to the report.
|
// PEP-143: «Сообщить о проблеме» attaches the page's last errors to the report.
|
||||||
if (message) {
|
if (message) {
|
||||||
const w = window as unknown as { __peppaErrors?: Array<{ type: string; message: string; at: string }> };
|
const w = window as unknown as { __peppaErrors?: Array<{ type: string; message: string; at: string }> };
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
// PEP-218: production errors read from Bugsink on the server — summary, filters, rows and the
|
// PEP-218: production errors read from Bugsink on the server — summary, filters, rows and the
|
||||||
// error card blocks. «Инженер» and the superadmin (`tech`) also see code places, releases,
|
// error card blocks. «Инженер» and the superadmin (`tech`) also see code places, releases,
|
||||||
// stacks and tags; «Продакт» — the title, how often, when and the bug task.
|
// stacks and tags; «Продакт» — the title, how often, when and the bug task.
|
||||||
import { platformZone } from "@peppa/shared/time";
|
import Link from "next/link";
|
||||||
import Link from "@/components/Link";
|
|
||||||
import { Bug, TrendingUp } from "lucide-react";
|
import { Bug, TrendingUp } from "lucide-react";
|
||||||
import type { ErrorDetail, ErrorFilter, ErrorRow, ErrorScope, ErrorsOverview, ErrorState } from "@peppa/core";
|
import type { ErrorDetail, ErrorFilter, ErrorRow, ErrorScope, ErrorsOverview, ErrorState } from "@peppa/core";
|
||||||
import { m, type Translator } from "@peppa/shared/i18n";
|
import { m, type Translator } from "@peppa/shared/i18n";
|
||||||
@ -17,7 +16,7 @@ import { errorAction } from "@/app/(app)/errors/actions";
|
|||||||
const STATE_LABEL: Record<ErrorState, string> = { unresolved: m("не решена"), resolved: m("решена"), muted: m("приглушена") };
|
const STATE_LABEL: Record<ErrorState, string> = { unresolved: m("не решена"), resolved: m("решена"), muted: m("приглушена") };
|
||||||
const STATE_TONE: Record<ErrorState, "danger" | "ok" | "muted"> = { unresolved: "danger", resolved: "ok", muted: "muted" };
|
const STATE_TONE: Record<ErrorState, "danger" | "ok" | "muted"> = { unresolved: "danger", resolved: "ok", muted: "muted" };
|
||||||
|
|
||||||
const hhmm = (d: Date, t: Translator) => d.toLocaleTimeString(t.locale === "en" ? "en-GB" : "ru-RU", { hour: "2-digit", minute: "2-digit", timeZone: platformZone() });
|
const hhmm = (d: Date, t: Translator) => d.toLocaleTimeString(t.locale === "en" ? "en-GB" : "ru-RU", { hour: "2-digit", minute: "2-digit" });
|
||||||
|
|
||||||
/** Bugsink failed: say so; the data below (if any) is from the cache. */
|
/** Bugsink failed: say so; the data below (if any) is from the cache. */
|
||||||
export function ErrorsDown({ down, at, tech, t }: { down: boolean; at: Date | null; tech: boolean; t: Translator }) {
|
export function ErrorsDown({ down, at, tech, t }: { down: boolean; at: Date | null; tech: boolean; t: Translator }) {
|
||||||
@ -92,8 +91,8 @@ export function ErrorRows({ rows, tech, from, t, showProject = true }: { rows: E
|
|||||||
{tech && r.culprit ? <span className="max-w-full truncate font-mono">{r.culprit}</span> : null}
|
{tech && r.culprit ? <span className="max-w-full truncate font-mono">{r.culprit}</span> : null}
|
||||||
{showProject ? <span>{r.bugsinkName}</span> : null}
|
{showProject ? <span>{r.bugsinkName}</span> : null}
|
||||||
<span className="tabular-nums">{t.n(r.events, "{n} раз", "{n} раза", "{n} раз")}</span>
|
<span className="tabular-nums">{t.n(r.events, "{n} раз", "{n} раза", "{n} раз")}</span>
|
||||||
<span title={r.firstSeen.toLocaleString(undefined, { timeZone: platformZone() })}>{t("впервые {ago}", { ago: ago(r.firstSeen, t) })}</span>
|
<span title={r.firstSeen.toLocaleString()}>{t("впервые {ago}", { ago: ago(r.firstSeen, t) })}</span>
|
||||||
<span title={r.lastSeen.toLocaleString(undefined, { timeZone: platformZone() })}>{t("последний раз {ago}", { ago: ago(r.lastSeen, t) })}</span>
|
<span title={r.lastSeen.toLocaleString()}>{t("последний раз {ago}", { ago: ago(r.lastSeen, t) })}</span>
|
||||||
{/* glossary-ignore: the release is shown to «Инженер» and the superadmin only */}
|
{/* glossary-ignore: the release is shown to «Инженер» and the superadmin only */}
|
||||||
{tech && r.release ? <span className="font-mono" title={r.release}>{t("релиз {sha}", { sha: r.release.slice(0, 8) })}</span> : null}
|
{tech && r.release ? <span className="font-mono" title={r.release}>{t("релиз {sha}", { sha: r.release.slice(0, 8) })}</span> : null}
|
||||||
{r.taskKey ? <Key href={`/t/${r.taskKey}`}>{r.taskKey}</Key> : null}
|
{r.taskKey ? <Key href={`/t/${r.taskKey}`}>{r.taskKey}</Key> : null}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { FEEDBACK_ADMIN_STATUS, FEEDBACK_KIND, FEEDBACK_SIZE, FEEDBACK_USER_STATUS, feedbackTitle, type FeedbackView } from "@peppa/core";
|
import { FEEDBACK_ADMIN_STATUS, FEEDBACK_KIND, FEEDBACK_SIZE, FEEDBACK_USER_STATUS, feedbackTitle, type FeedbackView } from "@peppa/core";
|
||||||
import { Hidden } from "@/components/cards";
|
import { Hidden } from "@/components/cards";
|
||||||
import { ago, Disclosure } from "@/components/common";
|
import { ago, Disclosure } from "@/components/common";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
import { CircleCheck, ImagePlus, MessageCircleWarning, X } from "lucide-react";
|
import { CircleCheck, ImagePlus, MessageCircleWarning, X } from "lucide-react";
|
||||||
@ -35,7 +35,6 @@ export function FeedbackButton() {
|
|||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
const [sent, setSent] = useState(false);
|
const [sent, setSent] = useState(false);
|
||||||
const [over, setOver] = useState(false);
|
const [over, setOver] = useState(false);
|
||||||
const lift = useComposerLift(inChat);
|
|
||||||
|
|
||||||
const add = useCallback(
|
const add = useCallback(
|
||||||
(files: Iterable<File>) => {
|
(files: Iterable<File>) => {
|
||||||
@ -125,9 +124,8 @@ export function FeedbackButton() {
|
|||||||
// Sits above the «в реальном времени» indicator of LiveRefresh (the same corner).
|
// Sits above the «в реальном времени» indicator of LiveRefresh (the same corner).
|
||||||
title={t("Сообщить о проблеме")}
|
title={t("Сообщить о проблеме")}
|
||||||
aria-label={t("Сообщить о проблеме")}
|
aria-label={t("Сообщить о проблеме")}
|
||||||
style={lift != null ? { bottom: lift } : undefined}
|
|
||||||
className={cn(
|
className={cn(
|
||||||
"fixed right-3 z-30 flex h-11 min-w-11 justify-center cursor-pointer items-center gap-2 rounded-full border bg-card px-3 text-sm text-muted-foreground shadow-md transition-colors hover:text-foreground",
|
"fixed right-3 z-30 flex h-10 cursor-pointer items-center gap-2 rounded-full border bg-card px-3 text-sm text-muted-foreground shadow-md transition-colors hover:text-foreground",
|
||||||
// PEP-207: in a conversation the message field is pinned to the bottom — the button goes above it, icon only.
|
// PEP-207: in a conversation the message field is pinned to the bottom — the button goes above it, icon only.
|
||||||
inChat ? "bottom-[calc(11rem+env(safe-area-inset-bottom))] md:bottom-32" : "bottom-[calc(6.5rem+env(safe-area-inset-bottom))] md:bottom-12",
|
inChat ? "bottom-[calc(11rem+env(safe-area-inset-bottom))] md:bottom-32" : "bottom-[calc(6.5rem+env(safe-area-inset-bottom))] md:bottom-12",
|
||||||
)}
|
)}
|
||||||
@ -233,51 +231,3 @@ export function FeedbackButton() {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* PEP-274 (F-12): in a conversation the button stays above the top edge of the message field,
|
|
||||||
* however tall the field grew (lines, attached files) — measured, not a fixed height that the
|
|
||||||
* field outgrows on a phone. `null` — no field on the page, the classes place the button.
|
|
||||||
*/
|
|
||||||
function useComposerLift(inChat: boolean): number | null {
|
|
||||||
const [lift, setLift] = useState<number | null>(null);
|
|
||||||
useEffect(() => {
|
|
||||||
if (!inChat) return setLift(null);
|
|
||||||
let frame = 0;
|
|
||||||
let observed: Element | null = null;
|
|
||||||
const ro = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => schedule());
|
|
||||||
const measure = () => {
|
|
||||||
frame = 0;
|
|
||||||
const box = document.querySelector("[data-chat-composer]");
|
|
||||||
if (box !== observed) {
|
|
||||||
if (observed) ro?.unobserve(observed);
|
|
||||||
if (box) ro?.observe(box);
|
|
||||||
observed = box;
|
|
||||||
}
|
|
||||||
if (!box) return setLift(null);
|
|
||||||
const top = box.getBoundingClientRect().top;
|
|
||||||
const viewport = window.visualViewport?.height ?? window.innerHeight;
|
|
||||||
// 8 px above the field; never under the bottom menu if the field scrolled out of view.
|
|
||||||
setLift(Math.max(Math.round(viewport - top + 8), 72));
|
|
||||||
};
|
|
||||||
const schedule = () => {
|
|
||||||
if (!frame) frame = requestAnimationFrame(measure);
|
|
||||||
};
|
|
||||||
schedule();
|
|
||||||
window.addEventListener("resize", schedule);
|
|
||||||
window.addEventListener("scroll", schedule, { passive: true, capture: true });
|
|
||||||
window.visualViewport?.addEventListener("resize", schedule);
|
|
||||||
// The page re-renders on live updates and may replace the field.
|
|
||||||
const mo = new MutationObserver(schedule);
|
|
||||||
mo.observe(document.body, { childList: true, subtree: true });
|
|
||||||
return () => {
|
|
||||||
if (frame) cancelAnimationFrame(frame);
|
|
||||||
ro?.disconnect();
|
|
||||||
mo.disconnect();
|
|
||||||
window.removeEventListener("resize", schedule);
|
|
||||||
window.removeEventListener("scroll", schedule, { capture: true });
|
|
||||||
window.visualViewport?.removeEventListener("resize", schedule);
|
|
||||||
};
|
|
||||||
}, [inChat]);
|
|
||||||
return lift;
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
// PEP-273: every link of the console goes through here. Next prefetches each visible <Link> in a
|
|
||||||
// production build; our pages are dynamic, so the home page alone made ~40 server renders per visit.
|
|
||||||
// Prefetch only where a link asks for it explicitly (`prefetch`).
|
|
||||||
import NextLink from "next/link";
|
|
||||||
import type { ComponentProps } from "react";
|
|
||||||
|
|
||||||
export default function Link({ prefetch = false, ...props }: ComponentProps<typeof NextLink>) {
|
|
||||||
return <NextLink prefetch={prefetch} {...props} />;
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
// Observability (PEP-202): shared pieces of the monitors list and the monitor page.
|
// Observability (PEP-202): shared pieces of the monitors list and the monitor page.
|
||||||
// glossary-ignore-file: the section is for the superadmin only.
|
// glossary-ignore-file: the section is for the superadmin only.
|
||||||
import { platformZone } from "@peppa/shared/time";
|
|
||||||
import { durationText, FEATURE_NAMES, FEATURES, type MonitorKind, type MonitorState, type MonitorView } from "@peppa/core";
|
import { durationText, FEATURE_NAMES, FEATURES, type MonitorKind, type MonitorState, type MonitorView } from "@peppa/core";
|
||||||
import type { Translator } from "@peppa/shared/i18n";
|
import type { Translator } from "@peppa/shared/i18n";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@ -27,7 +26,7 @@ export function CheckStrip({ recent, t }: { recent: MonitorView["recent"]; t: Tr
|
|||||||
<span key={`e${i}`} className="h-full w-1.5 rounded-sm bg-muted" />
|
<span key={`e${i}`} className="h-full w-1.5 rounded-sm bg-muted" />
|
||||||
))}
|
))}
|
||||||
{recent.map((c) => (
|
{recent.map((c) => (
|
||||||
<span key={c.at} title={new Date(c.at).toLocaleString("ru-RU", { timeZone: platformZone() })} className={cn("h-full w-1.5 rounded-sm", !c.ok ? "bg-destructive" : c.degraded ? "bg-warn" : "bg-ok")} />
|
<span key={c.at} title={new Date(c.at).toLocaleString("ru-RU")} className={cn("h-full w-1.5 rounded-sm", !c.ok ? "bg-destructive" : c.degraded ? "bg-warn" : "bg-ok")} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -126,4 +125,4 @@ export function OutageLine({ m, t, now = new Date() }: { m: MonitorView; t: Tran
|
|||||||
return <span className={m.state === "down" ? "text-destructive" : "text-warn"}>{parts.join(" · ")}</span>;
|
return <span className={m.state === "down" ? "text-destructive" : "text-warn"}>{parts.join(" · ")}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const hhmm = (iso: string) => new Date(iso).toLocaleTimeString("ru-RU", { hour: "2-digit", minute: "2-digit", timeZone: platformZone() });
|
const hhmm = (iso: string) => new Date(iso).toLocaleTimeString("ru-RU", { hour: "2-digit", minute: "2-digit", timeZone: process.env.PEPPA_TZ || undefined });
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import { platformZone } from "@peppa/shared/time";
|
import Link from "next/link";
|
||||||
import Link from "@/components/Link";
|
|
||||||
import { DELAY_REASON_NAMES, type DelayView } from "@peppa/core";
|
import { DELAY_REASON_NAMES, type DelayView } from "@peppa/core";
|
||||||
import { delayActionForm } from "@/app/(app)/dashboard/actions";
|
import { delayActionForm } from "@/app/(app)/dashboard/actions";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@ -14,7 +13,7 @@ import { getT } from "@/lib/i18n";
|
|||||||
*/
|
*/
|
||||||
export async function PlatformDelays({ delays, actions = false }: { delays: DelayView[]; actions?: boolean }) {
|
export async function PlatformDelays({ delays, actions = false }: { delays: DelayView[]; actions?: boolean }) {
|
||||||
const t = await getT();
|
const t = await getT();
|
||||||
const hhmm = (ms: number) => new Date(ms).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit", timeZone: platformZone() });
|
const hhmm = (ms: number) => new Date(ms).toLocaleString("ru-RU", { day: "2-digit", month: "2-digit", hour: "2-digit", minute: "2-digit", timeZone: process.env.PEPPA_TZ || undefined });
|
||||||
return (
|
return (
|
||||||
<ul className="m-0 flex list-none flex-col gap-2 p-0" data-delays>
|
<ul className="m-0 flex list-none flex-col gap-2 p-0" data-delays>
|
||||||
{delays.map((d) => (
|
{delays.map((d) => (
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
import { platformZone } from "@peppa/shared/time";
|
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import type { PoolOverview, PoolSubscriptionState } from "@peppa/core";
|
import type { PoolOverview, PoolSubscriptionState } from "@peppa/core";
|
||||||
import { intlLocale, type Locale } from "@peppa/shared/i18n";
|
import { intlLocale, type Locale } from "@peppa/shared/i18n";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { getT } from "@/lib/i18n";
|
import { getT } from "@/lib/i18n";
|
||||||
|
|
||||||
const hhmm = (d: Date, locale: Locale) => d.toLocaleTimeString(intlLocale(locale), { hour: "2-digit", minute: "2-digit", timeZone: platformZone() });
|
const hhmm = (d: Date, locale: Locale) => d.toLocaleTimeString(intlLocale(locale), { hour: "2-digit", minute: "2-digit", timeZone: process.env.PEPPA_TZ || undefined });
|
||||||
const KIND: Record<PoolSubscriptionState["provider"], string> = { claude: "Claude", codex: "ChatGPT", opencode: "OpenCode" };
|
const KIND: Record<PoolSubscriptionState["provider"], string> = { claude: "Claude", codex: "ChatGPT", opencode: "OpenCode" };
|
||||||
|
|
||||||
function tone(s: PoolSubscriptionState): "ok" | "warn" | "danger" | "muted" | "primary" {
|
function tone(s: PoolSubscriptionState): "ok" | "warn" | "danger" | "muted" | "primary" {
|
||||||
@ -76,7 +75,7 @@ export async function PoolSwitches({ o }: { o: PoolOverview }) {
|
|||||||
<span className="font-medium text-foreground">{t("Переключения")}</span>
|
<span className="font-medium text-foreground">{t("Переключения")}</span>
|
||||||
{o.switches.map((x, i) => (
|
{o.switches.map((x, i) => (
|
||||||
<span key={i}>
|
<span key={i}>
|
||||||
{x.at.toLocaleString(intlLocale(t.locale), { day: "numeric", month: "short", hour: "2-digit", minute: "2-digit", timeZone: platformZone() })}
|
{x.at.toLocaleString(intlLocale(t.locale), { day: "numeric", month: "short", hour: "2-digit", minute: "2-digit", timeZone: process.env.PEPPA_TZ || undefined })}
|
||||||
{" · "}
|
{" · "}
|
||||||
{x.taskKey ? <Link href={`/t/${x.taskKey}`}>{x.taskKey}</Link> : t("агент №{id}", { id: x.sessionId ?? "?" })}
|
{x.taskKey ? <Link href={`/t/${x.taskKey}`}>{x.taskKey}</Link> : t("агент №{id}", { id: x.sessionId ?? "?" })}
|
||||||
{": "}
|
{": "}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { ExternalLink, Hourglass, KeyRound, Rocket, Wrench, X } from "lucide-react";
|
import { ExternalLink, Hourglass, KeyRound, Rocket, Wrench, X } from "lucide-react";
|
||||||
import type { ProductNeedView, ProductReview, ProjectProduct, PublishMode } from "@peppa/core";
|
import type { ProductNeedView, ProductReview, ProjectProduct, PublishMode } from "@peppa/core";
|
||||||
import { Hidden } from "@/components/cards";
|
import { Hidden } from "@/components/cards";
|
||||||
@ -56,7 +56,7 @@ export async function ProductCard({
|
|||||||
const { task } = wording(engineer ? "engineer" : "product", t.locale);
|
const { task } = wording(engineer ? "engineer" : "product", t.locale);
|
||||||
const { live, check, doneStories } = product;
|
const { live, check, doneStories } = product;
|
||||||
const open = needs.filter((n) => n.open);
|
const open = needs.filter((n) => n.open);
|
||||||
if (!live && !check && doneStories === 0 && !open.length && !product.preparing && !product.stalled) return null;
|
if (!live && !check && doneStories === 0 && !open.length && !product.preparing) return null;
|
||||||
// PEP-145: one big button — the working product, else the version to check.
|
// PEP-145: one big button — the working product, else the version to check.
|
||||||
const link = live ?? check;
|
const link = live ?? check;
|
||||||
const deployed = !!(live || check);
|
const deployed = !!(live || check);
|
||||||
@ -67,7 +67,7 @@ export async function ProductCard({
|
|||||||
</p>
|
</p>
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<section aria-label={t("Ваш продукт")} className={`mb-5 flex flex-col gap-3 rounded-xl border p-4 ${open.length || (!link && product.stalled) ? "border-warn/50 bg-warn/5" : link ? "border-ok/40 bg-ok/5" : "border-info/40 bg-info/5"}`}>
|
<section aria-label={t("Ваш продукт")} className={`mb-5 flex flex-col gap-3 rounded-xl border p-4 ${open.length ? "border-warn/50 bg-warn/5" : link ? "border-ok/40 bg-ok/5" : "border-info/40 bg-info/5"}`}>
|
||||||
{link ? (
|
{link ? (
|
||||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-3">
|
<div className="flex flex-wrap items-center gap-x-4 gap-y-3">
|
||||||
<div className="flex min-w-0 flex-1 basis-full flex-col gap-0.5 sm:basis-0">
|
<div className="flex min-w-0 flex-1 basis-full flex-col gap-0.5 sm:basis-0">
|
||||||
@ -97,24 +97,6 @@ export async function ProductCard({
|
|||||||
</a>
|
</a>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : product.stalled ? (
|
|
||||||
// PEP-274: the wait ran out — an error in two phrases (what happened, what to do), not an endless «готовим».
|
|
||||||
<div className="flex flex-col gap-0.5" role="alert" data-product-stalled>
|
|
||||||
<span className="flex items-center gap-2 text-[15px] font-semibold">
|
|
||||||
<Wrench className="size-4 text-warn" /> {t("Ссылка на продукт пока не открывается")}
|
|
||||||
</span>
|
|
||||||
<span className="text-sm text-muted-foreground">
|
|
||||||
{product.fix ? (
|
|
||||||
<>
|
|
||||||
{t("Агент уже чинит это:")} <Link href={`/t/${product.fix.key}`}>{product.fix.key}</Link>. {t("Ссылка появится здесь сама, делать ничего не нужно.")}
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
{t("Запустить продукт пока не получилось. Если ссылка нужна срочно —")} <Link href={`/chats/${projectKey}`}>{t("напишите аналитику в чате")}</Link>.
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
) : product.preparing || doneStories > 0 ? (
|
) : product.preparing || doneStories > 0 ? (
|
||||||
<div className="flex flex-col gap-0.5" role="status">
|
<div className="flex flex-col gap-0.5" role="status">
|
||||||
<span className="flex items-center gap-2 text-[15px] font-semibold">
|
<span className="flex items-center gap-2 text-[15px] font-semibold">
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import type { ProgressOverview as Overview, ProjectProgress } from "@peppa/core";
|
import type { ProgressOverview as Overview, ProjectProgress } from "@peppa/core";
|
||||||
import { AgentBadge } from "@/components/AgentBadge";
|
import { AgentBadge } from "@/components/AgentBadge";
|
||||||
import { Empty, Key } from "@/components/common";
|
import { Empty, Key } from "@/components/common";
|
||||||
@ -58,8 +58,8 @@ function ProjectRow({ p, t, w }: { p: ProjectProgress; t: Translator; w: Words }
|
|||||||
{t("Открыть продукт")} ↗
|
{t("Открыть продукт")} ↗
|
||||||
</a>
|
</a>
|
||||||
) : p.productFix ? (
|
) : p.productFix ? (
|
||||||
<Link href={`/t/${p.productFix}`} className={cn("rounded-full border px-2 text-[11px] font-medium text-foreground hover:no-underline", p.productStalled ? "border-warn/50 bg-warn/12" : "border-info/50 bg-info/10")}>
|
<Link href={`/t/${p.productFix}`} className="rounded-full border border-info/50 bg-info/10 px-2 text-[11px] font-medium text-foreground hover:no-underline">
|
||||||
{p.productStalled ? t("Ссылка пока не открывается") : t("Готовим ссылку на продукт")}
|
{t("Готовим ссылку на продукт")}
|
||||||
</Link>
|
</Link>
|
||||||
) : null}
|
) : null}
|
||||||
<span className="ml-auto text-xs text-muted-foreground">
|
<span className="ml-auto text-xs text-muted-foreground">
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// PEP-218: the project's tab «Баги» — errors of its own Bugsink projects (`<KEY>-web` /
|
// PEP-218: the project's tab «Баги» — errors of its own Bugsink projects (`<KEY>-web` /
|
||||||
// `<KEY>-api`), read on the server, in the same view as the superadmin's /observability.
|
// `<KEY>-api`), read on the server, in the same view as the superadmin's /observability.
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { errorScope, listErrors } from "@peppa/core";
|
import { errorScope, listErrors } from "@peppa/core";
|
||||||
import { ErrorFilters, errorFilterFrom, ErrorRows, ErrorsDown } from "@/components/Errors";
|
import { ErrorFilters, errorFilterFrom, ErrorRows, ErrorsDown } from "@/components/Errors";
|
||||||
import { Section } from "@/components/common";
|
import { Section } from "@/components/common";
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// Runners console (PEP-38): list rows with status and limit info, and the details panel of the chosen runner.
|
// Runners console (PEP-38): list rows with status and limit info, and the details panel of the chosen runner.
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { SquareTerminal, X } from "lucide-react";
|
import { SquareTerminal, X } from "lucide-react";
|
||||||
import { FINISHED_SESSION_STATUSES, PROVIDER_NAMES, type RunnerTaskView, type SessionView, type StepView } from "@peppa/core";
|
import { FINISHED_SESSION_STATUSES, PROVIDER_NAMES, type RunnerTaskView, type SessionView, type StepView } from "@peppa/core";
|
||||||
import { RunnerStories } from "@/components/Runners";
|
import { RunnerStories } from "@/components/Runners";
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Link from "@/components/Link";
|
import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useLive } from "@/lib/live";
|
import { useLive } from "@/lib/live";
|
||||||
|
|||||||
@ -1,125 +0,0 @@
|
|||||||
"use client";
|
|
||||||
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import { RefreshCw } from "lucide-react";
|
|
||||||
import { unstable_isUnrecognizedActionError } from "next/navigation";
|
|
||||||
import { useT } from "@/components/I18n";
|
|
||||||
import { DraftTracker, claimReload, isStaleAction as isStaleText, isTextField, restoreDrafts, saveDrafts, takeDrafts, type FieldLike } from "@/lib/stale-action";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* PEP-324: a button of a page opened before an update calls a server action the new server doesn't
|
|
||||||
* know. The page keeps the typed text, says FORGE was updated and reloads itself (once a minute at
|
|
||||||
* most — then a button). PEP-114 stays: without such a failed press the page never reloads by itself.
|
|
||||||
*/
|
|
||||||
const EVENT = "peppa:stale-action";
|
|
||||||
const RELOAD_DELAY_MS = 1500;
|
|
||||||
const tracker = new DraftTracker();
|
|
||||||
|
|
||||||
/** The «action not found on the server» error, by Next's own check first. */
|
|
||||||
export const isStaleAction = (err: unknown) => isStaleText(err, unstable_isUnrecognizedActionError);
|
|
||||||
|
|
||||||
/** Called by the error boundary (app/error.tsx) when the caught error is an unknown action. */
|
|
||||||
export function reportStaleAction() {
|
|
||||||
if (typeof window !== "undefined") window.dispatchEvent(new Event(EVENT));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setFieldValue(el: FieldLike, value: string) {
|
|
||||||
const node = el as unknown as HTMLInputElement | HTMLTextAreaElement;
|
|
||||||
const proto = node instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
|
|
||||||
// The native setter + an input event: React-controlled fields see the value as typed.
|
|
||||||
Object.getOwnPropertyDescriptor(proto, "value")?.set?.call(node, value);
|
|
||||||
node.dispatchEvent(new Event("input", { bubbles: true }));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Text fields of this name on the page. Text is kept and put back by name only when there is exactly
|
|
||||||
* one: a card per question means a field per card under the same name, and an answer must not come
|
|
||||||
* back in another question's field. */
|
|
||||||
const named = (name: string) =>
|
|
||||||
Array.from(document.getElementsByName(name)).filter((n): n is HTMLInputElement | HTMLTextAreaElement => (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement) && isTextField(n));
|
|
||||||
const alone = (name: string) => named(name).length === 1;
|
|
||||||
|
|
||||||
function findField(key: string): FieldLike | null {
|
|
||||||
if (!key.startsWith("#")) {
|
|
||||||
const fields = named(key);
|
|
||||||
return fields.length === 1 ? fields[0]! : null;
|
|
||||||
}
|
|
||||||
const el = document.getElementById(key.slice(1));
|
|
||||||
return el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement ? el : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const path = () => location.pathname + location.search;
|
|
||||||
|
|
||||||
export function StaleActionGuard() {
|
|
||||||
const t = useT();
|
|
||||||
const [state, setState] = useState<null | "reloading" | "manual">(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// Text saved before the self-reload goes back; parts of the page that mount later get a few tries.
|
|
||||||
let fields = takeDrafts(sessionStorage, path(), Date.now());
|
|
||||||
const timers: ReturnType<typeof setTimeout>[] = [];
|
|
||||||
const place = () => {
|
|
||||||
if (!fields) return;
|
|
||||||
const left = restoreDrafts(fields, findField, setFieldValue, alone);
|
|
||||||
fields = left.length ? Object.fromEntries(left.map((k) => [k, fields![k]])) : null;
|
|
||||||
};
|
|
||||||
place();
|
|
||||||
for (const ms of [300, 1000, 3000]) timers.push(setTimeout(place, ms));
|
|
||||||
|
|
||||||
const onInput = (e: Event) => {
|
|
||||||
const el = e.target;
|
|
||||||
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement) tracker.input(el, alone);
|
|
||||||
};
|
|
||||||
const onSubmit = (e: Event) => tracker.submit(e.target, Date.now());
|
|
||||||
let handled = false;
|
|
||||||
const handle = () => {
|
|
||||||
if (handled) return;
|
|
||||||
handled = true;
|
|
||||||
saveDrafts(sessionStorage, path(), tracker.snapshot(Date.now()), Date.now());
|
|
||||||
if (claimReload(sessionStorage, Date.now())) {
|
|
||||||
setState("reloading");
|
|
||||||
timers.push(setTimeout(() => window.location.reload(), RELOAD_DELAY_MS));
|
|
||||||
} else setState("manual");
|
|
||||||
};
|
|
||||||
const onRejection = (e: PromiseRejectionEvent) => {
|
|
||||||
if (!isStaleAction(e.reason)) return;
|
|
||||||
e.preventDefault(); // not an error for the console or «Ошибки из прода»
|
|
||||||
handle();
|
|
||||||
};
|
|
||||||
const onError = (e: ErrorEvent) => {
|
|
||||||
if (!isStaleAction(e.error ?? e.message)) return;
|
|
||||||
e.preventDefault();
|
|
||||||
handle();
|
|
||||||
};
|
|
||||||
document.addEventListener("input", onInput, true);
|
|
||||||
document.addEventListener("submit", onSubmit, true);
|
|
||||||
window.addEventListener("unhandledrejection", onRejection);
|
|
||||||
window.addEventListener("error", onError);
|
|
||||||
window.addEventListener(EVENT, handle);
|
|
||||||
return () => {
|
|
||||||
for (const id of timers) clearTimeout(id);
|
|
||||||
document.removeEventListener("input", onInput, true);
|
|
||||||
document.removeEventListener("submit", onSubmit, true);
|
|
||||||
window.removeEventListener("unhandledrejection", onRejection);
|
|
||||||
window.removeEventListener("error", onError);
|
|
||||||
window.removeEventListener(EVENT, handle);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (!state) return null;
|
|
||||||
return (
|
|
||||||
<div role="alert" className="fixed inset-x-0 top-0 z-50 flex flex-wrap items-center justify-center gap-3 border-b border-primary/50 bg-background/95 px-4 py-2 text-sm shadow">
|
|
||||||
{state === "reloading" ? (
|
|
||||||
<span className="inline-flex items-center gap-2">
|
|
||||||
<RefreshCw className="size-3.5 animate-spin" /> {t("FORGE обновилась. Обновляем страницу — набранный текст сохранится.")}
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<span>{t("FORGE обновилась. Обновите страницу — набранный текст сохранится.")}</span>
|
|
||||||
<button type="button" onClick={() => window.location.reload()} className="inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1 font-medium text-primary-foreground">
|
|
||||||
<RefreshCw className="size-3.5" /> {t("Обновить страницу")}
|
|
||||||
</button>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
// Domain cards shared by pages: agent questions, runners, project list.
|
// Domain cards shared by pages: agent questions, runners, project list.
|
||||||
import { platformZone } from "@peppa/shared/time";
|
import Link from "next/link";
|
||||||
import Link from "@/components/Link";
|
|
||||||
import { BellRing, CircleCheck, CircleHelp, FileCheck, Hourglass, Play, RotateCcw, Send, ShieldQuestion, Square, SquareTerminal } from "lucide-react";
|
import { BellRing, CircleCheck, CircleHelp, FileCheck, Hourglass, Play, RotateCcw, Send, ShieldQuestion, Square, SquareTerminal } from "lucide-react";
|
||||||
import { pausedProjectIds, messageDetails, questionAuthor, questionDetails, questionIsFreeText, questionState, questionText, questionType, splitForDisplay, trashDaysLeft, type Project, type Question, type SessionView, type StepView } from "@peppa/core";
|
import { pausedProjectIds, messageDetails, questionAuthor, questionDetails, questionIsFreeText, questionState, questionText, questionType, splitForDisplay, trashDaysLeft, type Project, type Question, type SessionView, type StepView } from "@peppa/core";
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
@ -359,4 +358,4 @@ export async function ProjectList({ projects, userId, engineer = false, analyst,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const hhmm = (d: Date) => new Date(d).toLocaleTimeString("ru-RU", { hour: "2-digit", minute: "2-digit", timeZone: platformZone() });
|
const hhmm = (d: Date) => new Date(d).toLocaleTimeString("ru-RU", { hour: "2-digit", minute: "2-digit" });
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user