feat: improve assistant thinking states

This commit is contained in:
ajnart committed 2026-08-14 11:32:11 +02:00
1 parent ebd63bea74
commit 59cb3a4d99
9 files changed
+542 -23

No files matched your search

@@ -0,0 +1,29 @@
import type { AssistantDotMatrixState } from "./assistant-dot-matrix";
interface AssistantActivityStateInput {
isRunning: boolean;
latestPartType: string | undefined;
needsApproval: boolean;
failed: boolean;
}
export const getRunningAssistantPartType = (
messageStatusType: string | undefined,
latestPartType: string | undefined,
) => (messageStatusType === "running" ? latestPartType : undefined);
export const getAssistantActivityState = ({
isRunning,
latestPartType,
needsApproval,
failed,
}: AssistantActivityStateInput): AssistantDotMatrixState => {
if (isRunning) {
if (latestPartType === "tool-call") return "waiting";
if (latestPartType === undefined || latestPartType === "reasoning") return "thinking";
return "streaming";
}
if (needsApproval) return "waiting";
if (failed) return "error";
return "success";
};