The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(conversations): add conversation list view
Steven Enamakel3e00811b4a6e
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsxindex c680297aac..7966710094 100644--- a/app/src/features/conversations/Conversations.tsx+++ b/app/src/features/conversations/Conversations.tsx@@ -1349,47 +1349,88 @@ const Conversations = ({// `ChatRuntimeProvider.onCancelled` persists the partial and its processing// trail after the core confirms cancellation. Keeping that in one place also// covers turns superseded without a local Stop click.- const handleStopGeneration = useCallback(() => {- if (!selectedThreadId) {- debug('[chat] stop generation: no selected thread — noop');- return;- }- const threadId = selectedThreadId;- debug('[chat] stop generation: thread=%s', threadId);- void chatCancel(threadId).then(outcome => {- const accepted = outcome?.accepted === true;- const turnCancelled = outcome?.turnCancelled === true;- debug(- '[chat] stop generation: chatCancel thread=%s accepted=%s turnCancelled=%s',+ const clearStopSettleTimer = useCallback((threadId: string) => {+ const timer = stopSettleTimersRef.current.get(threadId);+ if (timer === undefined) return;+ clearTimeout(timer);+ stopSettleTimersRef.current.delete(threadId);+ }, []);++ // End a thread's local running state without waiting for the core.+ const settleStoppedThread = useCallback(+ (threadId: string, reason: string) => {+ debug('[chat] stop generation: settling local state thread=%s reason=%s', threadId, reason);+ clearStopSettleTimer(threadId);+ clearSilenceTimer(threadId);+ turnSignatureByThreadRef.current.delete(threadId);+ clearThreadStalled(threadId);+ dispatch(clearRuntimeForThread({ threadId }));+ dispatch(clearThreadInferenceActive(threadId));+ },+ [dispatch, clearSilenceTimer, clearThreadStalled, clearStopSettleTimer]+ );++ const stopThreadTurn = useCallback(+ (threadId: string) => {+ const sendPending = pendingSendsRef.current.has(threadId);+ debug('[chat] stop generation: thread=%s sendPending=%s', threadId, sendPending);+ // The core registers the turn only as the send RPC returns; until then+ // this cancel may find nothing. Remember the Stop so the send path can+ // re-issue it against the registered turn instead of letting it run.+ if (sendPending) stopRequestedDuringSendRef.current.add(threadId);++ clearStopSettleTimer(threadId);+ stopSettleTimersRef.current.set(threadId,- accepted,- turnCancelled+ setTimeout(() => {+ stopSettleTimersRef.current.delete(threadId);+ if (!isMountedRef.current) return;+ // A send in flight owns the thread's state (and re-issues the Stop).+ if (pendingSendsRef.current.has(threadId)) return;+ const lifecycle = inferenceTurnLifecycleRef.current[threadId];+ if (lifecycle !== 'started' && lifecycle !== 'streaming') return;+ settleStoppedThread(threadId, 'no terminal event after stop');+ }, STOP_SETTLE_FALLBACK_MS));- if (!accepted) return;- if (!turnCancelled) {++ void chatCancel(threadId).then(outcome => {+ const accepted = outcome?.accepted === true;+ const turnCancelled = outcome?.turnCancelled === true;+ debug(+ '[chat] stop generation: chatCancel thread=%s accepted=%s turnCancelled=%s',+ threadId,+ accepted,+ turnCancelled+ );+ // A rejected cancel is left to the backstop above.+ if (!accepted) return;+ if (turnCancelled) {+ // The turn was registered after all; a `chat_cancelled` is on its way.+ stopRequestedDuringSendRef.current.delete(threadId);+ return;+ }// The core has nothing running on this thread, so no `cancelled`- // chat_error will ever arrive to clear the composer. Without this the- // thread stays "generating" with a Stop button that can never work —- // e.g. a turn whose terminal event was lost across a reconnect. A send- // still waiting on its RPC is skipped: its turn may not be registered- // yet, and its own completion path owns the state.+ // chat_error will ever arrive to clear the composer — e.g. a turn+ // whose terminal event was lost across a reconnect. A send still+ // waiting on its RPC is the exception: its turn is not registered+ // yet, and the deferred Stop recorded above cancels it once it is.if (pendingSendsRef.current.has(threadId)) {- debug('[chat] stop generation: nothing in flight but send pending thread=%s', threadId);+ debug('[chat] stop generation: deferring until send returns thread=%s', threadId);return;}- debug(- '[chat] stop generation: nothing in flight — settling local state thread=%s',- threadId- );- clearSilenceTimer(threadId);- turnSignatureByThreadRef.current.delete(threadId);- clearThreadStalled(threadId);- dispatch(clearRuntimeForThread({ threadId }));- dispatch(clearThreadInferenceActive(threadId));- return;- }- });- }, [selectedThreadId, dispatch, clearSilenceTimer, clearThreadStalled]);+ settleStoppedThread(threadId, 'nothing in flight');+ });+ },+ [clearStopSettleTimer, settleStoppedThread]+ );++ const handleStopGeneration = useCallback(() => {+ if (!selectedThreadId) {+ debug('[chat] stop generation: no selected thread — noop');+ return;+ }+ stopThreadTurn(selectedThreadId);+ }, [selectedThreadId, stopThreadTurn]);handleStopGenerationRef.current = handleStopGeneration;