Fix pnpm resources (#29)

* Add message undo/refresh features and stop audio floating button

* Exclude workspace directory from pnpm workspace detection

---------

Co-authored-by: Chris Scott <chris@cstech.dev>
This commit is contained in:
Chris ScottandChris Scott authored and GitHub committed 2025-12-21 09:46:38 -05:00
1 parent fb430359ce
commit 0cbfe2e358
8 files changed
+338 -19

No files matched your search

@@ -1,4 +1,4 @@
import { useState, useRef, useEffect, useMemo, type KeyboardEvent } from 'react'
import { useState, useRef, useEffect, useMemo, useImperativeHandle, forwardRef, type KeyboardEvent } from 'react'
import { useSendPrompt, useAbortSession, useMessages, useSendShell, useAgents } from '@/hooks/useOpenCode'
import { useSettings } from '@/hooks/useSettings'
import { useCommands } from '@/hooks/useCommands'
@@ -23,6 +23,11 @@ import type { MessageWithParts, FileInfo } from '@/api/types'
type CommandType = components['schemas']['Command']
export interface PromptInputHandle {
setPromptValue: (value: string) => void
clearPrompt: () => void
}
interface PromptInputProps {
opcodeUrl: string
directory?: string
@@ -35,9 +40,10 @@ interface PromptInputProps {
onShowHelpDialog?: () => void
onToggleDetails?: () => boolean
onExportSession?: () => void
onPromptChange?: (hasContent: boolean) => void
}
export function PromptInput({
export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(function PromptInput({
opcodeUrl,
directory,
sessionID,
@@ -48,10 +54,30 @@ export function PromptInput({
onShowModelsDialog,
onShowHelpDialog,
onToggleDetails,
onExportSession
}: PromptInputProps) {
onExportSession,
onPromptChange
}, ref) {
const [prompt, setPrompt] = useState('')
useImperativeHandle(ref, () => ({
setPromptValue: (value: string) => {
setPrompt(value)
if (textareaRef.current) {
textareaRef.current.style.height = 'auto'
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`
textareaRef.current.focus()
}
},
clearPrompt: () => {
setPrompt('')
setAttachedFiles(new Map())
setSelectedAgent(null)
if (textareaRef.current) {
textareaRef.current.style.height = 'auto'
}
}
}), [])
const [isBashMode, setIsBashMode] = useState(false)
const [showSuggestions, setShowSuggestions] = useState(false)
const [suggestionQuery, setSuggestionQuery] = useState('')
@@ -465,6 +491,10 @@ export function PromptInput({
}
}, [disabled])
useEffect(() => {
onPromptChange?.(prompt.trim().length > 0)
}, [prompt, onPromptChange])
return (
@@ -573,4 +603,4 @@ export function PromptInput({
/>
</div>
)
}
})