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++
connect: the 8 tested harness configs (limits in plain words, context-aware), Connect view shows them
Niko12214e788fbf3e2e
diff --git a/strata_cli/launch/app.py b/strata_cli/launch/app.pyindex b5c24fc64..1afca3196 100644--- a/strata_cli/launch/app.py+++ b/strata_cli/launch/app.py@@ -300,7 +300,7 @@ def _info_for(result: Result, s: S.LaunchSettings) -> dict:except (OSError, ValueError):passreturn {"url": result.urls[0] if result.urls else f"http://127.0.0.1:{s.port}", "urls": result.urls, "key": result.key,- "model": cfg.get("model_name") or "strata", "name": s.name, "profile": result.profile, "running": True,+ "model": cfg.get("model_name") or "strata", "context": s.context, "name": s.name, "profile": result.profile, "running": True,"tunnel": result.tunnel}diff --git a/strata_cli/launch/cmd.py b/strata_cli/launch/cmd.pyindex f6b70158e..eb2e647b1 100644--- a/strata_cli/launch/cmd.py+++ b/strata_cli/launch/cmd.py@@ -122,6 +122,7 @@ def add_parsers(sp: argparse._SubParsersAction) -> list[argparse.ArgumentParser]c.add_argument("--key", metavar="KEY", help="the API key (default: the running launch's)")c.add_argument("--key-env", metavar="NAME", help="read the key from this environment variable")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("--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")@@ -329,6 +330,16 @@ def running_launches() -> list[dict]:return out+def _cfg_context(cfg: dict) -> int | None:+ args = [str(x) for x in cfg.get("args") or []]+ if "--max-context" in args and args.index("--max-context") + 1 < len(args):+ try:+ return int(args[args.index("--max-context") + 1])+ except ValueError:+ return None+ return None++def launch_info(name: str | None = None) -> dict | None:"""Address, key and model name of a launch that is running (or the named preset), for `connect` and the monitor's Connect view."""from strata_cli.launch import store@@ -350,7 +361,7 @@ def launch_info(name: str | None = None) -> dict | None:return Noneport = (pick or {}).get("port") or (preset.port if preset else S.DEFAULT_PORT)return {"url": (pick or {}).get("url") or f"http://127.0.0.1:{port}", "key": cfg.get("api_key") or (preset.api_key if preset else None),- "model": cfg.get("model_name") or "strata", "running": bool(pick), "name": (pick or {}).get("name") or (preset.name if preset else None),+ "model": cfg.get("model_name") or "strata", "context": _cfg_context(cfg), "running": bool(pick), "name": (pick or {}).get("name") or (preset.name if preset else None),"port": port, "access": preset.access if preset else None}@@ -508,18 +519,18 @@ def run_connect(a: argparse.Namespace) -> int:url = a.url or info.get("url") or f"http://127.0.0.1:{S.DEFAULT_PORT}"key = a.key or (os.environ.get(a.key_env) if a.key_env else None) or info.get("key") or ""model = a.model or info.get("model") or "strata"- out = harness.render(h, url=url, key=key or "<your API key>", model=model)+ context = a.context or info.get("context") or 32768+ tgt = harness.target(url, key, model, context)+ out = harness.render(h, tgt)shown_key = key if a.show_key else Noneif machine:- print(json.dumps({"schema_version": 1, "ok": True, **{k: (harness.mask(json.dumps(v), key) if False else v) for k, v in out.items()}}))+ print(json.dumps({"schema_version": 1, "ok": True, **{k: (harness.mask(v, key) if isinstance(v, str) else v) for k, v in out.items()+ if k != "files"},+ "files": [{**f, "text": harness.mask(f["text"], key)} for f in out["files"]]}))return 0_say(f"{h.title} ({h.speaks}; {h.status})")if not info.get("running") and not a.url:_say("[!] No running Strata server was found, so this uses the default address. Start one with: strata launch")- if not h.built_in and not h.tested:- _say("[!] This setup has not been tested with this app yet; treat it as a starting point.")- for n in h.notes:- _say(f" {n}")for f in out["files"]:_say("")_say(f"File: {f['path']}" + (" (merged into an existing file)" if f["merge"] else ""))@@ -527,12 +538,20 @@ def run_connect(a: argparse.Namespace) -> int:_say(" " + line)if out["env"]:_say("")- _say("Environment:" if True else "")+ _say("Environment:")for k, v in out["env"].items():- _say(f" {k}={v if shown_key else harness.mask(v, key)}" if os.name != "nt" else f" set {k}={v if shown_key else harness.mask(v, key)}")+ _say((f" {k}={v}" if os.name != "nt" else f" set {k}={v}") if shown_key or v == key and not key else+ (f" {k}={harness.mask(v, key)}" if os.name != "nt" else f" set {k}={harness.mask(v, key)}"))+ if out["limits"]:+ _say("")+ _say("Good to know:")+ for n in out["limits"]:+ _say(f" - {n}")if h.install:_say("")_say(f"Install the app (if you have not): {h.install}")+ if h.run:+ _say(f"Then try: {h.run}")if a.write:if not out["files"]:_say("Nothing to write for this app.")diff --git a/strata_cli/launch/harness.py b/strata_cli/launch/harness.pyindex 2966b7d69..29ebdc315 100644--- a/strata_cli/launch/harness.py+++ b/strata_cli/launch/harness.py@@ -1,16 +1,11 @@-"""`strata connect <harness>`: the setup text for an app that talks to a running Strata server.+"""`strata connect <harness>`: the setup for an app that talks to a running Strata server.-Each harness is one entry of `HARNESSES` below: what it speaks, where its config file lives, the text to put there, the-environment variables, and whether that config has been **tested** (phaseA-tests/split/harness-configs/<harness>.md, section 4 of-TUI-LAUNCH-SPEC.md: one prompt with the answer checked and one tool call with its arguments checked, at 32K).+Every entry below comes from a config that was tested for real against a Strata server at 32K context (one simple prompt with the+answer text checked and one tool call with its arguments checked, plus streaming, thinking and compaction at about 15K): the files in+phaseA-tests/split/harness-configs/<harness>.md, one per app, with the versions tested. The generators here fill in the real address,+key, model name and context of the running server; the "limits" are those files' gotchas in plain words.-TODO table (an entry says `tested=False` until its tested config replaces the draft below; the draft comes from the app's public-documentation and is labelled "not tested yet" on screen):-- opencode codex claude-code omp pi hermes openclaw -> tested configs from the section-4 worker- deepseek-harness -> built into the Strata app, nothing to write--Placeholders in the templates: {url} (server root, no /v1), {key}, {model}, {port}.+`tested` is the app version the config was tested with. A value of None would mean "not tested"; all eight entries are tested."""from __future__ import annotations@@ -22,109 +17,221 @@ import shutilimport timefrom dataclasses import dataclass, fieldfrom pathlib import Path+from typing import Callable++PLACEHOLDER_KEY = "strata-local" # the tested configs' placeholder when the server has no key (not a secret)+OUTPUT_CAP = 4096 # the output cap every tested config used+COMPACT_AT = 15000 # where the tested configs make the app compact its conversation+++@dataclass+class Target:+ """The running server, as a config needs to know it."""++ url: str # server root, no /v1+ key: str # real key, or the placeholder+ model: str+ context: int = 32768++ @property+ def base(self) -> str:+ return self.url.rstrip("/") + "/v1"++ @property+ def input_limit(self) -> int:+ return max(1024, self.context - OUTPUT_CAP)@dataclassclass FileSpec:- path: str # may start with ~ ; {home} {appdata} are not needed, ~ is expanded- kind: str # json | toml | yaml | text | env- content: str # template- merge: bool = False # json only: merge into an existing file instead of replacing it+ path: str # may start with ~+ kind: str # json | toml | yaml | text+ make: Callable[[Target], str]+ merge: bool = False # json only: merge into an existing file instead of replacing it@dataclassclass Harness:id: strtitle: str- speaks: str # "chat + tools", "responses + tools", ...+ speaks: str+ tested: str = "" # "opencode 1.19.3": the version the config was tested withfiles: list[FileSpec] = field(default_factory=list)- env: dict[str, str] = field(default_factory=dict)- notes: list[str] = field(default_factory=list)- tested: bool = False+ env: Callable[[Target], dict[str, str]] | None = None+ limits: Callable[[Target], list[str]] | None = None+ run: str = "" # one example command+ install: str = ""built_in: bool = Falsealiases: tuple[str, ...] = ()- install: str = ""@propertydef status(self) -> str:- return "built into the Strata app" if self.built_in else ("tested" if self.tested else "not tested yet")+ if self.built_in:+ return "built into the Strata app (tested)"+ return f"tested ({self.tested})" if self.tested else "not tested yet"def _j(obj) -> str:return json.dumps(obj, indent=2)-# --- drafts: replaced by the tested files of harness-configs/ (see the TODO table above) ---------------------------------------HARNESSES: list[Harness] = [- Harness("opencode", "OpenCode", "chat + tools",- files=[FileSpec("~/.config/opencode/opencode.json", "json", _j({- "$schema": "https://opencode.ai/config.json",- "provider": {"strata": {"npm": "@ai-sdk/openai-compatible", "name": "Strata",- "options": {"baseURL": "{url}/v1", "apiKey": "{key}"},- "models": {"{model}": {"name": "Strata ({model})"}}}},- "model": "strata/{model}"}), merge=True)],- install="npm i -g opencode-ai"),- Harness("codex", "Codex CLI", "responses + tools",- files=[FileSpec("~/.codex/config.toml", "toml",- 'model = "{model}"\nmodel_provider = "strata"\n\n[model_providers.strata]\nname = "Strata"\n'- 'base_url = "{url}/v1"\nenv_key = "STRATA_API_KEY"\nwire_api = "responses"\n')],- env={"STRATA_API_KEY": "{key}"}, install="npm i -g @openai/codex"),- Harness("claude-code", "Claude Code", "messages + tools",- files=[FileSpec("~/.claude/settings.json", "json", _j({"env": {- "ANTHROPIC_BASE_URL": "{url}", "ANTHROPIC_AUTH_TOKEN": "{key}", "ANTHROPIC_MODEL": "{model}",- "ANTHROPIC_SMALL_FAST_MODEL": "{model}", "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"}}), merge=True)],- env={"ANTHROPIC_BASE_URL": "{url}", "ANTHROPIC_AUTH_TOKEN": "{key}", "ANTHROPIC_MODEL": "{model}"},- notes=["No Anthropic login is needed: the server answers with your local model."],- aliases=("claude",), install="npm i -g @anthropic-ai/claude-code"),- Harness("omp", "oh-my-pi (omp)", "chat + tools",- files=[FileSpec("~/.omp/agent/models.yml", "yaml",- "providers:\n strata:\n baseUrl: {url}/v1\n apiKey: {key}\n api: openai-completions\n"- " models:\n - id: {model}\n name: Strata ({model})\n")],- aliases=("oh-my-pi",)),- Harness("pi", "pi (pi.dev)", "chat + tools",- files=[FileSpec("~/.pi/agent/models.json", "json", _j({"providers": {"strata": {- "baseUrl": "{url}/v1", "api": "openai-completions", "apiKey": "{key}",- "models": [{"id": "{model}"}]}}}), merge=True)]),- Harness("hermes", "Hermes Agent", "chat + tools",- files=[FileSpec("~/.hermes/config.yaml", "yaml",- "model:\n provider: custom\n base_url: {url}/v1\n api_key: {key}\n default: {model}\n")],- aliases=("hermes-agent",)),- Harness("openclaw", "OpenClaw", "chat + tools",- files=[FileSpec("~/.openclaw/openclaw.json", "json", _j({"models": {"mode": "merge", "providers": {"strata": {- "baseUrl": "{url}/v1", "apiKey": "{key}", "api": "openai-completions",- "models": [{"id": "{model}", "name": "Strata ({model})"}]}}},- "agents": {"defaults": {"model": {"primary": "strata/{model}"}}}}), merge=True)]),- Harness("deepseek-harness", "DeepSeek Harness", "the Strata app", built_in=True,- notes=["Strata's own coding harness lives in the Strata app: open the app, choose Code, and it uses this server."],- aliases=("deepseek",)),-]+# ------------------------------------------------------------------------------------------------ the eight-# The tested configs, when they exist, override the drafts: harness-configs/<id>.json beside this file (made from the .md files).-OVERRIDE_DIR = Path(__file__).with_name("harness_configs")+def opencode_file(t: Target) -> str:+ return _j({"$schema": "https://opencode.ai/config.json", "model": f"strata/{t.model}", "small_model": f"strata/{t.model}",+ "autoupdate": False,+ "compaction": {"auto": True, "buffer": max(1024, t.input_limit - COMPACT_AT)},+ "share": "disabled",+ "provider": {"strata": {"npm": "@ai-sdk/openai-compatible", "name": "Strata (local)",+ "options": {"baseURL": t.base, "apiKey": t.key},+ "models": {t.model: {"name": "Qwen3.8-Flash-Next (local)", "tool_call": True, "reasoning": True,+ "limit": {"context": t.context, "input": t.input_limit, "output": OUTPUT_CAP}}}}}})-def load_overrides() -> None:- if not OVERRIDE_DIR.is_dir():- return- by_id = {h.id: h for h in HARNESSES}- for path in sorted(OVERRIDE_DIR.glob("*.json")):- try:- data = json.loads(path.read_text(encoding="utf-8"))- h = by_id.get(data["id"]) or Harness(data["id"], data.get("title", data["id"]), data.get("speaks", ""))- h.title = data.get("title", h.title)- h.speaks = data.get("speaks", h.speaks)- h.files = [FileSpec(**f) for f in data.get("files", [])]- h.env = dict(data.get("env", {}))- h.notes = list(data.get("notes", []))- h.tested = bool(data.get("tested", True))- h.install = data.get("install", h.install)- if h.id not in by_id:- HARNESSES.append(h)- except (OSError, ValueError, KeyError, TypeError):- continue+def codex_file(t: Target) -> str:+ return (f'model = "{t.model}"\nmodel_provider = "strata"\nmodel_context_window = {t.context}\n'+ f"model_auto_compact_token_limit = {COMPACT_AT}\nmodel_reasoning_summary = \"auto\"\napproval_policy = \"never\"\n"+ 'sandbox_mode = "workspace-write"\ncheck_for_update_on_startup = false\n\n[model_providers.strata]\n'+ f'name = "Strata (local)"\nbase_url = "{t.base}"\nwire_api = "responses"\nenv_key = "STRATA_API_KEY"\n'+ "stream_idle_timeout_ms = 600000\n")+++def claude_env(t: Target) -> dict[str, str]:+ return {"ANTHROPIC_BASE_URL": t.url.rstrip("/"), "ANTHROPIC_AUTH_TOKEN": t.key, "ANTHROPIC_MODEL": t.model,+ "ANTHROPIC_SMALL_FAST_MODEL": t.model, "ANTHROPIC_DEFAULT_SONNET_MODEL": t.model, "ANTHROPIC_DEFAULT_OPUS_MODEL": t.model,+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": t.model, "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1", "DISABLE_AUTOUPDATER": "1",+ "DISABLE_TELEMETRY": "1", "CLAUDE_CODE_MAX_CONTEXT_TOKENS": str(t.context),+ "CLAUDE_CODE_MAX_OUTPUT_TOKENS": str(OUTPUT_CAP)} | ({"CLAUDE_CODE_SIMPLE": "1"} if t.context <= 40960 else {})+++def claude_file(t: Target) -> str:+ return _j({"env": claude_env(t)})+++def omp_models(t: Target) -> str:+ return ("providers:\n strata:\n baseUrl: " + t.base + "\n api: openai-completions\n auth: none\n compat:\n"+ " supportsDeveloperRole: false\n models:\n - id: " + t.model + "\n name: Qwen3.8-Flash-Next (Strata, local)\n"+ " reasoning: true\n input: [text]\n contextWindow: " + str(t.context) + "\n maxTokens: " + str(OUTPUT_CAP) ++ "\n thinking:\n mode: effort\n efforts: [minimal, low, medium, high]\n defaultLevel: medium\n"+ " cost: {input: 0, output: 0, cacheRead: 0, cacheWrite: 0}\n")+++def omp_config(t: Target) -> str:+ return ("modelRoles:\n default: strata/" + t.model + "\ndefaultThinkingLevel: medium\ncompaction:\n enabled: true\n thresholdTokens: "+ + str(COMPACT_AT) + "\n keepRecentTokens: 4000\n methodOrder:\n - soft\n idleEnabled: false\nsetupVersion: 2\n")+++def pi_models(t: Target) -> str:+ return _j({"providers": {"strata": {"baseUrl": t.base, "api": "openai-completions", "apiKey": t.key,+ "compat": {"supportsDeveloperRole": False, "supportsReasoningEffort": False},+ "models": [{"id": t.model, "name": "Qwen3.8-Flash-Next (Strata, local)", "reasoning": True,+ "input": ["text"], "contextWindow": t.context, "maxTokens": OUTPUT_CAP,+ "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}}]}}})++def pi_settings(t: Target) -> str:+ return _j({"defaultProvider": "strata", "defaultModel": t.model, "defaultThinkingLevel": "medium",+ "compaction": {"enabled": True, "reserveTokens": max(1024, t.context - COMPACT_AT), "keepRecentTokens": 4000}})-load_overrides()++def hermes_file(t: Target) -> str:+ return ("model:\n default: " + t.model + "\n provider: lmstudio\n base_url: " + t.base + "\n context_length: " + str(t.context) ++ "\ncompression:\n enabled: true\n threshold_tokens: " + str(COMPACT_AT) + "\nauxiliary:\n compression:\n context_length: 65536\n")+++def openclaw_file(t: Target) -> str:+ return _j({"models": {"mode": "merge", "providers": {"strata": {+ "baseUrl": t.base, "apiKey": t.key, "api": "openai-completions",+ "models": [{"id": t.model, "name": f"{t.model} (Strata)", "contextWindow": t.context,+ "contextTokens": int(t.context * 23192 / 32768), "maxTokens": OUTPUT_CAP, "reasoning": True, "input": ["text"],+ "cost": {"input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0}}]}}},+ "agents": {"defaults": {"model": {"primary": f"strata/{t.model}"},+ "compaction": {"enabled": True, "notifyUser": True, "keepRecentTokens": 4000}}}})+++def _limits_opencode(t: Target) -> list[str]:+ return ["The setup needs limit.input (strata connect sets it to %d); without it OpenCode never compacts its conversation." % t.input_limit,+ "Its first start downloads a plug-in from npm (internet needed once; the first run can take over a minute).",+ "In a script or over ssh, run it as: opencode run \"...\" < /dev/null (it waits for typing otherwise).",+ "Its system prompt and tools take about 7.4K tokens of the window."]+++def _limits_codex(t: Target) -> list[str]:+ return ["Codex prints \"Model metadata ... not found\" on every start: harmless, it does not know the model.",+ "It will not send without STRATA_API_KEY set; any text works when the server has no key.",+ "Where the sandbox cannot start (no bubblewrap), use --dangerously-bypass-approvals-and-sandbox only in a throwaway folder.",+ "Its system prompt and tools take about 8.6K tokens of the window."]+++def _limits_claude(t: Target) -> list[str]:+ out = ["Set CLAUDE_CODE_MAX_CONTEXT_TOKENS to the served context (%d here) and CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096: without them Claude Code "+ "assumes a 100K window and never compacts, or compacts on every turn." % t.context,+ "No Anthropic login or credential is used; the token is only checked by your own server.",+ "The notice [claude-code:unrecognized_model] on stderr is harmless."]+ if t.context <= 40960:+ out.append("Its full prompt is 15.6K tokens (20 tools): with a 32K window use CLAUDE_CODE_SIMPLE=1 (3 tools, 1.25K tokens), as set here.")+ return out+++def _limits_omp(t: Target) -> list[str]:+ return ["Its system prompt and tools take about 7.5K tokens of the window.",+ "One small title/summary request may come back empty because the model spent its 512 tokens thinking; omp carries on."]+++def _limits_pi(t: Target) -> list[str]:+ return ["pi has the smallest prompt of the eight (1.5K tokens): the most room for the conversation.",+ "It compacts after the turn that crosses the line, so one turn can reach about 15K tokens before it summarises."]+++def _limits_hermes(t: Target) -> list[str]:+ out = ["Hermes refuses a window under 64,000 tokens unless the provider is lmstudio with an explicit context_length: the config uses "+ "that, and auxiliary.compression.context_length 65536 for its summariser (the same floor).",+ "Its system prompt and 20 tools take about 12.9K tokens (40% of a 32K window): about 19K is left for the conversation.",+ "Its compaction threshold is floored at its own 64K minimum, so it compacts later than 15K (around 20K); it still fits 32K."]+ if t.context < 65536:+ out.insert(0, "WARNING: Hermes is built for 64K or more. At %dK it works only through the workaround above." % (t.context // 1024))+ return out+++def _limits_openclaw(t: Target) -> list[str]:+ return ["OpenClaw needs Node 24.16 or newer. On older Node, npm install -g openclaw quietly installs an empty 0.0.1 placeholder.",+ "Its own token count runs 10-30% above the server's, so keep contextTokens (set here) below the window.",+ "The embedded agent writes notes into its workspace folder: give it a scratch folder.",+ "Harmless on exit: 'SQLite reclamation Worker failed' and 'semantic vector embeddings unavailable'."]+++def _limits_dsh(t: Target) -> list[str]:+ return ["DeepSeek Harness is Strata's own coding harness inside the Strata app: nothing to write here.",+ "Its package default compaction headroom (64K) is larger than a 32K window; the app's bridge sets it for you."]+++HARNESSES: list[Harness] = [+ Harness("opencode", "OpenCode", "chat + tools", tested="opencode 1.19.3",+ files=[FileSpec("~/.config/opencode/opencode.json", "json", opencode_file, merge=True)], limits=_limits_opencode,+ run='opencode run "your task"', install="npm i -g opencode-ai"),+ Harness("codex", "Codex CLI", "responses + tools", tested="codex-cli 0.163.0",+ files=[FileSpec("~/.codex/config.toml", "toml", codex_file)], env=lambda t: {"STRATA_API_KEY": t.key}, limits=_limits_codex,+ run='codex exec --skip-git-repo-check "your task"', install="npm i -g @openai/codex"),+ Harness("claude-code", "Claude Code", "messages + tools", tested="Claude Code 2.1.302",+ files=[FileSpec("~/.claude/settings.json", "json", claude_file, merge=True)], env=claude_env, limits=_limits_claude,+ run='claude -p "your task"', install="npm i -g @anthropic-ai/claude-code", aliases=("claude",)),+ Harness("omp", "oh-my-pi (omp)", "chat + tools", tested="omp 18.11.2",+ files=[FileSpec("~/.omp/agent/models.yml", "yaml", omp_models), FileSpec("~/.omp/agent/config.yml", "yaml", omp_config)],+ limits=_limits_omp, run='omp -p "your task"', install="curl -fsSL https://omp.sh/install | sh", aliases=("oh-my-pi",)),+ Harness("pi", "pi (pi.dev)", "chat + tools", tested="pi 0.74.2",+ files=[FileSpec("~/.pi/agent/models.json", "json", pi_models, merge=True),+ FileSpec("~/.pi/agent/settings.json", "json", pi_settings, merge=True)],+ env=lambda t: {"PI_SKIP_VERSION_CHECK": "1"}, limits=_limits_pi, run='pi -p "your task"',+ install="npm install -g @earendil-works/pi-coding-agent"),+ Harness("hermes", "Hermes Agent", "chat + tools", tested="Hermes Agent 2026.9.24",+ files=[FileSpec("~/.hermes/config.yaml", "yaml", hermes_file)], env=lambda t: {"OPENAI_API_KEY": t.key},+ limits=_limits_hermes, run='hermes chat -Q --yolo -q "your task"', aliases=("hermes-agent",)),+ Harness("openclaw", "OpenClaw", "chat + tools", tested="OpenClaw 2026.10.4",+ files=[FileSpec("~/.openclaw/openclaw.json", "json", openclaw_file, merge=True)], limits=_limits_openclaw,+ run='openclaw agent --local --agent main --session-id demo --thinking low -m "your task"', install="npm install -g openclaw (Node 24.16+)"),+ Harness("deepseek-harness", "DeepSeek Harness", "the Strata app", tested="DSH 0.2.1-alpha.3", built_in=True,+ limits=_limits_dsh, aliases=("deepseek", "dsh")),+]def find(name: str) -> Harness | None:@@ -142,25 +249,16 @@ def closest_name(name: str) -> str | None:# ------------------------------------------------------------------------------------------------ rendering-def fill(text: str, *, url: str, key: str, model: str, port: int) -> str:- """Replace the placeholders; the key goes in only where the caller passed a real one."""- out = text- for k, v in (("{url}", url.rstrip("/")), ("{key}", key), ("{model}", model), ("{port}", str(port))):- out = out.replace(k, v)- return out+def target(url: str, key: str | None, model: str, context: int | None = None) -> Target:+ return Target(url=url.rstrip("/"), key=key or PLACEHOLDER_KEY, model=model or "strata", context=int(context or 32768))-def render(h: Harness, *, url: str, key: str, model: str) -> dict:- """What to show or write for this harness: files with their text, and environment lines."""- m = re.search(r":(\d+)(?:/|$)", url)- port = int(m.group(1)) if m else (443 if url.startswith("https") else 80)- files = []- for f in h.files:- files.append({"path": f.path, "kind": f.kind, "merge": f.merge,- "text": fill(f.content, url=url, key=key, model=model, port=port)})- env = {k: fill(v, url=url, key=key, model=model, port=port) for k, v in h.env.items()}- return {"harness": h.id, "title": h.title, "speaks": h.speaks, "status": h.status, "files": files, "env": env,- "notes": list(h.notes), "install": h.install}+def render(h: Harness, t: Target) -> dict:+ """What to show or write for this harness: files with their text, environment lines, the limits in plain words."""+ files = [{"path": f.path, "kind": f.kind, "merge": f.merge, "text": f.make(t)} for f in h.files]+ return {"harness": h.id, "title": h.title, "speaks": h.speaks, "status": h.status, "files": files,+ "env": h.env(t) if h.env else {}, "limits": h.limits(t) if h.limits else [], "run": h.run, "install": h.install,+ "tested": h.tested}def expand(path: str) -> Path:@@ -181,8 +279,7 @@ def write_file(spec: dict, *, backup: bool = True) -> dict:if existed and spec.get("merge") and spec["kind"] == "json":try:old = json.loads(path.read_text(encoding="utf-8-sig"))- new = json.loads(text)- text = json.dumps(_merge(old, new), indent=2)+ text = json.dumps(_merge(old, json.loads(text)), indent=2)except ValueError:pass # an old file that is not JSON is replaced (a backup was made)path.write_text(text if text.endswith("\n") else text + "\n", encoding="utf-8")@@ -190,8 +287,8 @@ def write_file(spec: dict, *, backup: bool = True) -> dict:os.chmod(path, 0o600) # it can hold the API keyexcept OSError:pass- return {"path": str(path), "backup": str(bak) if bak else None, "action": "merged" if existed and spec.get("merge") else- ("replaced" if existed else "created")}+ return {"path": str(path), "backup": str(bak) if bak else None,+ "action": "merged" if existed and spec.get("merge") and spec["kind"] == "json" else ("replaced" if existed else "created")}def _merge(old, new):@@ -204,4 +301,4 @@ def _merge(old, new):def mask(text: str, key: str) -> str:- return text.replace(key, key[:10] + "•" * 8) if key else text+ return text.replace(key, key[:10] + "•" * 8) if key and key != PLACEHOLDER_KEY else textdiff --git a/strata_cli/launch/monitor_ext.py b/strata_cli/launch/monitor_ext.pyindex f811bc322..ce3dd0613 100644--- a/strata_cli/launch/monitor_ext.py+++ b/strata_cli/launch/monitor_ext.py@@ -121,7 +121,7 @@ class LaunchMonitor(MonitorApp):def _rendered(self) -> dict:h = self._harness()key = self.info.get("key") or ""- return harness.render(h, url=self.info["url"], key=key or "<your API key>", model=self.info.get("model") or "strata")+ return harness.render(h, harness.target(self.info["url"], key, self.info.get("model") or "strata", self.info.get("context")))def _copy(self) -> None:out = self._rendered()@@ -216,7 +216,7 @@ class LaunchMonitor(MonitorApp):for i, h in enumerate(harness.HARNESSES):sel = i == self.connect_index % len(harness.HARNESSES)res = self.check_results.get(h.id)- status = h.status + (f" {g.tick}" if h.tested else "")+ status = ("tested " + g.tick) if h.tested else "not tested yet"style = ""if res == "running":status, style = "checking…", WARN@@ -228,28 +228,39 @@ class LaunchMonitor(MonitorApp):t.append(row.ljust(width - 1) + "\n", style=(f"bold {ACCENT} on #1f2a27" if sel else style))h = self._harness()out = self._rendered()+ key = self.info.get("key") or ""+ height = max(12, self.screen.size.height)+ used = t.plain.count("\n") + 2+ room = max(3, height - used - 3)t.append("\n")paths = ", ".join(f["path"] for f in out["files"]) or ("built into the Strata app" if h.built_in else "")t.append(f"{h.title} setup", style=f"bold {ACCENT}")t.append(f" {paths}\n", style=MUTE)- if not h.tested and not h.built_in:- t.append(" Not tested with this app yet: a starting point, not a promise.\n", style=WARN)- for n in h.notes:- t.append(f" {n}\n", style=MUTE)- shown_lines = []+ room -= 2+ import textwrap+ limit_lines: list[str] = []+ for n in out["limits"]:+ wrapped = textwrap.wrap(n, max(30, width - 6)) or [n]+ limit_lines += [" - " + wrapped[0]] + [" " + w for w in wrapped[1:]]+ code: list[str] = []for f in out["files"][:1]:body = f["text"] if self.show_key else harness.mask(f["text"], key)- shown_lines += body.splitlines()+ code += [" " + ln for ln in body.splitlines()]for k, v in out["env"].items():- shown_lines.append(f"{k}={v if self.show_key else harness.mask(v, key)}")- room = max(3, 0)- for line in shown_lines[:14]:- t.append(" " + line + "\n")- if len(shown_lines) > 14:- t.append(f" … {len(shown_lines) - 14} more lines (c copies all)\n", style=MUTE)+ code.append(f" {k}={v if self.show_key else harness.mask(v, key)}")res = self.check_results.get(h.id)+ res_lines = ([f" {g.tick if c.ok else 'x'} {c.name}: {c.detail}" for c in res] if isinstance(res, list) else [])+ want_code = min(len(code), max(3, room - min(len(limit_lines), 6) - len(res_lines) - 1))+ for ln in code[:want_code]:+ t.append(ln + "\n")+ if len(code) > want_code:+ t.append(f" ... {len(code) - want_code} more lines (c copies all)\n", style=MUTE)+ left = max(0, room - want_code - (1 if len(code) > want_code else 0) - len(res_lines))+ if limit_lines:+ t.append("Good to know\n", style=f"bold {ACCENT}")+ for ln in limit_lines[:max(2, left)]:+ t.append(ln + "\n", style=WARN if ln.lstrip().startswith("- WARNING") else MUTE)if isinstance(res, list):- t.append("\n")- for c in res:- t.append(f" {g.tick if c.ok else 'x'} {c.name}: {c.detail}\n", style=ACCENT if c.ok else BAD)+ for c, ln in zip(res, res_lines):+ t.append(ln + "\n", style=ACCENT if c.ok else BAD)return tdiff --git a/tests/terminal/test_launch.py b/tests/terminal/test_launch.pyindex d34c7f558..5387d3854 100644--- a/tests/terminal/test_launch.py+++ b/tests/terminal/test_launch.py@@ -512,6 +512,7 @@ class ConnectCommand(unittest.TestCase):self.assertEqual(code, 0, err)self.assertIn("http://127.0.0.1:8123/v1", out)self.assertIn("opencode.json", out)+ self.assertIn("limit", out)self.assertNotIn("abcdefghij1234", out)code, out, _ = run_cli(["connect", "opencode", "--url", "http://127.0.0.1:8123", "--key", "sk-strata-abcdefghij1234", "--show-key"])self.assertIn("sk-strata-abcdefghij1234", out)@@ -547,11 +548,76 @@ class ConnectCommand(unittest.TestCase):self.assertEqual(code, 0)self.assertIn("Nothing to write", out)- def test_untested_drafts_say_so(self):- h = harness.find("hermes")- if not h.tested:- code, out, _ = run_cli(["connect", "hermes"])- self.assertIn("not been tested", out)+ def render(self, name, **kw):+ h = harness.find(name)+ t = harness.target(kw.get("url", "http://127.0.0.1:18900"), kw.get("key"), "qwen3.8-flash-next-q2_0", kw.get("context", 32768))+ return harness.render(h, t)++ def test_all_eight_are_tested_configs(self):+ self.assertEqual([h.id for h in harness.HARNESSES],+ ["opencode", "codex", "claude-code", "omp", "pi", "hermes", "openclaw", "deepseek-harness"])+ for h in harness.HARNESSES:+ self.assertTrue(h.tested, h.id)+ self.assertIn("tested", h.status)++ def test_opencode_has_limit_input_and_the_15k_compaction_buffer(self):+ cfg = json.loads(self.render("opencode")["files"][0]["text"])+ m = cfg["provider"]["strata"]["models"]["qwen3.8-flash-next-q2_0"]+ self.assertEqual(m["limit"], {"context": 32768, "input": 28672, "output": 4096})+ self.assertEqual(cfg["compaction"]["buffer"], 13672) # 28672 - 15000+ self.assertEqual(cfg["provider"]["strata"]["options"]["baseURL"], "http://127.0.0.1:18900/v1")+ self.assertEqual(cfg["provider"]["strata"]["options"]["apiKey"], "strata-local")++ def test_codex_uses_responses_and_the_key_variable(self):+ out = self.render("codex", key="sk-real")+ text = out["files"][0]["text"]+ self.assertIn('wire_api = "responses"', text)+ self.assertIn("model_auto_compact_token_limit = 15000", text)+ self.assertIn('base_url = "http://127.0.0.1:18900/v1"', text)+ self.assertEqual(out["env"], {"STRATA_API_KEY": "sk-real"})++ def test_claude_code_sets_window_and_output_cap_and_has_no_login(self):+ out = self.render("claude-code")+ env = out["env"]+ self.assertEqual(env["ANTHROPIC_BASE_URL"], "http://127.0.0.1:18900")+ self.assertEqual(env["CLAUDE_CODE_MAX_CONTEXT_TOKENS"], "32768")+ self.assertEqual(env["CLAUDE_CODE_MAX_OUTPUT_TOKENS"], "4096")+ self.assertEqual(env["CLAUDE_CODE_SIMPLE"], "1") # the full prompt is 15.6K tokens+ self.assertEqual(json.loads(out["files"][0]["text"])["env"], env)+ big = self.render("claude-code", context=131072)["env"]+ self.assertEqual(big["CLAUDE_CODE_MAX_CONTEXT_TOKENS"], "131072")+ self.assertNotIn("CLAUDE_CODE_SIMPLE", big)+ self.assertTrue(any("CLAUDE_CODE_MAX_OUTPUT_TOKENS" in n for n in out["limits"]))++ def test_pi_omp_hermes_openclaw_numbers(self):+ pi = self.render("pi")["files"]+ self.assertEqual(json.loads(pi[1]["text"])["compaction"]["reserveTokens"], 17768) # 32768 - 15000+ self.assertEqual(json.loads(pi[0]["text"])["providers"]["strata"]["models"][0]["contextWindow"], 32768)+ omp = self.render("omp")["files"]+ self.assertIn("thresholdTokens: 15000", omp[1]["text"])+ self.assertIn("contextWindow: 32768", omp[0]["text"])+ hermes = self.render("hermes")+ self.assertIn("provider: lmstudio", hermes["files"][0]["text"])+ self.assertIn("context_length: 65536", hermes["files"][0]["text"])+ self.assertTrue(any("WARNING" in n and "64K" in n for n in hermes["limits"]))+ self.assertFalse(any("WARNING" in n for n in self.render("hermes", context=131072)["limits"]))+ oc = json.loads(self.render("openclaw")["files"][0]["text"])+ self.assertEqual(oc["models"]["providers"]["strata"]["models"][0]["contextTokens"], 23192)+ self.assertTrue(any("Node 24.16" in n for n in self.render("openclaw")["limits"]))++ def test_limits_are_in_plain_words_for_every_app(self):+ for h in harness.HARNESSES:+ self.assertTrue(self.render(h.id)["limits"], h.id)++ def test_deepseek_harness_is_the_app(self):+ out = self.render("deepseek-harness")+ self.assertEqual(out["files"], [])+ self.assertIn("Strata app", " ".join(out["limits"]))++ 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)+ self.assertIn('"reserveTokens": 50536', out)if __name__ == "__main__":