Files
learnharness/app/chat/[id]/page.tsx
T
amosblomqvist 9362baf36e practice polish: no phantom wake, Practice header tag, honest meta
- needsContinuation: a persisted problem-pose ack (terminate:true ended
  the turn deliberately) owes no continuation — reloads after a pose no
  longer wake a phantom turn; error results stay owed like any
  interrupted tool.
- Chat header: practice sessions swap the phase chip for a quiet
  Practice tag (no probe→teach arc applies) and hide the coverage ring
  (practice never extracts — an ever-filling ring would lie).
- ChatSummary gains pendingProblem (activeProblemOf at projection); the
  sidebar meta says 'Problem waiting' for a practice row with a posed
  problem. Kind threads through Chat/[id] page.
- Home picker chip gains Clear (picks were otherwise irremovable).
2026-10-04 22:06:22 +03:00

40 lines
1.4 KiB
TypeScript

import { notFound } from "next/navigation";
import { Chat } from "@/components/chat";
import { slotsConfigured } from "@/src/core";
import { getChat, isTurnRunning, readSettingsRecord } from "@/src/server";
export const dynamic = "force-dynamic";
export default async function ChatPage({
params,
searchParams,
}: {
params: Promise<{ id: string }>;
searchParams: Promise<{ prompt?: string }>;
}) {
const [{ id }, { prompt }] = await Promise.all([params, searchParams]);
const chat = getChat(id);
if (!chat) notFound();
// The persistent setup CTA's seed (BYOK, owner 2026-09-22): slotsConfigured
// over the settings record, server-read — the same gate home/new read. The
// server's 503 stays the truth; this only decides whether the pill rides.
const record = readSettingsRecord();
return (
<Chat
key={chat.id}
chatId={chat.id}
title={chat.title}
kind={chat.kind ?? "teach"}
// Wave D: the record IS native agent history — the client view is
// derived app-side (core/view.ts projectView; GET serves the same
// native messages).
initialMessages={chat.messages}
initialConfigured={slotsConfigured(record?.models)}
initialPrompt={prompt}
// A teacher turn that outlived its client: the remounted view must
// attach (busy shimmer + poll), never resurrect the stale record.
initiallyInFlight={isTurnRunning(chat.id)}
/>
);
}