fix(copilot): emit StreamLongRunningStart event in SDK path

Add logic to detect long-running tools in the SDK execution path
and emit StreamLongRunningStart event to trigger UI feedback display.

Changes:
- Import StreamLongRunningStart and get_tool
- Check if tool has is_long_running=True when StreamToolInputAvailable is received
- Yield StreamLongRunningStart event to notify frontend

This ensures the mini-game UI displays for long-running tools
like create_agent when using the SDK execution path.
This commit is contained in:
Zamil Majdy
2026-02-21 18:39:45 +07:00
parent 35a7f98ba7
commit 12d0a1f13b

View File

@@ -25,12 +25,14 @@ from ..response_model import (
StreamFinish,
StreamFinishStep,
StreamHeartbeat,
StreamLongRunningStart,
StreamStart,
StreamTextDelta,
StreamToolInputAvailable,
StreamToolOutputAvailable,
)
from ..service import _build_system_prompt, _generate_session_title
from ..tools import get_tool
from ..tools.sandbox import WORKSPACE_PREFIX, make_session_path
from ..tracking import track_user_message
from .response_adapter import SDKResponseAdapter
@@ -731,6 +733,15 @@ async def stream_chat_completion_sdk(
yield response
# Emit long-running notification for tools with is_long_running=True
if isinstance(response, StreamToolInputAvailable):
tool = get_tool(response.toolName)
if tool and tool.is_long_running:
yield StreamLongRunningStart(
toolCallId=response.toolCallId,
toolName=response.toolName,
)
if isinstance(response, StreamTextDelta):
delta = response.delta or ""
# After tool results, start a new assistant