fix(cli): preserve prompt text on dismiss

This commit is contained in:
Alex Alecu
2026-04-23 17:56:56 +03:00
parent 55fcb5725a
commit 6ee160f89c
3 changed files with 21 additions and 2 deletions
@@ -0,0 +1,5 @@
---
"@kilocode/cli": patch
---
Preserve typed text in the main prompt when a blocking question, suggestion, permission, or network overlay is shown and then dismissed.
@@ -1,5 +1,6 @@
import type { TuiPluginApi, TuiSlotContext, TuiSlotMap, TuiSlotProps } from "@kilocode/plugin/tui"
import { createSlot, createSolidSlotRegistry, type JSX, type SolidPlugin } from "@opentui/solid"
import { children } from "solid-js"
import { isRecord } from "@/util/record"
type RuntimeSlotMap = TuiSlotMap<Record<string, object>>
@@ -21,7 +22,18 @@ function empty<Name extends string>(_props: TuiSlotProps<Name>) {
let view: Slot = empty
export const Slot: Slot = (props) => view(props)
export const Slot = <Name extends string>(props: TuiSlotProps<Name>) => {
// kilocode_change start - stabilize fallback children so replace-mode slots
// don't recreate stateful defaults like the session prompt on prop changes.
const value = children(() => props.children)
return view({
...props,
get children() {
return value()
},
} as TuiSlotProps<Name>)
// kilocode_change end
}
function isHostSlotPlugin(value: unknown): value is HostSlotPlugin<Record<string, object>> {
if (!isRecord(value)) return false
@@ -1295,7 +1295,8 @@ export function Session() {
<NetworkPrompt request={network()[0]} />
</Show>
{/* kilocode_change end */}
<Show when={visible()}>
{/* kilocode_change start */}
<Show when={!session()?.parentID}>
<TuiPluginRuntime.Slot
name="session_prompt"
mode="replace"
@@ -1317,6 +1318,7 @@ export function Session() {
/>
</TuiPluginRuntime.Slot>
</Show>
{/* kilocode_change end */}
</box>
</Show>
<Toast />