mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
parent
e555e893c4
commit
6632987827
2 changed files with 9 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ import type { AgentPart, FilePart, TextPart } from "@opencode-ai/sdk/v2"
|
|||
|
||||
export type PromptInfo = {
|
||||
input: string
|
||||
mode?: "normal" | "shell"
|
||||
parts: (
|
||||
| Omit<FilePart, "id" | "messageID" | "sessionID">
|
||||
| Omit<AgentPart, "id" | "messageID" | "sessionID">
|
||||
|
|
|
|||
|
|
@ -495,6 +495,9 @@ export function Prompt(props: PromptProps) {
|
|||
// Filter out text parts (pasted content) since they're now expanded inline
|
||||
const nonTextParts = store.prompt.parts.filter((part) => part.type !== "text")
|
||||
|
||||
// Capture mode before it gets reset
|
||||
const currentMode = store.mode
|
||||
|
||||
if (store.mode === "shell") {
|
||||
sdk.client.session.shell({
|
||||
sessionID,
|
||||
|
|
@ -543,7 +546,10 @@ export function Prompt(props: PromptProps) {
|
|||
],
|
||||
})
|
||||
}
|
||||
history.append(store.prompt)
|
||||
history.append({
|
||||
...store.prompt,
|
||||
mode: currentMode,
|
||||
})
|
||||
input.extmarks.clear()
|
||||
setStore("prompt", {
|
||||
input: "",
|
||||
|
|
@ -767,6 +773,7 @@ export function Prompt(props: PromptProps) {
|
|||
if (item) {
|
||||
input.setText(item.input)
|
||||
setStore("prompt", item)
|
||||
setStore("mode", item.mode ?? "normal")
|
||||
restoreExtmarksFromParts(item.parts)
|
||||
e.preventDefault()
|
||||
if (direction === -1) input.cursorOffset = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue