Remove custom commands from palette
This commit is contained in:
@@ -39,8 +39,7 @@ import {
|
|||||||
import { keyboardRegistry, type KeyboardShortcut } from "../../lib/keyboard-registry"
|
import { keyboardRegistry, type KeyboardShortcut } from "../../lib/keyboard-registry"
|
||||||
import { messageStoreBus } from "../../stores/message-v2/bus"
|
import { messageStoreBus } from "../../stores/message-v2/bus"
|
||||||
import { clearSessionRenderCache } from "../message-block"
|
import { clearSessionRenderCache } from "../message-block"
|
||||||
import { buildCustomCommandEntries } from "../../lib/command-utils"
|
|
||||||
import { getCommands as getInstanceCommands } from "../../stores/commands"
|
|
||||||
import { isOpen as isCommandPaletteOpen, hideCommandPalette, showCommandPalette } from "../../stores/command-palette"
|
import { isOpen as isCommandPaletteOpen, hideCommandPalette, showCommandPalette } from "../../stores/command-palette"
|
||||||
import SessionList from "../session-list"
|
import SessionList from "../session-list"
|
||||||
import KeyboardHint from "../keyboard-hint"
|
import KeyboardHint from "../keyboard-hint"
|
||||||
@@ -373,9 +372,7 @@ const InstanceShell2: Component<InstanceShellProps> = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const customCommands = createMemo(() => buildCustomCommandEntries(props.instance.id, getInstanceCommands(props.instance.id)))
|
const instancePaletteCommands = createMemo(() => props.paletteCommands())
|
||||||
|
|
||||||
const instancePaletteCommands = createMemo(() => [...props.paletteCommands(), ...customCommands()])
|
|
||||||
const paletteOpen = createMemo(() => isCommandPaletteOpen(props.instance.id))
|
const paletteOpen = createMemo(() => isCommandPaletteOpen(props.instance.id))
|
||||||
|
|
||||||
const keyboardShortcuts = createMemo(() =>
|
const keyboardShortcuts = createMemo(() =>
|
||||||
|
|||||||
@@ -610,6 +610,11 @@ export default function PromptInput(props: PromptInputProps) {
|
|||||||
|
|
||||||
setHistoryDraft(null)
|
setHistoryDraft(null)
|
||||||
|
|
||||||
|
if (isKnownSlashCommand) {
|
||||||
|
// Record attempted slash commands even if execution fails.
|
||||||
|
void refreshHistory()
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (isShellMode) {
|
if (isShellMode) {
|
||||||
if (props.onRunShell) {
|
if (props.onRunShell) {
|
||||||
@@ -622,7 +627,9 @@ export default function PromptInput(props: PromptInputProps) {
|
|||||||
} else {
|
} else {
|
||||||
await props.onSend(resolvedPrompt, currentAttachments)
|
await props.onSend(resolvedPrompt, currentAttachments)
|
||||||
}
|
}
|
||||||
void refreshHistory()
|
if (!isKnownSlashCommand) {
|
||||||
|
void refreshHistory()
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error("Failed to send message:", error)
|
log.error("Failed to send message:", error)
|
||||||
showAlertDialog("Failed to send message", {
|
showAlertDialog("Failed to send message", {
|
||||||
@@ -1023,6 +1030,7 @@ export default function PromptInput(props: PromptInputProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const shellHint = () => (mode() === "shell" ? { key: "Esc", text: "to exit shell mode" } : { key: "!", text: "for shell mode" })
|
const shellHint = () => (mode() === "shell" ? { key: "Esc", text: "to exit shell mode" } : { key: "!", text: "for shell mode" })
|
||||||
|
const commandHint = () => ({ key: "/", text: "for commands" })
|
||||||
|
|
||||||
const shouldShowOverlay = () => prompt().length === 0
|
const shouldShowOverlay = () => prompt().length === 0
|
||||||
|
|
||||||
@@ -1215,6 +1223,11 @@ export default function PromptInput(props: PromptInputProps) {
|
|||||||
<span class="prompt-overlay-text">
|
<span class="prompt-overlay-text">
|
||||||
• <Kbd>{shellHint().key}</Kbd> {shellHint().text}
|
• <Kbd>{shellHint().key}</Kbd> {shellHint().text}
|
||||||
</span>
|
</span>
|
||||||
|
<Show when={mode() !== "shell"}>
|
||||||
|
<span class="prompt-overlay-text">
|
||||||
|
• <Kbd>{commandHint().key}</Kbd> {commandHint().text}
|
||||||
|
</span>
|
||||||
|
</Show>
|
||||||
<Show when={mode() === "shell"}>
|
<Show when={mode() === "shell"}>
|
||||||
<span class="prompt-overlay-shell-active">Shell mode active</span>
|
<span class="prompt-overlay-shell-active">Shell mode active</span>
|
||||||
</Show>
|
</Show>
|
||||||
|
|||||||
Reference in New Issue
Block a user