feat(web): move thread notices out of the composer banner stack #11999
main fromt3code/audit-composer-indicatorsopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
- apps/web/src/components/BranchToolbarServerUpdate.tsx line 21OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +1,21 @@1+import { useAtomValue } from "@effect/atom-react";2+import type { EnvironmentId } from "@t3tools/contracts";3+4+import { useEnvironment } from "../state/environments";5+import { serverEnvironment } from "../state/server";6+import {7+ resolveServerConfigVersionMismatch,8+ resolveServerSelfUpdateCapability,9+ supportsDesktopAppUpdate,10+ supportsServerUpdateThreadContinuation,11+} from "../versionSkew";12+import { ServerUpdateAction } from "./ServerUpdateAction";13+import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";14+15+/**16+ * "Update available" is a fact about the server this thread runs on, so it sits17+ * next to that server's name in the composer context strip. Null while the18+ * server matches the client, is ahead of it, or has an update in flight (the19+ * thread's notice stack carries progress and failure).20+ */21+export function useServerUpdateAvailability(environmentId: EnvironmentId) {apps/web/src/components/ChatView.tsx line 6049Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -6037,2 +6015,21 @@6015+ title: "Failed to wake thread",6016+ description: error instanceof Error ? error.message : "An error occurred.",6017+ }),6018+ );60376019 }60386020 }, [activeThreadRef, unsnoozeThreadMutation]);6021+ const snoozeWakeLabel = activeThreadSnoozed6022+ ? snoozeWakeDescription(6023+ activeThreadShell?.snoozedUntil ?? "",6024+ new Date(snoozeNow),6025+ timestampFormat,6026+ )6027+ : null;6028+ // One parked state feeds both the header pill and the composer placeholder.6029+ const parkedThreadState = useMemo(6030+ () =>6031+ snoozeWakeLabel !== null6032+ ? {6033+ kind: "snoozed" as const,6034+ detail: `Wakes ${snoozeWakeLabel}. Click to wake now, or send a message.`,6035+ onRelease: () => {apps/web/src/components/BranchToolbar.tsx line 636OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -627,3 +633,4 @@627633 availableEnvironments={availableEnvironments}628634 {...(showEnvironmentPicker && onEnvironmentChange ? { onEnvironmentChange } : {})}629635 />636+ {serverUpdate ? <BranchToolbarServerUpdate update={serverUpdate} /> : null}
- apps/web/src/components/chat/MessagesTimeline.logic.ts line 1355OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1340,3 +1352,4 @@13401352 createdAt: input.activeTurnStartedAt,13411353 });13421354 }1355+ if (input.contextOffer && !input.isWorking) {
- apps/web/src/components/BranchToolbarServerUpdate.tsx line 68OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +48,21 @@48+}: {49+ readonly update: ServerUpdateAvailability;50+}) {51+ const manual = update.selfUpdate === null;52+ return (53+ <Tooltip>54+ <TooltipTrigger55+ render={<span className="inline-flex shrink-0" data-composer-context-control />}56+ >57+ <ServerUpdateAction58+ environmentId={update.environmentId}59+ serverLabel={update.serverLabel}60+ selfUpdate={update.selfUpdate}61+ desktopAppUpdate={update.desktopAppUpdate}62+ threadContinuation={update.threadContinuation}63+ targetVersion={update.targetVersion}64+ label="Update"65+ manualLabel="Update"66+ variant="ghost"67+ size="xs"68+ className="h-7 px-1.5 font-normal text-foreground text-xs! sm:h-6"apps/web/src/components/chat/MessagesTimeline.tsx line 1662OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1624,0 +1642,21 @@1642+function ContextOfferTimelineRow({1643+ row,1644+}: {1645+ row: Extract<TimelineRow, { kind: "context-offer" }>;1646+}) {1647+ const ctx = use(TimelineRowCtx);1648+ return (1649+ <div1650+ role="note"1651+ className="mx-auto flex w-full max-w-3xl items-center gap-3 py-1 text-muted-foreground text-xs"1652+ >1653+ <span className="h-px flex-1 bg-border/70" />1654+ <span className="flex shrink-0 items-center gap-1.5">1655+ <Minimize2Icon aria-hidden="true" className="size-3" />1656+ {formatContextWindowTokens(row.usedTokens)} tokens in context1657+ {ctx.onCompactContext ? (1658+ <>1659+ <span aria-hidden="true" className="text-muted-foreground/40">1660+ ·1661+ </span>1662+ <buttonapps/web/src/components/chat/ChatHeader.tsx line 418Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -398,3 +409,7 @@398409 <TooltipPopup side="top">{activeThreadTitle}</TooltipPopup>399410 </Tooltip>400411 )}412+ {parkedState ? (413+ <Tooltip>414+ <TooltipTrigger415+ render={
- apps/web/src/components/chat/ChatHeader.tsx line 422OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -398,3 +410,13 @@398410 <TooltipPopup side="top">{activeThreadTitle}</TooltipPopup>399411 </Tooltip>400412 )}413+ {parkedState ? (414+ <Tooltip>415+ <TooltipTrigger416+ render={417+ <Button418+ size="xs"419+ variant="ghost-muted"420+ data-thread-parked={parkedState.kind}421+ onClick={parkedState.onRelease}422+ className="ml-2 h-5 rounded-full border-border/80 px-1.5 text-[11px] sm:h-5 [:hover,[data-pressed]]:border-foreground/40"
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/web/src/components/chat/ChatHeader.tsx line 422Resolvedby t3dotgg(GitHub profile, opens in a new tab)@@ -398,3 +412,11 @@398412 <TooltipPopup side="top">{activeThreadTitle}</TooltipPopup>399413 </Tooltip>400414 )}415+ {parkedState ? (416+ <Tooltip>417+ <TooltipTrigger418+ render={419+ <Button420+ size="pill"421+ variant="ghost-muted"422+ data-thread-parked={parkedState.kind}
- apps/web/src/components/BranchToolbar.tsx line 636OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -627,3 +633,4 @@627633 availableEnvironments={availableEnvironments}628634 {...(showEnvironmentPicker && onEnvironmentChange ? { onEnvironmentChange } : {})}629635 />636+ {serverUpdate ? <BranchToolbarServerUpdate update={serverUpdate} /> : null}
t3dotgg(GitHub profile, opens in a new tab) added labelsWIP
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:XL
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
t3dotgg(GitHub profile, opens in a new tab) removed labelsWIP
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:L
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XL
- apps/web/src/components/chat/MessagesTimeline.tsx line 1675OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1646,3 +1658,18 @@16461658 );16471659 }164816601661+/**1662+ * The compaction offer sits where the compaction separator will appear once1663+ * the user takes it: a hairline row at the end of the thread. Nothing to1664+ * dismiss. Sending a message without compacting scrolls it into history.1665+ */1666+function ContextOfferTimelineRow({1667+ row,1668+}: {1669+ row: Extract<TimelineRow, { kind: "context-offer" }>;1670+}) {1671+ const ctx = use(TimelineRowCtx);1672+ return (1673+ <div1674+ role="note"1675+ className="mx-auto flex w-full max-w-3xl items-center gap-3 py-1 text-muted-foreground text-xs"apps/web/src/components/BranchToolbarEnvironmentSelector.tsx lines 88 to 90OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -26,0 +70,21 @@70+ </span>71+ </span>72+ </>73+ );74+ const actionable = !(update.selfUpdate === "desktop-managed" && !update.desktopAppUpdate);75+ return (76+ <Tooltip>77+ <TooltipTrigger78+ render={<span className="inline-flex min-w-0 max-w-full" data-composer-context-control />}79+ >80+ {actionable ? (81+ <ServerUpdateAction82+ environmentId={update.environmentId}83+ serverLabel={update.serverLabel}84+ selfUpdate={update.selfUpdate}85+ desktopAppUpdate={update.desktopAppUpdate}86+ threadContinuation={update.threadContinuation}87+ targetVersion={update.targetVersion}88+ variant="ghost"89+ size="xs"90+ className="min-w-0 max-w-full font-normal text-muted-foreground/70 text-xs! hover:text-foreground"
- apps/web/src/components/BranchToolbarEnvironmentSelector.tsx line 262Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -101,3 +183,4 @@101183 >102184 {autoEnvironmentLabel ? (103185 <ScaleIcon className="size-3 shrink-0" aria-hidden="true" />186+ ) : serverUpdate ? (
- apps/web/src/components/ServerUpdateAction.tsx lines 81 to 81Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -37,0 +56,21 @@56+ title: "Update command copied",57+ description: `Run \`${command}\` on ${target.serverLabel} to update it.`,58+ });59+ },60+ onError: (error) => {61+ toastManager.add({62+ type: "error",63+ title: "Could not copy update command",64+ description: error.message,65+ });66+ },67+ });68+ const manualCommand =69+ target.selfUpdate === null ? manualServerUpdateCommand(target.targetVersion) : null;70+ const trigger = async () => {71+ if (manualCommand !== null) {72+ copyToClipboard(manualCommand, { command: manualCommand });73+ return;74+ }75+ if (pendingUpdateEnvironmentIds.has(target.environmentId)) return;76+ if (target.selfUpdate === "desktop-managed") {
- apps/web/src/components/BranchToolbarEnvironmentSelector.tsx line 239Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -86,6 +212,5 @@86212 <Select87213 modal={false}88214 value={autoEnvironmentLabel ? "auto" : environmentId}89- onValueChange={(value) =>90- value === "auto" ? onAutoEnvironment?.() : onEnvironmentChange(value as EnvironmentId)91- }215+ onValueChange={(value) => {216+ if (value === UPDATE_SERVER_VALUE) {
- apps/web/src/components/BranchToolbarEnvironmentSelector.tsx line 127OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -26,0 +107,21 @@107+ return (108+ <Tooltip>109+ <TooltipTrigger110+ render={<span className="inline-flex min-w-0 max-w-full" data-composer-context-control />}111+ >112+ {actionable ? (113+ <ServerUpdateAction114+ environmentId={update.environmentId}115+ serverLabel={update.serverLabel}116+ selfUpdate={update.selfUpdate}117+ desktopAppUpdate={update.desktopAppUpdate}118+ threadContinuation={update.threadContinuation}119+ targetVersion={update.targetVersion}120+ variant="ghost-muted"121+ size="xs"122+ className="min-w-0 max-w-full font-normal text-xs!"123+ >124+ {body}125+ </ServerUpdateAction>126+ ) : (127+ <span className="inline-flex h-7 min-w-0 max-w-full items-center gap-1 border border-transparent px-[calc(--spacing(2)-1px)] font-normal text-muted-foreground/70 text-xs sm:h-6">
- apps/web/src/components/BranchToolbarEnvironmentSelector.tsx lines 77 to 81OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -26 +61,21 @@2661 onEnvironmentChange?: (environmentId: EnvironmentId) => void;62+ /**63+ * An update waiting on the active server. An up arrow takes the machine64+ * icon's place while it is pending, and where the chip is not a picker the65+ * chip itself becomes the update action.66+ */67+ serverUpdate?: ServerUpdateAvailability | null;68+}69+70+/**71+ * The chip when it is a label, not a control. It carries the xs control's72+ * height (h-7 sm:h-6) and padding: the composer context strip has no73+ * min-height of its own, and the glass seam joining it to the composer assumes74+ * a fixed strip height, so a shorter label would drag the seam out of line75+ * whenever this label is the only thing in the strip.76+ */77+function StaticChip(props: ComponentProps<"span">) {78+ return (79+ <span80+ {...props}81+ className="inline-flex h-7 min-w-0 max-w-full items-center gap-1 border border-transparent px-[calc(--spacing(2)-1px)] font-normal text-muted-foreground/70 text-xs sm:h-6"
- apps/web/src/components/BranchToolbarEnvironmentSelector.tsx lines 308 to 316OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -140,7 +297,20 @@140297 <span className="inline-flex items-center gap-1.5">141- <EnvironmentMachineIcon kind={env.machine} className="size-3" />298+ {serverUpdate?.environmentId === env.environmentId ? (299+ <CircleArrowUpIcon aria-hidden="true" className="size-3 text-foreground" />300+ ) : (301+ <EnvironmentMachineIcon kind={env.machine} className="size-3" />302+ )}142303 {env.label}143304 </span>144305 </SelectItem>145306 ))}146307 </SelectGroup>308+ {serverUpdate && serverUpdateTrigger.actionable ? (309+ <>310+ <SelectSeparator />311+ <ServerUpdateSelectItem312+ label={serverUpdateTrigger.label}313+ serverLabel={serverUpdate.serverLabel}314+ />315+ </>316+ ) : null}
juliusmarminge added labelsmacroscope-review
juliusmarminge assignedjuliusmarminge
juliusmarminge closed this
Sign in to join this conversation.















macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed