mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-28 11:41:04 +00:00
- Introduce AgentStatus.IDLE for agents that finished work but can accept follow-up messages - Add isSettledStatus() helper to check if agent is settled (IDLE or terminal) - Update ArenaManager to transition to IDLE after agents finish initial task - Keep agent tabs visible when session is IDLE so users can continue interacting - Fix listener cleanup to not detach on IDLE (agents remain alive) - Update tests to expect 'idle' status after successful completion This enables the arena collaboration feature where agents can receive additional tasks after completing their initial work. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { theme } from '../semantic-colors.js';
|
|
import { AgentStatus } from '@qwen-code/qwen-code-core';
|
|
|
|
// --- Status Labels ---
|
|
|
|
export interface StatusLabel {
|
|
icon: string;
|
|
text: string;
|
|
color: string;
|
|
}
|
|
|
|
export function getArenaStatusLabel(status: AgentStatus): StatusLabel {
|
|
switch (status) {
|
|
case AgentStatus.IDLE:
|
|
return { icon: '✓', text: 'Idle', color: theme.status.success };
|
|
case AgentStatus.COMPLETED:
|
|
return { icon: '✓', text: 'Done', color: theme.status.success };
|
|
case AgentStatus.CANCELLED:
|
|
return { icon: '⊘', text: 'Cancelled', color: theme.status.warning };
|
|
case AgentStatus.FAILED:
|
|
return { icon: '✗', text: 'Failed', color: theme.status.error };
|
|
case AgentStatus.RUNNING:
|
|
return { icon: '○', text: 'Running', color: theme.text.secondary };
|
|
case AgentStatus.INITIALIZING:
|
|
return { icon: '○', text: 'Initializing', color: theme.text.secondary };
|
|
default:
|
|
return { icon: '○', text: status, color: theme.text.secondary };
|
|
}
|
|
}
|
|
|
|
// --- Thresholds ---
|
|
export const TOOL_SUCCESS_RATE_HIGH = 95;
|
|
export const TOOL_SUCCESS_RATE_MEDIUM = 85;
|
|
|
|
export const USER_AGREEMENT_RATE_HIGH = 75;
|
|
export const USER_AGREEMENT_RATE_MEDIUM = 45;
|
|
|
|
export const CACHE_EFFICIENCY_HIGH = 40;
|
|
export const CACHE_EFFICIENCY_MEDIUM = 15;
|
|
|
|
// --- Color Logic ---
|
|
export const getStatusColor = (
|
|
value: number,
|
|
thresholds: { green: number; yellow: number; red?: number },
|
|
options: { defaultColor?: string } = {},
|
|
) => {
|
|
if (value >= thresholds.green) {
|
|
return theme.status.success;
|
|
}
|
|
if (value >= thresholds.yellow) {
|
|
return theme.status.warning;
|
|
}
|
|
if (thresholds.red != null && value >= thresholds.red) {
|
|
return theme.status.error;
|
|
}
|
|
return options.defaultColor ?? theme.status.error;
|
|
};
|