diff options
| author | Ariane Emory <[email protected]> | 2025-12-15 15:42:17 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-15 14:42:17 -0600 |
| commit | 66329878271bab0b39ffc62b53b382a79df54414 (patch) | |
| tree | bca5d1b1a49acdfc96f8ab89ea152e92bf4ce5f9 | |
| parent | e555e893c46d16e5e557fd284e95165e162fc5d1 (diff) | |
| download | opencode-66329878271bab0b39ffc62b53b382a79df54414.tar.gz opencode-66329878271bab0b39ffc62b53b382a79df54414.zip | |
fix: record shell mode in history (resolves #5454) (#5551)
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx | 1 | ||||
| -rw-r--r-- | packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx index e55479c02..e90503e9f 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/history.tsx @@ -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"> diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index eefe43d1f..938405f68 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -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 |
