Dax Raad 3 месяцев назад
Родитель
Сommit
32c3fcbe61

+ 4 - 2
packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx

@@ -33,6 +33,7 @@ import { useKV } from "../../context/kv"
 
 export type PromptProps = {
   sessionID?: string
+  visible?: boolean
   disabled?: boolean
   onSubmit?: () => void
   ref?: (ref: PromptRef) => void
@@ -373,7 +374,8 @@ export function Prompt(props: PromptProps) {
   })
 
   createEffect(() => {
-    input.focus()
+    if (props.visible !== false) input?.focus()
+    if (props.visible === false) input?.blur()
   })
 
   onMount(() => {
@@ -798,7 +800,7 @@ export function Prompt(props: PromptProps) {
         agentStyleId={agentStyleId}
         promptPartTypeId={() => promptPartTypeId}
       />
-      <box ref={(r) => (anchor = r)}>
+      <box ref={(r) => (anchor = r)} visible={props.visible !== false}>
         <box
           border={["left"]}
           borderColor={highlight()}

+ 15 - 18
packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

@@ -1108,24 +1108,21 @@ export function Session() {
               </For>
             </scrollbox>
             <box flexShrink={0}>
-              <Switch>
-                <Match when={permissions().length > 0}>
-                  <PermissionPrompt request={permissions()[0]} />
-                </Match>
-                <Match when={!session()?.parentID}>
-                  <Prompt
-                    ref={(r) => {
-                      prompt = r
-                      promptRef.set(r)
-                    }}
-                    disabled={permissions().length > 0}
-                    onSubmit={() => {
-                      toBottom()
-                    }}
-                    sessionID={route.sessionID}
-                  />
-                </Match>
-              </Switch>
+              <Show when={permissions().length > 0}>
+                <PermissionPrompt request={permissions()[0]} />
+              </Show>
+              <Prompt
+                visible={!session().parentID && permissions().length === 0}
+                ref={(r) => {
+                  prompt = r
+                  promptRef.set(r)
+                }}
+                disabled={permissions().length > 0}
+                onSubmit={() => {
+                  toBottom()
+                }}
+                sessionID={route.sessionID}
+              />
             </box>
             <Show when={!sidebarVisible()}>
               <Footer />