Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142"""The active-output collector must observe the scripted prefix and completion.
A real daemon normally sends both. Use authored frames to verify that asame-length replacement or a clean EOF cannot satisfy the assertions."""
import ioimport jsonfrom pathlib import Pathimport sysfrom types import SimpleNamespaceimport unittestfrom unittest.mock import Mock
sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "e2e"))from active_output_test import PausedOutput
class ActiveOutputReaderTests(unittest.TestCase): def collect(self, prefix): app = Mock() app.session.return_value = "session" stream = b"".join( b"data: " + json.dumps({"events": [event]}).encode() + b"\n\n" for event in [ {"type": "reset"}, {"type": "text", "data": {"text": prefix}}, ] ) app.api.side_effect = [io.BytesIO(stream), io.BytesIO()] return PausedOutput(self, app, SimpleNamespace(), ["expected"])
def test_rejects_replaced_prefix_of_the_same_length(self): with self.assertRaisesRegex(AssertionError, "streamed prefix differs"): self.collect("replaced")
def test_rejects_eof_without_turn_completed(self): with self.assertRaisesRegex( AssertionError, "stream ended before turn_completed" ): self.collect("expected").finish(self)