fix: subagent unique ID matching + AgentState serialization + pre-existing TS errors
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

- S-3: Thread task_id (UUID) through all 6 layers (LoopEvent → StreamChatEvent → kernel-types → gateway-client → streamStore) so subtasks are matched by ID, not description string
- AgentState: Add #[serde(rename_all = "lowercase")] to fix PascalCase serialization ("Running" → "running"), update frontend matcher
- S-1: Remove unused onClose prop from ArtifactPanel + ChatArea call site
- Fix hooks/index.ts: remove orphaned useAutomationEvents re-exports (module deleted)
- Fix types/index.ts: remove orphaned automation type/value re-exports (module deleted)
- Fix ChatArea.tsx: framer-motion 12 + React 19 type compat — use createElement + explicit any return type to avoid unknown-in-JSX-child error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-06 22:30:16 +08:00
parent bbbcd7725b
commit 02c69bb3cf
13 changed files with 37 additions and 66 deletions

View File

@@ -178,7 +178,7 @@ export class GatewayClient {
onThinkingDelta?: (delta: string) => void;
onTool?: (tool: string, input: string, output: string) => void;
onHand?: (name: string, status: string, result?: unknown) => void;
onSubtaskStatus?: (description: string, status: string, detail?: string) => void;
onSubtaskStatus?: (taskId: string, description: string, status: string, detail?: string) => void;
onComplete: (inputTokens?: number, outputTokens?: number) => void;
onError: (error: string) => void;
}>();
@@ -404,7 +404,7 @@ export class GatewayClient {
const agents = await this.restGet<Array<{ id: string; name?: string; state?: string }>>('/api/agents');
if (agents && agents.length > 0) {
// Prefer agent with state "Running", otherwise use first agent
const runningAgent = agents.find((a: { id: string; name?: string; state?: string }) => a.state === 'Running');
const runningAgent = agents.find((a: { id: string; name?: string; state?: string }) => a.state === 'running');
const defaultAgent = runningAgent || agents[0];
this.defaultAgentId = defaultAgent.id;
this.log('info', `Fetched default agent from /api/agents: ${this.defaultAgentId} (${defaultAgent.name || 'unnamed'})`);
@@ -470,7 +470,7 @@ export class GatewayClient {
onThinkingDelta?: (delta: string) => void;
onTool?: (tool: string, input: string, output: string) => void;
onHand?: (name: string, status: string, result?: unknown) => void;
onSubtaskStatus?: (description: string, status: string, detail?: string) => void;
onSubtaskStatus?: (taskId: string, description: string, status: string, detail?: string) => void;
onComplete: (inputTokens?: number, outputTokens?: number) => void;
onError: (error: string) => void;
},
@@ -652,7 +652,7 @@ export class GatewayClient {
case 'subtask_status':
// Sub-agent task status update
if (callbacks.onSubtaskStatus && data.description) {
callbacks.onSubtaskStatus(data.description, data.status || '', data.detail);
callbacks.onSubtaskStatus(data.task_id || data.description, data.description, data.status || '', data.detail);
}
break;

View File

@@ -88,6 +88,7 @@ export interface ZclawStreamEvent {
agent_id?: string;
agents?: Array<{ id: string; name: string; status: string }>;
// Subtask status fields
task_id?: string;
description?: string;
status?: string;
detail?: string;

View File

@@ -147,9 +147,10 @@ export function installChatMethods(ClientClass: { prototype: KernelClient }): vo
break;
case 'subtaskStatus':
log.debug('Subtask status:', streamEvent.description, streamEvent.status, streamEvent.detail);
log.debug('Subtask status:', streamEvent.taskId, streamEvent.description, streamEvent.status, streamEvent.detail);
if (callbacks.onSubtaskStatus) {
callbacks.onSubtaskStatus(
streamEvent.taskId,
streamEvent.description,
streamEvent.status,
streamEvent.detail ?? undefined

View File

@@ -69,7 +69,7 @@ export interface StreamCallbacks {
onThinkingDelta?: (delta: string) => void;
onTool?: (tool: string, input: string, output: string) => void;
onHand?: (name: string, status: string, result?: unknown) => void;
onSubtaskStatus?: (description: string, status: string, detail?: string) => void;
onSubtaskStatus?: (taskId: string, description: string, status: string, detail?: string) => void;
onComplete: (inputTokens?: number, outputTokens?: number) => void;
onError: (error: string) => void;
}
@@ -129,6 +129,7 @@ export interface StreamEventHandEnd {
export interface StreamEventSubtaskStatus {
type: 'subtaskStatus';
taskId: string;
description: string;
status: string;
detail?: string;