(self, message: Message | None)
| 93 | return root |
| 94 | |
| 95 | def _extract_code(self, message: Message | None) -> str: |
| 96 | if not message: |
| 97 | return "" |
| 98 | raw = message.text_content() |
| 99 | if not raw or not raw.strip(): |
| 100 | return "" |
| 101 | match = _CODE_BLOCK_RE.search(raw) |
| 102 | code = match.group("code") if match else raw |
| 103 | return textwrap.dedent(code).strip() |
| 104 | |
| 105 | def _write_script_file(self, node: Node, workspace: Path, code: str) -> Path: |
| 106 | counters = self.context.global_state.setdefault(self.COUNTER_KEY, {}) |