Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions .fork/customizations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7144,8 +7144,10 @@
(`bot`, mascot:*) there and inherits every other tag, so a bot's subagent
is never a bot. Subagents made before that fix keep the copied tags and
list as bots until archived; there is no migration.
The collapsed tab strip and mobile are not bot-aware, and mobile lists bots
as No-project threads.
The collapsed tab strip lists bots as a track of mascots beside its project
switcher (custom/bots/CollapsedPetalTabs), never as tabs: the bot on screen, or
whose work is, is pressed, and picking one opens its conversation. Mobile is
not bot-aware and lists bots as No-project threads.
tier: 4
files:
- packages/shared/src/forkBotTags.ts
Expand All @@ -7167,6 +7169,7 @@
- apps/web/src/custom/bots/SidebarV2BotCardBody.tsx
- apps/web/src/custom/bots/useIsBotThread.ts
- apps/web/src/custom/bots/SidebarV2BotsSection.tsx
- apps/web/src/custom/bots/CollapsedPetalTabs.tsx
- apps/web/src/custom/SidebarV2SectionLabel.tsx
- apps/web/src/custom/SidebarV2StatusIndicator.tsx
- apps/web/src/custom/sidebarV2CardStatus.ts
Expand Down Expand Up @@ -7274,8 +7277,9 @@
setting for every bot. Sections that match nothing are dropped, and a list narrowed to
nothing offers to clear.
The search field takes focus only when its button opens it, never when the panel remounts
with search still open. The collapsed tab strip shows neither bots nor their work, as the
thread list does not. Mobile is not aware of any of it.
with search still open. The collapsed tab strip shows no bot work as tabs, as the thread
list does not; its bots are a mascot track beside the project switcher (fork-bots).
Mobile is not aware of any of it.
tier: 4
files:
- packages/shared/src/forkBotTags.ts
Expand Down Expand Up @@ -7429,3 +7433,20 @@
- apps/web/src/custom/SidebarV2ChromeRows.tsx
verify:
- apps/web/src/__fork_guards__/forkBots.test.ts
- id: fork-done-celebration
intent: >
A thread whose mark turns from Working to Done while it is on screen
celebrates once, in every theme: two rings in the Done dot's colour pulse
off it, and a petal's mascot in the same row gives one small hop. The
transition is remembered per thread across remounts (a finished row moves
out of the Working group), but only briefly, so a row unmounted while
working (a folded section) that comes back Done stays still. Reduced motion skips it.
tier: 1
files:
- apps/web/src/custom/doneCelebration.ts
- apps/web/src/custom/SidebarV2StatusIndicator.tsx
- apps/web/src/theme.custom.css
shadows: []
watch: []
verify:
- apps/web/src/custom/doneCelebration.test.ts
3 changes: 2 additions & 1 deletion apps/web/src/__fork_guards__/forkCoolDarkerTheme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ describe("fork guard: fork-cool-darker-theme", () => {
expect(
ruleBodyFor(themeRules, [
...DARKER_PANEL,
":is( [data-fork-projects-row], [data-fork-project-section-header], [data-fork-status-section-header], [data-fork-thread-card-meta], [data-fork-thread-card-actions], [data-fork-idle-mark] )",
":is( [data-fork-projects-row], [data-fork-bots-row], [data-fork-project-section-header], [data-fork-status-section-header], [data-fork-thread-card-meta], [data-fork-thread-card-actions], [data-fork-idle-mark] )",
]),
).toMatch(new RegExp(`--contrast-muted-foreground${quietInk.source}`, "u"));
// The draft pencil is drawn at muted/70, so it takes the ink directly.
Expand All @@ -179,6 +179,7 @@ describe("fork guard: fork-cool-darker-theme", () => {
// Every hook has to exist for the rule to land on anything.
for (const [file, hook] of [
["../custom/SidebarV2ChromeRows.tsx", "data-fork-projects-row"],
["../custom/bots/SidebarV2BotsSection.tsx", "data-fork-bots-row"],
["../custom/SidebarV2ProjectGroupHeader.tsx", "data-fork-project-section-header"],
["../custom/SidebarV2StatusSectionHeader.tsx", "data-fork-status-section-header"],
["../custom/SidebarV2ThreadCardMeta.tsx", "data-fork-thread-card-meta"],
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/__fork_guards__/forkGlass3d.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ describe("fork guard: fork-glass-3d", () => {
for (const rule of selection) {
const isTokens = compact(rule.selector) === compact(`${NOT_OFF}${PALETTE}`);
// The collapsed sidebar's tab row (fork-collapsed-thread-tabs) is the list laid
// sideways; the model picker's open provider tab (fork-model-picker) is selected too.
// sideways; the model picker's open provider tab (fork-model-picker) and the sidebar's
// chosen Code / Chat mode (fork-chat-mode) are selected too.
const isSelectedRow =
/\[data-thread-item\]|\[data-fork-chrome-row\]|\[data-fork-thread-tabs\]|\[data-fork-model-picker="providers"\] \[data-model-picker-provider\]\[aria-current="true"\]/u.test(
/\[data-thread-item\]|\[data-fork-chrome-row\]|\[data-fork-thread-tabs\]|\[data-fork-sidebar-mode-tabs\]|\[data-fork-model-picker="providers"\] \[data-model-picker-provider\]\[aria-current="true"\]/u.test(
rule.selector.replace(/\s+/gu, " "),
);
expect(isTokens || isSelectedRow, `not a selected row: "${rule.selector}"`).toBe(true);
Expand Down
21 changes: 11 additions & 10 deletions apps/web/src/__fork_guards__/forkGlassStageCard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,17 @@ describe("fork guard: fork-glass-stage-card", () => {
expect(Math.abs(composite - stage)).toBeLessThanOrEqual(1);
});

it("paints an embedded side chat's material once, from the right panel", () => {
// The card rules would add a second tint and wash over the panel's own.
const nested = rules.find(
(rule) =>
rule.selector.includes(VIBRANCY) &&
compact(rule.selector).endsWith(`[data-side-chat-pane]${CHAT}::before`),
);
expect(flat(nested?.body)).toBe("background: none;");
const ramp = rules.findIndex((rule) => rule.selector.includes(":has(.fork-timeline-cutoff)"));
expect(rules.indexOf(nested!)).toBeGreaterThan(ramp);
it("paints an embedded side chat's material once, from its own card", () => {
// The right panels read at the gutter's alpha, like the sidebar, so they paint no tint
// of their own, and the side chat's card keeps the card's fill.
expect(
rules.filter(
(rule) =>
rule.selector.includes('[data-preview-panel-mode="inline"]') &&
rule.body.includes("background"),
),
).toEqual([]);
expect(rules.filter((rule) => rule.selector.includes("[data-side-chat-pane]"))).toEqual([]);
});

it("dithers the stage ramp, or it bands under the desktop glass", () => {
Expand Down
9 changes: 9 additions & 0 deletions apps/web/src/__fork_guards__/forkPopupSurface.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ describe("fork guard: fork-popup-surface", () => {
);
});

it("leaves the composer's context strip bare", () => {
const rule = cssRules(palettes).find(
(candidate) =>
candidate.selector.replace(/\s+/gu, " ") ===
`${GLASS_GATE} [data-fork-composer-context-row] [data-slot="composer-context-strip"].surface-glass`,
);
expect(rule?.body).toMatch(/background:\s*none/u);
});

it("keeps the overlays' floor opaque", () => {
// The surface-glass overlays sit over transcript inside #root, where the
// popup cutout cannot clear, so their floor must be an opaque rgb()
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/__fork_guards__/sidebarV2CardRows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ describe("fork guard: sidebar-v2-card-rows", () => {
expect(marks).toMatch(
/tone === "failed" \? \(\s*<CircleAlertIcon weight="fill" className="size-3" \/>/u,
);
expect(marks).toContain('<span className="size-2.5 rounded-full bg-current" />');
expect(marks).toContain('<span ref={dotRef} className="size-2.5 rounded-full bg-current" />');
// Idle is the hollow twin of the Done dot, per Noey (2026-09-09).
expect(marks).toContain(
'<span className="size-2.5 rounded-full border border-muted-foreground" />',
Expand Down
17 changes: 16 additions & 1 deletion apps/web/src/custom/CollapsedThreadTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
* thread panes, filtered by project, the overflow behind More, New agent last. See
* `.fork/customizations.yaml#fork-collapsed-thread-tabs`. Renders only while collapsed. */
import { useAtomValue } from "@effect/atom-react";
import { scopeThreadRef, scopedThreadKey } from "@t3tools/client-runtime/environment";
import {
parseScopedThreadKey,
scopeThreadRef,
scopedThreadKey,
} from "@t3tools/client-runtime/environment";
import { threadWokeAt } from "@t3tools/client-runtime/state/thread-settled";
import {
resolveThreadCurrentPullRequestLink,
Expand Down Expand Up @@ -115,6 +119,7 @@ import {
} from "./sidebarV2StatusGrouping";
import { useStartNewAgentDraft } from "./useNewAgentDraft";
import { forkThreadTabsRef } from "./forkStageStamps";
import { CollapsedPetalTabs } from "./bots/CollapsedPetalTabs";

const STATUSES_STORAGE_KEY = "t3code:fork:collapsed-thread-tabs-statuses:v1";
const StoredStatuses = Schema.Array(Schema.Literals(COLLAPSED_TAB_STATUSES));
Expand Down Expand Up @@ -549,6 +554,16 @@ function CollapsedThreadTabsStrip(props: { readonly paneThreadRefs: readonly Sco
</ProjectTab>
))}
</SegmentedTabs>
<CollapsedPetalTabs
openThreadRef={openThreadKey === null ? null : parseScopedThreadKey(openThreadKey)}
onOpen={(threadRef) => {
clearSidebarSelection();
void router.navigate({
to: "/$environmentId/$threadId",
params: buildThreadRouteParams(threadRef),
});
}}
/>
<span className="flex shrink-0 items-center gap-1">
<Menu>
<Tooltip>
Expand Down
18 changes: 15 additions & 3 deletions apps/web/src/custom/SidebarV2StatusIndicator.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { type RefObject, useRef } from "react";

// Imported through the shim's own path rather than the `lucide-react` alias.
// This file is fork-owned, so there is no upstream import site to preserve —
// the alias exists to keep *upstream's* imports untouched, not this one.
Expand All @@ -12,6 +14,7 @@ import {
} from "./icons/lucide-phosphor";
import { cn } from "~/lib/utils";
import { BEAD_RING_PERIOD, bakeBeadRingFilm } from "./beadRing";
import { useDoneCelebration } from "./doneCelebration";
import { useForkWorkingMark } from "./forkWorkingMark";

/** The trailing slot of a Sidebar V2 card row's title line, and this module
Expand Down Expand Up @@ -376,15 +379,21 @@ export function SidebarV2WorkingMark({ seed }: { seed: string }) {
from "finished" and "broke" by form. The glyphs are 12px because Phosphor
inks a circle on ~81% of its grid: that is the design's 9.75px, and the
same visual weight as the 10px dot beside it. */
function SidebarV2StatusDot({ tone }: { tone: SidebarV2DotTone }) {
function SidebarV2StatusDot({
tone,
dotRef,
}: {
tone: SidebarV2DotTone;
dotRef: RefObject<HTMLSpanElement | null>;
}) {
return (
<span aria-hidden className={cn(MARK_SLOT_CLASS, TONE_TEXT_CLASS[tone])}>
{tone === "approval" || tone === "input" ? (
<CircleHalfIcon className="size-3" />
) : tone === "failed" ? (
<CircleAlertIcon weight="fill" className="size-3" />
) : (
<span className="size-2.5 rounded-full bg-current" />
<span ref={dotRef} className="size-2.5 rounded-full bg-current" />
)}
</span>
);
Expand Down Expand Up @@ -449,6 +458,7 @@ export type SidebarV2TopStatusMark =
/** One mark renderer for card and slim rows so monitoring is never a second path. */
export function SidebarV2StatusMark(props: {
readonly status: SidebarV2TopStatusMark | null;
/** The rain's phase, and the Done celebration's key: rows pass their scoped thread key. */
readonly seed: string;
/** Card rows draw the idle dot; without one an idle mark draws nothing.
Unpromoted drafts use the pencil as their idle glyph. */
Expand All @@ -458,6 +468,8 @@ export function SidebarV2StatusMark(props: {
readonly quietWorking?: boolean;
}) {
const status = props.status;
const dot = useRef<HTMLSpanElement>(null);
useDoneCelebration(props.seed, status, dot);
if (status === null) {
if (props.idle === "draft") {
return (
Expand Down Expand Up @@ -490,7 +502,7 @@ export function SidebarV2StatusMark(props: {
) : status.mark === "woke" ? (
<SidebarV2WokeMark />
) : (
<SidebarV2StatusDot tone={status.tone} />
<SidebarV2StatusDot tone={status.tone} dotRef={dot} />
)}
</>
);
Expand Down
73 changes: 73 additions & 0 deletions apps/web/src/custom/bots/CollapsedPetalTabs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/**
* The collapsed tab strip's petals — see `.fork/customizations.yaml#fork-bots`: a track of
* mascots beside the project switcher, apart from the thread tabs, one per petal the sidebar
* lists. The petal on screen, or whose work is, is pressed; picking one opens its conversation.
*/
import { scopedThreadKey, scopeThreadRef } from "@t3tools/client-runtime/environment";
import type { ScopedThreadRef } from "@t3tools/contracts";

import { Tooltip, TooltipPopup, TooltipTrigger } from "~/components/ui/tooltip";
import { useQuietThreadShells } from "~/state/entities";

import { SegmentedTab, SegmentedTabs } from "../SegmentedTabs";
import { BotMascot } from "./BotMascot";
import { botMascotShape } from "./botMascotTags";
import { listSidebarBots } from "./botThreads";
import { openBotThreadsPanel } from "./botThreadsPanelStore";
import { botWorkAttentionByBot } from "./botWork";
import { useBotThreadsPanelBot } from "./useBotWorkOwner";

export function CollapsedPetalTabs(props: {
readonly openThreadRef: ScopedThreadRef | null;
readonly onOpen: (threadRef: ScopedThreadRef) => void;
}) {
const threads = useQuietThreadShells();
const owner = useBotThreadsPanelBot(props.openThreadRef);
const petals = listSidebarBots(threads);
if (petals.length === 0) return null;
const ownerKey = owner === null ? null : scopedThreadKey(owner);
return (
<SegmentedTabs
aria-label="Petals"
value={ownerKey === null ? [] : [ownerKey]}
onValueChange={(value) => {
// Pressing the lit petal from its work unpresses it; that goes back to its conversation.
const key = value[0] ?? ownerKey;
if (key == null) return;
const petal = petals.find(
(thread) => scopedThreadKey(scopeThreadRef(thread.environmentId, thread.id)) === key,
);
if (petal === undefined) return;
const ref = scopeThreadRef(petal.environmentId, petal.id);
// As in the sidebar: a petal whose work needs you opens with its Threads panel.
if (botWorkAttentionByBot(threads).has(key)) openBotThreadsPanel(ref);
if (props.openThreadRef !== null && scopedThreadKey(props.openThreadRef) === key) return;
props.onOpen(ref);
}}
data-fork-tab-strip-projects=""
data-fork-tab-strip-petals=""
className="min-w-0 shrink overflow-x-auto rounded-full [scrollbar-width:none]"
>
{petals.map((petal) => {
const key = scopedThreadKey(scopeThreadRef(petal.environmentId, petal.id));
return (
<Tooltip key={key}>
<TooltipTrigger
render={
<SegmentedTab
value={key}
aria-label={petal.title}
data-fork-tab-strip-control=""
className="w-7 rounded-full px-0"
/>
}
>
<BotMascot shape={botMascotShape(petal.source)} mood="Idle" fit={18} />
</TooltipTrigger>
<TooltipPopup side="bottom">{petal.title}</TooltipPopup>
</Tooltip>
);
})}
</SegmentedTabs>
);
}
28 changes: 28 additions & 0 deletions apps/web/src/custom/doneCelebration.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { describe, expect, it } from "vite-plus/test";

import { createDoneTransitions } from "./doneCelebration";

describe("createDoneTransitions", () => {
it("sees a Done that just followed Working, once", () => {
const transitions = createDoneTransitions();
transitions.enter("a", "working", 0);
// The row sat Working for a minute; its mark leaves Working as it turns Done, or as the
// finished row unmounts from the Working group.
transitions.leave("a", "working", 60_000);
expect(transitions.leftWorking("a", 60_016)).toBe(true);
transitions.enter("a", "done", 60_016);
// A second copy of the same thread's mark finds the transition taken.
expect(transitions.leftWorking("a", 60_020)).toBe(false);
});

it("stays still for a row unmounted while Working (a folded section) that comes back Done", () => {
const transitions = createDoneTransitions();
transitions.enter("a", "working", 0);
transitions.leave("a", "working", 1_000);
expect(transitions.leftWorking("a", 120_000)).toBe(false);
});

it("does not see a thread first seen Done", () => {
expect(createDoneTransitions().leftWorking("a", 0)).toBe(false);
});
});
Loading
Loading