diff --git a/.kiro/settings/lsp.json b/.kiro/settings/lsp.json new file mode 100644 index 0000000..89ee072 --- /dev/null +++ b/.kiro/settings/lsp.json @@ -0,0 +1,198 @@ +{ + "languages": { + "ruby": { + "name": "solargraph", + "command": "solargraph", + "args": [ + "stdio" + ], + "file_extensions": [ + "rb" + ], + "project_patterns": [ + "Gemfile", + "Rakefile" + ], + "exclude_patterns": [ + "**/vendor/**", + "**/tmp/**" + ], + "multi_workspace": false, + "initialization_options": {}, + "request_timeout_secs": 60 + }, + "rust": { + "name": "rust-analyzer", + "command": "rust-analyzer", + "args": [], + "file_extensions": [ + "rs" + ], + "project_patterns": [ + "Cargo.toml" + ], + "exclude_patterns": [ + "**/target/**" + ], + "multi_workspace": false, + "initialization_options": { + "cargo": { + "buildScripts": { + "enable": true + } + }, + "diagnostics": { + "enable": true, + "enableExperimental": true + }, + "workspace": { + "symbol": { + "search": { + "scope": "workspace" + } + } + } + }, + "request_timeout_secs": 60 + }, + "java": { + "name": "jdtls", + "command": "jdtls", + "args": [], + "file_extensions": [ + "java" + ], + "project_patterns": [ + "pom.xml", + "build.gradle", + "build.gradle.kts", + ".project" + ], + "exclude_patterns": [ + "**/target/**", + "**/build/**", + "**/.gradle/**" + ], + "multi_workspace": false, + "initialization_options": { + "settings": { + "java": { + "compile": { + "nullAnalysis": { + "mode": "automatic" + } + }, + "configuration": { + "annotationProcessing": { + "enabled": true + } + } + } + } + }, + "request_timeout_secs": 60 + }, + "python": { + "name": "pyright", + "command": "pyright-langserver", + "args": [ + "--stdio" + ], + "file_extensions": [ + "py" + ], + "project_patterns": [ + "pyproject.toml", + "setup.py", + "requirements.txt", + "pyrightconfig.json" + ], + "exclude_patterns": [ + "**/__pycache__/**", + "**/venv/**", + "**/.venv/**", + "**/.pytest_cache/**" + ], + "multi_workspace": false, + "initialization_options": {}, + "request_timeout_secs": 60 + }, + "typescript": { + "name": "typescript-language-server", + "command": "typescript-language-server", + "args": [ + "--stdio" + ], + "file_extensions": [ + "ts", + "js", + "tsx", + "jsx" + ], + "project_patterns": [ + "package.json", + "tsconfig.json" + ], + "exclude_patterns": [ + "**/node_modules/**", + "**/dist/**" + ], + "multi_workspace": false, + "initialization_options": { + "preferences": { + "disableSuggestions": false + } + }, + "request_timeout_secs": 60 + }, + "go": { + "name": "gopls", + "command": "gopls", + "args": [], + "file_extensions": [ + "go" + ], + "project_patterns": [ + "go.mod", + "go.sum" + ], + "exclude_patterns": [ + "**/vendor/**" + ], + "multi_workspace": false, + "initialization_options": { + "usePlaceholders": true, + "completeUnimported": true + }, + "request_timeout_secs": 60 + }, + "cpp": { + "name": "clangd", + "command": "clangd", + "args": [ + "--background-index" + ], + "file_extensions": [ + "cpp", + "cc", + "cxx", + "c", + "h", + "hpp", + "hxx" + ], + "project_patterns": [ + "CMakeLists.txt", + "compile_commands.json", + "Makefile" + ], + "exclude_patterns": [ + "**/build/**", + "**/cmake-build-**/**" + ], + "multi_workspace": false, + "initialization_options": {}, + "request_timeout_secs": 60 + } + } +} \ No newline at end of file diff --git a/src/app.tsx b/src/app.tsx index 3c67d13..e353947 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -9,6 +9,7 @@ import { sendPrompt, sendCtl, createSession, + killSession, } from './lib/api' import type { IdxEntry } from './lib/api' import { parseChat } from './lib/chat' @@ -76,6 +77,13 @@ export function App() { if (s.length > 0) setSelectedId(s[s.length - 1].id) }, []) + const handleKill = useCallback(async (id: string) => { + await killSession(id) + if (selectedId === id) setSelectedId(null) + const s = await listSessions() + setSessions(s) + }, [selectedId]) + return (
setShowNew(true)} + onKill={handleKill} /> s.id === selectedId) ?? null} diff --git a/src/components/ChatPane.tsx b/src/components/ChatPane.tsx index 5b9a6d2..30c734e 100644 --- a/src/components/ChatPane.tsx +++ b/src/components/ChatPane.tsx @@ -16,16 +16,16 @@ interface Props { } function stateClass(state: string) { - if (state === 'running') return 'running' - if (state === 'idle' || state === 'waiting') return 'idle' - return 'stopped' + if (state === 'idle') return 'idle' + if (state === 'stopped') return 'stopped' + return 'running' } export function ChatPane({ session, cfg, messages, onSend, onStop }: Props) { const listRef = useRef(null) const [atBottom, setAtBottom] = useState(true) - const isRunning = cfg?.state === 'running' + const isRunning = !!cfg?.state && cfg.state !== 'idle' && cfg.state !== 'stopped' useEffect(() => { if (atBottom && listRef.current) { @@ -76,6 +76,8 @@ export function ChatPane({ session, cfg, messages, onSend, onStop }: Props) {
{msg.role === 'user' ? (
{msg.content}
+ ) : msg.role === 'tool' ? ( + ) : (
+ →{' '} + {name && {name}} +
{body}
+
+ ) +} + function Welcome() { const tree: [string, string][] = [ ['/s/', 'sessions'], diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index c8d56bd..4106620 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -6,15 +6,16 @@ interface Props { selectedId: string | null onSelect: (id: string) => void onNew: () => void + onKill: (id: string) => void } function stateClass(state: string) { - if (state === 'running') return 'running' - if (state === 'idle' || state === 'waiting') return 'idle' - return 'stopped' + if (state === 'idle') return 'idle' + if (state === 'stopped') return 'stopped' + return 'running' // thinking, calling: , etc. } -export function Sidebar({ sessions, selectedId, onSelect, onNew }: Props) { +export function Sidebar({ sessions, selectedId, onSelect, onNew, onKill }: Props) { return (