дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
Agent turns cut off by a window close, quit, restart, backend stop or crash are recorded as interrupted (without changing the task status) and can be resumed from the task view, a notification or automatically on reopen. Closing a window with running tasks asks whether to pause them or arm a one-time auto-resume. Transient network failures hold the turn in Waiting for network and continue once connectivity returns within a configurable window. Auto-resume is refused when the turn was waiting for tool approval, the approval policy changed, several local tasks share a checkout, or a crash loop is detected. Recovery settings are user-only so project settings cannot force auto-resume. Closes #6758 Co-authored-by: dengliu <[email protected]>
42 рядки
1.5 KiB
TypeScript
42 рядки
1.5 KiB
TypeScript
/**
|
|
* The tab strip's agent status indicator (#2233): a spinner while the task is busy, then a
|
|
* dot only while something waits for you (a finished reply not yet read, a question, an error).
|
|
*/
|
|
import { Badge, Spinner, tooltipAttrs } from "@/ui";
|
|
import { useTx } from "@/platform/i18n";
|
|
import { isBusy, isInterrupted, isWaitingForNetwork, taskStatusLabel } from "./model";
|
|
import { useAgents } from "./store";
|
|
|
|
export function TaskStatusMark({ task }: { task: string }) {
|
|
const tx = useTx();
|
|
const current = useAgents((s) => s.tasks.get(task));
|
|
const unread = useAgents((s) => s.unread.has(task));
|
|
if (!current) return null;
|
|
const { status } = current;
|
|
const waitingNetwork = isWaitingForNetwork(current);
|
|
const interrupted = isInterrupted(current);
|
|
// Waiting for you (or waiting for network / interrupted) is a dot, not a spinner.
|
|
const busy = isBusy(status) && status !== "needsInput" && !waitingNetwork;
|
|
const tone =
|
|
status === "failed" || status === "limited"
|
|
? "danger"
|
|
: status === "needsInput" || waitingNetwork || interrupted
|
|
? "warning"
|
|
: status === "ready" && unread
|
|
? "success"
|
|
: null;
|
|
if (!busy && !tone) return null;
|
|
const label = tx(taskStatusLabel(current));
|
|
return (
|
|
<span {...tooltipAttrs(label, undefined, true)} style={{ display: "inline-flex", alignItems: "center" }}>
|
|
{busy ? (
|
|
<Spinner size={10} variant="spokes" label={label} />
|
|
) : (
|
|
<Badge dot tone={tone!}>
|
|
{label}
|
|
</Badge>
|
|
)}
|
|
</span>
|
|
);
|
|
}
|