mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-21 05:52:35 +08:00
fix(cli): preserve prompt text on dismiss
This commit is contained in:
@@ -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 />
|
||||
|
||||
Reference in New Issue
Block a user