2026-11-13 19:16:03 +08:00
|
|
|
import { useMemo } from "react";
|
2026-10-14 00:11:00 +08:00
|
|
|
import { SubagentThreadView } from "@/components/thread/SubagentThreadView";
|
2026-11-13 19:16:03 +08:00
|
|
|
import { ExecSessionCommandsContext } from "@/components/thread/activity/exec-session-context";
|
|
|
|
|
import { execSessionCommands } from "@/components/thread/activity/exec-session-model";
|
2026-10-14 00:11:00 +08:00
|
|
|
import { useSubagentThread } from "@/components/thread/useSubagentThread";
|
|
|
|
|
import type { SubagentTaskSnapshot } from "@/lib/types";
|
2026-10-05 05:16:33 +08:00
|
|
|
|
|
|
|
|
interface SubagentThreadProps {
|
|
|
|
|
token: string;
|
|
|
|
|
sessionKey: string;
|
|
|
|
|
task: SubagentTaskSnapshot;
|
|
|
|
|
historyEnabled: boolean;
|
|
|
|
|
isStreaming: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function SubagentThread({ token, sessionKey, task, historyEnabled, isStreaming }: SubagentThreadProps) {
|
2026-10-20 15:32:21 +08:00
|
|
|
const { messages, loading, error, activeTurnId, retry } = useSubagentThread({ token, sessionKey, task, historyEnabled });
|
2026-11-13 19:16:03 +08:00
|
|
|
const commands = useMemo(() => execSessionCommands(messages), [messages]);
|
|
|
|
|
return <ExecSessionCommandsContext.Provider value={commands}>
|
|
|
|
|
<SubagentThreadView messages={messages} loading={loading} error={error} isStreaming={isStreaming}
|
|
|
|
|
activeTurnId={activeTurnId} runStartedAt={task.created_at} onRetry={retry} />
|
|
|
|
|
</ExecSessionCommandsContext.Provider>;
|
2026-10-05 05:16:33 +08:00
|
|
|
}
|