|
Expand Up
|
@@ -114,7 +114,10 @@ import Animated, { |
|
|
} from "react-native-reanimated"; |
|
|
import { useSafeAreaInsets } from "react-native-safe-area-context"; |
|
|
import { useBarOverlap } from "../../components/ui/useBarInset"; |
|
|
import { useWorkspaceContentWidth } from "../layout/workspace-content-width"; |
|
|
import { |
|
|
useWorkspaceContentWidth, |
|
|
WorkspaceSettledContentWidthContext, |
|
|
} from "../layout/workspace-content-width"; |
|
|
import { useAdaptiveWorkspaceLayout } from "../layout/adaptive-workspace-context"; |
|
|
import { useNativeWorkspaceColumnsSupported } from "../../native/NativeWorkspaceColumns"; |
|
|
import { |
|
Expand Down
Expand Up
|
@@ -317,6 +320,17 @@ export interface ThreadDetailScreenProps { |
|
|
|
|
|
// iOS questions overlay the controls; Android questions stack with child approvals. |
|
|
const ComposerPanels = Platform.OS === "android" ? Animated.ScrollView : Animated.View; |
|
|
|
|
|
/** Hands the feed the screen width measured for a native column; elsewhere keeps the inherited one. */ |
|
|
function ColumnWidth(props: { readonly width: number | null; readonly children: React.ReactNode }) { |
|
|
return props.width === null ? ( |
|
|
props.children |
|
|
) : ( |
|
|
<WorkspaceSettledContentWidthContext value={props.width}> |
|
|
{props.children} |
|
|
</WorkspaceSettledContentWidthContext> |
|
|
); |
|
|
} |
|
|
const USAGE_LIMITS_PANEL_GAP = 12; |
|
|
const USAGE_LIMITS_PANEL_MIN_HEIGHT = 44; |
|
|
|
|
Expand Down
Expand Up
|
@@ -1022,8 +1036,13 @@ function ThreadDetailBody( |
|
|
// Android lays the screen out below its opaque header and reports a zero |
|
|
// header height, so the window height overstates the room by the header. |
|
|
const [screenHeight, setScreenHeight] = useState<number | null>(null); |
|
|
const [screenWidth, setScreenWidth] = useState<number | null>(null); |
|
|
const handleScreenLayout = (event: LayoutChangeEvent) => { |
|
|
setScreenHeight(event.nativeEvent.layout.height); |
|
|
const width = Math.round(event.nativeEvent.layout.width); |
|
|
setScreenWidth((current) => |
|
|
current !== null && Math.abs(current - width) <= 1 ? current : width, |
|
|
); |
|
|
}; |
|
|
const screenAreaHeight = screenHeight ?? windowHeight; |
|
|
const draftViewportHeight = screenAreaHeight - navigationHeaderHeight - liveKeyboardHeight; |
|
Expand Down
Expand Up
|
@@ -1211,6 +1230,13 @@ function ThreadDetailBody( |
|
|
} |
|
|
: { width: "auto", right: controlInsets.right }, |
|
|
); |
|
|
// A native column resizes the screen before JS hears of it. The feed and the composer take the |
|
|
// measured width in one render, so they change size together rather than the composer first. |
|
|
const columnWidth = usesNativeWorkspaceColumns && isSplitLayout ? screenWidth : null; |
|
|
const columnComposerWidthStyle = |
|
|
columnWidth === null |
|
|
? null |
|
|
: { width: Math.max(0, columnWidth - controlInsets.left - controlInsets.right) }; |
|
|
const selectedInstanceId = props.selectedThread.modelSelection.instanceId; |
|
|
useAtomMount(threadStreamHaptics(props.selectedThreadDetailRef)); |
|
|
const selectedProviderSkills = (() => { |
|
Expand Down
Expand Up
|
@@ -1436,54 +1462,58 @@ function ThreadDetailBody( |
|
|
)} |
|
|
> |
|
|
<WorkspaceMutationIdProvider threadRef={props.selectedThreadDetailRef}> |
|
|
<ThreadFeed |
|
|
toolCallVisibility={toolCallVisibility} |
|
|
environmentId={props.environmentId} |
|
|
threadId={props.selectedThread.id} |
|
|
detailRef={props.selectedThreadDetailRef} |
|
|
workspaceRoot={props.threadCwd} |
|
|
feed={props.selectedThreadFeed} |
|
|
pendingHandoff={props.pendingHandoff} |
|
|
worktreeSetup={props.worktreeSetup} |
|
|
setupWorkingStartedAt={props.setupWorkingStartedAt} |
|
|
queuedMessages={props.queuedMessages} |
|
|
dispatchingMessageId={props.dispatchingMessageId} |
|
|
// A native subagent has no composer to edit a pending message in; |
|
|
// Cancel on the edit banner would discard it. |
|
|
onEditPendingMessage={ |
|
|
isProviderSubagent || pendingMessageEditBlocked ? null : handleEditPendingMessage |
|
|
} |
|
|
contentPresentation={props.contentPresentation} |
|
|
threadTitle={props.selectedThread.title} |
|
|
latestRun={props.activityRun} |
|
|
activeWorkStartedAt={props.activeWorkStartedAt} |
|
|
runlessWorkActive={props.runlessWorkActive ?? false} |
|
|
listRef={listRef} |
|
|
freeze={freeze} |
|
|
anchorMessageId={anchorMessageId} |
|
|
jumpToMessageId={jumpMessageLoaded ? jumpMessageId : null} |
|
|
onJumpedToMessage={() => finishThreadMessageJump(selectedThreadKey)} |
|
|
contentInsetEndAdjustment={combinedContentInsetEndAdjustment} |
|
|
keyboardOffset={composerKeyboardOffset} |
|
|
sendingWithKeyboard={sendingWithKeyboard} |
|
|
fitShortFeedToViewport={questionInFlow && !isKeyboardVisible} |
|
|
contentTopInset={0} |
|
|
contentBottomInset={ |
|
|
questionInFlow |
|
|
? 0 |
|
|
: estimatedOverlayHeight + |
|
|
(showFloatingStatus ? FLOATING_WORKING_CONTROL_COVERAGE : 0) |
|
|
} |
|
|
contentMaxWidth={contentMaxWidth} |
|
|
historyControls={props.historyControls} |
|
|
contentSideInsets={nativeMetrics?.safeArea} |
|
|
layoutVariant={layoutVariant} |
|
|
usesAutomaticContentInsets={props.usesAutomaticContentInsets} |
|
|
onHeaderMaterialVisibilityChange={props.onHeaderMaterialVisibilityChange} |
|
|
onIsAtEndChange={setIsAtEnd} |
|
|
skills={selectedProviderSkills} |
|
|
onUseArtifactTemplate={handleUseArtifactTemplate} |
|
|
/> |
|
|
<ColumnWidth width={columnWidth}> |
|
|
<ThreadFeed |
|
|
toolCallVisibility={toolCallVisibility} |
|
|
environmentId={props.environmentId} |
|
|
threadId={props.selectedThread.id} |
|
|
detailRef={props.selectedThreadDetailRef} |
|
|
workspaceRoot={props.threadCwd} |
|
|
feed={props.selectedThreadFeed} |
|
|
pendingHandoff={props.pendingHandoff} |
|
|
worktreeSetup={props.worktreeSetup} |
|
|
setupWorkingStartedAt={props.setupWorkingStartedAt} |
|
|
queuedMessages={props.queuedMessages} |
|
|
dispatchingMessageId={props.dispatchingMessageId} |
|
|
// A native subagent has no composer to edit a pending message in; |
|
|
// Cancel on the edit banner would discard it. |
|
|
onEditPendingMessage={ |
|
|
isProviderSubagent || pendingMessageEditBlocked |
|
|
? null |
|
|
: handleEditPendingMessage |
|
|
} |
|
|
contentPresentation={props.contentPresentation} |
|
|
threadTitle={props.selectedThread.title} |
|
|
latestRun={props.activityRun} |
|
|
activeWorkStartedAt={props.activeWorkStartedAt} |
|
|
runlessWorkActive={props.runlessWorkActive ?? false} |
|
|
listRef={listRef} |
|
|
freeze={freeze} |
|
|
anchorMessageId={anchorMessageId} |
|
|
jumpToMessageId={jumpMessageLoaded ? jumpMessageId : null} |
|
|
onJumpedToMessage={() => finishThreadMessageJump(selectedThreadKey)} |
|
|
contentInsetEndAdjustment={combinedContentInsetEndAdjustment} |
|
|
keyboardOffset={composerKeyboardOffset} |
|
|
sendingWithKeyboard={sendingWithKeyboard} |
|
|
fitShortFeedToViewport={questionInFlow && !isKeyboardVisible} |
|
|
contentTopInset={0} |
|
|
contentBottomInset={ |
|
|
questionInFlow |
|
|
? 0 |
|
|
: estimatedOverlayHeight + |
|
|
(showFloatingStatus ? FLOATING_WORKING_CONTROL_COVERAGE : 0) |
|
|
} |
|
|
contentMaxWidth={contentMaxWidth} |
|
|
historyControls={props.historyControls} |
|
|
contentSideInsets={nativeMetrics?.safeArea} |
|
|
layoutVariant={layoutVariant} |
|
|
usesAutomaticContentInsets={props.usesAutomaticContentInsets} |
|
|
onHeaderMaterialVisibilityChange={props.onHeaderMaterialVisibilityChange} |
|
|
onIsAtEndChange={setIsAtEnd} |
|
|
skills={selectedProviderSkills} |
|
|
onUseArtifactTemplate={handleUseArtifactTemplate} |
|
|
/> |
|
|
</ColumnWidth> |
|
|
</WorkspaceMutationIdProvider> |
|
|
</RenderErrorBoundary> |
|
|
</View> |
|
Expand Down
Expand Up
|
@@ -1533,18 +1563,25 @@ function ThreadDetailBody( |
|
|
pointerEvents="box-none" |
|
|
style={ |
|
|
questionInFlow |
|
|
? isSplitLayout |
|
|
? composerWidthStyle |
|
|
: undefined |
|
|
: [ |
|
|
{ |
|
|
position: "absolute", |
|
|
bottom: controlInsets.bottom, |
|
|
left: controlInsets.left, |
|
|
right: controlInsets.right, |
|
|
}, |
|
|
composerWidthStyle, |
|
|
] |
|
|
? (columnComposerWidthStyle ?? (isSplitLayout ? composerWidthStyle : undefined)) |
|
|
: columnComposerWidthStyle |
|
|
? [ |
|
|
{ |
|
|
position: "absolute", |
|
|
bottom: controlInsets.bottom, |
|
|
left: controlInsets.left, |
|
|
}, |
|
|
columnComposerWidthStyle, |
|
|
] |
|
|
: [ |
|
|
{ |
|
|
position: "absolute", |
|
|
bottom: controlInsets.bottom, |
|
|
left: controlInsets.left, |
|
|
right: controlInsets.right, |
|
|
}, |
|
|
composerWidthStyle, |
|
|
] |
|
|
} |
|
|
> |
|
|
{/* No paddingTop here: the overlay's measured height becomes the |
|
Expand Down
|
|