({
input,
inputMode,
isLoading,
isRemoteMode,
hasSpeculationAccept,
fromKeybinding,
hasStashedPrompt,
}: ResolveReplSubmitStateInput)
| 25 | } |
| 26 | |
| 27 | export function resolveReplSubmitState({ |
| 28 | input, |
| 29 | inputMode, |
| 30 | isLoading, |
| 31 | isRemoteMode, |
| 32 | hasSpeculationAccept, |
| 33 | fromKeybinding, |
| 34 | hasStashedPrompt, |
| 35 | }: ResolveReplSubmitStateInput): ReplSubmitState { |
| 36 | const isSlashCommand = !hasSpeculationAccept && input.trim().startsWith('/') |
| 37 | const submitsNow = !isLoading || hasSpeculationAccept || isRemoteMode |
| 38 | const shouldRestoreStashImmediately = |
| 39 | hasStashedPrompt && !isSlashCommand && submitsNow |
| 40 | |
| 41 | return { |
| 42 | isSlashCommand, |
| 43 | submitsNow, |
| 44 | shouldAddToHistory: !fromKeybinding, |
| 45 | shouldRestoreStashImmediately, |
| 46 | // Preserve the current leader-submit contract exactly. In remote mode this |
| 47 | // callback is ignored, but the existing REPL still builds it. |
| 48 | shouldProvideDeferredStashRestore: |
| 49 | hasStashedPrompt && (isSlashCommand || isLoading), |
| 50 | shouldClearInputValue: |
| 51 | submitsNow && !shouldRestoreStashImmediately && !fromKeybinding, |
| 52 | shouldClearPastedContents: submitsNow && !shouldRestoreStashImmediately, |
| 53 | shouldResetInputMode: submitsNow, |
| 54 | shouldIncrementSubmitCount: submitsNow, |
| 55 | shouldClearBuffer: submitsNow, |
| 56 | shouldShowProcessingPlaceholder: |
| 57 | submitsNow && |
| 58 | !isSlashCommand && |
| 59 | inputMode === 'prompt' && |
| 60 | !hasSpeculationAccept && |
| 61 | !isRemoteMode, |
| 62 | } |
| 63 | } |
no outgoing calls
no test coverage detected