(self, response: str)
| 352 | return "\n\n".join(parts) |
| 353 | |
| 354 | def _parse_actions(self, response: str) -> tuple[str, list[tuple[str, str]]]: |
| 355 | actions: list[tuple[str, str]] = [] |
| 356 | reply_lines: list[str] = [] |
| 357 | prefix = f"##ACT_{self._action_nonce}_" |
| 358 | |
| 359 | for line in response.split("\n"): |
| 360 | stripped = line.strip() |
| 361 | if stripped.startswith(prefix): |
| 362 | tag = stripped[len(prefix):] |
| 363 | if tag.startswith("RUN:"): |
| 364 | actions.append(("RUN", tag[4:].strip())) |
| 365 | elif tag == "STATUS": |
| 366 | actions.append(("STATUS", "")) |
| 367 | elif tag == "STOP": |
| 368 | actions.append(("STOP", "")) |
| 369 | elif tag == "EXPORT": |
| 370 | actions.append(("EXPORT", "")) |
| 371 | elif tag == "LIST": |
| 372 | actions.append(("LIST", "")) |
| 373 | elif tag.startswith("REMEMBER:"): |
| 374 | actions.append(("REMEMBER", tag[9:].strip())) |
| 375 | else: |
| 376 | reply_lines.append(line) |
| 377 | else: |
| 378 | reply_lines.append(line) |
| 379 | |
| 380 | return "\n".join(reply_lines).strip(), actions |
| 381 | |
| 382 | async def _condense_memory(self, memory) -> None: |
| 383 | old_msgs = memory.messages[:-memory.KEEP_RECENT] |
no test coverage detected