ui: round 8 — fuzzy session search, stacked doors, All right, teach divider at the step seam
- SESSION SEARCH goes fuzzy on the SAME fuzzyScore the model pickers use (de0c286's util — one scoring across every search surface): ranked by score instead of raw substring; empty query keeps order. - SIDEBAR: New Teaching / New Practice STACK (full-width rows); the kind filter reads Teaching · Practice · All — the real modes first, All as the escape hatch, mirroring the stack above. Home stays in the LH band (owner-confirmed). - TEACH DIVIDER, the stacked-dividers bug: the plan presentation and the first tagged quiz call usually share ONE assistant message, so the message-level seam drew Planning+Teaching back-to-back. New pure teachStepIndex(parts) finds the STEP boundary governing the flip call; the divider renders there (replacing that boundary's plain hairline — a labeled rule supersedes it), prepending before the whole message only when the flip is in its first step. The fold (chip, sidebar state) is untouched. - JOBS SUITE, flake round 3: the sweep scans the SHARED jobs dir, so parallel test FILES' running records respawn into this file's counters — the assertions go jurisdictional (own-job ids collected; foreign respawns are not this test's business). 1331/1331.
This commit is contained in:
+32
-9
@@ -50,6 +50,7 @@ import {
|
||||
findPendingToolCall,
|
||||
phaseAt3,
|
||||
phaseTimeline,
|
||||
teachStepIndex,
|
||||
toolQuestionKind,
|
||||
quizNeedsReveal,
|
||||
} from "@/src/core";
|
||||
@@ -1238,15 +1239,26 @@ export function Chat({
|
||||
{/* THE INFERRED TEACH SEAM (owner ruling 2026-09-26, the verdict
|
||||
death): teaching begins where the FIRST nodeId-tagged quiz is
|
||||
posed — the fold (phaseTimeline, the same derivation the phase chip
|
||||
reads) flips to teach exactly AT this assistant group, so the divider
|
||||
renders BEFORE the whole block (thinking -> prose -> the quiz call) —
|
||||
where the explicit accept marker used to sit. The boundary check
|
||||
(this index flips, the previous didn't) guarantees exactly ONE divider
|
||||
per session. PREPENDED, never a replacement branch: the teach group is
|
||||
a real message with content (the marker branches above have none) — a
|
||||
replacement ternary swallowed the entire first lesson block (the
|
||||
Lacan session, 2026-09-27). */}
|
||||
{m.role === "assistant" && mi > 0 && phases[mi] === "teach" && phases[mi - 1] !== "teach" ? (
|
||||
reads) flips to teach exactly AT this assistant group. STEP-LEVEL
|
||||
since owner round 8 (2026-10-05 — the stacked-dividers bug): the
|
||||
plan presentation often lives in the SAME message, an earlier
|
||||
provider step than the quiz call, and the old message-level seam
|
||||
drew this divider before the plan too (Planning and Teaching
|
||||
stacked back-to-back, nothing between). teachStepIndex finds the
|
||||
step boundary governing the flip call: -1 = the message's first
|
||||
step → prepend before the whole block (this branch); a later
|
||||
index → the divider renders AT that part boundary in the loop
|
||||
below (replacing the plain step hairline — a labeled phase rule
|
||||
supersedes it). The boundary check (this index flips, the
|
||||
previous didn't) still guarantees exactly ONE divider per session.
|
||||
PREPENDED, never a replacement branch: the teach group is a real
|
||||
message with content — a replacement ternary swallowed the entire
|
||||
first lesson block (the Lacan session, 2026-09-27). */}
|
||||
{m.role === "assistant" &&
|
||||
mi > 0 &&
|
||||
phases[mi] === "teach" &&
|
||||
phases[mi - 1] !== "teach" &&
|
||||
teachStepIndex(m.parts) === -1 ? (
|
||||
<PhaseDivider key={`teach-${m.id || `m-${mi}`}`} phase="teach" />
|
||||
) : null}
|
||||
{m.role === "user" ? (
|
||||
@@ -1273,6 +1285,15 @@ export function Chat({
|
||||
<MessageContent className="w-full">
|
||||
{m.parts.map((part, pi) => {
|
||||
const isLastPart = mi === messages.length - 1 && pi === m.parts.length - 1;
|
||||
// The step boundary where teaching begins (round 8): when
|
||||
// the teach flip happens in a LATER step, its PhaseDivider
|
||||
// replaces this boundary's plain hairline.
|
||||
const teachBoundary =
|
||||
m.role === "assistant" &&
|
||||
mi > 0 &&
|
||||
phases[mi] === "teach" &&
|
||||
phases[mi - 1] !== "teach" &&
|
||||
teachStepIndex(m.parts) === pi;
|
||||
// A tool call that errored BACK TO THE AGENT (validation
|
||||
// failure, malformed args) is invisible work — the agent
|
||||
// reads the error and retries. Owner ruling 2026-09-26:
|
||||
@@ -1302,6 +1323,8 @@ export function Chat({
|
||||
</Reasoning>
|
||||
);
|
||||
case "step-start":
|
||||
if (teachBoundary)
|
||||
return <PhaseDivider key={`teach-step-${pi}`} phase="teach" />;
|
||||
return pi > 0 ? <Separator key={pi} className="my-3" /> : null;
|
||||
case "data-plan-block":
|
||||
// The plan in the chat (wave 4): a frozen snapshot
|
||||
|
||||
+22
-10
@@ -17,6 +17,7 @@ import { Hint } from "@/components/ui/hint";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { fuzzyScore } from "@/src/core";
|
||||
import { useServerEvent, useServerResync } from "@/components/server-events";
|
||||
import type { ChatListItem } from "@/src/core";
|
||||
import { kbdEventForAction } from "@/src/core";
|
||||
@@ -384,15 +385,22 @@ function SessionsSidebar() {
|
||||
router.push("/chat/new");
|
||||
}, [router]);
|
||||
|
||||
/* FUZZY (owner round 8, 2026-10-05): subsequence match ranked by
|
||||
* fuzzyScore — prefix beats word-boundary beats scattered. Empty query
|
||||
* keeps the natural list order (scores are all 0, sort is stable). */
|
||||
const shown = useMemo(() => {
|
||||
const q = query.trim().toLowerCase();
|
||||
const q = query.trim();
|
||||
let list = chats;
|
||||
if (list && kindFilter !== "all") {
|
||||
list = list.filter((c) => (c.kind ?? "teach") === kindFilter);
|
||||
}
|
||||
if (!list) return list;
|
||||
if (!q) return list;
|
||||
return list.filter((c) => c.title.toLowerCase().includes(q));
|
||||
return list
|
||||
.map((c) => ({ c, score: fuzzyScore(q, c.title) }))
|
||||
.filter((r): r is { c: (typeof list)[number]; score: number } => r.score !== null)
|
||||
.sort((a, b) => b.score - a.score)
|
||||
.map((r) => r.c);
|
||||
}, [chats, query, kindFilter]);
|
||||
|
||||
const refreshInFlightRef = useRef(false);
|
||||
@@ -688,14 +696,16 @@ function SessionsSidebar() {
|
||||
</Hint>
|
||||
</div>
|
||||
|
||||
{/* Two doors (practice sessions, owner 2026-10-04): teaching
|
||||
keeps the original draft route; practice carries its mode. */}
|
||||
<div className="mx-3 mb-1 flex gap-1.5">
|
||||
{/* Two doors, STACKED (owner round 8, 2026-10-05 — was a
|
||||
half/half row): full-width rows read cleaner and give the
|
||||
labels room; teaching keeps the original draft route,
|
||||
practice carries its mode. */}
|
||||
<div className="mx-3 mb-1 flex flex-col gap-1.5">
|
||||
<button
|
||||
type="button"
|
||||
data-testid="new-session"
|
||||
onClick={() => void newSession()}
|
||||
className="flex flex-1 items-center gap-1.5 rounded-md px-2 py-1.5 text-xs uppercase tracking-wider text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
||||
className="flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-xs uppercase tracking-wider text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
||||
>
|
||||
<PlusIcon className="size-3" />
|
||||
Teaching
|
||||
@@ -705,7 +715,7 @@ function SessionsSidebar() {
|
||||
type="button"
|
||||
data-testid="new-session-practice"
|
||||
onClick={() => router.push("/chat/new?mode=practice")}
|
||||
className="flex flex-1 items-center gap-1.5 rounded-md px-2 py-1.5 text-xs uppercase tracking-wider text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
||||
className="flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-xs uppercase tracking-wider text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
||||
>
|
||||
<DumbbellIcon className="size-3" />
|
||||
Practice
|
||||
@@ -713,10 +723,12 @@ function SessionsSidebar() {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* The three-way filter (owner, 2026-10-04): Teaching / All /
|
||||
Practice, quiet segmented, persisted client-side. */}
|
||||
{/* The three-way filter (owner, 2026-10-04; order owner round 8,
|
||||
2026-10-05): Teaching / Practice / All — the two real modes
|
||||
first, "All" as the escape hatch on the right, mirroring the
|
||||
stacked create-buttons above. Persisted client-side. */}
|
||||
<div className="mx-3 mb-1.5 flex items-center gap-0.5 rounded-md border border-border/60 bg-background p-0.5" data-testid="session-kind-filter">
|
||||
{(["teach", "all", "practice"] as const).map((f) => (
|
||||
{(["teach", "practice", "all"] as const).map((f) => (
|
||||
<button
|
||||
key={f}
|
||||
type="button"
|
||||
|
||||
Reference in New Issue
Block a user