From eb760d7a92be3fdf10d5ba55d193513e62398b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=81=D0=B5=D0=BB=D1=8C?= Date: Sun, 15 Nov 2026 16:12:54 +0500 Subject: [PATCH] PEP-112: go-live needs, project secrets in deploys, restart on secret change, product agent accepts deploys Co-Authored-By: Claude Fable 5.2 --- apps/web/app/(app)/actions.ts | 19 + apps/web/app/(app)/p/[key]/page.tsx | 5 +- apps/web/components/ProductCard.tsx | 116 +++++- apps/web/components/ProjectSecrets.tsx | 4 +- packages/core/src/analyst-chat.ts | 2 +- packages/core/src/index.ts | 2 + packages/core/src/product-needs.ts | 141 +++++++ packages/core/src/product-review.ts | 208 ++++++++++ packages/core/src/secrets.ts | 24 +- packages/core/src/tasks.ts | 5 +- packages/mcp/src/agent.ts | 41 +- packages/mcp/src/format.ts | 6 + packages/runner/src/analyst-chat.ts | 18 +- packages/runner/src/ci-feedback.ts | 12 + packages/runner/src/claude-print.ts | 12 +- packages/runner/src/deploy.ts | 66 ++- packages/runner/src/hook.ts | 3 +- packages/runner/src/index.ts | 1 + packages/runner/src/product-review.ts | 170 ++++++++ packages/runner/src/reviewer.ts | 3 +- packages/runner/src/watchdog.ts | 5 + packages/testkit/bin/mock-docker | 5 +- packages/testkit/src/mock-intake.ts | 21 +- .../testkit/test/product-acceptance.test.ts | 389 ++++++++++++++++++ packages/testkit/test/secrets.test.ts | 2 +- template/.gitea/peppa-deploy.sh | 32 +- template/.gitea/workflows/deploy.yml | 5 +- template/deploy/compose.yml | 3 +- 28 files changed, 1275 insertions(+), 45 deletions(-) create mode 100644 packages/core/src/product-needs.ts create mode 100644 packages/core/src/product-review.ts create mode 100644 packages/runner/src/product-review.ts create mode 100644 packages/testkit/test/product-acceptance.test.ts diff --git a/apps/web/app/(app)/actions.ts b/apps/web/app/(app)/actions.ts index c1c484f5..9e8ac290 100644 --- a/apps/web/app/(app)/actions.ts +++ b/apps/web/app/(app)/actions.ts @@ -52,6 +52,8 @@ import { setTaskBudget, type Budget, setProjectSecret, + setNeedDone, + removeNeed, deleteProjectSecret, reencryptAll, markSecretRotated, @@ -646,6 +648,23 @@ export async function saveProjectSecretAction(f: FormData) { }); } +// PEP-112: «чтобы заработало по-настоящему» on the «Ваш продукт» card. +export async function setNeedDoneAction(f: FormData) { + const user = asWebActor(await requireUser()); + await attempt(f, async () => { + const project = await projectForUser(db, user.id, Number(str(f, "projectId"))); + await setNeedDone(db, project.id, str(f, "id"), str(f, "done") !== "0"); + }); +} + +export async function removeNeedAction(f: FormData) { + const user = asWebActor(await requireUser()); + await attempt(f, async () => { + const project = await projectForUser(db, user.id, Number(str(f, "projectId"))); + await removeNeed(db, project.id, str(f, "id")); + }); +} + export async function deleteProjectSecretAction(f: FormData) { const user = asWebActor(await requireUser()); await attempt(f, async () => { diff --git a/apps/web/app/(app)/p/[key]/page.tsx b/apps/web/app/(app)/p/[key]/page.tsx index 938ab43a..abc9eea5 100644 --- a/apps/web/app/(app)/p/[key]/page.tsx +++ b/apps/web/app/(app)/p/[key]/page.tsx @@ -4,7 +4,7 @@ import { notFound } from "next/navigation"; import { ExternalLink, Plus, Rocket, SquareTerminal } from "lucide-react"; import { columnOf, currentReleases, describeRepo, isPlatform, listReleases, bugsinkWebhookBase, openPulls, platformReleaseCandidate, platformReleaseOffers, ownPendingLogins, readAgentsMd, repoOverview, type Release, sharedRequest } from "@peppa/runner"; import { poolSubscriptions, userProjectIds, projectProduct, discussionUnread, ensureProjectChat, listHosts, DEFAULT_RUNNER_SETTINGS, DEFAULT_AGENT_SETTINGS, getProjectAgentSettings, getSystemAgentSettings, getProjectRunnerSettings, getSystemRunnerSettings, blockedLabel, blockersMap, epicProgress, progressLabel, taskProgress, getProjectBudget, listJournal, listProjectSecrets, projectMetrics, type ActorChannel, type ActorKind, getAutonomy, getIncidentSettings, getReviewSettings, isSuperadmin, listEpics, listErrorSources, listIncidents, listMembers, listPools, listSpecs, taskAgentNames, getIntakeSettings, intakePendingTasks, projectAgentWarning, memoryStats, readMemory, projectPool, sharedPool, ownPool, poolOverview, repoAudience, repoVisibilityLabel } from "@peppa/core"; -import { PRODUCT_PROJECT_TABS } from "@peppa/core"; +import { productNeeds, lastProductReview } from "@peppa/core"; import { LiveRefresh } from "@/components/LiveRefresh"; import { PanelSection } from "@/components/ActivityAside"; import { Board, type Card } from "@/components/Board"; @@ -156,6 +156,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr const specs = tab === "specs" ? listSpecs(p) : []; const agentsMd = tab === "agents" ? await readAgentsMd(db, p) : null; const product = await projectProduct(db, p.id); + 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. const canChat = (await userProjectIds(db, user.id)).includes(p.id); const sharedReq = await sharedRequest(db, p.id); @@ -487,7 +488,7 @@ export default async function ProjectPage({ params, searchParams }: { params: Pr

)} - {tab === "board" && } + {tab === "board" && }