chore: bump version to 0.7.3, set package to public, and add per-session agent mode switching

Changes:
- Bump version to 0.7.3
- Set package.private to false
- Add useSessionAgent hook for per-session agent mode
- Remove global mode preference, use session-level mode
- Add mobile drag-and-drop toggle for repo list
- Improve repo card UI with truncation and compact status
- Fix TypeScript errors in repo.ts (undefined handling)
This commit is contained in:
Chris Scott committed 2026-01-23 17:08:18 -05:00
1 parent 94725ce473
commit e6156f3c47
12 files changed
+202 -76

No files matched your search

@@ -3,6 +3,7 @@ import { Send, X, Pencil, Loader2 } from 'lucide-react'
import { useRefreshMessage } from '@/hooks/useRemoveMessage'
import { useUIState } from '@/stores/uiStateStore'
import { useMobile } from '@/hooks/useMobile'
import { useSessionAgent } from '@/hooks/useSessionAgent'
interface EditableUserMessageProps {
opcodeUrl: string
@@ -12,7 +13,6 @@ interface EditableUserMessageProps {
assistantMessageId: string
onCancel: () => void
model?: string
agent?: string
}
export const EditableUserMessage = memo(function EditableUserMessage({
@@ -22,14 +22,15 @@ export const EditableUserMessage = memo(function EditableUserMessage({
content,
assistantMessageId,
onCancel,
model,
agent
model
}: EditableUserMessageProps) {
const [editedContent, setEditedContent] = useState(content)
const textareaRef = useRef<HTMLTextAreaElement>(null)
const isMobile = useMobile()
const refreshMessage = useRefreshMessage({ opcodeUrl, sessionId, directory })
const setIsEditingMessage = useUIState((state) => state.setIsEditingMessage)
const sessionAgent = useSessionAgent(opcodeUrl, sessionId, directory)
const currentMode = sessionAgent.agent
useEffect(() => {
if (textareaRef.current) {
@@ -61,7 +62,7 @@ export const EditableUserMessage = memo(function EditableUserMessage({
assistantMessageID: assistantMessageId,
userMessageContent: editedContent.trim(),
model,
agent
agent: currentMode
}, {
onSuccess: () => {
onCancel()
@@ -29,7 +29,6 @@ interface MessageThreadProps {
onChildSessionClick?: (sessionId: string) => void
onUndoMessage?: (restoredPrompt: string) => void
model?: string
agent?: string
}
const isMessageStreaming = (msg: MessageWithParts): boolean => {
@@ -70,8 +69,7 @@ export const MessageThread = memo(function MessageThread({
onFileClick,
onChildSessionClick,
onUndoMessage,
model,
agent
model
}: MessageThreadProps) {
const [editingUserMessageId, setEditingUserMessageId] = useState<string | null>(null)
const [editingForAssistantId, setEditingForAssistantId] = useState<string | null>(null)
@@ -229,7 +227,6 @@ const state = latestTodoPart.state
assistantMessageId={editingForAssistantId}
onCancel={handleCancelEdit}
model={model}
agent={agent}
/>
) : msg.info.role === 'user' && canEditUserMessage && nextAssistantMessage ? (
<ClickableUserMessage
@@ -1,11 +1,11 @@
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'
import { useCommandHandler } from '@/hooks/useCommandHandler'
import { useFileSearch } from '@/hooks/useFileSearch'
import { useModelSelection } from '@/hooks/useModelSelection'
import { useVariants } from '@/hooks/useVariants'
import { useSessionAgent } from '@/hooks/useSessionAgent'
import { useUserBash } from '@/stores/userBashStore'
import { useMobile } from '@/hooks/useMobile'
@@ -88,6 +88,7 @@ export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(funct
const [selectedMentionIndex, setSelectedMentionIndex] = useState(0)
const [selectedCommandIndex, setSelectedCommandIndex] = useState(0)
const [selectedAgent, setSelectedAgent] = useState<string | null>(null)
const [localMode, setLocalMode] = useState<string | null>(null)
const [isFocused, setIsFocused] = useState(false)
const textareaRef = useRef<HTMLTextAreaElement>(null)
@@ -121,7 +122,6 @@ export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(funct
const sendShell = useSendShell(opcodeUrl, directory)
const abortSession = useAbortSession(opcodeUrl, directory, sessionID)
const { data: messages } = useMessages(opcodeUrl, sessionID, directory)
const { preferences, updateSettings } = useSettings()
const { filterCommands } = useCommands(opcodeUrl)
const { executeCommand } = useCommandHandler({
opcodeUrl,
@@ -348,7 +348,7 @@ export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(funct
const handleModeToggle = () => {
const newMode = currentMode === 'plan' ? 'build' : 'plan'
updateSettings({ mode: newMode })
setLocalMode(newMode)
}
const addImageAttachment = (file: File) => {
@@ -680,7 +680,8 @@ if (isIOS && isSecureContext && navigator.clipboard && navigator.clipboard.read)
const lastAssistantMessage = messages?.filter(msg => msg.info.role === 'assistant').at(-1)
const hasIncompleteMessages = lastAssistantMessage ? isMessageIncomplete(lastAssistantMessage) : false
const currentMode = preferences?.mode || 'build'
const sessionAgent = useSessionAgent(opcodeUrl, sessionID, directory)
const currentMode = localMode ?? sessionAgent.agent
const modeColor = currentMode === 'plan' ? 'text-yellow-600 dark:text-yellow-500' : 'text-green-600 dark:text-green-500'
const modeBg = currentMode === 'plan' ? 'bg-yellow-500/20 border-yellow-400 hover:bg-yellow-500/30 hover:border-yellow-300' : 'bg-green-500/20 border-green-400 hover:bg-green-500/30 hover:border-green-300'
const modeShadow = currentMode === 'plan' ? 'shadow-yellow-500/20 hover:shadow-yellow-500/30' : 'shadow-green-500/20 hover:shadow-green-500/30'
@@ -708,6 +709,10 @@ const { model, modelString } = useModelSelection(opcodeUrl, directory)
onPromptChange?.(prompt.trim().length > 0)
}, [prompt, onPromptChange])
useEffect(() => {
setLocalMode(null)
}, [sessionID])
@@ -773,6 +778,7 @@ return (
<div className="flex gap-1.5 md:gap-2 items-center justify-between">
<div className="flex gap-1.5 md:gap-2 items-center">
<button
data-toggle-mode
onClick={handleModeToggle}
className={`px-3 md:px-3.5 py-1 h-[36px] rounded-lg text-sm font-medium border w-14 flex items-center justify-center transition-all duration-200 active:scale-95 hover:scale-105 shadow-md ${
isBashMode