mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
Open the branch picker from the branch name under the chat composer (#39692)
* Open the branch picker from the branch name under the chat composer * Copy the current branch from its row in the composer's branch picker * Keep the composer copy button clickable and out of the list's keyboard, and keep a twin copy's status out of the picker * Read a twin copy's status privately in the branch picker and drop refreshes that land after its twin is selected * Block on a twin's returned read error, re-read after the picker closes itself, and distrust a twin's leftover status on becoming owner * Build the environment name selector outside the component so the React compiler can lower the picker * Trust a copy's status again once its picker refresh settles, even when an identical newer poll superseded it * Read a newly owning copy's own status until the inherited slot changes, instead of trusting a settled refresh * Route the composer picker through the copy's owner and block while this chat's turn is active * Keep the composer picker's agent gate on the shared working check, as in Source Control
This commit is contained in:
@@ -410,6 +410,7 @@ export const NativeChatComposerPane = forwardRef<ComposerHandle, C.NativeChatCom
|
||||
<NativeChatComposerWorkspace
|
||||
terminalTabId={terminalTabId}
|
||||
structuredTransport={structuredTransport}
|
||||
isWorking={isWorking}
|
||||
/>
|
||||
) : undefined
|
||||
}
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
import { useCallback } from 'react'
|
||||
import { GitBranch } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { useWorktreeGitOwnerTarget } from '@/components/right-sidebar/source-control/sync/worktree-git-owner-target'
|
||||
import { WorkspaceBranchPicker } from '@/components/right-sidebar/source-control/branches/WorkspaceBranchPicker'
|
||||
import { recordWorktreeBranchSwitchLanded } from '@/components/right-sidebar/source-control/branches/workspace-branch-switch-status'
|
||||
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
|
||||
|
||||
export function NativeChatComposerBranchPicker({
|
||||
worktreeId,
|
||||
worktreePath,
|
||||
hostId,
|
||||
repoId,
|
||||
branch,
|
||||
turnActive,
|
||||
textClassName,
|
||||
onCopyBranch,
|
||||
fallback
|
||||
}: {
|
||||
worktreeId: string
|
||||
worktreePath: string
|
||||
hostId: ExecutionHostId
|
||||
repoId: string
|
||||
branch: string
|
||||
/** This chat's own turn; the picker names it instead of a generic agent. */
|
||||
turnActive: boolean
|
||||
textClassName: string
|
||||
onCopyBranch: () => void
|
||||
/** Shown while the copy's owner is unresolved, so no git call can reach another host's copy. */
|
||||
fallback: React.ReactNode
|
||||
}): React.JSX.Element | null {
|
||||
const t = useTranslate()
|
||||
// The same owner resolution as the status read, so both reach one copy.
|
||||
const target = useWorktreeGitOwnerTarget(worktreeId, hostId)
|
||||
const onLanded = useCallback(
|
||||
() => recordWorktreeBranchSwitchLanded(worktreeId, hostId, worktreePath),
|
||||
[worktreeId, hostId, worktreePath]
|
||||
)
|
||||
if (!target) {
|
||||
return <>{fallback}</>
|
||||
}
|
||||
return (
|
||||
<WorkspaceBranchPicker
|
||||
worktreeId={worktreeId}
|
||||
worktreePath={worktreePath}
|
||||
hostId={hostId}
|
||||
repoId={repoId}
|
||||
target={target}
|
||||
branch={branch}
|
||||
agentNotice={
|
||||
turnActive
|
||||
? t(
|
||||
'components.native-chat.composerWorkspace.turnWorking',
|
||||
"This chat's agent is working. Switch branches after its turn finishes."
|
||||
)
|
||||
: undefined
|
||||
}
|
||||
refreshOnOpen
|
||||
onCopyBranch={onCopyBranch}
|
||||
onLanded={onLanded}
|
||||
trigger={
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="xs"
|
||||
className="h-5.5 min-w-0 flex-1 justify-start"
|
||||
title={branch}
|
||||
aria-label={t('sourceControl.branchPicker.switch', 'Switch branch: {{branch}}', {
|
||||
branch
|
||||
})}
|
||||
>
|
||||
<GitBranch className="size-3" aria-hidden />
|
||||
<span className={`${textClassName} font-mono`}>{branch}</span>
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
+66
-29
@@ -8,10 +8,12 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { usePublishedMachineName } from '@/components/machine-identity/use-published-machine-name'
|
||||
import { getWorktreeGitIdentityDisplay } from '../../../../../../shared/worktree/git-identity-display'
|
||||
import { parseExecutionHostId } from '../../../../../../shared/execution-host'
|
||||
import {
|
||||
createNativeChatComposerWorkspaceSelector,
|
||||
type NativeChatComposerWorkspaceTarget
|
||||
} from './native-chat-composer-workspace'
|
||||
import { NativeChatComposerBranchPicker } from './NativeChatComposerBranchPicker'
|
||||
|
||||
// Trim to cap height so flex centering aligns glyphs with icons; clip x only to keep descenders.
|
||||
const FOOTER_TEXT =
|
||||
@@ -19,10 +21,12 @@ const FOOTER_TEXT =
|
||||
|
||||
export function NativeChatComposerWorkspace({
|
||||
terminalTabId,
|
||||
structuredTransport
|
||||
structuredTransport,
|
||||
isWorking = false
|
||||
}: {
|
||||
terminalTabId: string
|
||||
structuredTransport?: NativeChatComposerWorkspaceTarget
|
||||
isWorking?: boolean
|
||||
}): React.JSX.Element {
|
||||
const t = useTranslate()
|
||||
const { worktreeId, runtimeEnvironmentId } = structuredTransport ?? {}
|
||||
@@ -37,7 +41,17 @@ export function NativeChatComposerWorkspace({
|
||||
),
|
||||
[terminalTabId, worktreeId, runtimeEnvironmentId, hasTransport]
|
||||
)
|
||||
const { hostId, machine, checkout, kind, path, branch, head } = useAppStore(useShallow(selector))
|
||||
const {
|
||||
worktreeId: rowWorktreeId,
|
||||
repoId,
|
||||
hostId,
|
||||
machine,
|
||||
checkout,
|
||||
kind,
|
||||
path,
|
||||
branch,
|
||||
head
|
||||
} = useAppStore(useShallow(selector))
|
||||
|
||||
const identity = getWorktreeGitIdentityDisplay({ branch, head })
|
||||
const label = identity?.kind === 'branch' ? identity.branchName : identity?.sourceControlLabel
|
||||
@@ -60,6 +74,36 @@ export function NativeChatComposerWorkspace({
|
||||
? t('components.native-chat.composerWorkspace.mainCheckout', 'Main checkout')
|
||||
: t('components.native-chat.composerWorkspace.worktree', 'Worktree')
|
||||
|
||||
const copyIdentityButton =
|
||||
identity && label ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="xs"
|
||||
className="h-5.5 min-w-0 flex-1 justify-start"
|
||||
aria-label={t(
|
||||
'components.native-chat.composerWorkspace.copyIdentity',
|
||||
'Copy {{value0}}',
|
||||
{ value0: label }
|
||||
)}
|
||||
onClick={() => void copyValue(identityCopyValue)}
|
||||
>
|
||||
{identity.kind === 'branch' ? (
|
||||
<GitBranch className="size-3" aria-hidden />
|
||||
) : (
|
||||
<GitCommitHorizontal className="size-3" aria-hidden />
|
||||
)}
|
||||
<span className={`${FOOTER_TEXT} font-mono`}>{label}</span>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top" sideOffset={4}>
|
||||
{identity.kind === 'detached' ? identity.tooltip : label}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
) : null
|
||||
|
||||
return (
|
||||
<div className="@container mt-1 flex h-5.5 shrink-0 min-w-0 items-center gap-1.5 px-3 text-2xs text-chat-foreground-faint">
|
||||
{hostId && (
|
||||
@@ -111,33 +155,26 @@ export function NativeChatComposerWorkspace({
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
)}
|
||||
{identity && label && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="xs"
|
||||
className="h-5.5 min-w-0 flex-1 justify-start"
|
||||
aria-label={t(
|
||||
'components.native-chat.composerWorkspace.copyIdentity',
|
||||
'Copy {{value0}}',
|
||||
{ value0: label }
|
||||
)}
|
||||
onClick={() => void copyValue(identityCopyValue)}
|
||||
>
|
||||
{identity.kind === 'branch' ? (
|
||||
<GitBranch className="size-3" aria-hidden />
|
||||
) : (
|
||||
<GitCommitHorizontal className="size-3" aria-hidden />
|
||||
)}
|
||||
<span className={`${FOOTER_TEXT} font-mono`}>{label}</span>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top" sideOffset={4}>
|
||||
{identity.kind === 'detached' ? identity.tooltip : label}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
{identity?.kind === 'branch' &&
|
||||
rowWorktreeId &&
|
||||
repoId &&
|
||||
hostId &&
|
||||
path &&
|
||||
// Direct SSH ids aren't served by the git switch route; those keep click-to-copy.
|
||||
parseExecutionHostId(hostId)?.kind !== 'ssh' ? (
|
||||
<NativeChatComposerBranchPicker
|
||||
worktreeId={rowWorktreeId}
|
||||
worktreePath={path}
|
||||
hostId={hostId}
|
||||
repoId={repoId}
|
||||
branch={identity.branchName}
|
||||
turnActive={isWorking}
|
||||
textClassName={FOOTER_TEXT}
|
||||
onCopyBranch={() => void copyValue(identity.branchName)}
|
||||
fallback={copyIdentityButton}
|
||||
/>
|
||||
) : (
|
||||
copyIdentityButton
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
+4
@@ -57,6 +57,8 @@ export function createNativeChatComposerWorkspaceSelector(
|
||||
let runtimeIds: string[] = []
|
||||
const selectMachine = createComposerMachineSelector(!target)
|
||||
let presentation: {
|
||||
worktreeId?: string
|
||||
repoId?: string
|
||||
hostId?: ExecutionHostId
|
||||
machine?: string
|
||||
checkout?: string
|
||||
@@ -128,6 +130,8 @@ export function createNativeChatComposerWorkspaceSelector(
|
||||
path: path ?? undefined
|
||||
}
|
||||
presentation = {
|
||||
worktreeId: row?.id,
|
||||
repoId: repo?.id,
|
||||
checkout: row?.displayName,
|
||||
kind: row
|
||||
? (repo && isFolderRepo(repo)) ||
|
||||
|
||||
+35
@@ -201,3 +201,38 @@ it('delivers the original workspace outcome after the picker unmounts', async ()
|
||||
await act(async () => finish?.({ ok: true, branch: 'feature', warning: 'Files left behind.' }))
|
||||
expect(onSwitched).toHaveBeenCalledWith('Files left behind.')
|
||||
})
|
||||
|
||||
it('reports the picker closing itself after a switch so the next open reads status again', async () => {
|
||||
vi.mocked(listRuntimeGitBranches).mockResolvedValue({
|
||||
current: 'main',
|
||||
branches: ['main', 'feature']
|
||||
})
|
||||
vi.mocked(searchRuntimeRemoteBranches).mockResolvedValue({ refs: [], truncated: false })
|
||||
vi.mocked(switchRuntimeGitBranch).mockResolvedValueOnce({ ok: true, branch: 'feature' })
|
||||
const onOpenChange = vi.fn()
|
||||
await act(async () =>
|
||||
root.render(
|
||||
<BranchPicker
|
||||
branch="main"
|
||||
blocker={null}
|
||||
context={{ target: { kind: 'local' }, worktreeId: 'original', worktreePath: '/repo' }}
|
||||
repoId="repo"
|
||||
hostId="local"
|
||||
hostLabel="This computer"
|
||||
workspaceLabel="repo"
|
||||
workspaces={new Map()}
|
||||
onOpenWorkspace={vi.fn()}
|
||||
onSwitched={vi.fn()}
|
||||
onOpenChange={onOpenChange}
|
||||
/>
|
||||
)
|
||||
)
|
||||
await act(async () => container.querySelector('button')?.click())
|
||||
expect(onOpenChange).toHaveBeenLastCalledWith(true)
|
||||
await act(async () =>
|
||||
Array.from(container.querySelectorAll('button'))
|
||||
.find((button) => button.textContent === 'feature')
|
||||
?.click()
|
||||
)
|
||||
expect(onOpenChange).toHaveBeenLastCalledWith(false)
|
||||
})
|
||||
|
||||
+56
-16
@@ -1,5 +1,6 @@
|
||||
import { memo } from 'react'
|
||||
import { Check, ChevronDown, GitBranch, Info } from 'lucide-react'
|
||||
import { memo, type ReactNode } from 'react'
|
||||
import { Check, ChevronDown, Copy, GitBranch, Info } from 'lucide-react'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
|
||||
import { Command, CommandInput, CommandItem, CommandList } from '@/components/ui/command'
|
||||
import { useIntlLocale, useTranslate } from '@/i18n/use-translate'
|
||||
@@ -12,11 +13,17 @@ export type BranchPickerProps = BranchPickerOptions & {
|
||||
branch: string
|
||||
blocker: string | null
|
||||
dirtyOnlyBlocker?: boolean
|
||||
/** Replaces the header trigger; it must forward a ref and props to a button. */
|
||||
trigger?: ReactNode
|
||||
/** Adds a copy button to the current branch's row. */
|
||||
onCopyBranch?: () => void
|
||||
}
|
||||
export function BranchPicker({
|
||||
branch,
|
||||
blocker,
|
||||
dirtyOnlyBlocker = false,
|
||||
trigger,
|
||||
onCopyBranch,
|
||||
...options
|
||||
}: BranchPickerProps) {
|
||||
const t = useTranslate()
|
||||
@@ -26,17 +33,19 @@ export function BranchPicker({
|
||||
return (
|
||||
<Popover open={picker.open} onOpenChange={picker.setOpen}>
|
||||
<PopoverTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t('sourceControl.branchPicker.switch', 'Switch branch: {{branch}}', {
|
||||
branch
|
||||
})}
|
||||
className="flex min-w-0 items-center gap-1 rounded-sm font-mono text-[10.5px] font-medium text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
||||
>
|
||||
<GitBranch className="size-3 shrink-0" />
|
||||
<span className="truncate">{branch}</span>
|
||||
<ChevronDown className="size-3 shrink-0" />
|
||||
</button>
|
||||
{trigger ?? (
|
||||
<button
|
||||
type="button"
|
||||
aria-label={t('sourceControl.branchPicker.switch', 'Switch branch: {{branch}}', {
|
||||
branch
|
||||
})}
|
||||
className="flex min-w-0 items-center gap-1 rounded-sm font-mono text-[10.5px] font-medium text-foreground outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
||||
>
|
||||
<GitBranch className="size-3 shrink-0" />
|
||||
<span className="truncate">{branch}</span>
|
||||
<ChevronDown className="size-3 shrink-0" />
|
||||
</button>
|
||||
)}
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="start" className="w-80">
|
||||
<Command shouldFilter={false}>
|
||||
@@ -68,6 +77,7 @@ export function BranchPicker({
|
||||
pending={picker.pending}
|
||||
disabled={row.target.kind === 'new' && dirtyOnlyBlocker ? picker.pending : disabled}
|
||||
onSelect={picker.select}
|
||||
onCopy={row.current ? onCopyBranch : undefined}
|
||||
/>
|
||||
))}
|
||||
</CommandList>
|
||||
@@ -83,7 +93,8 @@ const BranchRow = memo(function BranchRow({
|
||||
openedAt,
|
||||
pending,
|
||||
disabled,
|
||||
onSelect
|
||||
onSelect,
|
||||
onCopy
|
||||
}: {
|
||||
row: BranchPickerRow
|
||||
branch: string
|
||||
@@ -91,6 +102,7 @@ const BranchRow = memo(function BranchRow({
|
||||
pending: boolean
|
||||
disabled: boolean
|
||||
onSelect: (row: BranchPickerRow) => Promise<void>
|
||||
onCopy?: () => void
|
||||
}) {
|
||||
const t = useTranslate()
|
||||
const intlLocale = useIntlLocale()
|
||||
@@ -100,7 +112,11 @@ const BranchRow = memo(function BranchRow({
|
||||
value={`${row.target.kind}:${row.target.name}`}
|
||||
data-current={row.current ? 'true' : undefined}
|
||||
selection="palette"
|
||||
disabled={row.current || (row.workspace ? pending : disabled || Boolean(row.occupiedPath))}
|
||||
// A disabled item swallows pointer events, so a row carrying the copy button stays enabled; select ignores it.
|
||||
disabled={
|
||||
(row.current && !onCopy) ||
|
||||
(!row.current && (row.workspace ? pending : disabled || Boolean(row.occupiedPath)))
|
||||
}
|
||||
onSelect={() => void onSelect(row)}
|
||||
>
|
||||
<span className="min-w-0 flex-1 truncate">
|
||||
@@ -112,7 +128,31 @@ const BranchRow = memo(function BranchRow({
|
||||
: row.label}
|
||||
</span>
|
||||
{row.current ? (
|
||||
<Check className="size-3" />
|
||||
<>
|
||||
{onCopy && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon-xs"
|
||||
className="size-5"
|
||||
aria-label={t('sourceControl.branchPicker.copy', 'Copy branch name')}
|
||||
onClick={(event) => {
|
||||
// The row owns selection; copying must not reach it.
|
||||
event.stopPropagation()
|
||||
onCopy()
|
||||
}}
|
||||
onKeyDown={(event) => {
|
||||
// cmdk's root turns Enter into a select of the highlighted row.
|
||||
if (event.key === 'Enter' || event.key === ' ') {
|
||||
event.stopPropagation()
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Copy className="size-3" />
|
||||
</Button>
|
||||
)}
|
||||
<Check className="size-3" />
|
||||
</>
|
||||
) : row.workspace ? (
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{t('sourceControl.branchPicker.open', 'Open workspace')}
|
||||
|
||||
+12
-125
@@ -1,147 +1,34 @@
|
||||
import { useCallback, useMemo } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { basename } from '@/lib/path'
|
||||
import { isWorkspaceSelected } from '@/lib/active-workspace-host'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { useAppStore } from '@/store'
|
||||
import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields'
|
||||
import { getIndexedWorktreeMap } from '@/store/slices/worktrees/listing/worktree-catalog-index'
|
||||
import { getExecutionHostLabel } from '../../../../../../shared/execution-host'
|
||||
import { selectWorktreeAgentActivitySummary } from '@/components/sidebar/workspace-card/activity/worktree-agent-activity-summary'
|
||||
import type { BranchWorkspace } from './branch-picker-rows'
|
||||
import { BranchPicker } from './BranchPicker'
|
||||
import { useCallback } from 'react'
|
||||
import type { SourceControlPanelModel } from '../panel/use-panel-model'
|
||||
import { requireGitOwnerTarget } from '../sync/worktree-git-owner-target'
|
||||
import { WorkspaceBranchPicker } from './WorkspaceBranchPicker'
|
||||
|
||||
export function SourceControlBranchPicker({ model }: { model: SourceControlPanelModel }) {
|
||||
const t = useTranslate()
|
||||
const {
|
||||
activeWorktree,
|
||||
activeWorktreeId,
|
||||
activeRepoTarget,
|
||||
activeRepo,
|
||||
branchName,
|
||||
entries,
|
||||
conflictOperation,
|
||||
statusReadError,
|
||||
recordBranchSwitchOutcome,
|
||||
refreshActiveGitStatusAfterMutation
|
||||
} = model
|
||||
const statusKnown = useAppStore((state) =>
|
||||
activeWorktreeId ? state.gitStatusHeadByWorktree?.[activeWorktreeId] !== undefined : false
|
||||
)
|
||||
const hostLabel = useAppStore((state) =>
|
||||
activeRepoTarget?.kind === 'environment'
|
||||
? state.runtimeEnvironments.find((host) => host.id === activeRepoTarget.environmentId)?.name
|
||||
: undefined
|
||||
)
|
||||
// The panel's map holds only the owner inside a folder section; workspace rows need every worktree.
|
||||
const worktreeMap = useAppStore((state) => getIndexedWorktreeMap(selectWorktreesByRepo(state)))
|
||||
const agentWorking = useAppStore((state) =>
|
||||
activeWorktreeId
|
||||
? selectWorktreeAgentActivitySummary(state, activeWorktreeId).hasLiveWorking
|
||||
: false
|
||||
)
|
||||
const showDirtyBlocker =
|
||||
statusKnown && !statusReadError && conflictOperation === 'unknown' && entries.length > 0
|
||||
const changedCount = useMemo(
|
||||
() => (showDirtyBlocker ? new Set(entries.map((entry) => entry.path)).size : 0),
|
||||
[entries, showDirtyBlocker]
|
||||
)
|
||||
const onOpenWorkspace = useCallback(
|
||||
(workspace: BranchWorkspace) =>
|
||||
useAppStore.getState().setActiveWorktree(workspace.id, workspace.hostId),
|
||||
[]
|
||||
)
|
||||
const selectedHostId = useAppStore((state) => state.activeWorkspaceExecutionHostId ?? null)
|
||||
const resolvedHostLabel = hostLabel ?? getExecutionHostLabel(activeWorktree?.hostId ?? 'local')
|
||||
// Worktree ids repeat across hosts, so a remote copy is named with its host.
|
||||
const workspaceLabel = activeWorktree
|
||||
? (activeWorktree.hostId ?? 'local') === 'local'
|
||||
? basename(activeWorktree.path)
|
||||
: `${basename(activeWorktree.path)} (${resolvedHostLabel})`
|
||||
: ''
|
||||
const onSwitched = useCallback(
|
||||
(message?: string) => {
|
||||
if (message) {
|
||||
// The switch can land after the user moved on; name the workspace it happened in.
|
||||
const selection = { worktreeId: activeWorktreeId, executionHostId: selectedHostId }
|
||||
if (isWorkspaceSelected(useAppStore.getState(), selection)) {
|
||||
toast.warning(message, { duration: 15000 })
|
||||
} else {
|
||||
toast.warning(
|
||||
translate('sourceControl.branchPicker.switchedIn', 'In {{workspace}}', {
|
||||
workspace: workspaceLabel
|
||||
}),
|
||||
{ description: message, duration: 15000 }
|
||||
)
|
||||
}
|
||||
}
|
||||
recordBranchSwitchOutcome(refreshActiveGitStatusAfterMutation)
|
||||
},
|
||||
[
|
||||
activeWorktreeId,
|
||||
selectedHostId,
|
||||
workspaceLabel,
|
||||
recordBranchSwitchOutcome,
|
||||
refreshActiveGitStatusAfterMutation
|
||||
]
|
||||
const onLanded = useCallback(
|
||||
() => recordBranchSwitchOutcome(refreshActiveGitStatusAfterMutation),
|
||||
[recordBranchSwitchOutcome, refreshActiveGitStatusAfterMutation]
|
||||
)
|
||||
if (!activeWorktree || !activeWorktreeId || !activeRepo || !activeRepoTarget) {
|
||||
return null
|
||||
}
|
||||
// Checking out moves HEAD under the agent, so creating a branch waits too; the host re-checks on switch.
|
||||
const blocker = agentWorking
|
||||
? t(
|
||||
'sourceControl.branchPicker.agentWorking',
|
||||
'An agent is working in this workspace. Switch branches after it finishes, or close its tab if it has stopped.'
|
||||
)
|
||||
: statusReadError
|
||||
? t(
|
||||
'sourceControl.branchPicker.statusFailed',
|
||||
"Orca couldn't read this checkout's changes. Refresh Source Control before switching."
|
||||
)
|
||||
: !statusKnown
|
||||
? t(
|
||||
'sourceControl.branchPicker.statusUnknown',
|
||||
'Read this checkout’s changes before switching.'
|
||||
)
|
||||
: conflictOperation !== 'unknown'
|
||||
? t(
|
||||
'sourceControl.branchPicker.conflict',
|
||||
'Finish or abort the {{operation}} before switching branches.',
|
||||
{ operation: conflictOperation }
|
||||
)
|
||||
: entries.length
|
||||
? t(
|
||||
'sourceControl.branchPicker.dirty',
|
||||
'Commit or discard {{count}} changed files before switching branches.',
|
||||
{
|
||||
count: changedCount,
|
||||
defaultValue_one:
|
||||
'Commit or discard {{count}} changed file before switching branches.'
|
||||
}
|
||||
)
|
||||
: null
|
||||
return (
|
||||
<BranchPicker
|
||||
key={`${activeWorktree.hostId}:${activeWorktreeId}`}
|
||||
branch={branchName}
|
||||
blocker={blocker}
|
||||
dirtyOnlyBlocker={showDirtyBlocker && !agentWorking}
|
||||
context={{
|
||||
target: requireGitOwnerTarget(activeRepoTarget),
|
||||
worktreeId: activeWorktreeId,
|
||||
worktreePath: activeWorktree.path
|
||||
}}
|
||||
repoId={activeRepo.id}
|
||||
<WorkspaceBranchPicker
|
||||
worktreeId={activeWorktreeId}
|
||||
worktreePath={activeWorktree.path}
|
||||
hostId={activeWorktree.hostId ?? 'local'}
|
||||
hostLabel={resolvedHostLabel}
|
||||
workspaceLabel={workspaceLabel}
|
||||
workspaces={worktreeMap}
|
||||
onOpenWorkspace={onOpenWorkspace}
|
||||
onSwitched={onSwitched}
|
||||
repoId={activeRepo.id}
|
||||
target={requireGitOwnerTarget(activeRepoTarget)}
|
||||
branch={branchName}
|
||||
onLanded={onLanded}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
+179
@@ -0,0 +1,179 @@
|
||||
import { useCallback, useMemo, useState, type ReactNode } from 'react'
|
||||
import { toast } from 'sonner'
|
||||
import { basename } from '@/lib/path'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { useTranslate } from '@/i18n/use-translate'
|
||||
import { useAppStore } from '@/store'
|
||||
import type { AppState } from '@/store/types'
|
||||
import { worktreeGitCopyHostId } from '@/lib/worktree-git-copy'
|
||||
import { selectWorktreesByRepo } from '@/store/workspaces/catalog/workspace-record-fields'
|
||||
import { getIndexedWorktreeMap } from '@/store/slices/worktrees/listing/worktree-catalog-index'
|
||||
import {
|
||||
getExecutionHostLabel,
|
||||
type ExecutionHostId
|
||||
} from '../../../../../../shared/execution-host'
|
||||
import type { RuntimeClientTarget } from '../../../../../../shared/runtime-client-target'
|
||||
import { selectWorktreeAgentActivitySummary } from '@/components/sidebar/workspace-card/activity/worktree-agent-activity-summary'
|
||||
import type { BranchWorkspace } from './branch-picker-rows'
|
||||
import { BranchPicker } from './BranchPicker'
|
||||
import { useWorkspaceCopyStatus } from './use-workspace-copy-status'
|
||||
|
||||
export type WorkspaceBranchPickerProps = {
|
||||
worktreeId: string
|
||||
worktreePath: string
|
||||
hostId: ExecutionHostId
|
||||
repoId: string
|
||||
target: RuntimeClientTarget
|
||||
branch: string
|
||||
/** Replaces the generic agent notice, e.g. when the working agent is this chat's own. */
|
||||
agentNotice?: string
|
||||
trigger?: ReactNode
|
||||
/** Reads status when the picker opens; polling already covers the selected workspace. */
|
||||
refreshOnOpen?: boolean
|
||||
onCopyBranch?: () => void
|
||||
/** Runs after every landed switch. */
|
||||
onLanded: () => void
|
||||
}
|
||||
|
||||
/** Caches by list identity and selects only the name, so other hosts' edits re-render nothing. */
|
||||
function createEnvironmentNameSelector(environmentId: string | null) {
|
||||
let source: AppState['runtimeEnvironments'] | undefined
|
||||
let name: string | undefined
|
||||
return (state: AppState): string | undefined => {
|
||||
if (!environmentId) {
|
||||
return undefined
|
||||
}
|
||||
if (state.runtimeEnvironments !== source) {
|
||||
source = state.runtimeEnvironments
|
||||
name = source.find((host) => host.id === environmentId)?.name
|
||||
}
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
||||
/** One workspace's branch picker; every surface that switches branches in place renders this. */
|
||||
export function WorkspaceBranchPicker({
|
||||
worktreeId,
|
||||
worktreePath,
|
||||
hostId,
|
||||
repoId,
|
||||
target,
|
||||
branch,
|
||||
agentNotice,
|
||||
trigger,
|
||||
refreshOnOpen = false,
|
||||
onCopyBranch,
|
||||
onLanded
|
||||
}: WorkspaceBranchPickerProps) {
|
||||
const t = useTranslate()
|
||||
const [open, setOpen] = useState(false)
|
||||
const { statusKnown, statusReadError, conflictOperation, entries } = useWorkspaceCopyStatus({
|
||||
worktreeId,
|
||||
worktreePath,
|
||||
hostId,
|
||||
open,
|
||||
refreshOnOpen
|
||||
})
|
||||
const environmentId = target.kind === 'environment' ? target.environmentId : null
|
||||
const selectEnvironmentName = useMemo(
|
||||
() => createEnvironmentNameSelector(environmentId),
|
||||
[environmentId]
|
||||
)
|
||||
const environmentName = useAppStore(selectEnvironmentName)
|
||||
// Workspace rows need every worktree, not a folder section's owner-only map.
|
||||
const worktreeMap = useAppStore((state) => getIndexedWorktreeMap(selectWorktreesByRepo(state)))
|
||||
const agentWorking = useAppStore(
|
||||
(state) => selectWorktreeAgentActivitySummary(state, worktreeId).hasLiveWorking
|
||||
)
|
||||
const showDirtyBlocker =
|
||||
statusKnown && !statusReadError && conflictOperation === 'unknown' && entries.length > 0
|
||||
const changedCount = useMemo(
|
||||
() => (showDirtyBlocker ? new Set(entries.map((entry) => entry.path)).size : 0),
|
||||
[entries, showDirtyBlocker]
|
||||
)
|
||||
const onOpenWorkspace = useCallback(
|
||||
(workspace: BranchWorkspace) =>
|
||||
useAppStore.getState().setActiveWorktree(workspace.id, workspace.hostId),
|
||||
[]
|
||||
)
|
||||
const hostLabel = environmentName ?? getExecutionHostLabel(hostId)
|
||||
// Worktree ids repeat across hosts, so a remote copy is named with its host.
|
||||
const workspaceLabel =
|
||||
hostId === 'local' ? basename(worktreePath) : `${basename(worktreePath)} (${hostLabel})`
|
||||
const onSwitched = useCallback(
|
||||
(message?: string) => {
|
||||
if (message) {
|
||||
// The switch can land after the user moved on; name the workspace it happened in.
|
||||
const state = useAppStore.getState()
|
||||
const selected =
|
||||
state.activeWorktreeId === worktreeId &&
|
||||
worktreeGitCopyHostId(state, worktreeId) === hostId
|
||||
if (selected) {
|
||||
toast.warning(message, { duration: 15000 })
|
||||
} else {
|
||||
toast.warning(
|
||||
translate('sourceControl.branchPicker.switchedIn', 'In {{workspace}}', {
|
||||
workspace: workspaceLabel
|
||||
}),
|
||||
{ description: message, duration: 15000 }
|
||||
)
|
||||
}
|
||||
}
|
||||
onLanded()
|
||||
},
|
||||
[worktreeId, hostId, workspaceLabel, onLanded]
|
||||
)
|
||||
// Checking out moves HEAD under the agent, so creating a branch waits too; the host re-checks on switch.
|
||||
const blocker = agentWorking
|
||||
? (agentNotice ??
|
||||
t(
|
||||
'sourceControl.branchPicker.agentWorking',
|
||||
'An agent is working in this workspace. Switch branches after it finishes, or close its tab if it has stopped.'
|
||||
))
|
||||
: statusReadError
|
||||
? t(
|
||||
'sourceControl.branchPicker.statusFailed',
|
||||
"Orca couldn't read this checkout's changes. Refresh Source Control before switching."
|
||||
)
|
||||
: !statusKnown
|
||||
? t(
|
||||
'sourceControl.branchPicker.statusUnknown',
|
||||
'Read this checkout’s changes before switching.'
|
||||
)
|
||||
: conflictOperation !== 'unknown'
|
||||
? t(
|
||||
'sourceControl.branchPicker.conflict',
|
||||
'Finish or abort the {{operation}} before switching branches.',
|
||||
{ operation: conflictOperation }
|
||||
)
|
||||
: entries.length
|
||||
? t(
|
||||
'sourceControl.branchPicker.dirty',
|
||||
'Commit or discard {{count}} changed files before switching branches.',
|
||||
{
|
||||
count: changedCount,
|
||||
defaultValue_one:
|
||||
'Commit or discard {{count}} changed file before switching branches.'
|
||||
}
|
||||
)
|
||||
: null
|
||||
return (
|
||||
<BranchPicker
|
||||
key={`${hostId}:${worktreeId}`}
|
||||
branch={branch}
|
||||
blocker={blocker}
|
||||
dirtyOnlyBlocker={showDirtyBlocker && !agentWorking}
|
||||
trigger={trigger}
|
||||
onOpenChange={setOpen}
|
||||
onCopyBranch={onCopyBranch}
|
||||
context={{ target, worktreeId, worktreePath }}
|
||||
repoId={repoId}
|
||||
hostId={hostId}
|
||||
hostLabel={hostLabel}
|
||||
workspaceLabel={workspaceLabel}
|
||||
workspaces={worktreeMap}
|
||||
onOpenWorkspace={onOpenWorkspace}
|
||||
onSwitched={onSwitched}
|
||||
/>
|
||||
)
|
||||
}
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
// @vitest-environment happy-dom
|
||||
import type { ReactNode } from 'react'
|
||||
import { act } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { afterEach, beforeAll, expect, it, vi } from 'vitest'
|
||||
import { BranchPicker } from './BranchPicker'
|
||||
import {
|
||||
listRuntimeGitBranches,
|
||||
searchRuntimeRemoteBranches,
|
||||
switchRuntimeGitBranch
|
||||
} from '@/runtime/source-control/git/runtime-git-branch-client'
|
||||
|
||||
vi.mock('@/runtime/source-control/git/runtime-git-branch-client', () => ({
|
||||
listRuntimeGitBranches: vi.fn(),
|
||||
searchRuntimeRemoteBranches: vi.fn(),
|
||||
switchRuntimeGitBranch: vi.fn(),
|
||||
branchSwitchExistingBranch: vi.fn(() => null)
|
||||
}))
|
||||
vi.mock('@/components/ui/popover', () => ({
|
||||
Popover: ({
|
||||
children,
|
||||
onOpenChange
|
||||
}: {
|
||||
children: ReactNode
|
||||
onOpenChange: (o: boolean) => void
|
||||
}) => (
|
||||
<>
|
||||
<button onClick={() => onOpenChange(true)}>Open picker</button>
|
||||
{children}
|
||||
</>
|
||||
),
|
||||
PopoverTrigger: () => null,
|
||||
PopoverContent: ({ children }: { children: ReactNode }) => <div>{children}</div>
|
||||
}))
|
||||
Reflect.set(globalThis, 'IS_REACT_ACT_ENVIRONMENT', true)
|
||||
beforeAll(() => {
|
||||
Element.prototype.scrollIntoView ??= () => {}
|
||||
})
|
||||
const container = document.createElement('div')
|
||||
document.body.append(container)
|
||||
let root = createRoot(container)
|
||||
afterEach(async () => {
|
||||
await act(async () => root.unmount())
|
||||
root = createRoot(container)
|
||||
vi.clearAllMocks()
|
||||
})
|
||||
|
||||
it('keeps the copy button usable on the current row and out of the list keyboard', async () => {
|
||||
vi.mocked(listRuntimeGitBranches).mockResolvedValue({
|
||||
current: 'main',
|
||||
branches: ['main', 'feature']
|
||||
})
|
||||
vi.mocked(searchRuntimeRemoteBranches).mockResolvedValue({ refs: [], truncated: false })
|
||||
const onCopyBranch = vi.fn()
|
||||
await act(async () =>
|
||||
root.render(
|
||||
<BranchPicker
|
||||
branch="main"
|
||||
blocker={null}
|
||||
context={{ target: { kind: 'local' }, worktreeId: 'repo::/repo', worktreePath: '/repo' }}
|
||||
repoId="repo"
|
||||
hostId="local"
|
||||
hostLabel="This computer"
|
||||
workspaceLabel="repo"
|
||||
workspaces={new Map()}
|
||||
onOpenWorkspace={vi.fn()}
|
||||
onSwitched={vi.fn()}
|
||||
onCopyBranch={onCopyBranch}
|
||||
/>
|
||||
)
|
||||
)
|
||||
await act(async () => container.querySelector('button')?.click())
|
||||
const copy = container.querySelector('[aria-label="Copy branch name"]')
|
||||
if (!(copy instanceof HTMLElement)) {
|
||||
throw new Error('Copy button missing')
|
||||
}
|
||||
// A disabled item swallows pointer events, which would leave the button unclickable.
|
||||
expect(copy.closest('[cmdk-item]')?.getAttribute('aria-disabled')).toBe('false')
|
||||
// Highlight `feature` so a leaked Enter would switch to it.
|
||||
await act(async () =>
|
||||
container
|
||||
.querySelector('[cmdk-input]')
|
||||
?.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }))
|
||||
)
|
||||
expect(container.querySelector('[cmdk-item][aria-selected="true"]')?.textContent).toBe('feature')
|
||||
await act(async () =>
|
||||
copy.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }))
|
||||
)
|
||||
expect(switchRuntimeGitBranch).not.toHaveBeenCalled()
|
||||
await act(async () => copy.click())
|
||||
expect(onCopyBranch).toHaveBeenCalledOnce()
|
||||
expect(switchRuntimeGitBranch).not.toHaveBeenCalled()
|
||||
})
|
||||
@@ -32,15 +32,22 @@ export type BranchPickerOptions = {
|
||||
workspaces: ReadonlyMap<string, BranchWorkspace>
|
||||
onOpenWorkspace: (workspace: BranchWorkspace) => void
|
||||
onSwitched: (warning?: string) => void
|
||||
/** Every open change, including the picker closing itself after a switch. */
|
||||
onOpenChange?: (open: boolean) => void
|
||||
}
|
||||
export function useBranchPicker(options: BranchPickerOptions) {
|
||||
const [open, updateOpen] = useState(false)
|
||||
const [openedAt, setOpenedAt] = useState(0)
|
||||
const onOpenChangeRef = useRef(options.onOpenChange)
|
||||
useEffect(() => {
|
||||
onOpenChangeRef.current = options.onOpenChange
|
||||
}, [options.onOpenChange])
|
||||
const setOpen = useCallback((next: boolean) => {
|
||||
if (next) {
|
||||
setOpenedAt(Date.now())
|
||||
}
|
||||
updateOpen(next)
|
||||
onOpenChangeRef.current?.(next)
|
||||
}, [])
|
||||
const [query, setQuery] = useState('')
|
||||
const [local, setLocal] = useState(EMPTY_LOCAL)
|
||||
|
||||
+253
@@ -0,0 +1,253 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { act } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
||||
import type { Repo } from '../../../../../../shared/repo-types'
|
||||
import type { Worktree } from '../../../../../../shared/worktree/types'
|
||||
import type {
|
||||
GitStatusEntry,
|
||||
GitStatusResult
|
||||
} from '../../../../../../shared/git/status/git-status-types'
|
||||
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
|
||||
import { useAppStore } from '@/store/index'
|
||||
import { useWorkspaceCopyStatus, type WorkspaceCopyStatus } from './use-workspace-copy-status'
|
||||
import { recordWorktreeBranchSwitchLanded } from './workspace-branch-switch-status'
|
||||
import { resolveWorktreeGitCopyNow } from '@/lib/worktree-git-copy'
|
||||
import { refreshGitStatusForWorktree } from '../sync/git-status-refresh'
|
||||
|
||||
// The same project at the same path on this machine and on an SSH host share one status slot.
|
||||
const id = 'repo1::/srv/ai-tools'
|
||||
const path = '/srv/ai-tools'
|
||||
const initialAppState = useAppStore.getInitialState()
|
||||
const dirty: GitStatusEntry[] = [{ path: 'b.txt', status: 'modified', area: 'unstaged' }]
|
||||
const clean: GitStatusResult = {
|
||||
entries: [],
|
||||
head: 'aaa',
|
||||
branch: 'refs/heads/master',
|
||||
upstreamStatus: { hasUpstream: false, ahead: 0, behind: 0 },
|
||||
conflictOperation: 'unknown'
|
||||
}
|
||||
|
||||
function repo(overrides: Partial<Repo>): Repo {
|
||||
return {
|
||||
id: 'repo1',
|
||||
path,
|
||||
displayName: 'ai-tools',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0,
|
||||
kind: 'git',
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
function copy(overrides: Partial<Worktree>): Worktree {
|
||||
return {
|
||||
id,
|
||||
repoId: 'repo1',
|
||||
path,
|
||||
head: 'aaa',
|
||||
branch: 'refs/heads/master',
|
||||
isBare: false,
|
||||
isMainWorktree: true,
|
||||
displayName: 'master',
|
||||
comment: '',
|
||||
linkedIssue: null,
|
||||
linkedPR: null,
|
||||
linkedLinearIssue: null,
|
||||
isArchived: false,
|
||||
isUnread: false,
|
||||
isPinned: false,
|
||||
sortOrder: 0,
|
||||
lastActivityAt: 0,
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
const status = vi.fn<(args: { connectionId?: string }) => Promise<GitStatusResult>>()
|
||||
const container = document.createElement('div')
|
||||
let root = createRoot(container)
|
||||
Reflect.set(globalThis, 'IS_REACT_ACT_ENVIRONMENT', true)
|
||||
|
||||
beforeEach(() => {
|
||||
status.mockResolvedValue(clean)
|
||||
vi.stubGlobal('window', { ...window, api: { git: { status } } })
|
||||
useAppStore.setState({
|
||||
repos: [repo({ connectionId: null }), repo({ connectionId: 'box-b' })],
|
||||
worktreesByRepo: {
|
||||
repo1: [
|
||||
copy({ hostId: 'local' }),
|
||||
copy({ hostId: 'ssh:box-b', head: 'bbb', branch: 'refs/heads/feature' })
|
||||
]
|
||||
},
|
||||
// The SSH copy is selected and dirty.
|
||||
activeWorktreeId: id,
|
||||
activeWorkspaceExecutionHostId: 'ssh:box-b',
|
||||
gitStatusByWorktree: { [id]: [...dirty] },
|
||||
gitStatusHeadByWorktree: { [id]: 'bbb' }
|
||||
})
|
||||
})
|
||||
afterEach(async () => {
|
||||
await act(async () => root.unmount())
|
||||
root = createRoot(container)
|
||||
useAppStore.setState(initialAppState, true)
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
async function readFor(hostId: ExecutionHostId): Promise<{ current: WorkspaceCopyStatus | null }> {
|
||||
const seen: { current: WorkspaceCopyStatus | null } = { current: null }
|
||||
function Probe() {
|
||||
seen.current = useWorkspaceCopyStatus({
|
||||
worktreeId: id,
|
||||
worktreePath: path,
|
||||
hostId,
|
||||
open: true,
|
||||
refreshOnOpen: true
|
||||
})
|
||||
return null
|
||||
}
|
||||
await act(async () => root.render(<Probe />))
|
||||
return seen
|
||||
}
|
||||
|
||||
function deferStatus(): (result: GitStatusResult) => Promise<void> {
|
||||
let finish: (result: GitStatusResult) => void = () => {}
|
||||
status.mockImplementationOnce(() => new Promise((resolve) => (finish = resolve)))
|
||||
return async (result) => {
|
||||
await act(async () => finish(result))
|
||||
}
|
||||
}
|
||||
|
||||
it("reads a twin's own status instead of the selected copy's slot", async () => {
|
||||
const seen = await readFor('local')
|
||||
expect(seen.current).toMatchObject({ statusKnown: true, entries: [] })
|
||||
expect(useAppStore.getState().gitStatusByWorktree[id]).toEqual(dirty)
|
||||
expect(useAppStore.getState().gitStatusHeadByWorktree[id]).toBe('bbb')
|
||||
})
|
||||
|
||||
it('keeps a hostless local selection from claiming the slot for either copy', async () => {
|
||||
useAppStore.setState({ activeWorkspaceExecutionHostId: null })
|
||||
const seen = await readFor('ssh:box-b')
|
||||
expect(seen.current).toMatchObject({ statusKnown: true, entries: [] })
|
||||
expect(status).toHaveBeenCalledWith(expect.objectContaining({ connectionId: 'box-b' }))
|
||||
expect(useAppStore.getState().gitStatusByWorktree[id]).toEqual(dirty)
|
||||
})
|
||||
|
||||
it('drops an open-time refresh that lands after the user selects the twin', async () => {
|
||||
useAppStore.setState({
|
||||
activeWorkspaceExecutionHostId: 'local',
|
||||
gitStatusByWorktree: { [id]: [] }
|
||||
})
|
||||
const finish = deferStatus()
|
||||
await readFor('local')
|
||||
await act(async () =>
|
||||
useAppStore.setState({
|
||||
activeWorkspaceExecutionHostId: 'ssh:box-b',
|
||||
gitStatusByWorktree: { [id]: [...dirty] }
|
||||
})
|
||||
)
|
||||
await finish(clean)
|
||||
expect(useAppStore.getState().gitStatusByWorktree[id]).toEqual(dirty)
|
||||
expect(useAppStore.getState().gitStatusHeadByWorktree[id]).toBe('bbb')
|
||||
})
|
||||
|
||||
it('drops a landed-switch refresh that settles after the user selects the twin', async () => {
|
||||
useAppStore.setState({
|
||||
activeWorkspaceExecutionHostId: 'local',
|
||||
gitStatusByWorktree: { [id]: [] }
|
||||
})
|
||||
const finish = deferStatus()
|
||||
recordWorktreeBranchSwitchLanded(id, 'local', path)
|
||||
useAppStore.setState({
|
||||
activeWorkspaceExecutionHostId: 'ssh:box-b',
|
||||
gitStatusByWorktree: { [id]: [...dirty] }
|
||||
})
|
||||
await finish(clean)
|
||||
expect(useAppStore.getState().gitStatusByWorktree[id]).toEqual(dirty)
|
||||
})
|
||||
|
||||
it("blocks on a twin's status read that comes back with readError", async () => {
|
||||
status.mockResolvedValueOnce({
|
||||
entries: [],
|
||||
conflictOperation: 'unknown',
|
||||
readError: 'index unreadable'
|
||||
})
|
||||
const seen = await readFor('local')
|
||||
expect(seen.current?.statusReadError).toBe('index unreadable')
|
||||
})
|
||||
|
||||
it("doesn't trust the twin's slot when this copy becomes the owner", async () => {
|
||||
const seen = await readFor('local')
|
||||
expect(seen.current).toMatchObject({ statusKnown: true, entries: [] })
|
||||
const finish = deferStatus()
|
||||
await act(async () => useAppStore.setState({ activeWorkspaceExecutionHostId: 'local' }))
|
||||
// The slot still holds the SSH copy's dirty status until this copy's refresh lands.
|
||||
expect(seen.current?.entries).toEqual([])
|
||||
await finish(clean)
|
||||
expect(useAppStore.getState().gitStatusByWorktree[id]).toEqual([])
|
||||
expect(seen.current).toMatchObject({ statusKnown: true, entries: [] })
|
||||
})
|
||||
|
||||
it("shows the copy's own status when an identical newer poll supersedes the picker refresh", async () => {
|
||||
// Both copies clean at the same commit; the store keeps the same entries reference for an identical status.
|
||||
useAppStore.setState({
|
||||
gitStatusByWorktree: { [id]: [] },
|
||||
gitStatusHeadByWorktree: { [id]: 'aaa' }
|
||||
})
|
||||
const seen: { current: WorkspaceCopyStatus | null } = { current: null }
|
||||
function Probe({ open }: { open: boolean }) {
|
||||
seen.current = useWorkspaceCopyStatus({
|
||||
worktreeId: id,
|
||||
worktreePath: path,
|
||||
hostId: 'local',
|
||||
open,
|
||||
refreshOnOpen: true
|
||||
})
|
||||
return null
|
||||
}
|
||||
await act(async () => root.render(<Probe open={false} />))
|
||||
await act(async () => useAppStore.setState({ activeWorkspaceExecutionHostId: 'local' }))
|
||||
const finishPicker = deferStatus()
|
||||
await act(async () => root.render(<Probe open />))
|
||||
const target = resolveWorktreeGitCopyNow(id, 'local')
|
||||
if (!target) {
|
||||
throw new Error('Local copy unresolved')
|
||||
}
|
||||
const state = useAppStore.getState()
|
||||
await act(async () =>
|
||||
refreshGitStatusForWorktree({
|
||||
target: target.transport,
|
||||
ownerHostId: target.hostId,
|
||||
worktreeId: id,
|
||||
worktreePath: path,
|
||||
deps: {
|
||||
setGitStatus: state.setGitStatus,
|
||||
updateWorktreeGitIdentity: state.updateWorktreeGitIdentity,
|
||||
setUpstreamStatus: state.setUpstreamStatus,
|
||||
fetchUpstreamStatus: async () => null
|
||||
}
|
||||
})
|
||||
)
|
||||
await finishPicker(clean)
|
||||
expect(seen.current).toMatchObject({ statusKnown: true, entries: [] })
|
||||
})
|
||||
|
||||
it("keeps the twin's status out after selecting it and back while a refresh is in flight", async () => {
|
||||
useAppStore.setState({
|
||||
activeWorkspaceExecutionHostId: 'local',
|
||||
gitStatusByWorktree: { [id]: [] }
|
||||
})
|
||||
const finishFirst = deferStatus()
|
||||
const seen = await readFor('local')
|
||||
await act(async () =>
|
||||
useAppStore.setState({
|
||||
activeWorkspaceExecutionHostId: 'ssh:box-b',
|
||||
gitStatusByWorktree: { [id]: [...dirty] },
|
||||
gitStatusHeadByWorktree: { [id]: 'bbb' }
|
||||
})
|
||||
)
|
||||
const finishSecond = deferStatus()
|
||||
await act(async () => useAppStore.setState({ activeWorkspaceExecutionHostId: 'local' }))
|
||||
await finishFirst(clean)
|
||||
expect(seen.current?.entries).toEqual([])
|
||||
await finishSecond(clean)
|
||||
expect(seen.current?.entries).toEqual([])
|
||||
})
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { useAppStore } from '@/store'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
import { resolveWorktreeGitCopyNow } from '@/lib/worktree-git-copy'
|
||||
import { getRuntimeGitStatus } from '@/runtime/source-control/git/runtime-git-status-client'
|
||||
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
|
||||
import type {
|
||||
GitConflictOperation,
|
||||
GitStatusEntry,
|
||||
GitStatusResult
|
||||
} from '../../../../../../shared/git/status/git-status-types'
|
||||
import { copyOwnsStatusSlot, refreshWorktreeCopyStatus } from './workspace-branch-switch-status'
|
||||
|
||||
const NO_ENTRIES: GitStatusEntry[] = []
|
||||
|
||||
export type WorkspaceCopyStatus = {
|
||||
statusKnown: boolean
|
||||
statusReadError: string | undefined
|
||||
conflictOperation: GitConflictOperation
|
||||
entries: GitStatusEntry[]
|
||||
}
|
||||
|
||||
type PrivateRead = { key: string; status?: GitStatusResult; error?: string }
|
||||
|
||||
/**
|
||||
* The picker's view of one copy's checkout. The owning copy uses the shared slots; a twin of
|
||||
* another selected copy reads its own status into picker state so neither copy sees the other's.
|
||||
*/
|
||||
export function useWorkspaceCopyStatus({
|
||||
worktreeId,
|
||||
worktreePath,
|
||||
hostId,
|
||||
open,
|
||||
refreshOnOpen
|
||||
}: {
|
||||
worktreeId: string
|
||||
worktreePath: string
|
||||
hostId: ExecutionHostId
|
||||
open: boolean
|
||||
refreshOnOpen: boolean
|
||||
}): WorkspaceCopyStatus {
|
||||
const owner = useAppStore((state) => copyOwnsStatusSlot(state, worktreeId, hostId))
|
||||
const head = useAppStore((state) =>
|
||||
owner ? state.gitStatusHeadByWorktree?.[worktreeId] : undefined
|
||||
)
|
||||
const slotReadError = useAppStore((state) =>
|
||||
owner ? state.gitStatusReadErrorByWorktree?.[worktreeId] : undefined
|
||||
)
|
||||
const slotConflict = useAppStore((state) =>
|
||||
owner ? state.gitConflictOperationByWorktree[worktreeId] : undefined
|
||||
)
|
||||
const slotEntries = useAppStore((state) =>
|
||||
owner ? state.gitStatusByWorktree[worktreeId] : undefined
|
||||
)
|
||||
const [read, setRead] = useState<PrivateRead | null>(null)
|
||||
// Selecting a copy doesn't clear the slots, so on becoming owner they may still hold the twin's
|
||||
// status; until they change, this copy reads its own status as a non-owner would.
|
||||
const [wasOwner, setWasOwner] = useState(owner)
|
||||
const [inherited, setInherited] = useState<{ head?: string; entries?: GitStatusEntry[] } | null>(
|
||||
null
|
||||
)
|
||||
if (owner !== wasOwner) {
|
||||
setWasOwner(owner)
|
||||
setInherited(owner ? { head, entries: slotEntries } : null)
|
||||
}
|
||||
const slotTrusted =
|
||||
owner && !(inherited && inherited.head === head && inherited.entries === slotEntries)
|
||||
const key = `${hostId}\u0000${worktreeId}\u0000${worktreePath}`
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
return
|
||||
}
|
||||
if (owner && refreshOnOpen) {
|
||||
refreshWorktreeCopyStatus(worktreeId, hostId, worktreePath)
|
||||
}
|
||||
if (slotTrusted) {
|
||||
return
|
||||
}
|
||||
const copy = resolveWorktreeGitCopyNow(worktreeId, hostId)
|
||||
if (!copy) {
|
||||
return
|
||||
}
|
||||
let stale = false
|
||||
void getRuntimeGitStatus(
|
||||
{ target: copy.transport, worktreeId, worktreePath, connectionId: copy.connectionId },
|
||||
{ admissionTier: 'interactive' }
|
||||
).then(
|
||||
(status) => {
|
||||
if (!stale) {
|
||||
setRead({ key, status })
|
||||
}
|
||||
},
|
||||
(error: unknown) => {
|
||||
if (!stale) {
|
||||
setRead({
|
||||
key,
|
||||
error:
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: translate(
|
||||
'sourceControl.branchPicker.statusFailed',
|
||||
"Orca couldn't read this checkout's changes. Refresh Source Control before switching."
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
)
|
||||
return () => {
|
||||
stale = true
|
||||
}
|
||||
}, [open, owner, slotTrusted, refreshOnOpen, worktreeId, hostId, worktreePath, key])
|
||||
if (slotTrusted) {
|
||||
return {
|
||||
statusKnown: head !== undefined,
|
||||
statusReadError: slotReadError,
|
||||
conflictOperation: slotConflict ?? 'unknown',
|
||||
entries: slotEntries ?? NO_ENTRIES
|
||||
}
|
||||
}
|
||||
const own = read?.key === key ? read : null
|
||||
return {
|
||||
statusKnown: own?.status !== undefined,
|
||||
// A failed status can come back as a result carrying readError rather than a rejection.
|
||||
statusReadError: own?.error ?? own?.status?.readError,
|
||||
conflictOperation: own?.status?.conflictOperation ?? 'unknown',
|
||||
entries: own?.status?.entries ?? NO_ENTRIES
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
import { useAppStore } from '@/store'
|
||||
import type { AppState } from '@/store/types'
|
||||
import {
|
||||
resolveWorktreeGitCopyNow,
|
||||
worktreeCopyPushTarget,
|
||||
worktreeGitCopyHostId
|
||||
} from '@/lib/worktree-git-copy'
|
||||
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
|
||||
import {
|
||||
clearLandedBranchSwitchError,
|
||||
getWorktreeOperationStore
|
||||
} from '../panel/worktree-operation-store'
|
||||
import { refreshGitStatusForWorktree } from '../sync/git-status-refresh'
|
||||
|
||||
/** Status slots are keyed by id alone; only the copy the live resolver names may read or write them. */
|
||||
export function copyOwnsStatusSlot(
|
||||
state: AppState,
|
||||
worktreeId: string,
|
||||
hostId: ExecutionHostId
|
||||
): boolean {
|
||||
return worktreeGitCopyHostId(state, worktreeId) === hostId
|
||||
}
|
||||
|
||||
/** Polling covers only the active workspace; a picker elsewhere would show stale or unknown changes. */
|
||||
export function refreshWorktreeCopyStatus(
|
||||
worktreeId: string,
|
||||
hostId: ExecutionHostId,
|
||||
worktreePath: string
|
||||
): void {
|
||||
const state = useAppStore.getState()
|
||||
const copy = resolveWorktreeGitCopyNow(worktreeId, hostId)
|
||||
if (!copy || !copyOwnsStatusSlot(state, worktreeId, hostId)) {
|
||||
return
|
||||
}
|
||||
void refreshGitStatusForWorktree({
|
||||
target: copy.transport,
|
||||
ownerHostId: copy.hostId,
|
||||
worktreeId,
|
||||
worktreePath,
|
||||
connectionId: copy.connectionId,
|
||||
pushTarget: worktreeCopyPushTarget(state, worktreeId, copy.hostId),
|
||||
deps: state,
|
||||
request: {
|
||||
admissionTier: 'interactive',
|
||||
reuseLineStats: true,
|
||||
// The user can select a twin while this read is in flight.
|
||||
shouldApply: () => copyOwnsStatusSlot(useAppStore.getState(), worktreeId, hostId)
|
||||
}
|
||||
}).catch((error: unknown) => console.warn('[BranchPicker] git status refresh failed', error))
|
||||
}
|
||||
|
||||
/** What the Source Control panel does after a landed switch, for a picker outside the panel. */
|
||||
export function recordWorktreeBranchSwitchLanded(
|
||||
worktreeId: string,
|
||||
hostId: ExecutionHostId,
|
||||
worktreePath: string
|
||||
): void {
|
||||
clearLandedBranchSwitchError(getWorktreeOperationStore(worktreeId, hostId, undefined))
|
||||
refreshWorktreeCopyStatus(worktreeId, hostId, worktreePath)
|
||||
}
|
||||
+6
-5
@@ -8,7 +8,11 @@ import { useStore } from 'zustand'
|
||||
import { worktreeGitCopyHostId } from '@/lib/worktree-git-copy'
|
||||
import type { GitConflictOperation } from '../../../../../../shared/git/status/git-status-types'
|
||||
import { remoteActionErrorSettledByConflictOperation } from '../sync/remote-refresh'
|
||||
import { getWorktreeOperationStore, writeWorktreeCommitDraft } from './worktree-operation-store'
|
||||
import {
|
||||
clearLandedBranchSwitchError,
|
||||
getWorktreeOperationStore,
|
||||
writeWorktreeCommitDraft
|
||||
} from './worktree-operation-store'
|
||||
|
||||
/** Bind the panel to its owner's operation record; admission reads `operationStore.getState()`. */
|
||||
export function useSourceControlWorktreeOperationState({
|
||||
@@ -48,12 +52,9 @@ export function useSourceControlWorktreeOperationState({
|
||||
writeWorktreeCommitDraft(operationStore, update),
|
||||
[operationStore]
|
||||
)
|
||||
// A landed switch clears the last action error, which belonged to the previous branch.
|
||||
const recordBranchSwitchOutcome = useCallback(
|
||||
(refresh?: () => Promise<void>): void => {
|
||||
if (operationStore.getState().remoteActionError) {
|
||||
operationStore.setState({ remoteActionError: null })
|
||||
}
|
||||
clearLandedBranchSwitchError(operationStore)
|
||||
void refresh?.().catch(() => {})
|
||||
},
|
||||
[operationStore]
|
||||
|
||||
+7
@@ -186,6 +186,13 @@ export function writeWorktreeCommitDraft(
|
||||
}
|
||||
}
|
||||
|
||||
/** A landed switch clears the last action error, which belonged to the previous branch. */
|
||||
export function clearLandedBranchSwitchError(store: WorktreeOperationStore): void {
|
||||
if (store.getState().remoteActionError) {
|
||||
store.setState({ remoteActionError: null })
|
||||
}
|
||||
}
|
||||
|
||||
export function setCreatePrIntentNotice(
|
||||
store: WorktreeOperationStore,
|
||||
notice: CreatePrIntentNotice | null
|
||||
|
||||
+12
-4
@@ -6,6 +6,7 @@ import { useAppStore } from '@/store/index'
|
||||
import type { AppState } from '@/store/types'
|
||||
import { UNRESOLVED_GIT_HOST_ERROR } from '@/store/slices/editor/git/git-operation-target'
|
||||
import type { AttachedWorktreeOwner } from '../../folder-workspace-attached-worktrees'
|
||||
import type { ExecutionHostId } from '../../../../../../shared/execution-host'
|
||||
|
||||
export function sourceControlFileWatchRuntimeEnvironmentId(
|
||||
state: AppState,
|
||||
@@ -25,9 +26,15 @@ export function sourceControlFileWatchRuntimeEnvironmentId(
|
||||
|
||||
function ownerTargetFor(
|
||||
state: AppState,
|
||||
worktreeId: string | null | undefined
|
||||
worktreeId: string | null | undefined,
|
||||
hostId?: ExecutionHostId
|
||||
): RuntimeClientTarget | null {
|
||||
return worktreeId ? runtimeTargetForWorkspaceOwner(state, { workspaceId: worktreeId }) : null
|
||||
return worktreeId
|
||||
? runtimeTargetForWorkspaceOwner(state, {
|
||||
workspaceId: worktreeId,
|
||||
...(hostId ? { hostId } : {})
|
||||
})
|
||||
: null
|
||||
}
|
||||
|
||||
/** Resolve the worktree owner, never mutable host focus; missing/disagreeing rows return null. */
|
||||
@@ -39,11 +46,12 @@ export function getWorktreeGitOwnerTarget(
|
||||
|
||||
/** {@link getWorktreeGitOwnerTarget} as a hook with a stable identity per owner. */
|
||||
export function useWorktreeGitOwnerTarget(
|
||||
worktreeId: string | null | undefined
|
||||
worktreeId: string | null | undefined,
|
||||
hostId?: ExecutionHostId
|
||||
): RuntimeClientTarget | null {
|
||||
// Subscribe by primitive owner key; fresh resolver objects would rerender every write.
|
||||
const ownerKey = useAppStore((state) => {
|
||||
const target = ownerTargetFor(state, worktreeId)
|
||||
const target = ownerTargetFor(state, worktreeId, hostId)
|
||||
return target ? (target.kind === 'environment' ? `env:${target.environmentId}` : 'local') : null
|
||||
})
|
||||
return useMemo(
|
||||
|
||||
@@ -20191,6 +20191,7 @@
|
||||
"copyIdentity": "{{value0}} kopieren",
|
||||
"folder": "Ordner",
|
||||
"mainCheckout": "Haupt-Checkout",
|
||||
"turnWorking": "Der Agent dieses Chats arbeitet. Wechsle den Branch, wenn sein Zug beendet ist.",
|
||||
"worktree": "Worktree"
|
||||
},
|
||||
"explicitChatWindows": "Der Chat dieses Agenten ist unter Windows noch nicht verfügbar. Öffne ihn stattdessen in einem Terminal.",
|
||||
@@ -21300,6 +21301,7 @@
|
||||
"switch": "Branch wechseln: {{branch}}",
|
||||
"search": "Branches suchen",
|
||||
"recover": "Zu {{branch}} wechseln",
|
||||
"copy": "Branch-Namen kopieren",
|
||||
"create": "Branch {{name}} aus {{branch}} erstellen",
|
||||
"open": "Arbeitsbereich öffnen",
|
||||
"occupied": "Ausgecheckt in {{path}}",
|
||||
|
||||
@@ -20756,6 +20756,7 @@
|
||||
"copyIdentity": "Copy {{value0}}",
|
||||
"folder": "Folder",
|
||||
"mainCheckout": "Main checkout",
|
||||
"turnWorking": "This chat's agent is working. Switch branches after its turn finishes.",
|
||||
"worktree": "Worktree"
|
||||
},
|
||||
"creationChatNotOpened": "Your worktree is ready, but the chat could not open. Retry to open it with your message.",
|
||||
@@ -22008,6 +22009,7 @@
|
||||
"switch": "Switch branch: {{branch}}",
|
||||
"search": "Search branches",
|
||||
"recover": "Switch to {{branch}}",
|
||||
"copy": "Copy branch name",
|
||||
"create": "Create branch {{name}} from {{branch}}",
|
||||
"open": "Open workspace",
|
||||
"occupied": "Checked out in {{path}}",
|
||||
|
||||
@@ -19994,6 +19994,7 @@
|
||||
"copyIdentity": "Copiar {{value0}}",
|
||||
"folder": "Carpeta",
|
||||
"mainCheckout": "Checkout principal",
|
||||
"turnWorking": "El agente de este chat está trabajando. Cambia de rama cuando termine su turno.",
|
||||
"worktree": "Worktree"
|
||||
},
|
||||
"explicitChatWindows": "El chat de este agente aún no está disponible en Windows. Ábralo en una terminal.",
|
||||
@@ -22107,6 +22108,7 @@
|
||||
"switch": "Cambiar de rama: {{branch}}",
|
||||
"search": "Buscar ramas",
|
||||
"recover": "Cambiar a {{branch}}",
|
||||
"copy": "Copiar nombre de la rama",
|
||||
"create": "Crear la rama {{name}} desde {{branch}}",
|
||||
"open": "Abrir espacio de trabajo",
|
||||
"occupied": "Activa en {{path}}",
|
||||
|
||||
@@ -20215,6 +20215,7 @@
|
||||
"copyIdentity": "Copier {{value0}}",
|
||||
"folder": "Dossier",
|
||||
"mainCheckout": "Copie principale",
|
||||
"turnWorking": "L’agent de ce chat est en cours d’exécution. Changez de branche une fois son tour terminé.",
|
||||
"worktree": "Worktree"
|
||||
},
|
||||
"explicitChatWindows": "Le chat de cet agent n’est pas encore disponible sous Windows. Ouvrez-le plutôt dans un terminal.",
|
||||
@@ -21651,6 +21652,7 @@
|
||||
"switch": "Changer de branche : {{branch}}",
|
||||
"search": "Rechercher des branches",
|
||||
"recover": "Passer à {{branch}}",
|
||||
"copy": "Copier le nom de la branche",
|
||||
"create": "Créer la branche {{name}} à partir de {{branch}}",
|
||||
"open": "Ouvrir l’espace de travail",
|
||||
"occupied": "Extraite dans {{path}}",
|
||||
|
||||
@@ -19485,6 +19485,7 @@
|
||||
"copyIdentity": "{{value0}} をコピー",
|
||||
"folder": "フォルダー",
|
||||
"mainCheckout": "メインチェックアウト",
|
||||
"turnWorking": "このチャットの Agent が作業中です。ターンが終わってからブランチを切り替えてください。",
|
||||
"worktree": "ワークツリー"
|
||||
},
|
||||
"explicitChatWindows": "この Agent のチャットはまだ Windows では利用できません。ターミナルで開いてください。",
|
||||
@@ -21012,6 +21013,7 @@
|
||||
"switch": "ブランチを切り替え: {{branch}}",
|
||||
"search": "ブランチを検索",
|
||||
"recover": "{{branch}} に切り替え",
|
||||
"copy": "ブランチ名をコピー",
|
||||
"create": "{{branch}} からブランチ {{name}} を作成",
|
||||
"open": "ワークスペースを開く",
|
||||
"occupied": "{{path}} でチェックアウト済み",
|
||||
|
||||
@@ -19485,6 +19485,7 @@
|
||||
"copyIdentity": "{{value0}} 복사",
|
||||
"folder": "폴더",
|
||||
"mainCheckout": "기본 체크아웃",
|
||||
"turnWorking": "이 채팅의 에이전트가 작업 중입니다. 턴이 끝난 후 브랜치를 전환하세요.",
|
||||
"worktree": "작업 트리"
|
||||
},
|
||||
"explicitChatWindows": "이 에이전트의 채팅은 아직 Windows에서 사용할 수 없습니다. 대신 터미널에서 여세요.",
|
||||
@@ -21012,6 +21013,7 @@
|
||||
"switch": "브랜치 전환: {{branch}}",
|
||||
"search": "브랜치 검색",
|
||||
"recover": "{{branch}}(으)로 전환",
|
||||
"copy": "브랜치 이름 복사",
|
||||
"create": "{{branch}}에서 {{name}} 브랜치 만들기",
|
||||
"open": "작업 공간 열기",
|
||||
"occupied": "{{path}}에서 체크아웃됨",
|
||||
|
||||
@@ -301,6 +301,7 @@
|
||||
"switch": "Trocar de branch: {{branch}}",
|
||||
"search": "Pesquisar branches",
|
||||
"recover": "Trocar para {{branch}}",
|
||||
"copy": "Copiar nome do branch",
|
||||
"create": "Criar branch {{name}} a partir de {{branch}}",
|
||||
"open": "Abrir espaço de trabalho",
|
||||
"occupied": "Em uso em {{path}}",
|
||||
@@ -21170,6 +21171,7 @@
|
||||
"copyIdentity": "Copiar {{value0}}",
|
||||
"folder": "Pasta",
|
||||
"mainCheckout": "Checkout principal",
|
||||
"turnWorking": "O agente deste chat está trabalhando. Troque de branch quando o turno dele terminar.",
|
||||
"worktree": "Worktree"
|
||||
},
|
||||
"explicitChatWindows": "O chat deste agente ainda não está disponível no Windows. Abra-o em um terminal.",
|
||||
|
||||
@@ -20858,6 +20858,7 @@
|
||||
"copyIdentity": "Копировать {{value0}}",
|
||||
"folder": "Папка",
|
||||
"mainCheckout": "Основная рабочая копия",
|
||||
"turnWorking": "Агент этого чата работает. Переключите ветку после завершения его хода.",
|
||||
"worktree": "Рабочее дерево"
|
||||
},
|
||||
"explicitChatWindows": "Чат этого агента пока недоступен в Windows. Откройте его в терминале.",
|
||||
@@ -21996,6 +21997,7 @@
|
||||
"switch": "Сменить ветку: {{branch}}",
|
||||
"search": "Поиск веток",
|
||||
"recover": "Переключиться на {{branch}}",
|
||||
"copy": "Копировать имя ветки",
|
||||
"create": "Создать ветку {{name}} из {{branch}}",
|
||||
"open": "Открыть рабочее пространство",
|
||||
"occupied": "Извлечена в {{path}}",
|
||||
|
||||
@@ -20173,6 +20173,7 @@
|
||||
"copyIdentity": "{{value0}} kopyala",
|
||||
"folder": "Klasör",
|
||||
"mainCheckout": "Ana çalışma kopyası",
|
||||
"turnWorking": "Bu sohbetin ajanı çalışıyor. Dalı, sırası bittikten sonra değiştirin.",
|
||||
"worktree": "Worktree"
|
||||
},
|
||||
"explicitChatWindows": "Bu ajanın sohbeti henüz Windows'ta kullanılamıyor. Bunun yerine bir terminalde açın.",
|
||||
@@ -21281,6 +21282,7 @@
|
||||
"switch": "Dal değiştir: {{branch}}",
|
||||
"search": "Dallarda ara",
|
||||
"recover": "{{branch}} dalına geç",
|
||||
"copy": "Dal adını kopyala",
|
||||
"create": "{{branch}} dalından {{name}} dalını oluştur",
|
||||
"open": "Çalışma alanını aç",
|
||||
"occupied": "{{path}} konumunda kullanımda",
|
||||
|
||||
@@ -19882,6 +19882,7 @@
|
||||
"copyIdentity": "複製 {{value0}}",
|
||||
"folder": "資料夾",
|
||||
"mainCheckout": "主要工作副本",
|
||||
"turnWorking": "此聊天的代理正在工作。請在其回合結束後再切換分支。",
|
||||
"worktree": "工作樹"
|
||||
},
|
||||
"explicitChatWindows": "此 Agent 的聊天尚不支援 Windows。請改為在終端機中開啟。",
|
||||
@@ -20981,6 +20982,7 @@
|
||||
"switch": "切換分支:{{branch}}",
|
||||
"search": "搜尋分支",
|
||||
"recover": "切換到 {{branch}}",
|
||||
"copy": "複製分支名稱",
|
||||
"create": "從 {{branch}} 建立分支 {{name}}",
|
||||
"open": "開啟工作區",
|
||||
"occupied": "已在 {{path}} 中簽出",
|
||||
|
||||
@@ -19426,6 +19426,7 @@
|
||||
"copyIdentity": "复制 {{value0}}",
|
||||
"folder": "文件夹",
|
||||
"mainCheckout": "主工作副本",
|
||||
"turnWorking": "此聊天的代理正在工作。请在其回合结束后再切换分支。",
|
||||
"worktree": "工作树"
|
||||
},
|
||||
"explicitChatWindows": "此 Agent 的聊天暂不支持 Windows。请改为在终端中打开。",
|
||||
@@ -21012,6 +21013,7 @@
|
||||
"switch": "切换分支:{{branch}}",
|
||||
"search": "搜索分支",
|
||||
"recover": "切换到 {{branch}}",
|
||||
"copy": "复制分支名称",
|
||||
"create": "从 {{branch}} 创建分支 {{name}}",
|
||||
"open": "打开工作区",
|
||||
"occupied": "已在 {{path}} 中检出",
|
||||
|
||||
Reference in New Issue
Block a user