>
) : null}
) : (
{stateChip}
{stateDescription}
)}
{announcement}
{
if (!open) {
setConfirmation(null);
setVisibilityPreview(null);
onForkClose?.();
}
}}
title={
confirmation?.kind === "fork"
? confirmation.visibility === "workspace"
? `Fork a workspace-visible copy?`
: "Fork a private copy?"
: confirmation?.visibility === "workspace"
? `Share this session with ${scopeLabel}?`
: "Limit this session to you?"
}
description={
(pendingFork ? pendingFork.sourceEventId : sourceEventId)
? `Copy the conversation through the selected message${confirmation?.visibility === "workspace" ? ` into a session visible to people in ${scopeLabel}` : " into a session visible only to you"}. Later messages are excluded. Live credentials, tools, goals, and processes are not copied.`
: confirmation?.kind === "fork" &&
displayedTenancy.visibility === "private" &&
confirmation.visibility === "workspace"
? `This private session's complete conversation will be copied into a new session visible to people in ${scopeLabel}. Live credentials, connections, tools, goals, and processes are not copied.`
: confirmation?.kind === "fork"
? confirmation.visibility === "workspace"
? `Create an independent copy visible to people in ${scopeLabel}. Live credentials, connections, tools, goals, and processes are not copied.`
: "Create an independent copy visible only to you. Live credentials, connections, tools, goals, and processes are not copied."
: confirmation?.visibility === "workspace"
? "People who can access this workspace will be able to open and continue the session. Current work keeps running with its existing identity and connections."
: `Only you will be able to open the session.${privateSessionSandboxNote(session.sandboxBackend)}`
}
confirmLabel={
confirmation?.kind === "fork"
? retryingFork
? "Retry fork"
: confirmation.visibility === "workspace"
? "Fork for workspace"
: "Fork privately"
: visibilityConfirmLabel
}
pendingLabel={
confirmation?.kind === "visibility" && stopsWork ? "Stopping work…" : "Working…"
}
// A fork only widens exposure when a private source is copied into the
// workspace. Changing an existing session to workspace visibility always
// does, and making it private destroys the work and access it drops.
// A shared-to-shared fork exposes nothing new.
destructive={
confirmation?.kind === "fork"
? displayedTenancy.visibility === "private" && confirmation.visibility === "workspace"
: confirmation?.visibility === "workspace" || workToStop !== null
}
cancelAutoFocus
restoreFocusRef={sourceEventId ? undefined : accessTriggerRef}
onConfirm={() => {
if (!confirmation) return true;
return confirmation.kind === "visibility"
? changeVisibility(confirmation.visibility, workToStop !== null)
: forkSession(confirmation.visibility);
}}
>
{confirmation?.kind === "visibility" && workToStop ? (