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.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364"""Run the upstream ACP compatibility kit against the checkout's stdio adapter."""
import jsonimport subprocessimport tempfileimport unittest
from acp_support import answeredfrom harness import ROOT, Albedo, Provider, exclusive, latest_user, python, textfrom scratch import ROOT as REPORT_DIR
class AcpCompatibilityTests(unittest.TestCase): @exclusive def test_upstream_v1(self): self.run_kit(1)
@exclusive def test_upstream_v2(self): self.run_kit(2)
def run_kit(self, version): cancel_prompt = "Keep this turn open for the compatibility test."
def reply(request): if cancel_prompt in str(latest_user(request)): return text("ok", delay=1) if version == 2 and not answered(request): return python( "from pathlib import Path\nfrom uuid import uuid4\n" "Path(f'acp-{uuid4()}.txt').write_text('ok')" ) return text("ok")
provider = Provider(reply) self.addCleanup(provider.close) with ( Albedo(provider) as app, tempfile.NamedTemporaryFile( dir=REPORT_DIR, prefix="albedo-acp-tck-", suffix=".json", delete=False ) as report, ): print(f"ACP compatibility report: {report.name}", flush=True) subprocess.run( [ "acp-tck", "--protocol-version", str(version), "--cancel-prompt", cancel_prompt, "--report-json", report.name, "--agent-cwd", str(app.workspace), "--", app.env.get("ALBEDO_TEST_CLI", str(ROOT / "cli/bin/albedo")), "acp", ], env=app.env, check=True, ) for tier, counts in json.load(report)["verdict"]["tier_counts"].items(): self.assertEqual(counts["FAIL"], 0, f"{tier} failures in {report.name}")