Skip to content

Commit 0fab947

Browse files
author
Zvonimir Sabljic
committed
Added important_stream message to the core - this tells the extension that the next stream should be visible to the user (unfolded) and currently, render it as a markdown
1 parent 3587763 commit 0fab947

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

core/agents/bug_hunter.py

+6
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ async def start_pair_programming(self):
184184
convo = self.generate_iteration_convo_so_far(True)
185185
convo.remove_last_x_messages(1)
186186
convo = convo.template("problem_explanation")
187+
await self.ui.start_important_stream()
187188
initial_explanation = await llm(convo, temperature=0.5)
188189

189190
convo = convo.template("data_about_logs").require_schema(ImportantLogsForDebugging)
@@ -236,23 +237,27 @@ async def start_pair_programming(self):
236237
elif next_step.button == "question":
237238
user_response = await self.ask_question("Oh, cool, what would you like to know?")
238239
convo = convo.template("ask_a_question", question=user_response.text)
240+
await self.ui.start_important_stream()
239241
llm_answer = await llm(convo, temperature=0.5)
240242
await self.send_message(llm_answer)
241243
elif next_step.button == "tell_me_more":
242244
convo.template("tell_me_more")
245+
await self.ui.start_important_stream()
243246
response = await llm(convo, temperature=0.5)
244247
await self.send_message(response)
245248
elif next_step.button == "other":
246249
# this is the same as "question" - we want to keep an option for users to click to understand if we're missing something with other options
247250
user_response = await self.ask_question("Let me know what you think...")
248251
convo = convo.template("ask_a_question", question=user_response.text)
252+
await self.ui.start_important_stream()
249253
llm_answer = await llm(convo, temperature=0.5)
250254
await self.send_message(llm_answer)
251255
elif next_step.button == "solution_hint":
252256
human_hint_label = "Amazing!!! How do you think we can solve this bug?"
253257
while True:
254258
human_hint = await self.ask_question(human_hint_label)
255259
convo = convo.template("instructions_from_human_hint", human_hint=human_hint.text)
260+
await self.ui.start_important_stream()
256261
llm = self.get_llm(CHECK_LOGS_AGENT_NAME)
257262
human_readable_instructions = await llm(convo, temperature=0.5)
258263
human_approval = await self.ask_question(
@@ -270,6 +275,7 @@ async def start_pair_programming(self):
270275
break
271276
elif next_step.button == "tell_me_more":
272277
convo.template("tell_me_more")
278+
await self.ui.start_important_stream()
273279
response = await llm(convo, temperature=0.5)
274280
await self.send_message(response)
275281
continue

core/ui/base.py

+7
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,13 @@ async def send_project_root(self, path: str):
268268
"""
269269
raise NotImplementedError()
270270

271+
async def start_important_stream(self, path: str):
272+
"""
273+
Tell the extension that next stream should be visible and rendered as markdown
274+
275+
"""
276+
raise NotImplementedError()
277+
271278
async def send_project_stats(self, stats: dict):
272279
"""
273280
Send project statistics to the UI.

core/ui/console.py

+3
Original file line numberDiff line numberDiff line change
@@ -151,5 +151,8 @@ async def send_features_list(self, features: list[str]):
151151
async def import_project(self, project_dir: str):
152152
pass
153153

154+
async def start_important_stream(self):
155+
pass
156+
154157

155158
__all__ = ["PlainConsoleUI"]

core/ui/ipc_client.py

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class MessageType(str, Enum):
4545
FEATURE_FINISHED = "featureFinished"
4646
GENERATE_DIFF = "generateDiff"
4747
CLOSE_DIFF = "closeDiff"
48+
IMPORTANT_STREAM = "importantStream"
4849

4950

5051
class Message(BaseModel):
@@ -362,6 +363,12 @@ async def send_project_root(self, path: str):
362363
content=basename(path),
363364
)
364365

366+
async def start_important_stream(self):
367+
await self._send(
368+
MessageType.IMPORTANT_STREAM,
369+
content={},
370+
)
371+
365372
async def send_project_stats(self, stats: dict):
366373
await self._send(
367374
MessageType.PROJECT_STATS,

core/ui/virtual.py

+3
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ async def open_editor(self, file: str, line: Optional[int] = None):
126126
async def send_project_root(self, path: str):
127127
pass
128128

129+
async def start_important_stream(self):
130+
pass
131+
129132
async def send_project_stats(self, stats: dict):
130133
pass
131134

0 commit comments

Comments
 (0)