Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🍴 feat: Separate Machine, Workspace, and Git Controls (#16696)
lia-by-librechat[bot]86cf4a16fdf1
diff --git a/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx b/client/src/components/Chat/Input/CodeWorkspaceMenu.tsxindex ccc64256e4..6221c959d7 100644--- a/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx+++ b/client/src/components/Chat/Input/CodeWorkspaceMenu.tsx@@ -1,8 +1,26 @@import { Fragment, useId, useState } from 'react';import * as Ariakit from '@ariakit/react';-import { isCodeWorkspaceCheckoutAvailable } from 'librechat-data-provider';-import { TooltipAnchor, composerControlClasses, useToastContext } from '@librechat/client';-import { Check, ChevronDown, Folder, FolderSync, FolderX, RefreshCw, Monitor } from 'lucide-react';+import {+ CheckboxGlyph,+ TooltipAnchor,+ composerControlClasses,+ useToastContext,+} from '@librechat/client';+import {+ isCodeWorkspaceCheckoutAvailable,+ isLinkedWorktreeRoutingAllowed,+} from 'librechat-data-provider';+import {+ Check,+ ChevronDown,+ Folder,+ FolderSync,+ FolderX,+ RefreshCw,+ Monitor,+ GitBranch,+ GitFork,+} from 'lucide-react';import type { CodeWorkspaceSelection, TConversation } from 'librechat-data-provider';import type { SetterOrUpdater } from 'recoil';import type {@@ -36,6 +54,13 @@ const stateLabels: Partial<Record<CodeWorkspaceResult['state'], TranslationKeys>};const headingClasses = 'px-2.5 py-1.5 text-xs font-medium text-text-secondary';+const menuClasses = cn(+ 'z-50 flex max-w-[min(360px,calc(100vw-2rem))] min-w-[280px] flex-col rounded-xl',+ 'border-border-light bg-presentation max-h-[var(--popover-available-height)] overflow-y-auto border p-1.5 shadow-lg',+ 'origin-bottom opacity-0 transition-[opacity,transform] duration-200 ease-out motion-reduce:transition-none',+ 'data-[enter]:scale-100 data-[enter]:opacity-100',+ 'scale-95 data-[leave]:scale-95 data-[leave]:opacity-0',+);const menuItemClasses = (selected = false) =>cn(@@ -258,6 +283,103 @@ function EnvironmentWorkspaces({);}+function GitContext({+ target,+ disabled,+ locked,+ onSelect,+}: {+ target: CodeWorkspaceEnvironmentResult;+ disabled: boolean;+ locked: boolean;+ onSelect?: (selection: CodeWorkspaceSelection) => void;+}) {+ const localize = useLocalize();+ const descriptor = target.workspaces.find(({ id }) => id === target.selected?.workspaceId);+ if (descriptor == null) return null;+ const supportsWorktree = descriptor.workspaceInstances?.includes('git_worktree') === true;+ const checkout = target.selected?.checkout;+ const checkoutSelectionAllowed =+ target.environment.configSchema?.workspaces?.allowCheckoutSelection === true;+ const checkoutEditable = !locked && supportsWorktree && checkoutSelectionAllowed;+ const usesIsolation = checkout !== 'source' && supportsWorktree;+ const showLinkedWorktrees =+ !usesIsolation &&+ descriptor.workspaceScopes?.includes('git_linked_worktree') &&+ isLinkedWorktreeRoutingAllowed(target.environment.configSchema?.workspaces?.linkedWorktrees) &&+ isCodeWorkspaceCheckoutAvailable({ checkout }, descriptor, checkoutSelectionAllowed);+ const worktreeInfo =+ checkout == null+ ? localize('com_ui_code_checkout_automatic_info')+ : localize(+ checkout === 'isolated'+ ? 'com_ui_code_checkout_isolated_info'+ : 'com_ui_code_checkout_source_info',+ );+ return (+ <>+ {descriptor.environment?.ref && (+ <TooltipAnchor+ description={localize('com_ui_code_branch_info')}+ render={<span className={cn(composerControlClasses(), 'max-w-full min-w-0 px-2.5')} />}+ >+ <GitBranch className="text-text-secondary size-4 shrink-0" aria-hidden="true" />+ <span+ data-testid="code-branch"+ aria-label={`${localize('com_ui_code_branch')}: ${descriptor.environment.ref}`}+ className="max-w-[12rem] min-w-0 truncate"+ >+ {descriptor.environment.ref}+ </span>+ </TooltipAnchor>+ )}+ {(supportsWorktree || checkout != null) && (+ <TooltipAnchor+ description={worktreeInfo}+ render={+ <button+ type="button"+ role="checkbox"+ data-testid="code-worktree"+ aria-label={localize('com_ui_code_worktree')}+ aria-checked={checkout == null ? 'mixed' : checkout === 'isolated'}+ disabled={disabled || !checkoutEditable}+ className={cn(+ composerControlClasses(),+ 'px-2.5 disabled:cursor-not-allowed disabled:opacity-50',+ )}+ onClick={() => {+ if (target.selected == null || !checkoutEditable) return;+ onSelect?.({+ ...target.selected,+ checkout: checkout === 'isolated' ? 'source' : 'isolated',+ });+ }}+ />+ }+ >+ <CheckboxGlyph checked={checkout === 'isolated'} />+ <span>{localize('com_ui_code_worktree')}</span>+ {checkout == null && (+ <span className="text-text-secondary text-xs">+ {localize('com_ui_code_checkout_automatic')}+ </span>+ )}+ </TooltipAnchor>+ )}+ {showLinkedWorktrees && (+ <TooltipAnchor+ description={localize('com_ui_code_linked_worktrees_info')}+ render={<span className={cn(composerControlClasses(), 'px-2.5')} />}+ >+ <GitFork className="text-text-secondary size-4 shrink-0" aria-hidden="true" />+ <span>{localize('com_ui_code_linked_worktrees')}</span>+ </TooltipAnchor>+ )}+ </>+ );+}+function WorkspaceRequirements({ id, requirements }: { id: string; requirements: string[] }) {if (requirements.length === 0) return null;return (@@ -283,6 +405,8 @@ export default function CodeWorkspaceMenu({const { showToast } = useToastContext();const menuStore = Ariakit.useMenuStore({ focusLoop: true, placement: 'top-start' });const isOpen = menuStore.useState('open');+ const machineMenuStore = Ariakit.useMenuStore({ focusLoop: true, placement: 'top-start' });+ const machineMenuOpen = machineMenuStore.useState('open');const [machineId, setMachineId] = useState<string | null>(null);const machine = workspace.machineOptions?.find(({ id }) =>@@ -337,6 +461,7 @@ export default function CodeWorkspaceMenu({const { transition } = workspace;const environmentIds = new Set(workspace.environments.map(({ environment }) => environment.id));const selectWorkspace = (selection: CodeWorkspaceSelection) => {+ if (disabled || workspace.locked) return;const previous = workspace.environments.find(({ environment }) => environment.id === selection.environmentId,)?.selected;@@ -380,6 +505,7 @@ export default function CodeWorkspaceMenu({});};const selectWithoutAttached = () => {+ if (disabled || workspace.locked) return;setConversation((current) =>current == null? current@@ -481,12 +607,6 @@ export default function CodeWorkspaceMenu({} else if (label == null) {label = labelKey ? localize(labelKey) : localize('com_ui_code_workspace_choose');}- if (onlyDescriptor && (workspace.machineOptions?.length ?? 0) > 1) {- label = `${onlyEnvironment?.environment.name ?? onlyEnvironment?.environment.id} · ${label}`;- }- if (onlyEnvironment?.selected?.checkout != null) {- label = `${label} · ${localize(onlyEnvironment.selected.checkout === 'isolated' ? 'com_ui_code_checkout_isolated' : 'com_ui_code_checkout_source')}`;- }const checkoutSummaries = workspace.environments.flatMap(({ environment, selected, workspaces }) => {if (selected?.checkout == null) return [];@@ -543,29 +663,45 @@ export default function CodeWorkspaceMenu({? localize('com_ui_code_workspace_without_attached_info'): localize('com_ui_code_workspace_locked_recovery');return (- <div className="flex min-w-0 flex-col items-start gap-1">- <TooltipAnchor- description={requirements.join(' ') || recovery}- render={- <button- type="button"- data-testid="code-workspace-locked-status"- disabled={disabled || isRefreshing}- onClick={() => void refresh()}- aria-label={`${label}. ${recovery}. ${localize('com_ui_retry')}`}- aria-describedby={requirements.length > 0 ? requirementsId : undefined}- aria-busy={isRefreshing}- className={cn(composerControlClasses(), 'max-w-full min-w-0 px-2.5')}- />- }- >- <Icon className="text-text-secondary size-4 shrink-0" aria-hidden="true" />- <span role="status" className="max-w-[16rem] min-w-0 truncate">- {label}+ <div className="flex min-w-0 flex-wrap items-center gap-2">+ {onlyEnvironment != null && workspace.mode !== 'without_attached' && (+ <span+ data-testid="code-machine-status"+ className={cn(composerControlClasses(), 'max-w-full min-w-0 px-2.5')}+ >+ <Monitor className="text-text-secondary size-4 shrink-0" aria-hidden="true" />+ <span className="max-w-[12rem] min-w-0 truncate">+ {onlyEnvironment.environment.name ?? onlyEnvironment.environment.id}+ </span></span>- <RefreshCw className="text-text-secondary size-3 shrink-0" aria-hidden="true" />- </TooltipAnchor>- <WorkspaceRequirements id={requirementsId} requirements={requirements} />+ )}+ <div className="flex min-w-0 flex-col items-start gap-1">+ <TooltipAnchor+ description={requirements.join(' ') || recovery}+ render={+ <button+ type="button"+ data-testid="code-workspace-locked-status"+ disabled={disabled || isRefreshing}+ onClick={() => void refresh()}+ aria-label={`${label}. ${recovery}. ${localize('com_ui_retry')}`}+ aria-describedby={requirements.length > 0 ? requirementsId : undefined}+ aria-busy={isRefreshing}+ className={cn(composerControlClasses(), 'max-w-full min-w-0 px-2.5')}+ />+ }+ >+ <Icon className="text-text-secondary size-4 shrink-0" aria-hidden="true" />+ <span role="status" className="max-w-[16rem] min-w-0 truncate">+ {label}+ </span>+ <RefreshCw className="text-text-secondary size-3 shrink-0" aria-hidden="true" />+ </TooltipAnchor>+ <WorkspaceRequirements id={requirementsId} requirements={requirements} />+ </div>+ {onlyEnvironment != null && workspace.mode !== 'without_attached' && (+ <GitContext target={onlyEnvironment} disabled={disabled} locked={true} />+ )}{workspace.environments.length > 1 && (<WorkspaceRequirementsid={`${requirementsId}-checkouts`}@@ -583,270 +719,332 @@ export default function CodeWorkspaceMenu({const ButtonIcon = renamesForMove ? FolderSync : Icon;const ConfirmIcon = transition?.kind === 'attach' ? Folder : FolderSync;const buttonLabel = renamesForMove ? transitionText.label : label;+ const machines = new Map(+ workspace.environments.map(({ environment }) => [environment.id, environment]),+ );+ workspace.machineOptions?.forEach((candidate) => machines.set(candidate.id, candidate));+ const showMachinePicker = !workspace.locked && machines.size > 0;+ const machineLabel =+ workspace.mode === 'without_attached' || workspace.environments.length === 0+ ? localize('com_ui_code_machine_choose')+ : (onlyEnvironment?.environment.name ??+ onlyEnvironment?.environment.id ??+ localize('com_ui_code_machines_selected', { 0: workspace.environments.length }));return (- <Ariakit.MenuProvider store={menuStore}>- <div className="flex min-w-0 flex-col items-start gap-1">- <TooltipAnchor- description={- transitionText?.info ?? (requirements.join(' ') || localize('com_ui_code_workspace'))- }- disabled={isOpen}- render={- <Ariakit.MenuButton- disabled={buttonDisabled}- data-testid={renamesForMove ? 'code-workspace-move' : 'code-workspace'}- aria-describedby={requirements.length > 0 ? requirementsId : undefined}- aria-label={- transitionText == null- ? `${localize('com_ui_code_workspace')}: ${label}`- : `${buttonLabel}. ${transitionText.info}`- }- className={cn(- composerControlClasses(),- 'md:px-theme-control-x max-w-full min-w-0 px-2.5',- isOpen && 'bg-surface-hover',- buttonDisabled && 'cursor-not-allowed opacity-50',- )}- />- }+ <div className="flex min-w-0 flex-wrap items-center gap-2">+ {workspace.locked && onlyEnvironment != null && workspace.mode !== 'without_attached' && (+ <span+ data-testid="code-machine-status"+ className={cn(composerControlClasses(), 'max-w-full min-w-0 px-2.5')}>- <ButtonIcon className="text-text-secondary size-4 shrink-0" aria-hidden="true" />- <span className="max-w-[12rem] min-w-0 truncate">{buttonLabel}</span>- <ChevronDown- className={cn(- 'text-text-secondary size-3 shrink-0 transition-transform',- isOpen && 'rotate-180',- )}- aria-hidden="true"- />- </TooltipAnchor>- <WorkspaceRequirements id={requirementsId} requirements={requirements} />- </div>- <Ariakit.Menu- portal={true}- gutter={8}- unmountOnHide={true}- className={cn(- 'z-50 flex max-w-[min(360px,calc(100vw-2rem))] min-w-[280px] flex-col rounded-xl',- 'border-border-light bg-presentation max-h-[var(--popover-available-height)] overflow-y-auto border p-1.5 shadow-lg',- 'origin-bottom opacity-0 transition-[opacity,transform] duration-200 ease-out',- 'data-[enter]:scale-100 data-[enter]:opacity-100',- 'scale-95 data-[leave]:scale-95 data-[leave]:opacity-0',- )}- >- {transition != null && transitionText != null ? (- <>- <Ariakit.MenuHeading render={<div />} className={headingClasses}>- {transitionText.label}- </Ariakit.MenuHeading>- <p className="text-text-secondary px-2.5 pb-2 text-xs">{transitionText.info}</p>- {transition.targets.map((target) => (- <EnvironmentWorkspaces- key={target.environment.id}- environment={target.environment}- requiredBy={target.requiredBy}- workspaces={target.workspaces}- emptyLabel={localize('com_ui_code_workspace_unavailable')}- hideOnClick={false}- isSelected={(workspaceId) => chosenWorkspaceId(target, moveChoices) === workspaceId}- allowCheckoutSelection={true}- checkout={- chosenTargets.find(({ environmentId }) => environmentId === target.environment.id)- ?.checkout- }- onSelect={(selection) =>- setMoveDraft({- conversationId: transition.conversationId,- workspaces: {- ...moveChoices,- [selection.environmentId]: {- ...selection,- checkout:- selection.checkout ??- chosenTargets.find(- ({ environmentId }) => environmentId === selection.environmentId,- )?.checkout,- },- },- })- }- />- ))}- <Ariakit.MenuSeparator className="border-border-light my-1 h-0 w-full border-t" />- {offersMove && (- <Ariakit.MenuItem- disabled={disabled || !moveReady || moveMutation.isLoading}- hideOnClick={true}- onClick={confirmMove}- className={cn(- menuItemClasses(),- 'items-center aria-disabled:cursor-not-allowed aria-disabled:opacity-50',- )}- >- <ConfirmIcon className="text-text-secondary size-4 shrink-0" aria-hidden="true" />- <span className="text-text-primary min-w-0 flex-1 truncate text-left text-sm font-medium">- {transitionText.label}- </span>- </Ariakit.MenuItem>- )}- {transition.detachable && (- <Ariakit.MenuItem- data-testid="code-workspace-detach"- disabled={disabled || moveMutation.isLoading}- hideOnClick={true}- onClick={confirmDetach}+ <Monitor className="text-text-secondary size-4 shrink-0" aria-hidden="true" />+ <span className="max-w-[12rem] min-w-0 truncate">+ {onlyEnvironment.environment.name ?? onlyEnvironment.environment.id}+ </span>+ </span>+ )}+ {showMachinePicker && (+ <Ariakit.MenuProvider store={machineMenuStore}>+ <TooltipAnchor+ description={localize('com_ui_code_environment_choose_machine')}+ render={+ <Ariakit.MenuButton+ data-testid="code-machine"+ disabled={buttonDisabled}+ aria-label={`${localize('com_ui_code_machine')}: ${machineLabel}`}className={cn(- menuItemClasses(),- 'aria-disabled:cursor-not-allowed aria-disabled:opacity-50',+ composerControlClasses(),+ 'max-w-full min-w-0 px-2.5',+ machineMenuOpen && 'bg-surface-hover',)}- >- <FolderX- className="text-text-secondary mt-0.5 size-4 shrink-0"- aria-hidden="true"- />- <div className="min-w-0 flex-1 text-left">- <div className="text-text-primary truncate text-sm font-medium">- {localize('com_ui_code_workspace_detach')}- </div>- <p className="text-text-secondary text-xs">- {localize('com_ui_code_workspace_detach_info')}- </p>- </div>- </Ariakit.MenuItem>- )}- </>- ) : (- <>+ />+ }+ >+ <Monitor className="text-text-secondary size-4 shrink-0" aria-hidden="true" />+ <span className="max-w-[12rem] min-w-0 truncate">{machineLabel}</span>+ <ChevronDown className="text-text-secondary size-3 shrink-0" aria-hidden="true" />+ </TooltipAnchor>+ <Ariakit.Menu+ portal+ gutter={8}+ unmountOnHide+ autoFocusOnHide={() => !menuStore.getState().open}+ className={menuClasses}+ ><Ariakit.MenuHeading render={<div />} className={headingClasses}>- {localize('com_ui_code_environment')}+ {localize('com_ui_code_machine')}</Ariakit.MenuHeading>- {workspace.supportsEnvironmentDecisions && (- <Ariakit.MenuItemRadio- name="codeEnvironmentMode"- value="without_attached"- checked={workspace.mode === 'without_attached'}+ {[...machines.values()].map((candidate) => (+ <Ariakit.MenuItem+ key={candidate.id}+ disabled={buttonDisabled}hideOnClick={true}- onChange={selectWithoutAttached}- className={menuItemClasses(workspace.mode === 'without_attached')}+ className={menuItemClasses(environmentIds.has(candidate.id))}+ onClick={() => {+ setMachineId(candidate.id);+ menuStore.setAutoFocusOnShow(true);+ menuStore.show();+ }}>- <FolderX+ <MonitorclassName="text-text-secondary mt-0.5 size-4 shrink-0"aria-hidden="true"/>- <div className="min-w-0 flex-1 text-left">- <div className="text-text-primary truncate text-sm font-medium">- {localize('com_ui_code_workspace_without_attached')}- </div>- <p className="text-text-secondary text-xs">- {localize('com_ui_code_workspace_without_attached_info')}- </p>- </div>- {workspace.mode === 'without_attached' && (+ <span className="text-text-primary min-w-0 flex-1 truncate text-left text-sm">+ {candidate.name ?? candidate.id}+ </span>+ {workspace.mode === 'attached' && environmentIds.has(candidate.id) && (<Check className="text-text-primary mt-0.5 size-4 shrink-0" aria-hidden="true" />)}- </Ariakit.MenuItemRadio>- )}- {workspace.environments.map(- ({ environment, state, workspaces, selected, requiredBy }) => (+ </Ariakit.MenuItem>+ ))}+ </Ariakit.Menu>+ </Ariakit.MenuProvider>+ )}+ <Ariakit.MenuProvider store={menuStore}>+ <div className="flex min-w-0 flex-col items-start gap-1">+ <TooltipAnchor+ description={+ transitionText?.info ?? (requirements.join(' ') || localize('com_ui_code_workspace'))+ }+ render={+ <Ariakit.MenuButton+ disabled={buttonDisabled}+ onClick={() => setMachineId(null)}+ onKeyDown={(event) => {+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') setMachineId(null);+ }}+ data-testid={renamesForMove ? 'code-workspace-move' : 'code-workspace'}+ aria-describedby={requirements.length > 0 ? requirementsId : undefined}+ aria-label={+ transitionText == null+ ? `${localize('com_ui_code_workspace')}: ${label}`+ : `${buttonLabel}. ${transitionText.info}`+ }+ className={cn(+ composerControlClasses(),+ 'md:px-theme-control-x max-w-full min-w-0 px-2.5',+ isOpen && 'bg-surface-hover',+ buttonDisabled && 'cursor-not-allowed opacity-50',+ )}+ />+ }+ >+ <ButtonIcon className="text-text-secondary size-4 shrink-0" aria-hidden="true" />+ <span className="max-w-[12rem] min-w-0 truncate">{buttonLabel}</span>+ <ChevronDown+ className={cn(+ 'text-text-secondary size-3 shrink-0 transition-transform',+ isOpen && 'rotate-180',+ )}+ aria-hidden="true"+ />+ </TooltipAnchor>+ <WorkspaceRequirements id={requirementsId} requirements={requirements} />+ </div>+ <Ariakit.Menu portal={true} gutter={8} unmountOnHide={true} className={menuClasses}>+ {transition != null && transitionText != null ? (+ <>+ <Ariakit.MenuHeading render={<div />} className={headingClasses}>+ {transitionText.label}+ </Ariakit.MenuHeading>+ <p className="text-text-secondary px-2.5 pb-2 text-xs">{transitionText.info}</p>+ {transition.targets.map((target) => (<EnvironmentWorkspaces- key={environment.id}- environment={environment}- requiredBy={requiredBy}- workspaces={workspaces}- emptyLabel={localize(stateLabels[state] ?? 'com_ui_code_workspace_unavailable')}- hideOnClick={true}+ key={target.environment.id}+ environment={target.environment}+ requiredBy={target.requiredBy}+ workspaces={target.workspaces}+ emptyLabel={localize('com_ui_code_workspace_unavailable')}+ hideOnClick={false}isSelected={(workspaceId) =>- workspace.mode === 'attached' && workspaceId === selected?.workspaceId+ chosenWorkspaceId(target, moveChoices) === workspaceId+ }+ allowCheckoutSelection={true}+ checkout={+ chosenTargets.find(+ ({ environmentId }) => environmentId === target.environment.id,+ )?.checkout+ }+ onSelect={(selection) =>+ setMoveDraft({+ conversationId: transition.conversationId,+ workspaces: {+ ...moveChoices,+ [selection.environmentId]: {+ ...selection,+ checkout:+ selection.checkout ??+ chosenTargets.find(+ ({ environmentId }) => environmentId === selection.environmentId,+ )?.checkout,+ },+ },+ })}- onSelect={selectWorkspace}- checkout={selected?.checkout}- allowCheckoutSelection={!workspace.locked}/>- ),- )}- {workspace.machineOptions?.some(({ id }) => !environmentIds.has(id)) && (- <>- <Ariakit.MenuSeparator className="border-border-light my-1 h-0 w-full border-t" />- <Ariakit.MenuHeading render={<div />} className={headingClasses}>- {localize('com_ui_code_environment_choose_machine')}- </Ariakit.MenuHeading>- {workspace.machineOptions- ?.filter(({ id }) => !environmentIds.has(id))- .map((candidate) => (- <Ariakit.MenuItem- key={candidate.id}- hideOnClick={false}- className={menuItemClasses(machineId === candidate.id)}- onClick={() => setMachineId(candidate.id)}- >- <Monitor- className="text-text-secondary mt-0.5 size-4 shrink-0"- aria-hidden="true"- />- <span className="text-text-primary min-w-0 flex-1 truncate text-left text-sm">- {candidate.name ?? candidate.id}- </span>- </Ariakit.MenuItem>- ))}- {machine != null &&- (machineReady ? (- <EnvironmentWorkspaces- environment={machine}- workspaces={machineStatus?.workspaces ?? []}- emptyLabel={localize('com_ui_code_workspace_unavailable')}- hideOnClick={true}- isSelected={() => false}- onSelect={selectWorkspace}+ ))}+ <Ariakit.MenuSeparator className="border-border-light my-1 h-0 w-full border-t" />+ {offersMove && (+ <Ariakit.MenuItem+ disabled={disabled || !moveReady || moveMutation.isLoading}+ hideOnClick={true}+ onClick={confirmMove}+ className={cn(+ menuItemClasses(),+ 'items-center aria-disabled:cursor-not-allowed aria-disabled:opacity-50',+ )}+ >+ <ConfirmIcon className="text-text-secondary size-4 shrink-0" aria-hidden="true" />+ <span className="text-text-primary min-w-0 flex-1 truncate text-left text-sm font-medium">+ {transitionText.label}+ </span>+ </Ariakit.MenuItem>+ )}+ {transition.detachable && (+ <Ariakit.MenuItem+ data-testid="code-workspace-detach"+ disabled={disabled || moveMutation.isLoading}+ hideOnClick={true}+ onClick={confirmDetach}+ className={cn(+ menuItemClasses(),+ 'aria-disabled:cursor-not-allowed aria-disabled:opacity-50',+ )}+ >+ <FolderX+ className="text-text-secondary mt-0.5 size-4 shrink-0"+ aria-hidden="true"+ />+ <div className="min-w-0 flex-1 text-left">+ <div className="text-text-primary truncate text-sm font-medium">+ {localize('com_ui_code_workspace_detach')}+ </div>+ <p className="text-text-secondary text-xs">+ {localize('com_ui_code_workspace_detach_info')}+ </p>+ </div>+ </Ariakit.MenuItem>+ )}+ </>+ ) : (+ <>+ <Ariakit.MenuHeading render={<div />} className={headingClasses}>+ {localize('com_ui_code_workspace')}+ </Ariakit.MenuHeading>+ {workspace.supportsEnvironmentDecisions && (+ <Ariakit.MenuItemRadio+ name="codeEnvironmentMode"+ value="without_attached"+ checked={workspace.mode === 'without_attached'}+ hideOnClick={true}+ onChange={selectWithoutAttached}+ className={menuItemClasses(workspace.mode === 'without_attached')}+ >+ <FolderX+ className="text-text-secondary mt-0.5 size-4 shrink-0"+ aria-hidden="true"+ />+ <div className="min-w-0 flex-1 text-left">+ <div className="text-text-primary truncate text-sm font-medium">+ {localize('com_ui_code_workspace_without_attached')}+ </div>+ <p className="text-text-secondary text-xs">+ {localize('com_ui_code_workspace_without_attached_info')}+ </p>+ </div>+ {workspace.mode === 'without_attached' && (+ <Check+ className="text-text-primary mt-0.5 size-4 shrink-0"+ aria-hidden="true"/>- ) : (- <Ariakit.MenuItem- hideOnClick={false}- className={menuItemClasses()}- disabled={machineQuery?.isLoading}- aria-busy={machineQuery?.isLoading}- onClick={() => void machineQuery?.refetch()}- >- <RefreshCw- className="text-text-secondary mt-0.5 size-4 shrink-0"- aria-hidden="true"- />- <span role="status" className="text-text-secondary text-sm">- {localize(- machineQuery?.isLoading- ? 'com_ui_code_workspace_loading'- : 'com_ui_code_workspace_unavailable',- )}- </span>- </Ariakit.MenuItem>- ))}- </>+ )}+ </Ariakit.MenuItemRadio>+ )}+ {workspace.environments+ .filter(({ environment }) => machineId == null || environment.id === machineId)+ .map(({ environment, state, workspaces, selected, requiredBy }) => (+ <EnvironmentWorkspaces+ key={environment.id}+ environment={environment}+ requiredBy={requiredBy}+ workspaces={workspaces}+ emptyLabel={localize(stateLabels[state] ?? 'com_ui_code_workspace_unavailable')}+ hideOnClick={true}+ isSelected={(workspaceId) =>+ workspace.mode === 'attached' && workspaceId === selected?.workspaceId+ }+ onSelect={selectWorkspace}+ checkout={selected?.checkout}+ allowCheckoutSelection={!workspace.locked}+ />+ ))}+ {machine != null &&+ (machineReady ? (+ <EnvironmentWorkspaces+ environment={machine}+ workspaces={machineStatus?.workspaces ?? []}+ emptyLabel={localize('com_ui_code_workspace_unavailable')}+ hideOnClick={true}+ isSelected={() => false}+ onSelect={selectWorkspace}+ />+ ) : (+ <Ariakit.MenuItem+ hideOnClick={false}+ className={menuItemClasses()}+ disabled={buttonDisabled || machineQuery?.isLoading}+ aria-busy={machineQuery?.isLoading}+ onClick={() => void machineQuery?.refetch()}+ >+ <RefreshCw+ className="text-text-secondary mt-0.5 size-4 shrink-0"+ aria-hidden="true"+ />+ <span role="status" className="text-text-secondary text-sm">+ {localize(+ machineQuery?.isLoading+ ? 'com_ui_code_workspace_loading'+ : 'com_ui_code_workspace_unavailable',+ )}+ </span>+ </Ariakit.MenuItem>+ ))}+ </>+ )}+ <Ariakit.MenuSeparator className="border-border-light my-1 h-0 w-full border-t" />+ <Ariakit.MenuItem+ disabled={buttonDisabled || isRefreshing}+ hideOnClick={false}+ onClick={() => void refresh()}+ aria-busy={isRefreshing}+ className={cn(+ menuItemClasses(),+ 'items-center aria-disabled:cursor-not-allowed aria-disabled:opacity-50',)}- </>+ >+ <RefreshCw className="text-text-secondary size-4 shrink-0" aria-hidden="true" />+ <span className="text-text-primary text-sm font-medium">+ {localize('com_ui_refresh')}+ </span>+ </Ariakit.MenuItem>+ </Ariakit.Menu>+ {workspace.environments.length > 1 && (+ <WorkspaceRequirements+ id={`${requirementsId}-checkouts`}+ requirements={checkoutSummaries}+ />)}- <Ariakit.MenuSeparator className="border-border-light my-1 h-0 w-full border-t" />- <Ariakit.MenuItem- disabled={buttonDisabled || isRefreshing}- hideOnClick={false}- onClick={() => void refresh()}- aria-busy={isRefreshing}- className={cn(- menuItemClasses(),- 'items-center aria-disabled:cursor-not-allowed aria-disabled:opacity-50',- )}- >- <RefreshCw className="text-text-secondary size-4 shrink-0" aria-hidden="true" />- <span className="text-text-primary text-sm font-medium">- {localize('com_ui_refresh')}- </span>- </Ariakit.MenuItem>- </Ariakit.Menu>- {workspace.environments.length > 1 && (- <WorkspaceRequirements- id={`${requirementsId}-checkouts`}- requirements={checkoutSummaries}+ </Ariakit.MenuProvider>+ {onlyEnvironment != null && workspace.mode !== 'without_attached' && (+ <GitContext+ target={onlyEnvironment}+ disabled={buttonDisabled}+ locked={workspace.locked}+ onSelect={selectWorkspace}/>)}- </Ariakit.MenuProvider>+ </div>);}diff --git a/client/src/components/Chat/Input/__tests__/CodeWorkspaceMenu.spec.tsx b/client/src/components/Chat/Input/__tests__/CodeWorkspaceMenu.spec.tsxindex 8df1f95fc2..36019c1dc2 100644--- a/client/src/components/Chat/Input/__tests__/CodeWorkspaceMenu.spec.tsx+++ b/client/src/components/Chat/Input/__tests__/CodeWorkspaceMenu.spec.tsx@@ -33,17 +33,12 @@ jest.mock('~/hooks', () => ({}));jest.mock('@librechat/client', () => {- const { cloneElement } = jest.requireActual('react');+ const { CheckboxGlyph, TooltipAnchor } = jest.requireActual('@librechat/client');return {+ CheckboxGlyph,composerControlClasses: () => 'composer-control',useToastContext: () => ({ showToast: mockShowToast }),- TooltipAnchor: ({- render,- children,- }: {- render: React.ReactElement;- children: React.ReactNode;- }) => cloneElement(render, {}, children),+ TooltipAnchor,};});@@ -101,6 +96,377 @@ function renderMenu(ui: React.ReactElement) {}describe('CodeWorkspaceMenu', () => {+ test('separates machine, folder, and reported branch without committing defaults', async () => {+ const graph = workspace({ machineOptions: [environment] });+ graph.environments[0].workspaces[0].environment = {+ fingerprint: 'a'.repeat(64),+ repo: 'example/app',+ ref: 'dev',+ actions: [],+ };+ const setter = jest.fn();+ renderMenu(<CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />);+ expect(screen.getByTestId('code-machine')).toHaveTextContent('Personal VM');+ expect(screen.getByTestId('code-workspace')).toHaveTextContent('Project A');+ expect(screen.getByTestId('code-workspace')).not.toHaveTextContent('Personal VM');+ expect(screen.getByTestId('code-branch')).toHaveTextContent('dev');+ expect(screen.getByTestId('code-branch').closest('button')).toBeNull();+ await userEvent.click(screen.getByTestId('code-machine'));+ expect(screen.queryByRole('menuitemradio', { name: /Project A/ })).not.toBeInTheDocument();+ await userEvent.click(screen.getByRole('menuitem', { name: 'Personal VM' }));+ expect(await screen.findByRole('menuitemradio', { name: /Project A/ })).toBeVisible();+ expect(setter).not.toHaveBeenCalled();+ });++ test('cancels machine discovery with Escape without committing a decision', async () => {+ const setter = jest.fn();+ renderMenu(+ <CodeWorkspaceMenu setConversation={setter} workspace={workspace()} disabled={false} />,+ );+ const machineButton = screen.getByTestId('code-machine');+ machineButton.focus();+ await userEvent.keyboard('{ArrowDown}');+ await waitFor(() =>+ expect(screen.getByRole('menu')).toContainElement(document.activeElement as HTMLElement),+ );+ await userEvent.keyboard('{Escape}');+ await waitFor(() =>+ expect(screen.queryByRole('menu', { hidden: true })).not.toBeInTheDocument(),+ );+ expect(machineButton).toBeEnabled();+ expect(setter).not.toHaveBeenCalled();+ });++ test('opens the workspace menu with keyboard focus and cancels without committing', async () => {+ const alternate = { ...environment, id: 'runtime-vm', name: 'Runtime VM' };+ const read = jest.spyOn(dataService, 'getCodeEnvironmentStatus').mockResolvedValue({+ environmentId: alternate.id,+ status: 'ready',+ operations: ['read_file'],+ workspaces: [{ id: 'runtime', name: 'Runtime Project' }],+ });+ const setter = jest.fn();+ renderMenu(+ <CodeWorkspaceMenu+ setConversation={setter}+ workspace={workspace({ machineOptions: [environment, alternate] })}+ disabled={false}+ />,+ );+ const machineButton = screen.getByTestId('code-machine');+ machineButton.focus();+ await userEvent.keyboard('{ArrowDown}');+ const candidate = await screen.findByRole('menuitem', { name: alternate.name });+ await waitFor(() =>+ expect(candidate.closest('[role="menu"]')).toContainElement(+ document.activeElement as HTMLElement,+ ),+ );+ await userEvent.keyboard('{End}');+ await waitFor(() => expect(candidate).toHaveFocus());+ await userEvent.keyboard('{Enter}');+ const folder = await screen.findByRole('menuitemradio', { name: /Runtime Project/ });+ await waitFor(() =>+ expect(folder.closest('[role="menu"]')).toContainElement(+ document.activeElement as HTMLElement,+ ),+ );+ await userEvent.keyboard('{Escape}');+ await waitFor(() =>+ expect(screen.queryByRole('menu', { hidden: true })).not.toBeInTheDocument(),+ );+ expect(screen.getByTestId('code-workspace')).toBeEnabled();+ expect(setter).not.toHaveBeenCalled();+ read.mockRestore();+ });++ test.each(['ArrowDown', 'ArrowUp'])(+ 'reopens current folders with %s after cancelling another machine',+ async (key) => {+ const alternate = { ...environment, id: 'runtime-vm', name: 'Runtime VM' };+ const read = jest.spyOn(dataService, 'getCodeEnvironmentStatus').mockResolvedValue({+ environmentId: alternate.id,+ status: 'ready',+ operations: ['read_file'],+ workspaces: [{ id: 'runtime', name: 'Runtime Project' }],+ });+ const graph = workspace({ machineOptions: [environment, alternate] });+ graph.environments[0].environment = {+ ...environment,+ configSchema: { workspaces: { allowCheckoutSelection: true } },+ };+ graph.environments[0].workspaces[0].workspaceInstances = ['git_worktree'];+ const selected = {+ environmentId: environment.id,+ workspaceId: 'project-a',+ checkout: 'source' as const,+ };+ graph.environments[0].selected = selected;+ const setter = jest.fn();+ renderMenu(<CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />);+ await userEvent.click(screen.getByTestId('code-machine'));+ await userEvent.click(screen.getByRole('menuitem', { name: alternate.name }));+ const alternateFolder = await screen.findByRole('menuitemradio', { name: /Runtime Project/ });+ await waitFor(() =>+ expect(alternateFolder.closest('[role="menu"]')).toContainElement(+ document.activeElement as HTMLElement,+ ),+ );+ await userEvent.keyboard('{Escape}');+ await waitFor(() =>+ expect(screen.queryByRole('menu', { hidden: true })).not.toBeInTheDocument(),+ );+ const folderButton = screen.getByTestId('code-workspace');+ folderButton.focus();+ await userEvent.keyboard(`{${key}}`);+ expect(await screen.findByRole('menuitemradio', { name: /Project A/ })).toHaveAttribute(+ 'aria-checked',+ 'true',+ );+ expect(+ screen.getByRole('menuitemradio', { name: /com_ui_code_checkout_source/ }),+ ).toHaveAttribute('aria-checked', 'true');+ expect(+ screen.queryByRole('menuitemradio', { name: /Runtime Project/ }),+ ).not.toBeInTheDocument();+ expect(setter).not.toHaveBeenCalled();+ expect(graph.rememberSelection).not.toHaveBeenCalled();+ expect(graph.environments[0].selected).toEqual(selected);+ read.mockRestore();+ },+ );++ test.each(['source', 'isolated', undefined] as const)(+ 'shows and updates the inline worktree control for %s without losing ownership',+ async (checkout) => {+ const graph = workspace();+ graph.environments[0].environment = {+ ...environment,+ configSchema: { workspaces: { allowCheckoutSelection: true } },+ };+ graph.environments[0].workspaces[0].workspaceInstances = ['git_worktree'];+ const selected = {+ environmentId: environment.id,+ workspaceId: 'project-a',+ agentIds: ['lia'],+ checkout,+ };+ graph.environments[0].selected = selected;+ const setter = jest.fn();+ renderMenu(<CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />);+ const control = screen.getByRole('checkbox', { name: 'com_ui_code_worktree' });+ expect(control).toHaveAttribute(+ 'aria-checked',+ checkout == null ? 'mixed' : String(checkout === 'isolated'),+ );+ expect(setter).not.toHaveBeenCalled();+ await userEvent.click(control);+ expect(setter.mock.calls[0][0](conversation).codeWorkspaces).toEqual([+ { ...selected, checkout: checkout === 'isolated' ? 'source' : 'isolated' },+ ]);+ },+ );++ test('reports machine, branch, and worktree mode on a restored sealed chat', () => {+ const graph = workspace({ locked: true, transition: undefined });+ graph.environments[0].workspaces[0].environment = {+ fingerprint: 'a'.repeat(64),+ ref: 'dev',+ actions: [],+ };+ graph.environments[0].workspaces[0].workspaceInstances = ['git_worktree'];+ graph.environments[0].selected = {+ environmentId: environment.id,+ workspaceId: 'project-a',+ checkout: 'isolated',+ };+ renderMenu(+ <CodeWorkspaceMenu setConversation={jest.fn()} workspace={graph} disabled={false} />,+ );+ expect(screen.getByTestId('code-machine-status')).toHaveTextContent('Personal VM');+ expect(screen.getByTestId('code-branch')).toHaveTextContent('dev');+ expect(screen.getByRole('checkbox')).toHaveAttribute('aria-checked', 'true');+ expect(screen.getByRole('checkbox')).toBeDisabled();+ });++ test.each(['source', 'isolated'] as const)(+ 'keeps recorded %s visible when worker isolation support disappears',+ async (checkout) => {+ const graph = workspace({ locked: true, transition: undefined });+ graph.environments[0].environment = {+ ...environment,+ configSchema: { workspaces: { allowCheckoutSelection: true } },+ };+ graph.environments[0].workspaces[0].workspaceInstances = ['git_worktree'];+ const selected = { environmentId: environment.id, workspaceId: 'project-a', checkout };+ graph.environments[0].selected = selected;+ const setter = jest.fn();+ const { rerenderMenu } = renderMenu(+ <CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />,+ );+ graph.environments[0].workspaces[0].workspaceInstances = undefined;+ graph.environments[0].state = checkout === 'isolated' ? 'unsupported' : 'ready';+ graph.state = graph.environments[0].state;+ graph.canSubmit = checkout !== 'isolated';+ rerenderMenu(+ <CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />,+ );+ const control = screen.getByRole('checkbox', { name: 'com_ui_code_worktree' });+ expect(control).toHaveAttribute('aria-checked', String(checkout === 'isolated'));+ expect(control).toBeDisabled();+ await userEvent.click(control);+ expect(setter).not.toHaveBeenCalled();+ expect(graph.rememberSelection).not.toHaveBeenCalled();+ expect(graph.environments[0].selected).toEqual(selected);+ },+ );++ test.each([+ { enabled: false, capable: true },+ { enabled: true, capable: false },+ ])(+ 'reports an unsupported draft checkout without permitting an unavailable override: %j',+ async ({ enabled, capable }) => {+ const graph = workspace({ state: 'unsupported', canSubmit: false });+ graph.environments[0].environment = {+ ...environment,+ configSchema: { workspaces: { allowCheckoutSelection: enabled } },+ };+ graph.environments[0].workspaces[0].workspaceInstances = capable+ ? ['git_worktree']+ : undefined;+ graph.environments[0].selected = {+ environmentId: environment.id,+ workspaceId: 'project-a',+ checkout: 'isolated',+ };+ const setter = jest.fn();+ renderMenu(<CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />);+ const control = screen.getByRole('checkbox', { name: 'com_ui_code_worktree' });+ expect(control).toHaveAttribute('aria-checked', 'true');+ expect(control).toBeDisabled();+ await userEvent.click(control);+ expect(setter).not.toHaveBeenCalled();+ expect(graph.rememberSelection).not.toHaveBeenCalled();+ },+ );++ test('keeps automatic worktree policy visible but read-only when overrides are disabled', () => {+ const graph = workspace();+ graph.environments[0].workspaces[0].workspaceInstances = ['git_worktree'];+ const setter = jest.fn();+ renderMenu(<CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />);+ expect(screen.getByRole('checkbox')).toBeDisabled();+ expect(screen.getByRole('checkbox')).toHaveAttribute('aria-checked', 'mixed');+ expect(screen.getByRole('checkbox')).toHaveTextContent('com_ui_code_checkout_automatic');+ expect(setter).not.toHaveBeenCalled();+ });++ test.each([true, false])(+ 'shows linked-worktree capability only when policy allows it: %s',+ (enabled) => {+ const graph = workspace();+ graph.environments[0].environment = {+ ...environment,+ configSchema: { workspaces: { linkedWorktrees: enabled, allowCheckoutSelection: false } },+ };+ graph.environments[0].workspaces[0].workspaceScopes = ['git_linked_worktree'];+ renderMenu(+ <CodeWorkspaceMenu setConversation={jest.fn()} workspace={graph} disabled={false} />,+ );+ expect(screen.queryByText('com_ui_code_linked_worktrees') != null).toBe(enabled);+ expect(screen.queryByRole('checkbox')).not.toBeInTheDocument();+ },+ );++ describe.each([false, true])('checkout context with locked=%s', (locked) => {+ test.each([+ { checkout: 'source', capable: true, linked: undefined, allowed: true, expected: true },+ { checkout: 'source', capable: true, linked: true, allowed: true, expected: true },+ { checkout: 'source', capable: true, linked: false, allowed: true, expected: false },+ { checkout: 'isolated', capable: true, linked: undefined, allowed: true, expected: false },+ { checkout: 'isolated', capable: true, linked: true, allowed: true, expected: false },+ { checkout: undefined, capable: true, linked: undefined, allowed: false, expected: false },+ { checkout: undefined, capable: true, linked: true, allowed: true, expected: false },+ { checkout: undefined, capable: false, linked: undefined, allowed: false, expected: true },+ { checkout: undefined, capable: false, linked: true, allowed: false, expected: true },+ { checkout: undefined, capable: false, linked: false, allowed: true, expected: false },+ { checkout: 'source', capable: false, linked: undefined, allowed: true, expected: true },+ { checkout: 'source', capable: true, linked: true, allowed: false, expected: false },+ { checkout: 'isolated', capable: false, linked: true, allowed: true, expected: false },+ ] as const)(+ 'reports available linked lanes without changing the checkout: %j',+ ({ checkout, capable, linked, allowed, expected }) => {+ const graph = workspace({ locked });+ graph.environments[0].environment = {+ ...environment,+ configSchema: {+ workspaces: { linkedWorktrees: linked, allowCheckoutSelection: allowed },+ },+ };+ graph.environments[0].workspaces[0].workspaceInstances = capable+ ? ['git_worktree']+ : undefined;+ graph.environments[0].workspaces[0].workspaceScopes = ['git_linked_worktree'];+ const selected = {+ environmentId: environment.id,+ workspaceId: 'project-a',+ checkout,+ agentIds: ['lia'],+ };+ graph.environments[0].selected = selected;+ const setter = jest.fn();+ renderMenu(+ <CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={false} />,+ );+ expect(screen.queryByText('com_ui_code_linked_worktrees') != null).toBe(expected);+ const control = screen.queryByRole('checkbox', { name: 'com_ui_code_worktree' });+ if (capable || checkout != null) {+ expect(control).toHaveAttribute(+ 'aria-checked',+ checkout == null ? 'mixed' : String(checkout === 'isolated'),+ );+ } else {+ expect(control).toBeNull();+ }+ expect(setter).not.toHaveBeenCalled();+ expect(graph.rememberSelection).not.toHaveBeenCalled();+ expect(graph.environments[0].selected).toEqual(selected);+ },+ );+ });++ test('hides Git context when continuing without an attached workspace', () => {+ const graph = workspace({ mode: 'without_attached', state: 'without_attached' });+ graph.environments[0].workspaces[0].workspaceInstances = ['git_worktree'];+ graph.environments[0].workspaces[0].environment = {+ fingerprint: 'a'.repeat(64),+ ref: 'dev',+ actions: [],+ };+ renderMenu(+ <CodeWorkspaceMenu setConversation={jest.fn()} workspace={graph} disabled={false} />,+ );+ expect(screen.queryByTestId('code-branch')).not.toBeInTheDocument();+ expect(screen.queryByRole('checkbox')).not.toBeInTheDocument();+ });++ test('disables the inline worktree choice during generation', async () => {+ const graph = workspace();+ graph.environments[0].environment = {+ ...environment,+ configSchema: { workspaces: { allowCheckoutSelection: true } },+ };+ graph.environments[0].workspaces[0].workspaceInstances = ['git_worktree'];+ const setter = jest.fn();+ renderMenu(<CodeWorkspaceMenu setConversation={setter} workspace={graph} disabled={true} />);+ expect(screen.getByTestId('code-machine')).toBeDisabled();+ expect(screen.getByTestId('code-workspace')).toBeDisabled();+ expect(screen.getByRole('checkbox')).toBeDisabled();+ await userEvent.click(screen.getByRole('checkbox'));+ expect(setter).not.toHaveBeenCalled();+ });+test.each(['source', 'isolated'] as const)('keeps explicit %s when choosing another repository on the same machine',async (checkout) => {@@ -337,7 +703,7 @@ describe('CodeWorkspaceMenu', () => {/>,);expect(read).not.toHaveBeenCalled();- await userEvent.click(screen.getByTestId('code-workspace'));+ await userEvent.click(screen.getByTestId('code-machine'));expect(read).not.toHaveBeenCalled();await userEvent.click(screen.getByRole('menuitem', { name: 'Runtime VM' }));await userEvent.click(await screen.findByRole('menuitemradio', { name: /Runtime Project/ }));@@ -372,7 +738,7 @@ describe('CodeWorkspaceMenu', () => {disabled={false}/>,);- await userEvent.click(screen.getByTestId('code-workspace'));+ await userEvent.click(screen.getByTestId('code-machine'));await userEvent.click(screen.getByRole('menuitem', { name: 'Runtime VM' }));await userEvent.click(await screen.findByRole('menuitemradio', { name: /Runtime Project/ }));expect(@@ -435,7 +801,7 @@ describe('CodeWorkspaceMenu', () => {disabled={false}/>,);- await userEvent.click(screen.getByTestId('code-workspace'));+ await userEvent.click(screen.getByTestId('code-machine'));expect(screen.getByRole('menuitem', { name: 'Runtime VM' })).toBeVisible();});@@ -458,7 +824,7 @@ describe('CodeWorkspaceMenu', () => {disabled={false}/>,);- await userEvent.click(screen.getByTestId('code-workspace'));+ await userEvent.click(screen.getByTestId('code-machine'));await userEvent.click(screen.getByRole('menuitem', { name: 'Runtime VM' }));const retry = await screen.findByRole('menuitem', {name: 'com_ui_code_workspace_unavailable',@@ -585,7 +951,7 @@ describe('CodeWorkspaceMenu', () => {<CodeWorkspaceMenu setConversation={setConversation} workspace={state} disabled={false} />,);await userEvent.click(screen.getByTestId('code-workspace'));- expect(await screen.findByText(label!)).toBeInTheDocument();+ expect((await screen.findAllByText(label!)).length).toBeGreaterThan(0);expect(setConversation).not.toHaveBeenCalled();});test('shows a suggested workspace without committing the conversation decision', () => {@@ -1134,6 +1500,9 @@ describe('CodeWorkspaceMenu', () => {expect(setConversation).not.toHaveBeenCalled();expect(rememberSelection).not.toHaveBeenCalled();await userEvent.keyboard('{Escape}');+ await waitFor(() =>+ expect(screen.queryByRole('menu', { hidden: true })).not.toBeInTheDocument(),+ );expect(moveSpy).not.toHaveBeenCalled();await userEvent.click(screen.getByTestId('code-workspace-move'));await userEvent.click(diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.jsonindex 1dca5f0bae..9c8012f2d8 100644--- a/client/src/locales/en/translation.json+++ b/client/src/locales/en/translation.json@@ -80,6 +80,16 @@"com_ui_schedule_disabled_mcp_configuration": "Disabled: MCP configuration required","com_ui_schedule_disabled_mcp_permission": "Disabled: MCP permission revoked","com_ui_code_approval_mode": "Code approval mode",+ "com_ui_code_machine": "Machine",+ "com_ui_code_machine_choose": "Choose machine",+ "com_ui_code_machines_selected": "{{0}} machines",+ "com_ui_code_branch": "Branch",+ "com_ui_code_branch_info": "Branch reported by the registered workspace. Branch selection is not supported.",+ "com_ui_code_worktree": "Worktree",+ "com_ui_code_checkout_automatic": "Auto",+ "com_ui_code_checkout_automatic_info": "Use the worker's automatic checkout policy. Choose a checkout mode before sending to override it.",+ "com_ui_code_linked_worktrees": "Linked worktrees",+ "com_ui_code_linked_worktrees_info": "Commands in .worktrees/<name> use that worktree's execution lane. This does not create a worktree.","com_ui_code_workspace": "Code workspace","com_ui_code_workspace_choose": "Choose workspace","com_ui_code_workspace_required_for": "Choose a workspace for {{0}} on {{1}}.",