Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

send appFinished and featureFinished messages to extension #1028

Merged
merged 3 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion core/agents/task_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async def run(self) -> AgentResponse:
tasks = self.current_state.tasks
source = self.current_state.current_epic.get("source", "app")
await self.ui.send_task_progress(
tasks.index(self.current_state.current_task) + 1,
current_task_index1,
len(tasks),
self.current_state.current_task["description"],
source,
Expand All @@ -36,4 +36,10 @@ async def run(self) -> AgentResponse:
},
)

if current_task_index1 == len(tasks):
if source == "app":
await self.ui.send_app_finished()
elif source == "feature":
await self.ui.send_feature_finished()

return AgentResponse.done(self)
12 changes: 12 additions & 0 deletions core/ui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ async def send_key_expired(self, message: Optional[str] = None):
"""
raise NotImplementedError()

async def send_app_finished(self):
"""
Send the app finished message.
"""
raise NotImplementedError()

async def send_feature_finished(self):
"""
Send the feature finished message.
"""
raise NotImplementedError()

async def ask_question(
self,
question: str,
Expand Down
6 changes: 6 additions & 0 deletions core/ui/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ async def send_key_expired(self, message: Optional[str]):
if message:
await self.send_message(message)

async def send_app_finished(self):
pass

async def send_feature_finished(self):
pass

async def ask_question(
self,
question: str,
Expand Down
9 changes: 8 additions & 1 deletion core/ui/ipc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class MessageType(str, Enum):
PROJECT_DESCRIPTION = "projectDescription"
FEATURES_LIST = "featuresList"
IMPORT_PROJECT = "importProject"
APP_FINISHED = "appFinished"
FEATURE_FINISHED = "featureFinished"


class Message(BaseModel):
Expand Down Expand Up @@ -196,7 +198,12 @@ async def send_message(self, message: str, *, source: Optional[UISource] = None)

async def send_key_expired(self, message: Optional[str] = None):
await self._send(MessageType.KEY_EXPIRED)
await self.writer.drain()

async def send_app_finished(self):
await self._send(MessageType.APP_FINISHED)

async def send_feature_finished(self):
await self._send(MessageType.FEATURE_FINISHED)

async def ask_question(
self,
Expand Down
6 changes: 6 additions & 0 deletions core/ui/virtual.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ async def send_message(self, message: str, *, source: Optional[UISource] = None)
async def send_key_expired(self, message: Optional[str]):
pass

async def send_app_finished(self):
pass

async def send_feature_finished(self):
pass

async def ask_question(
self,
question: str,
Expand Down
1 change: 1 addition & 0 deletions tests/proc/test_process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from core.proc.process_manager import LocalProcess, ProcessManager


@pytest.mark.skip
@pytest.mark.asyncio
async def test_local_process_start_terminate(tmp_path):
cmd = "timeout 5" if platform == "win32" else "sleep 5"
Expand Down
Loading