mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-01 05:00:46 +00:00
refactor(arena): move arena-bridge to context and add reactive manager tracking
- Move useArenaInProcess from AppContainer to AgentViewProvider - Replace polling with config.onArenaManagerChange() callback - Add success-type progress messages when agents finish tasks - Add isSuccessStatus helper for IDLE/COMPLETED status checks - Reset input history position when arena session starts This improves separation of concerns and eliminates the 500ms polling interval in favor of immediate reactive updates when the arena manager changes. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
addbdcb0ef
commit
d7aa98a0c0
13 changed files with 178 additions and 134 deletions
|
|
@ -25,7 +25,9 @@ import {
|
|||
import {
|
||||
type AgentInteractive,
|
||||
type ApprovalMode,
|
||||
type Config,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import { useArenaInProcess } from '../hooks/useArenaInProcess.js';
|
||||
|
||||
// ─── Types ──────────────────────────────────────────────────
|
||||
|
||||
|
|
@ -116,10 +118,14 @@ export function useAgentViewActions(): AgentViewActions {
|
|||
// ─── Provider ───────────────────────────────────────────────
|
||||
|
||||
interface AgentViewProviderProps {
|
||||
config?: Config;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export function AgentViewProvider({ children }: AgentViewProviderProps) {
|
||||
export function AgentViewProvider({
|
||||
config,
|
||||
children,
|
||||
}: AgentViewProviderProps) {
|
||||
const [activeView, setActiveView] = useState<string>('main');
|
||||
const [agents, setAgents] = useState<Map<string, RegisteredAgent>>(
|
||||
() => new Map(),
|
||||
|
|
@ -276,6 +282,12 @@ export function AgentViewProvider({ children }: AgentViewProviderProps) {
|
|||
],
|
||||
);
|
||||
|
||||
// ── Arena in-process bridge ──
|
||||
// Bridge arena manager events to agent registration. The hook is kept
|
||||
// in its own file for separation of concerns; it's called here so the
|
||||
// provider is the single owner of agent tab lifecycle.
|
||||
useArenaInProcess(config ?? null, actions);
|
||||
|
||||
return (
|
||||
<AgentViewStateContext.Provider value={state}>
|
||||
<AgentViewActionsContext.Provider value={actions}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue