From 0dceba0ff2e057ae94d1de2dda8495e901d94a0f Mon Sep 17 00:00:00 2001
From: peppa-bot
Date: Sat, 21 Nov 2026 14:54:13 +0000
Subject: [PATCH] =?UTF-8?q?PEP-228:=20=D0=BE=D0=B1=D0=BB=D0=B0=D1=81=D1=82?=
=?UTF-8?q?=D1=8C=20chat:=20=D0=BD=D0=B5=D1=81=D1=91=D1=82=20=D1=81?=
=?UTF-8?q?=D0=BE=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B4=D0=BB?=
=?UTF-8?q?=D1=8F=20=D0=B7=D1=80=D0=B8=D1=82=D0=B5=D0=BB=D1=8F,=20=D0=BB?=
=?UTF-8?q?=D0=B5=D0=BD=D1=82=D0=B0=20=D1=87=D0=B0=D1=82=D0=B0=20=D0=B4?=
=?UTF-8?q?=D0=BE=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D1=8B=D0=B2=D0=B0=D0=B5?=
=?UTF-8?q?=D1=82=20=D0=B8=D1=85=20=D0=BD=D0=B0=20=D0=BC=D0=B5=D1=81=D1=82?=
=?UTF-8?q?=D0=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-Authored-By: Claude Opus 5.5
---
apps/web/app/(app)/chats/[chat]/page.tsx | 85 +++++---
apps/web/app/(app)/chats/actions.ts | 14 +-
apps/web/components/Attachments.tsx | 3 +-
apps/web/components/ChatLiveFeed.tsx | 200 ++++++++++++++++++
apps/web/components/LiveRefresh.tsx | 15 +-
apps/web/components/common.tsx | 24 +--
apps/web/lib/chat-live-types.ts | 32 +++
apps/web/lib/chat-live.ts | 43 ++++
apps/web/lib/chat-text.ts | 10 +
apps/web/lib/format.tsx | 25 +++
apps/web/lib/live-server.ts | 4 +-
apps/web/lib/live.ts | 3 +-
.../pep-228-chat-messages-in-place/design.md | 2 +-
.../proposal.md | 2 +-
.../pep-228-chat-messages-in-place/tasks.md | 2 +-
packages/core/src/attachments.ts | 3 +-
packages/core/src/chats.ts | 6 +
packages/runner/src/live.ts | 87 ++++++--
packages/shared/package.json | 3 +-
packages/shared/src/format.ts | 4 +
20 files changed, 468 insertions(+), 99 deletions(-)
create mode 100644 apps/web/components/ChatLiveFeed.tsx
create mode 100644 apps/web/lib/chat-live-types.ts
create mode 100644 apps/web/lib/chat-live.ts
create mode 100644 apps/web/lib/format.tsx
create mode 100644 packages/shared/src/format.ts
diff --git a/apps/web/app/(app)/chats/[chat]/page.tsx b/apps/web/app/(app)/chats/[chat]/page.tsx
index c7a3848b..c867f609 100644
--- a/apps/web/app/(app)/chats/[chat]/page.tsx
+++ b/apps/web/app/(app)/chats/[chat]/page.tsx
@@ -10,6 +10,7 @@ import { LiveRefresh } from "@/components/LiveRefresh";
import { AgentBadge } from "@/components/AgentBadge";
import { ChatThreadList } from "@/components/ChatThreadList";
import { ChatScroll } from "@/components/ChatScroll";
+import { ChatLiveFeed } from "@/components/ChatLiveFeed";
import { ChatSwitch } from "@/components/ChatSwitch";
import { ago, Empty, Flash, linkify, StatusBadge } from "@/components/common";
import { Hidden, QuestionCard } from "@/components/cards";
@@ -24,7 +25,7 @@ import { requireUser, words } from "@/lib/auth";
import { db } from "@/lib/db";
import { getT } from "@/lib/i18n";
import { cn } from "@/lib/utils";
-import { cleanText } from "@/lib/chat-text";
+import { cleanText, messageLink, STUCK_NOTICE } from "@/lib/chat-text";
import { chatOfferAction, linkChatAction, postChatAction, unlinkChatAction } from "../actions";
type Params = { error?: string; thread?: string; link?: string; q?: string; list?: string };
@@ -223,10 +224,31 @@ export default async function ChatPage({ params, searchParams }: { params: Promi
return { slug: c.slug, label: marks ? `${c.kind === "master" ? name : `${c.slug} · ${name}`} (${marks})` : c.kind === "master" ? name : `${c.slug} · ${name}` };
});
+ const feed = ordered.length === 0 ? (
+ {discussion ? t("Напишите, что хотите узнать или сделать, — аналитик ответит здесь же. Например: «Что сейчас в работе?» или «Хочу страницу с отзывами клиентов».") : master ? t("Пока тихо: здесь появятся вопросы агентов, сбои и обновления ваших проектов.") : thread === undefined ? t("Сообщений пока нет: они появятся, когда агенты возьмутся за {tasks}.", { tasks: w.task("accPl") }) : t("В этом треде пока пусто.")}
+ ) : (
+
+ {groups.map((g) =>
+ g.kind === "events" ? (
+ -
+
+
+ ) : (
+ -
+
+
+
+
+ ),
+ )}
+
+ );
+
return (
- {/* PEP-225: a project chat re-renders only for its own new messages; the master feed gathers every project. */}
-
+ {/* PEP-228: a project chat draws its new messages in place (ChatLiveFeed) and re-renders only for
+ what it can't draw; the master feed gathers every project and re-renders. */}
+
{t("Чаты")}
@@ -285,32 +307,33 @@ export default async function ChatPage({ params, searchParams }: { params: Promi
)}
- {ordered.length === 0 ? (
- {discussion ? t("Напишите, что хотите узнать или сделать, — аналитик ответит здесь же. Например: «Что сейчас в работе?» или «Хочу страницу с отзывами клиентов».") : master ? t("Пока тихо: здесь появятся вопросы агентов, сбои и обновления ваших проектов.") : thread === undefined ? t("Сообщений пока нет: они появятся, когда агенты возьмутся за {tasks}.", { tasks: w.task("accPl") }) : t("В этом треде пока пусто.")}
+ {master ? (
+ <>
+ {feed}
+
+
+ >
) : (
-
- {groups.map((g) =>
- g.kind === "events" ? (
- -
-
-
- ) : (
- -
-
-
-
-
- ),
- )}
-
+
+ {t("печатает…")}
+
+ ) : null
+ }
+ >
+ {feed}
+
)}
- {typing && (
-
- {t("печатает…")}
-
- )}
-
-
{writable && (