diff --git a/src/main/cloud-workspaces/cloud-workspaces-client.test.ts b/src/main/cloud-workspaces/cloud-workspaces-client.test.ts index 3354b19c6c1..e287f3cb383 100644 --- a/src/main/cloud-workspaces/cloud-workspaces-client.test.ts +++ b/src/main/cloud-workspaces/cloud-workspaces-client.test.ts @@ -269,3 +269,30 @@ describe('cloud workspaces client: owner change (OWNER-TRANSFER)', () => { expect(init?.method).toBe('POST') }) }) + +describe('cloud workspaces client: git actor (GH-ACTING-LINE)', () => { + it('asks for feature git-actor on the detail read and parses the actor', async () => { + const { client, fetch } = clientAnswering(200, { + workspace: { id: SBX }, + gitActor: { kind: 'member', userId: 'u1', login: 'octo-dev', until: 123 }, + viewerConnected: true + }) + expect(await client.gitActor(SBX)).toEqual({ + gitActor: { kind: 'member', userId: 'u1', login: 'octo-dev', until: 123 }, + viewerConnected: true + }) + const [url, init] = fetch.mock.calls[0]! + expect(String(url)).toBe(`https://cp.example.test/v1/team/workspaces/${SBX}`) + expect(new Headers(init?.headers).get('x-orca-sandbox-features')).toBe('git-actor') + }) + + it('an older control plane (no field) or an unknown shape reads as no actor', async () => { + expect(await clientAnswering(200, { workspace: { id: SBX } }).client.gitActor(SBX)).toEqual({}) + expect( + await clientAnswering(200, { + gitActor: { kind: 'robot' }, + viewerConnected: 'yes' + }).client.gitActor(SBX) + ).toEqual({}) + }) +}) diff --git a/src/main/cloud-workspaces/cloud-workspaces-client.ts b/src/main/cloud-workspaces/cloud-workspaces-client.ts index 97454f32d17..a10319340a8 100644 --- a/src/main/cloud-workspaces/cloud-workspaces-client.ts +++ b/src/main/cloud-workspaces/cloud-workspaces-client.ts @@ -15,6 +15,7 @@ import { CloudWorkspaceListResponseSchema, CloudWorkspacePresenceResponseSchema, CloudWorkspaceResponseSchema, + CloudWorkspaceGitActorSchema, CloudWorkspaceFollowSchema, OrgPromptsSchema, type CloudWorkspaceLinkTarget, @@ -78,7 +79,8 @@ export function createCloudWorkspacesClient(options: CloudWorkspacesClientOption schema: z.ZodType, body?: unknown, timeoutMs = CONTROL_TIMEOUT_MS, - maxBytes = MAX_RESPONSE_BYTES + maxBytes = MAX_RESPONSE_BYTES, + features?: string ): Promise { const signal = AbortSignal.timeout(timeoutMs) let token: string @@ -95,6 +97,7 @@ export function createCloudWorkspacesClient(options: CloudWorkspacesClientOption headers: { authorization: `Bearer ${token}`, accept: 'application/json', + ...(features ? { 'x-orca-sandbox-features': features } : {}), ...(body === undefined ? {} : { 'content-type': 'application/json' }) }, body: body === undefined ? undefined : JSON.stringify(body), @@ -157,6 +160,11 @@ export function createCloudWorkspacesClient(options: CloudWorkspacesClientOption async get(id: string) { return (await call('GET', ws(id), CloudWorkspaceResponseSchema)).workspace }, + /** GH-ACTING-LINE: the detail read, asking for who git acts as. */ + async gitActor(id: string) { + const read = CloudWorkspaceGitActorSchema + return call('GET', ws(id), read, undefined, undefined, undefined, 'git-actor') + }, async patch(id: string, patch: CloudWorkspacePatch) { return call('PATCH', ws(id), CloudWorkspaceResponseSchema.extend({}).passthrough(), patch) }, diff --git a/src/main/cloud-workspaces/cloud-workspaces-service.ts b/src/main/cloud-workspaces/cloud-workspaces-service.ts index 724f7cb8602..c5322152ae7 100644 --- a/src/main/cloud-workspaces/cloud-workspaces-service.ts +++ b/src/main/cloud-workspaces/cloud-workspaces-service.ts @@ -213,6 +213,7 @@ export function createCloudWorkspacesService(deps: { return reader.read(id) }), get: (id: string) => wrap(() => client.get(id)), + gitActor: (id: string) => wrap(() => client.gitActor(id)), follow: (id: string, follow: boolean) => wrap(() => client.follow(id, follow)), patch: (id: string, patch: CloudWorkspacePatch) => wrap(async () => (await client.patch(id, patch)).workspace), diff --git a/src/main/ipc/cloud-workspaces-prefs.ts b/src/main/ipc/cloud-workspaces-prefs.ts index 03cefe190fb..da2bc701e51 100644 --- a/src/main/ipc/cloud-workspaces-prefs.ts +++ b/src/main/ipc/cloud-workspaces-prefs.ts @@ -23,6 +23,12 @@ export function registerCloudWorkspacePrefsHandlers( ? s.putPrefs(parsed.data.document, parsed.data.revision) : INVALID }) + // GH-ACTING-LINE: who the workspace's pushes and PRs go out as right now. + handle('cloudWorkspaces:gitActor', async (args) => { + const parsed = z.object({ id: z.string().regex(/^sbx_[0-9a-f]{24}$/) }).safeParse(args) + const s = await getService() + return !s ? NOT_CONFIGURED : parsed.success ? s.gitActor(parsed.data.id) : INVALID + }) handle('cloudWorkspaces:getOrgSlug', async (args) => { const parsed = z.object({ orgName: z.string().max(200).nullable().optional() }).safeParse(args) const s = await getService() diff --git a/src/preload/api/cloud-workspaces-api.ts b/src/preload/api/cloud-workspaces-api.ts index da5ff2fdf7c..08c13da827e 100644 --- a/src/preload/api/cloud-workspaces-api.ts +++ b/src/preload/api/cloud-workspaces-api.ts @@ -1,5 +1,6 @@ import type { CloudWorkspace, + CloudWorkspaceGitActor, CloudWorkspaceFollow, CloudWorkspaceGrant, CloudOrgSlug, @@ -41,6 +42,8 @@ export type CloudWorkspacesApi = { available: () => Promise list: (query: CloudWorkspaceListQuery) => Promise get: (id: string) => Promise> + /** GH-ACTING-LINE: who the workspace's pushes and PRs go out as right now. */ + gitActor?: (id: string) => Promise> patch: (id: string, patch: CloudWorkspacePatch) => Promise> /** Follow or unfollow a team workspace (PARITY-FOLLOW): the caller's state and its followers. */ follow: (id: string, follow: boolean) => Promise> diff --git a/src/preload/api/cloud-workspaces-bridge.ts b/src/preload/api/cloud-workspaces-bridge.ts index 2ea27c1ffa7..b9915afa74c 100644 --- a/src/preload/api/cloud-workspaces-bridge.ts +++ b/src/preload/api/cloud-workspaces-bridge.ts @@ -5,6 +5,7 @@ export const cloudWorkspacesApi = { available: () => ipcRenderer.invoke('cloudWorkspaces:available'), list: (query) => ipcRenderer.invoke('cloudWorkspaces:list', query), get: (id) => ipcRenderer.invoke('cloudWorkspaces:get', { id }), + gitActor: (id) => ipcRenderer.invoke('cloudWorkspaces:gitActor', { id }), patch: (id, patch) => ipcRenderer.invoke('cloudWorkspaces:patch', { id, patch }), follow: (id, follow) => ipcRenderer.invoke('cloudWorkspaces:follow', { id, follow }), resolveLink: (target, chatId) => diff --git a/src/renderer/src/components/cloud-workspaces/CloudWorkspaceFollowers.tsx b/src/renderer/src/components/cloud-workspaces/CloudWorkspaceFollowers.tsx index 80ddb6559a5..fbe9d1b2719 100644 --- a/src/renderer/src/components/cloud-workspaces/CloudWorkspaceFollowers.tsx +++ b/src/renderer/src/components/cloud-workspaces/CloudWorkspaceFollowers.tsx @@ -80,6 +80,7 @@ export function CloudWorkspaceFollowers({ busy = false, onToggleFollow, onOpenMember, + acting = null, max = 3 }: { entries: WorkspaceFollowerEntry[] @@ -91,6 +92,11 @@ export function CloudWorkspaceFollowers({ onToggleFollow?: () => void /** Opens the teammate's profile. */ onOpenMember?: (userId: string) => void + /** + * GH-ACTING-LINE: who pushes and PRs go out as, said in the acting member's tooltip (or the first + * avatar's when it's Orca's bot). Words only: no action here. + */ + acting?: { text: string; userId: string | null } | null max?: number }): React.JSX.Element | null { const t = useTranslate() @@ -107,7 +113,11 @@ export function CloudWorkspaceFollowers({ aria-label={t('cloudFollow.stackLabel', 'People on this workspace')} className="flex items-center -space-x-1" > - {shown.map((entry) => { + {shown.map((entry, index) => { + const actingHere = + acting !== null && + (acting.userId === entry.userId || + (index === 0 && !shown.some((e) => e.userId === acting.userId))) const name = memberName(directory, entry.userId, selfId, t) const label = entryLabel(entry, name, t) const ring: React.CSSProperties & { '--avatar-hue': string } = { @@ -139,6 +149,7 @@ export function CloudWorkspaceFollowers({ {label} + {actingHere ?
{acting.text}
: null}
) diff --git a/src/renderer/src/components/cloud-workspaces/CloudWorkspacePeople.tsx b/src/renderer/src/components/cloud-workspaces/CloudWorkspacePeople.tsx index 91d2875cd89..8c5b38277b4 100644 --- a/src/renderer/src/components/cloud-workspaces/CloudWorkspacePeople.tsx +++ b/src/renderer/src/components/cloud-workspaces/CloudWorkspacePeople.tsx @@ -13,6 +13,8 @@ import { CloudWorkspaceFollowers, workspaceFollowerEntries } from './CloudWorksp import { setCloudWorkspaceFollow, useTeamWorkspacesLive } from './team-workspaces-live' import { useMemberDirectory } from './use-cloud-workspace-row-actions' import { useCloudWorkspacesAvailable } from './use-cloud-workspaces' +import { gitActingLine } from './cloud-git-acting-copy' +import { useCloudGitActor } from './use-cloud-git-actor' /** * Follow is offered on a teammate's team workspace; never on your own (it is yours already), and not @@ -44,6 +46,9 @@ export function CloudWorkspacePeople({ const live = useTeamWorkspacesLive(orgId && available && sandboxId ? account : null) const workspace = sandboxId ? (live?.find((w) => w.id === sandboxId) ?? null) : null const { directory } = useMemberDirectory(orgId ?? undefined, workspace ? [workspace] : []) + const gitActor = useCloudGitActor(workspace ? worktreeId : null) + const actingLine = gitActingLine(gitActor, t) + const actingUserId = gitActor?.gitActor?.kind === 'member' ? gitActor.gitActor.userId : null if (!workspace) { return null } @@ -80,6 +85,7 @@ export function CloudWorkspacePeople({ busy={busy} onToggleFollow={toggle} onOpenMember={(userId) => (userId === selfId ? undefined : openTeammateProfile(userId))} + acting={actingLine ? { text: actingLine.text, userId: actingUserId } : null} /> ) } diff --git a/src/renderer/src/components/cloud-workspaces/cloud-git-acting-copy.ts b/src/renderer/src/components/cloud-workspaces/cloud-git-acting-copy.ts new file mode 100644 index 00000000000..a1701542f63 --- /dev/null +++ b/src/renderer/src/components/cloud-workspaces/cloud-git-acting-copy.ts @@ -0,0 +1,48 @@ +// GH-ACTING-LINE: who a cloud workspace's pushes and PRs go out as right now, in words. The control +// plane decides (the solo owner, else the latest sender within the hour, else Orca's bot) and says +// so in `gitActor`; this only puts it into words. Nothing when the field is absent (not on GitHub, +// member identities off, an older control plane). +import type { Translate } from '@/i18n/use-translate' +import type { CloudWorkspaceGitActor } from '../../../../shared/cloud-workspaces/cloud-workspaces-wire' + +export type GitActingLine = { + text: string + /** The viewer could be the one it acts as, but hasn't connected GitHub: offer Connect GitHub. */ + connect: boolean +} + +export function gitActingLine( + answer: CloudWorkspaceGitActor | null, + t: Translate +): GitActingLine | null { + const actor = answer?.gitActor + if (!actor) { + return null + } + if (actor.kind === 'member') { + return { + text: t('cloudGitActing.member', 'Pushes and PRs go out as @{{login}}', { + login: actor.login + }), + connect: false + } + } + return { + text: + actor.reason === 'stale' + ? t( + 'cloudGitActing.stale', + 'Pushes and PRs go out as Orca bot (no one has sent in the last hour)' + ) + : t('cloudGitActing.bot', 'Pushes and PRs go out as Orca bot'), + connect: answer?.viewerConnected === false + } +} + +/** The caveat that holds whatever the line says. */ +export function gitActingCaveat(t: Translate): string { + return t( + 'cloudGitActing.caveat', + 'Approvals always go out as Orca bot, and so do merges in shared workspaces.' + ) +} diff --git a/src/renderer/src/components/cloud-workspaces/use-cloud-git-actor.test.ts b/src/renderer/src/components/cloud-workspaces/use-cloud-git-actor.test.ts new file mode 100644 index 00000000000..9cd39d1a2e0 --- /dev/null +++ b/src/renderer/src/components/cloud-workspaces/use-cloud-git-actor.test.ts @@ -0,0 +1,31 @@ +// GH-ACTING-LINE: one read per workspace, deduped; re-read when forced (the window lapsing). +import { afterEach, describe, expect, it, vi } from 'vitest' +import { refreshCloudGitActor } from './use-cloud-git-actor' + +vi.mock('@/store', () => ({ useAppStore: () => null })) +vi.mock('./cloud-workspace-identity', () => ({ + sandboxIdForWorktree: () => null, + useCloudWorkspaceIdentities: () => null +})) + +afterEach(() => vi.unstubAllGlobals()) + +describe('refreshCloudGitActor', () => { + it('dedupes reads in flight and within the fresh window; a forced read goes through', async () => { + const gitActor = vi.fn(async () => ({ + ok: true, + value: { gitActor: { kind: 'bot', reason: 'stale' } } + })) + vi.stubGlobal('window', { api: { cloudWorkspaces: { gitActor } } }) + await Promise.all([refreshCloudGitActor('sbx_a'), refreshCloudGitActor('sbx_a')]) + await refreshCloudGitActor('sbx_a') + expect(gitActor).toHaveBeenCalledTimes(1) + await refreshCloudGitActor('sbx_a', true) + expect(gitActor).toHaveBeenCalledTimes(2) + }) + + it('an older desktop bridge without gitActor reads nothing', async () => { + vi.stubGlobal('window', { api: { cloudWorkspaces: {} } }) + await expect(refreshCloudGitActor('sbx_b')).resolves.toBeUndefined() + }) +}) diff --git a/src/renderer/src/components/cloud-workspaces/use-cloud-git-actor.ts b/src/renderer/src/components/cloud-workspaces/use-cloud-git-actor.ts new file mode 100644 index 00000000000..8c8564dfbbc --- /dev/null +++ b/src/renderer/src/components/cloud-workspaces/use-cloud-git-actor.ts @@ -0,0 +1,82 @@ +// GH-ACTING-LINE: the git actor of the cloud workspace a worktree belongs to, shared by the people +// tooltip and the source control panel (one read per workspace). Re-read when Orca is focused, +// when a shared workspace's hour lapses (`until`), and every two minutes while mounted, since +// another member sending also changes it. +import { useEffect, useSyncExternalStore } from 'react' +import { useAppStore } from '@/store' +import type { CloudWorkspaceGitActor } from '../../../../shared/cloud-workspaces/cloud-workspaces-wire' +import { sandboxIdForWorktree, useCloudWorkspaceIdentities } from './cloud-workspace-identity' + +const REFRESH_MS = 2 * 60_000 +const FRESH_MS = 15_000 + +type Entry = { value: CloudWorkspaceGitActor | null; at: number; inflight: Promise | null } +const entries = new Map() +const listeners = new Set<() => void>() +const emit = (): void => listeners.forEach((listener) => listener()) + +/** Reads the actor now (deduped while one is in flight, and not again within FRESH_MS unless forced). */ +export function refreshCloudGitActor(sandboxId: string, force = false): Promise { + const entry = entries.get(sandboxId) ?? { value: null, at: 0, inflight: null } + entries.set(sandboxId, entry) + if (entry.inflight || (!force && Date.now() - entry.at < FRESH_MS)) { + return entry.inflight ?? Promise.resolve() + } + const read = window.api.cloudWorkspaces.gitActor + if (!read) { + return Promise.resolve() + } + entry.inflight = read(sandboxId) + .then((result) => { + // A failed read keeps the last answer; the next focus or tick asks again. + if (result.ok) { + entry.value = result.value + } + }) + .catch(() => undefined) + .finally(() => { + entry.at = Date.now() + entry.inflight = null + emit() + }) + return entry.inflight +} + +export function useCloudGitActor(worktreeId: string | null): CloudWorkspaceGitActor | null { + const hostId = useAppStore((s) => s.activeWorkspaceExecutionHostId) + const identities = useCloudWorkspaceIdentities() + const sandboxId = worktreeId ? sandboxIdForWorktree({ id: worktreeId, hostId }, identities) : null + const value = useSyncExternalStore( + (listener) => { + listeners.add(listener) + return () => listeners.delete(listener) + }, + () => (sandboxId ? (entries.get(sandboxId)?.value ?? null) : null) + ) + const until = value?.gitActor?.kind === 'member' ? value.gitActor.until : undefined + useEffect(() => { + if (!sandboxId) { + return + } + void refreshCloudGitActor(sandboxId) + const onFocus = (): void => void refreshCloudGitActor(sandboxId) + window.addEventListener('focus', onFocus) + const tick = setInterval(() => void refreshCloudGitActor(sandboxId), REFRESH_MS) + return () => { + window.removeEventListener('focus', onFocus) + clearInterval(tick) + } + }, [sandboxId]) + useEffect(() => { + if (!sandboxId || until === undefined) { + return + } + // A second past the window, so the server already answers with the bot. + const timer = setTimeout( + () => void refreshCloudGitActor(sandboxId, true), + Math.max(0, until - Date.now()) + 1_000 + ) + return () => clearTimeout(timer) + }, [sandboxId, until]) + return value +} diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/cloud-git-acting-notice.fixture.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/cloud-git-acting-notice.fixture.tsx new file mode 100644 index 00000000000..ec884fc3cc5 --- /dev/null +++ b/src/renderer/src/components/right-sidebar/source-control/commit/cloud-git-acting-notice.fixture.tsx @@ -0,0 +1,31 @@ +// GH-ACTING-LINE under Commit/Push in a cloud workspace's source control panel. +import { defineFixture } from '../../../../component-fixtures/component-fixture' +import type { CloudWorkspaceGitActor } from '../../../../../../shared/cloud-workspaces/cloud-workspaces-wire' +import { CloudGitActingNoticeView } from './cloud-git-acting-notice' + +function fixture(answer: CloudWorkspaceGitActor) { + return defineFixture({ + width: 320, + render: () => ( +
+
+ Commit & Push +
+ {}} /> +
+ ) + }) +} + +export const member = fixture({ + gitActor: { kind: 'member', userId: 'u1', login: 'octo-dev' }, + viewerConnected: true +}) +export const botConnect = fixture({ + gitActor: { kind: 'bot', reason: 'no_connected_member' }, + viewerConnected: false +}) +export const botStale = fixture({ + gitActor: { kind: 'bot', reason: 'stale' }, + viewerConnected: true +}) diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/cloud-git-acting-notice.test.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/cloud-git-acting-notice.test.tsx new file mode 100644 index 00000000000..5e6dbaffdf7 --- /dev/null +++ b/src/renderer/src/components/right-sidebar/source-control/commit/cloud-git-acting-notice.test.tsx @@ -0,0 +1,71 @@ +// @vitest-environment happy-dom +// GH-ACTING-LINE: the source control panel says who pushes and PRs go out as, and offers Connect +// GitHub only when it falls back to Orca's bot for a viewer who hasn't connected. +import { act } from 'react' +import { createRoot, type Root } from 'react-dom/client' +import { afterEach, describe, expect, it, vi } from 'vitest' +import { TooltipProvider } from '@/components/ui/tooltip' +import type { CloudWorkspaceGitActor } from '../../../../../../shared/cloud-workspaces/cloud-workspaces-wire' +import { CloudGitActingNoticeView } from './cloud-git-acting-notice' + +globalThis.IS_REACT_ACT_ENVIRONMENT = true +let root: Root | null = null + +afterEach(async () => { + await act(async () => root?.unmount()) + root = null + document.body.innerHTML = '' +}) + +async function show( + answer: CloudWorkspaceGitActor | null, + onConnect = vi.fn() +): Promise { + const container = document.createElement('div') + document.body.appendChild(container) + root = createRoot(container) + await act(async () => + root!.render( + + + + ) + ) + return container +} + +const connectButton = (c: HTMLElement) => + [...c.querySelectorAll('button')].find((b) => b.textContent === 'Connect GitHub') ?? null + +describe('who pushes and PRs go out as, in source control', () => { + it('a member: as @login, no action', async () => { + const c = await show({ + gitActor: { kind: 'member', userId: 'u1', login: 'octo-dev' }, + viewerConnected: true + }) + expect(c.textContent).toContain('Pushes and PRs go out as @octo-dev') + expect(connectButton(c)).toBeNull() + }) + + it('the bot for a viewer who isn’t connected: Connect GitHub', async () => { + const onConnect = vi.fn() + const c = await show( + { gitActor: { kind: 'bot', reason: 'no_connected_member' }, viewerConnected: false }, + onConnect + ) + expect(c.textContent).toContain('Pushes and PRs go out as Orca bot') + await act(async () => connectButton(c)!.click()) + expect(onConnect).toHaveBeenCalledTimes(1) + }) + + it('the bot after the hour lapsed, viewer connected: says why, no action', async () => { + const c = await show({ gitActor: { kind: 'bot', reason: 'stale' }, viewerConnected: true }) + expect(c.textContent).toContain('no one has sent in the last hour') + expect(connectButton(c)).toBeNull() + }) + + it('no actor (not GitHub, identities off, older control plane): nothing', async () => { + expect((await show({ viewerConnected: false })).textContent).toBe('') + expect((await show(null)).textContent).toBe('') + }) +}) diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/cloud-git-acting-notice.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/cloud-git-acting-notice.tsx new file mode 100644 index 00000000000..8779acde3be --- /dev/null +++ b/src/renderer/src/components/right-sidebar/source-control/commit/cloud-git-acting-notice.tsx @@ -0,0 +1,73 @@ +import React from 'react' +import { Github } from 'lucide-react' +import { Button } from '@/components/ui/button' +import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip' +import { useTranslate } from '@/i18n/use-translate' +import { gitActingCaveat, gitActingLine } from '@/components/cloud-workspaces/cloud-git-acting-copy' +import { useCloudGitActor } from '@/components/cloud-workspaces/use-cloud-git-actor' +import type { CloudWorkspaceGitActor } from '../../../../../../shared/cloud-workspaces/cloud-workspaces-wire' + +/** + * GH-ACTING-LINE under Commit/Push in a cloud workspace: who pushes and PRs go out as right now, and, + * when it falls back to Orca's bot for a viewer who hasn't connected GitHub, Connect GitHub. The + * only place that action shows; the people tooltip just says who. + */ +export function CloudGitActingNoticeView({ + answer, + onConnect +}: { + answer: CloudWorkspaceGitActor | null + onConnect: () => void +}): React.JSX.Element | null { + const t = useTranslate() + const line = gitActingLine(answer, t) + if (!line) { + return null + } + return ( +
+ + + + + {line.text} + + + + {gitActingCaveat(t)} + + + {line.connect ? ( + + ) : null} +
+ ) +} + +export function CloudGitActingNotice({ + worktreeId +}: { + worktreeId: string | null +}): React.JSX.Element | null { + const answer = useCloudGitActor(worktreeId) + // The browser OAuth finishes elsewhere; the actor is re-read when Orca is focused again. + const connect = (): void => + void Promise.resolve() + .then(() => window.api.orcaCloudWorkspace.connectGitHubUser()) + .catch(() => null) + return +} diff --git a/src/renderer/src/components/right-sidebar/source-control/commit/commit-area.tsx b/src/renderer/src/components/right-sidebar/source-control/commit/commit-area.tsx index bf7a0537a43..be5cd02cb40 100644 --- a/src/renderer/src/components/right-sidebar/source-control/commit/commit-area.tsx +++ b/src/renderer/src/components/right-sidebar/source-control/commit/commit-area.tsx @@ -16,6 +16,7 @@ import { CommitActionMenu } from './commit-action-menu' import type { CommitAreaProps } from './commit-area-types' import { CommitMessageComposer } from './commit-message-composer' import { CommitNotices } from './commit-notices' +import { CloudGitActingNotice } from './cloud-git-acting-notice' import { getCommitMessageTextareaRows } from './commit-message-rows' import type { PrimaryAction } from '../review/source-control-primary-action-types' import { getSourceControlRecoveryFailureKindLabel } from '../sync/push-recovery' @@ -243,6 +244,7 @@ export function CommitArea({ dropdownMenuContent={dropdownMenuContent} onPrimaryAction={onPrimaryAction} /> + +export const CloudWorkspaceGitActorSchema = z + .object({ + gitActor: CloudGitActorSchema.optional().catch(undefined), + viewerConnected: z.boolean().optional().catch(undefined) + }) + .strip() +export type CloudWorkspaceGitActor = z.infer /** PUT/DELETE /v1/team/workspaces/:id/follow (PARITY-FOLLOW). */ export const CloudWorkspaceFollowSchema = z.object({ following: z.boolean(),