+36
![github-actions[bot]](/assets/img/avatar_default.png)








Julius Marminge
maria-rcks
Bilal Bakr
shivam
Vitalii Yehorov
Jake Leventhal
Claude Opus 5
Alex Southwell
github-actions[bot]
Nicholas Wasmiller
PB
Exotic
Yash Singh
Devin
Theo Browne
Gabriel De Andrade
Dara Adedeji
scratchyone
Dominic Roy
chukfinley
Primož Ajdišek
benthecarman
NaveDanan
aaditagrawal
Aditya Garud
Nick Anisimov
MacKinley Smith
Yordis Prieto
t3-code[bot]
AKolenda
Guillermo Casanova
Otavio Salvador
Shirish Pothi
Ishaan Kothari
Bob Fowler
Anton Bezdenezhnykh
ValeraZSD
Ephraim
Ryan Ilano
Alex
maco
Cursor
Tristan Knight
PR Batch Tester
oliver
kamkm
de34391427
Co-authored-by: maria-rcks <[email protected]> Co-authored-by: Bilal Bakr <[email protected]> Co-authored-by: shivam <[email protected]> Co-authored-by: Vitalii Yehorov <[email protected]> Co-authored-by: Jake Leventhal <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Alex Southwell <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Nicholas Wasmiller <[email protected]> Co-authored-by: PB <[email protected]> Co-authored-by: Exotic <[email protected]> Co-authored-by: Yash Singh <[email protected]> Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Theo Browne <[email protected]> Co-authored-by: Gabriel De Andrade <[email protected]> Co-authored-by: Dara Adedeji <[email protected]> Co-authored-by: scratchyone <[email protected]> Co-authored-by: Dominic Roy <[email protected]> Co-authored-by: chukfinley <[email protected]> Co-authored-by: Primož Ajdišek <[email protected]> Co-authored-by: benthecarman <[email protected]> Co-authored-by: NaveDanan <[email protected]> Co-authored-by: aaditagrawal <[email protected]> Co-authored-by: Aditya Garud <[email protected]> Co-authored-by: Nick Anisimov <[email protected]> Co-authored-by: MacKinley Smith <[email protected]> Co-authored-by: Yordis Prieto <[email protected]> Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com> Co-authored-by: AKolenda <[email protected]> Co-authored-by: Guillermo Casanova <[email protected]> Co-authored-by: Otavio Salvador <[email protected]> Co-authored-by: Shirish Pothi <[email protected]> Co-authored-by: Ishaan Kothari <[email protected]> Co-authored-by: Bob Fowler <[email protected]> Co-authored-by: Anton Bezdenezhnykh <[email protected]> Co-authored-by: ValeraZSD <[email protected]> Co-authored-by: Ephraim <[email protected]> Co-authored-by: Ryan Ilano <[email protected]> Co-authored-by: Alex <[email protected]> Co-authored-by: maco <[email protected]> Co-authored-by: Cursor <[email protected]> Co-authored-by: Tristan Knight <[email protected]> Co-authored-by: PR Batch Tester <[email protected]> Co-authored-by: oliver <[email protected]> Co-authored-by: kamkm <[email protected]> Signed-off-by: Yordis Prieto <[email protected]>
118 lines
4.1 KiB
TypeScript
118 lines
4.1 KiB
TypeScript
import type { ProviderDriverKind } from "@t3tools/contracts";
|
|
import { FolderGit2Icon, FolderIcon, GitBranchIcon } from "lucide-react";
|
|
import { ProjectFavicon, type ProjectFaviconProject } from "./ProjectFavicon";
|
|
import { ProviderInstanceIcon } from "./chat/ProviderInstanceIcon";
|
|
import { cn } from "~/lib/utils";
|
|
|
|
import { MiddleTruncate } from "./ui/middle-truncate";
|
|
|
|
/**
|
|
* Flip this while reviewing command-palette thread subtitles.
|
|
* - favicon-workspace-harness: favicon + Folder/FolderGit2 + branch + harness (default)
|
|
* - favicon-workspace: same without harness
|
|
* - favicon-branch-harness: GitBranch for local, FolderGit2 for worktrees, + harness
|
|
*/
|
|
export type ThreadCommandSubtitleVariant =
|
|
| "favicon-workspace-harness"
|
|
| "favicon-workspace"
|
|
| "favicon-branch-harness";
|
|
|
|
const THREAD_COMMAND_SUBTITLE_VARIANT: ThreadCommandSubtitleVariant = "favicon-workspace-harness";
|
|
|
|
export const COMMAND_PALETTE_META_ICON_CLASS = "size-3 shrink-0 text-muted-foreground/70";
|
|
|
|
export function CommandPaletteMetaDot() {
|
|
return <span className="shrink-0 text-muted-foreground/50">·</span>;
|
|
}
|
|
|
|
function WorkspaceIcon(props: { variant: ThreadCommandSubtitleVariant; isWorktree: boolean }) {
|
|
if (props.isWorktree) {
|
|
return <FolderGit2Icon className={COMMAND_PALETTE_META_ICON_CLASS} aria-hidden />;
|
|
}
|
|
if (props.variant === "favicon-branch-harness") {
|
|
return <GitBranchIcon className={COMMAND_PALETTE_META_ICON_CLASS} aria-hidden />;
|
|
}
|
|
return <FolderIcon className={COMMAND_PALETTE_META_ICON_CLASS} aria-hidden />;
|
|
}
|
|
|
|
export function ThreadCommandSubtitle(props: {
|
|
project: ProjectFaviconProject | null;
|
|
projectTitle: string | null;
|
|
environmentLabel?: string | null;
|
|
branch: string | null;
|
|
worktreePath: string | null;
|
|
isCurrent: boolean;
|
|
driverKind?: ProviderDriverKind | null;
|
|
providerDisplayName?: string | null;
|
|
acpRegistryAgentId?: string | undefined;
|
|
acpRegistryIconUrl?: string | undefined;
|
|
variant?: ThreadCommandSubtitleVariant;
|
|
className?: string;
|
|
}) {
|
|
const variant = props.variant ?? THREAD_COMMAND_SUBTITLE_VARIANT;
|
|
const isWorktree = props.worktreePath != null && props.worktreePath.trim().length > 0;
|
|
const showHarness =
|
|
variant !== "favicon-workspace" && props.driverKind != null && props.providerDisplayName;
|
|
|
|
const projectLabel = props.projectTitle?.trim() || null;
|
|
const branchLabel = props.branch?.trim() || null;
|
|
|
|
if (!projectLabel && !branchLabel && !props.isCurrent && !showHarness) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<span
|
|
className={cn(
|
|
"inline-flex min-w-0 max-w-full items-center gap-1 text-xs text-muted-foreground/70",
|
|
props.className,
|
|
)}
|
|
>
|
|
{projectLabel ? (
|
|
<span className="inline-flex min-w-0 items-center gap-1">
|
|
{props.project ? (
|
|
<ProjectFavicon project={props.project} className="size-3 shrink-0" />
|
|
) : null}
|
|
<span className="min-w-0 truncate">{projectLabel}</span>
|
|
{props.environmentLabel ? (
|
|
<>
|
|
<CommandPaletteMetaDot />
|
|
<span className="shrink-0">{props.environmentLabel}</span>
|
|
</>
|
|
) : null}
|
|
</span>
|
|
) : null}
|
|
|
|
{branchLabel ? (
|
|
<>
|
|
{projectLabel ? <CommandPaletteMetaDot /> : null}
|
|
<span className="inline-flex min-w-0 items-center gap-1">
|
|
<WorkspaceIcon variant={variant} isWorktree={isWorktree} />
|
|
<MiddleTruncate value={branchLabel} />
|
|
</span>
|
|
</>
|
|
) : null}
|
|
|
|
{showHarness && props.driverKind ? (
|
|
<>
|
|
{projectLabel || branchLabel ? <CommandPaletteMetaDot /> : null}
|
|
<ProviderInstanceIcon
|
|
driverKind={props.driverKind}
|
|
displayName={props.providerDisplayName ?? props.driverKind}
|
|
acpRegistryAgentId={props.acpRegistryAgentId}
|
|
acpRegistryIconUrl={props.acpRegistryIconUrl}
|
|
iconClassName="size-3 shrink-0 opacity-70"
|
|
/>
|
|
</>
|
|
) : null}
|
|
|
|
{props.isCurrent ? (
|
|
<>
|
|
{projectLabel || branchLabel || showHarness ? <CommandPaletteMetaDot /> : null}
|
|
<span className="shrink-0">Current thread</span>
|
|
</>
|
|
) : null}
|
|
</span>
|
|
);
|
|
}
|