End a session with its sibling folder, share the part renderer, and split claude-instances

This commit is contained in:
2026-09-24 20:25:44 +02:00
parent 0bfbfa53c1
commit b5a7a116c2
3 changed files with 108 additions and 72 deletions
+18
View File
@@ -82,6 +82,24 @@ class Archive(unittest.TestCase):
self.assertIn("said", open(copy).read())
class Said(unittest.TestCase):
def test_renders_text_and_tool_calls_and_nothing_else(self):
self.assertEqual(loop.said({"type": "text", "text": "hi"}), "hi")
self.assertEqual(loop.said({"type": "text", "text": " \n"}), "")
self.assertEqual(loop.said({"type": "tool_use", "name": "Bash", "input": {"command": "x" * 500}}, 20), '[tool Bash] {"command": "xxxxxxx')
self.assertEqual(loop.said("not a part"), "")
class EndSession(unittest.TestCase):
def test_removes_the_transcript_and_its_sibling_folder(self):
with tempfile.TemporaryDirectory() as root:
transcript = os.path.join(root, "abc.jsonl")
open(transcript, "w").write("{}\n")
os.makedirs(os.path.join(root, "abc", "subagents"))
loop.end_session(transcript)
self.assertEqual(os.listdir(root), [])
class Grounded(unittest.TestCase):
def test_an_interrupt_must_quote_the_transcript(self):
self.assertTrue(loop.grounded({"ask": False, "evidence": ""}, "anything"))