Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

launch: connect --check, tester stage scripts (phaseA-tests/split/launch-tests are outside the repo)

Niko12216a29939806b2
diff --git a/strata_cli/launch/check.py b/strata_cli/launch/check.py
index 4399906e1..feacecc88 100644
--- a/strata_cli/launch/check.py
+++ b/strata_cli/launch/check.py
@@ -104,8 +104,9 @@ def tool_calls(wire: str, data: dict) -> list[tuple[str, dict]]:
return out
-def run_checks(harness_id: str, url: str, key: str, model: str, *, timeout: float = 240.0, poster=_post) -> list[Check]:
+def run_checks(harness_id: str, url: str, key: str, model: str, *, timeout: float = 240.0, poster=None) -> list[Check]:
"""The two checks for one harness. `poster` is replaceable for tests."""
+ poster = poster or _post
base = url.rstrip("/")
wire = wire_for(harness_id)
checks: list[Check] = []
diff --git a/strata_cli/launch/cmd.py b/strata_cli/launch/cmd.py
index 7619caeb9..b539ebcd5 100644
--- a/strata_cli/launch/cmd.py
+++ b/strata_cli/launch/cmd.py
@@ -124,6 +124,7 @@ def add_parsers(sp: argparse._SubParsersAction) -> list[argparse.ArgumentParser]
c.add_argument("--model", metavar="NAME", help="the model name the server reports (default: the running launch's)")
c.add_argument("--context", type=_context, metavar="SIZE", help="the context the server was started with (default: the running launch's, else 32k)")
c.add_argument("--preset", metavar="NAME", help="take the address, key and model from this saved preset")
+ c.add_argument("--check", action="store_true", help="send one prompt and one tool call to the running server the way this app would, and say if each worked")
c.add_argument("--write", action="store_true", help="write the file(s), after asking; a replaced file is backed up first")
c.add_argument("--yes", action="store_true", help="do not ask before --write")
c.add_argument("--show-key", action="store_true", help="print the real key instead of a masked one")
@@ -480,14 +481,20 @@ def run_launch(a: argparse.Namespace) -> int:
return 0
_say("")
_say("Strata is serving.")
- for i, u in enumerate(result.urls):
- _say(f" {'This computer' if i == 0 and '127.0.0.1' in u else 'Address':<14} {u}/v1")
+ for u in result.urls:
+ label = ("This computer" if "127.0.0.1" in u else "Cloudflare" if "trycloudflare" in u else
+ "Tailscale" if ("ts.net" in u or u.split("//")[1].startswith("100.")) else "Network")
+ _say(f" {label:<14} {u}/v1")
if result.key:
from strata_cli.launch import access
_say(f" {'API key':<14} {access.mask_key(result.key)} (show it: strata launch --show-key --preset \"{s.name}\")")
for n in result.notices:
_say(f"[!] {n}")
- _say(f" Watch it: strata monitor --url {result.urls[0] if result.urls else ''}")
+ local = next((u for u in result.urls if "127.0.0.1" in u), result.urls[0] if result.urls else "")
+ if result.key:
+ _say(f" Watch it: STRATA_API_KEY=$(strata launch --show-key) strata monitor --url {local} --credential-env STRATA_API_KEY")
+ else:
+ _say(f" Watch it: strata monitor --url {local}")
_say(f" Connect an app: strata connect opencode Stop: strata launch --stop --preset \"{s.name}\"")
return 0
except store.PresetError as e:
@@ -558,6 +565,15 @@ def run_connect(a: argparse.Namespace) -> int:
_say(f"Install the app (if you have not): {h.install}")
if h.run:
_say(f"Then try: {h.run}")
+ if a.check:
+ from strata_cli.launch import check
+ _say("")
+ _say("Checking: one prompt and one tool call, sent the way this app sends them (this can take a minute).")
+ results = check.run_checks(h.id if not h.built_in else "opencode", tgt.url, key, tgt.model)
+ for r in results:
+ _say(f"{'PASS' if r.ok else 'FAIL'} {r.name}: {r.detail} ({r.seconds:.0f} s)")
+ if not all(r.ok for r in results):
+ return 1
if a.write:
if not out["files"]:
_say("Nothing to write for this app.")
diff --git a/tests/terminal/test_launch.py b/tests/terminal/test_launch.py
index 5387d3854..72fdd3f5b 100644
--- a/tests/terminal/test_launch.py
+++ b/tests/terminal/test_launch.py
@@ -614,6 +614,61 @@ class ConnectCommand(unittest.TestCase):
self.assertEqual(out["files"], [])
self.assertIn("Strata app", " ".join(out["limits"]))
+ def test_check_sends_the_apps_own_wire_format_and_reports_pass_or_fail(self):
+ from strata_cli.launch import check
+ seen = []
+
+ def good(url, key, body, headers=None, timeout=0):
+ seen.append(url)
+ if url.endswith("/v1/responses"):
+ if "tools" in body:
+ return {"output": [{"type": "function_call", "name": "get_weather", "arguments": json.dumps({"city": "Paris"})}]}
+ return {"output_text": "pong"}
+ if url.endswith("/v1/messages"):
+ if "tools" in body:
+ return {"content": [{"type": "tool_use", "name": "get_weather", "input": {"city": "Paris"}}]}
+ return {"content": [{"type": "text", "text": "pong"}]}
+ if "tools" in body:
+ return {"choices": [{"message": {"content": None, "tool_calls": [{"function": {"name": "get_weather", "arguments": "{\"city\": \"Paris\"}"}}]}}]}
+ return {"choices": [{"message": {"content": "Pong."}}]}
+
+ for h, ending in (("opencode", "/v1/chat/completions"), ("codex", "/v1/responses"), ("claude-code", "/v1/messages")):
+ seen.clear()
+ res = check.run_checks(h, "http://127.0.0.1:1", "k", "m", poster=good)
+ self.assertEqual([r.ok for r in res], [True, True], h)
+ self.assertTrue(all(u.endswith(ending) for u in seen), (h, seen))
+
+ def wrong(url, key, body, headers=None, timeout=0):
+ if "tools" in body:
+ return {"choices": [{"message": {"content": "It is sunny.", "tool_calls": None}}]}
+ return {"choices": [{"message": {"content": "hello there"}}]}
+
+ res = check.run_checks("pi", "http://127.0.0.1:1", "k", "m", poster=wrong)
+ self.assertEqual([r.ok for r in res], [False, False])
+ self.assertIn("not the word asked for", res[0].detail)
+ self.assertIn("did not call the tool", res[1].detail)
+
+ import urllib.error
+
+ def refused(url, key, body, headers=None, timeout=0):
+ raise urllib.error.HTTPError(url, 401, "no", None, None)
+ res = check.run_checks("pi", "http://127.0.0.1:1", "", "m", poster=refused)
+ self.assertIn("refused the key", res[0].detail)
+
+ def test_connect_check_flag_prints_pass_lines(self):
+ from strata_cli.launch import check
+ ok = [check.Check("prompt", True, "It answered: 'pong'.", 1.0), check.Check("tool call", True, "It called get_weather with {}.", 2.0)]
+ with mock.patch.object(check, "run_checks", return_value=ok):
+ code, out, err = run_cli(["connect", "opencode", "--url", "http://127.0.0.1:1", "--check"])
+ self.assertEqual(code, 0, err)
+ self.assertIn("PASS prompt", out)
+ self.assertIn("PASS tool call", out)
+ bad = [check.Check("prompt", False, "x", 1.0), ok[1]]
+ with mock.patch.object(check, "run_checks", return_value=bad):
+ code, out, err = run_cli(["connect", "opencode", "--url", "http://127.0.0.1:1", "--check"])
+ self.assertEqual(code, 1)
+ self.assertIn("FAIL prompt", out)
+
def test_context_flag_reaches_the_config(self):
code, out, _ = run_cli(["connect", "pi", "--url", "http://127.0.0.1:8080", "--context", "64k", "--show-key"])
self.assertIn('"contextWindow": 65536', out)