The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(viewer): support WebKit audio ranges and gate complete workflow coverage
Deec5ca5b61dfd9
diff --git a/docs/research/2026-09-16-harness-store-candidates.md b/docs/research/2026-09-16-harness-store-candidates.mdindex fe3599926..a686a8077 100644--- a/docs/research/2026-09-16-harness-store-candidates.md+++ b/docs/research/2026-09-16-harness-store-candidates.md@@ -2,9 +2,24 @@Research date: September 16, 2026 (America/New_York).-**Status: Implementation started.** [Game Studio / Godogen](../../store/agents/godogen/README.md) and [Film Director / OpenMontage](../../store/agents/openmontage/README.md) are implemented, with shared interactive viewers and reproducible browser checks. The other eight candidates remain research-backed backlog items. The research assessments below describe the original investigation; the package READMEs and testing notes record what has since been verified.--To resume: refresh the chosen upstream's maintenance status, license, and dependencies; pin a commit; reproduce its proposed demonstration in isolation; then package the verified workflow for Harness. The experience names below describe product ideas. Package names and upstream credit should follow the [Store conventions](../../store/README.md).+**Status: all ten shortlist entries now have packages.** [Game Studio / Godogen](../../store/agents/godogen/README.md) and [Film Director / OpenMontage](../../store/agents/openmontage/README.md) were built first. The remaining eight now have independently installable packages, local starter workflows, interactive Studio Viewer panes, pinned upstream sources, and explicit native-integration boundaries. The user selected **this Mac and local simulations** for acceptance. See [verification and coverage](../../store/viewers/studio-viewer/TESTING.md).++| Added package | Local experience | Verified local engine/output |+| --- | --- | --- |+| [JUCE Agent Toolkit](../../store/agents/juce-agent-toolkit/README.md) | Instrument maker | DSP and native JUCE offline WAV rendering |+| [Foam-Agent](../../store/agents/foam-agent/README.md) | Wind tunnel | D2Q9 flow simulation and measured fields |+| [autoresearch-mlx](../../store/agents/autoresearch-mlx/README.md) | Research notebook | CPU character model, saved checkpoint, independent holdout evaluation |+| [Ableton AI](../../store/agents/ableton-ai/README.md) | Loop room | Seeded MIDI, WAV, and matching browser audition |+| [DimOS](../../store/agents/dimos/README.md) | Mission control | A* route planning and actual MuJoCo rover dynamics |+| [SimSkill](../../store/agents/simskill/README.md) | City lab | Native SUMO traffic simulation and recorded vehicle playback |+| [Bonsai MCP](../../store/agents/bonsai-mcp/README.md) | House of ideas | Real IFC4 authoring, tessellation, and quantity read-back |+| [Comfy MCP](../../store/agents/comfy-mcp/README.md) | Variation garden | Reproducible procedural SVG studies and recipes |++The research assessments below preserve the original investigation and proposed demonstrations.+The local starters do not claim every ambitious demo below has been reproduced. Live Ableton,+OpenFOAM, Blender/Bonsai, full DimOS perception/hardware, Apple Silicon MLX, and diffusion-model+ComfyUI runs have separate requirements. Package READMEs and integration notes identify the+shipped actions and what was actually exercised.## Recommendation@@ -18,7 +33,7 @@ The current Store already has Blender, MuJoCo, Phaser, Remotion, Strudel, RDKit,I examined the current Store manifests, searched public projects and maker demonstrations, then retrieved metadata, READMEs, licenses, and selected implementation files directly from 13 relevant GitHub repositories. I also inspected Godogen's demo briefs and OpenMontage's Backlot screenshot and viewer documentation.-The original September 16 research was a source and product assessment; it did **not** install the packages, generate a game or film, run benchmarks, or operate hardware. Subsequent implementation checks for Godogen and OpenMontage are documented in their packages. Public examples are upstream demonstrations, not independently reproduced results. Every proposed demo below is a Harness product idea; it is not a claim that the exact prompt already succeeds upstream.+The original September 16 research was a source and product assessment; it did **not** install the packages, generate a game or film, run benchmarks, or operate hardware. Subsequent implementation checks are documented in each package and the shared viewers’ testing notes. Public examples are upstream demonstrations, not independently reproduced results. Every proposed demo below is a Harness product idea; it is not a claim that the exact prompt already succeeds upstream.## Ranked shortlistdiff --git a/store/agents/ableton-ai/toolchain/studio_fetch.py b/store/agents/ableton-ai/toolchain/studio_fetch.pyindex 88a670b25..7b7d2613a 100644--- a/store/agents/ableton-ai/toolchain/studio_fetch.py+++ b/store/agents/ableton-ai/toolchain/studio_fetch.py@@ -1,34 +1,47 @@-"""Fetch reviewed source pins without installing a service or changing user configuration."""+"""Fetch reviewed source pins without installing services or changing user configuration."""import jsonimport osfrom pathlib import Path+import reimport subprocess-root = Path(__file__).resolve().parent.parent-sources = json.loads((root / "upstream.lock.json").read_text())-for source in sources:- target = root / source["directory"]- def git(*args):- return subprocess.check_output(["git", "-C", str(target), *args], text=True,- env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()- if not (target / ".git").exists():- target.mkdir(parents=True, exist_ok=True)- git("init", "-q")- git("remote", "add", "origin", source["url"])++def fetch_sources(root):+ root = Path(root).resolve()+ sources = json.loads((root / "upstream.lock.json").read_text())+ for source in sources:+ directory = source["directory"]+ if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9._-]*", directory):+ raise ValueError("Upstream directories must be package-local names")+ if not re.fullmatch(r"[0-9a-f]{40}", source["commit"]):+ raise ValueError("Upstream sources must use full commit pins")+ target = root / directory+ target.resolve().relative_to(root)+ def git(*args, quiet=False):+ return subprocess.check_output(["git", "-C", str(target), *args], text=True,+ stderr=subprocess.DEVNULL if quiet else None,+ env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()+ if not (target / ".git").exists():+ target.mkdir(parents=True, exist_ok=True)+ git("init", "-q")+ git("remote", "add", "origin", source["url"])+ if source.get("sparse"):+ git("sparse-checkout", "init", "--cone")+ if git("remote", "get-url", "origin") != source["url"]:+ raise SystemExit(f"Unexpected upstream remote in {target}")+ try:+ current = git("rev-parse", "--verify", "HEAD", quiet=True)+ except subprocess.CalledProcessError:+ current = ""+ if current != source["commit"] and current and git("status", "--porcelain"):+ raise SystemExit(f"Save your edits in {target} before changing its source pin")if source.get("sparse"):- git("sparse-checkout", "init", "--cone")git("sparse-checkout", "set", *source["sparse"])- if git("remote", "get-url", "origin") != source["url"]:- raise SystemExit(f"Unexpected upstream remote in {target}")- if source.get("sparse"):- git("sparse-checkout", "set", *source["sparse"])- try:- current = git("rev-parse", "HEAD")- except subprocess.CalledProcessError:- current = ""- if current != source["commit"]:- if current and git("status", "--porcelain"):- raise SystemExit(f"Save your edits in {target} before changing its source pin")- git("fetch", "--depth", "1", "--filter=blob:none", "origin", source["commit"])- git("checkout", "--detach", source["commit"])- print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+ if current != source["commit"]:+ git("fetch", "--quiet", "--depth", "1", "--filter=blob:none", "origin", source["commit"])+ git("checkout", "--quiet", "--detach", source["commit"])+ print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+++if __name__ == "__main__":+ fetch_sources(Path(__file__).resolve().parent.parent)diff --git a/store/agents/autoresearch-mlx/toolchain/studio_fetch.py b/store/agents/autoresearch-mlx/toolchain/studio_fetch.pyindex 88a670b25..7b7d2613a 100644--- a/store/agents/autoresearch-mlx/toolchain/studio_fetch.py+++ b/store/agents/autoresearch-mlx/toolchain/studio_fetch.py@@ -1,34 +1,47 @@-"""Fetch reviewed source pins without installing a service or changing user configuration."""+"""Fetch reviewed source pins without installing services or changing user configuration."""import jsonimport osfrom pathlib import Path+import reimport subprocess-root = Path(__file__).resolve().parent.parent-sources = json.loads((root / "upstream.lock.json").read_text())-for source in sources:- target = root / source["directory"]- def git(*args):- return subprocess.check_output(["git", "-C", str(target), *args], text=True,- env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()- if not (target / ".git").exists():- target.mkdir(parents=True, exist_ok=True)- git("init", "-q")- git("remote", "add", "origin", source["url"])++def fetch_sources(root):+ root = Path(root).resolve()+ sources = json.loads((root / "upstream.lock.json").read_text())+ for source in sources:+ directory = source["directory"]+ if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9._-]*", directory):+ raise ValueError("Upstream directories must be package-local names")+ if not re.fullmatch(r"[0-9a-f]{40}", source["commit"]):+ raise ValueError("Upstream sources must use full commit pins")+ target = root / directory+ target.resolve().relative_to(root)+ def git(*args, quiet=False):+ return subprocess.check_output(["git", "-C", str(target), *args], text=True,+ stderr=subprocess.DEVNULL if quiet else None,+ env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()+ if not (target / ".git").exists():+ target.mkdir(parents=True, exist_ok=True)+ git("init", "-q")+ git("remote", "add", "origin", source["url"])+ if source.get("sparse"):+ git("sparse-checkout", "init", "--cone")+ if git("remote", "get-url", "origin") != source["url"]:+ raise SystemExit(f"Unexpected upstream remote in {target}")+ try:+ current = git("rev-parse", "--verify", "HEAD", quiet=True)+ except subprocess.CalledProcessError:+ current = ""+ if current != source["commit"] and current and git("status", "--porcelain"):+ raise SystemExit(f"Save your edits in {target} before changing its source pin")if source.get("sparse"):- git("sparse-checkout", "init", "--cone")git("sparse-checkout", "set", *source["sparse"])- if git("remote", "get-url", "origin") != source["url"]:- raise SystemExit(f"Unexpected upstream remote in {target}")- if source.get("sparse"):- git("sparse-checkout", "set", *source["sparse"])- try:- current = git("rev-parse", "HEAD")- except subprocess.CalledProcessError:- current = ""- if current != source["commit"]:- if current and git("status", "--porcelain"):- raise SystemExit(f"Save your edits in {target} before changing its source pin")- git("fetch", "--depth", "1", "--filter=blob:none", "origin", source["commit"])- git("checkout", "--detach", source["commit"])- print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+ if current != source["commit"]:+ git("fetch", "--quiet", "--depth", "1", "--filter=blob:none", "origin", source["commit"])+ git("checkout", "--quiet", "--detach", source["commit"])+ print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+++if __name__ == "__main__":+ fetch_sources(Path(__file__).resolve().parent.parent)diff --git a/store/agents/bonsai-mcp/toolchain/studio_fetch.py b/store/agents/bonsai-mcp/toolchain/studio_fetch.pyindex 88a670b25..7b7d2613a 100644--- a/store/agents/bonsai-mcp/toolchain/studio_fetch.py+++ b/store/agents/bonsai-mcp/toolchain/studio_fetch.py@@ -1,34 +1,47 @@-"""Fetch reviewed source pins without installing a service or changing user configuration."""+"""Fetch reviewed source pins without installing services or changing user configuration."""import jsonimport osfrom pathlib import Path+import reimport subprocess-root = Path(__file__).resolve().parent.parent-sources = json.loads((root / "upstream.lock.json").read_text())-for source in sources:- target = root / source["directory"]- def git(*args):- return subprocess.check_output(["git", "-C", str(target), *args], text=True,- env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()- if not (target / ".git").exists():- target.mkdir(parents=True, exist_ok=True)- git("init", "-q")- git("remote", "add", "origin", source["url"])++def fetch_sources(root):+ root = Path(root).resolve()+ sources = json.loads((root / "upstream.lock.json").read_text())+ for source in sources:+ directory = source["directory"]+ if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9._-]*", directory):+ raise ValueError("Upstream directories must be package-local names")+ if not re.fullmatch(r"[0-9a-f]{40}", source["commit"]):+ raise ValueError("Upstream sources must use full commit pins")+ target = root / directory+ target.resolve().relative_to(root)+ def git(*args, quiet=False):+ return subprocess.check_output(["git", "-C", str(target), *args], text=True,+ stderr=subprocess.DEVNULL if quiet else None,+ env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()+ if not (target / ".git").exists():+ target.mkdir(parents=True, exist_ok=True)+ git("init", "-q")+ git("remote", "add", "origin", source["url"])+ if source.get("sparse"):+ git("sparse-checkout", "init", "--cone")+ if git("remote", "get-url", "origin") != source["url"]:+ raise SystemExit(f"Unexpected upstream remote in {target}")+ try:+ current = git("rev-parse", "--verify", "HEAD", quiet=True)+ except subprocess.CalledProcessError:+ current = ""+ if current != source["commit"] and current and git("status", "--porcelain"):+ raise SystemExit(f"Save your edits in {target} before changing its source pin")if source.get("sparse"):- git("sparse-checkout", "init", "--cone")git("sparse-checkout", "set", *source["sparse"])- if git("remote", "get-url", "origin") != source["url"]:- raise SystemExit(f"Unexpected upstream remote in {target}")- if source.get("sparse"):- git("sparse-checkout", "set", *source["sparse"])- try:- current = git("rev-parse", "HEAD")- except subprocess.CalledProcessError:- current = ""- if current != source["commit"]:- if current and git("status", "--porcelain"):- raise SystemExit(f"Save your edits in {target} before changing its source pin")- git("fetch", "--depth", "1", "--filter=blob:none", "origin", source["commit"])- git("checkout", "--detach", source["commit"])- print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+ if current != source["commit"]:+ git("fetch", "--quiet", "--depth", "1", "--filter=blob:none", "origin", source["commit"])+ git("checkout", "--quiet", "--detach", source["commit"])+ print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+++if __name__ == "__main__":+ fetch_sources(Path(__file__).resolve().parent.parent)diff --git a/store/agents/comfy-mcp/toolchain/studio_fetch.py b/store/agents/comfy-mcp/toolchain/studio_fetch.pyindex 88a670b25..7b7d2613a 100644--- a/store/agents/comfy-mcp/toolchain/studio_fetch.py+++ b/store/agents/comfy-mcp/toolchain/studio_fetch.py@@ -1,34 +1,47 @@-"""Fetch reviewed source pins without installing a service or changing user configuration."""+"""Fetch reviewed source pins without installing services or changing user configuration."""import jsonimport osfrom pathlib import Path+import reimport subprocess-root = Path(__file__).resolve().parent.parent-sources = json.loads((root / "upstream.lock.json").read_text())-for source in sources:- target = root / source["directory"]- def git(*args):- return subprocess.check_output(["git", "-C", str(target), *args], text=True,- env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()- if not (target / ".git").exists():- target.mkdir(parents=True, exist_ok=True)- git("init", "-q")- git("remote", "add", "origin", source["url"])++def fetch_sources(root):+ root = Path(root).resolve()+ sources = json.loads((root / "upstream.lock.json").read_text())+ for source in sources:+ directory = source["directory"]+ if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9._-]*", directory):+ raise ValueError("Upstream directories must be package-local names")+ if not re.fullmatch(r"[0-9a-f]{40}", source["commit"]):+ raise ValueError("Upstream sources must use full commit pins")+ target = root / directory+ target.resolve().relative_to(root)+ def git(*args, quiet=False):+ return subprocess.check_output(["git", "-C", str(target), *args], text=True,+ stderr=subprocess.DEVNULL if quiet else None,+ env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()+ if not (target / ".git").exists():+ target.mkdir(parents=True, exist_ok=True)+ git("init", "-q")+ git("remote", "add", "origin", source["url"])+ if source.get("sparse"):+ git("sparse-checkout", "init", "--cone")+ if git("remote", "get-url", "origin") != source["url"]:+ raise SystemExit(f"Unexpected upstream remote in {target}")+ try:+ current = git("rev-parse", "--verify", "HEAD", quiet=True)+ except subprocess.CalledProcessError:+ current = ""+ if current != source["commit"] and current and git("status", "--porcelain"):+ raise SystemExit(f"Save your edits in {target} before changing its source pin")if source.get("sparse"):- git("sparse-checkout", "init", "--cone")git("sparse-checkout", "set", *source["sparse"])- if git("remote", "get-url", "origin") != source["url"]:- raise SystemExit(f"Unexpected upstream remote in {target}")- if source.get("sparse"):- git("sparse-checkout", "set", *source["sparse"])- try:- current = git("rev-parse", "HEAD")- except subprocess.CalledProcessError:- current = ""- if current != source["commit"]:- if current and git("status", "--porcelain"):- raise SystemExit(f"Save your edits in {target} before changing its source pin")- git("fetch", "--depth", "1", "--filter=blob:none", "origin", source["commit"])- git("checkout", "--detach", source["commit"])- print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+ if current != source["commit"]:+ git("fetch", "--quiet", "--depth", "1", "--filter=blob:none", "origin", source["commit"])+ git("checkout", "--quiet", "--detach", source["commit"])+ print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+++if __name__ == "__main__":+ fetch_sources(Path(__file__).resolve().parent.parent)diff --git a/store/agents/dimos/toolchain/studio_fetch.py b/store/agents/dimos/toolchain/studio_fetch.pyindex 88a670b25..7b7d2613a 100644--- a/store/agents/dimos/toolchain/studio_fetch.py+++ b/store/agents/dimos/toolchain/studio_fetch.py@@ -1,34 +1,47 @@-"""Fetch reviewed source pins without installing a service or changing user configuration."""+"""Fetch reviewed source pins without installing services or changing user configuration."""import jsonimport osfrom pathlib import Path+import reimport subprocess-root = Path(__file__).resolve().parent.parent-sources = json.loads((root / "upstream.lock.json").read_text())-for source in sources:- target = root / source["directory"]- def git(*args):- return subprocess.check_output(["git", "-C", str(target), *args], text=True,- env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()- if not (target / ".git").exists():- target.mkdir(parents=True, exist_ok=True)- git("init", "-q")- git("remote", "add", "origin", source["url"])++def fetch_sources(root):+ root = Path(root).resolve()+ sources = json.loads((root / "upstream.lock.json").read_text())+ for source in sources:+ directory = source["directory"]+ if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9._-]*", directory):+ raise ValueError("Upstream directories must be package-local names")+ if not re.fullmatch(r"[0-9a-f]{40}", source["commit"]):+ raise ValueError("Upstream sources must use full commit pins")+ target = root / directory+ target.resolve().relative_to(root)+ def git(*args, quiet=False):+ return subprocess.check_output(["git", "-C", str(target), *args], text=True,+ stderr=subprocess.DEVNULL if quiet else None,+ env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()+ if not (target / ".git").exists():+ target.mkdir(parents=True, exist_ok=True)+ git("init", "-q")+ git("remote", "add", "origin", source["url"])+ if source.get("sparse"):+ git("sparse-checkout", "init", "--cone")+ if git("remote", "get-url", "origin") != source["url"]:+ raise SystemExit(f"Unexpected upstream remote in {target}")+ try:+ current = git("rev-parse", "--verify", "HEAD", quiet=True)+ except subprocess.CalledProcessError:+ current = ""+ if current != source["commit"] and current and git("status", "--porcelain"):+ raise SystemExit(f"Save your edits in {target} before changing its source pin")if source.get("sparse"):- git("sparse-checkout", "init", "--cone")git("sparse-checkout", "set", *source["sparse"])- if git("remote", "get-url", "origin") != source["url"]:- raise SystemExit(f"Unexpected upstream remote in {target}")- if source.get("sparse"):- git("sparse-checkout", "set", *source["sparse"])- try:- current = git("rev-parse", "HEAD")- except subprocess.CalledProcessError:- current = ""- if current != source["commit"]:- if current and git("status", "--porcelain"):- raise SystemExit(f"Save your edits in {target} before changing its source pin")- git("fetch", "--depth", "1", "--filter=blob:none", "origin", source["commit"])- git("checkout", "--detach", source["commit"])- print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+ if current != source["commit"]:+ git("fetch", "--quiet", "--depth", "1", "--filter=blob:none", "origin", source["commit"])+ git("checkout", "--quiet", "--detach", source["commit"])+ print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+++if __name__ == "__main__":+ fetch_sources(Path(__file__).resolve().parent.parent)diff --git a/store/agents/foam-agent/toolchain/studio_fetch.py b/store/agents/foam-agent/toolchain/studio_fetch.pyindex 88a670b25..7b7d2613a 100644--- a/store/agents/foam-agent/toolchain/studio_fetch.py+++ b/store/agents/foam-agent/toolchain/studio_fetch.py@@ -1,34 +1,47 @@-"""Fetch reviewed source pins without installing a service or changing user configuration."""+"""Fetch reviewed source pins without installing services or changing user configuration."""import jsonimport osfrom pathlib import Path+import reimport subprocess-root = Path(__file__).resolve().parent.parent-sources = json.loads((root / "upstream.lock.json").read_text())-for source in sources:- target = root / source["directory"]- def git(*args):- return subprocess.check_output(["git", "-C", str(target), *args], text=True,- env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()- if not (target / ".git").exists():- target.mkdir(parents=True, exist_ok=True)- git("init", "-q")- git("remote", "add", "origin", source["url"])++def fetch_sources(root):+ root = Path(root).resolve()+ sources = json.loads((root / "upstream.lock.json").read_text())+ for source in sources:+ directory = source["directory"]+ if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9._-]*", directory):+ raise ValueError("Upstream directories must be package-local names")+ if not re.fullmatch(r"[0-9a-f]{40}", source["commit"]):+ raise ValueError("Upstream sources must use full commit pins")+ target = root / directory+ target.resolve().relative_to(root)+ def git(*args, quiet=False):+ return subprocess.check_output(["git", "-C", str(target), *args], text=True,+ stderr=subprocess.DEVNULL if quiet else None,+ env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()+ if not (target / ".git").exists():+ target.mkdir(parents=True, exist_ok=True)+ git("init", "-q")+ git("remote", "add", "origin", source["url"])+ if source.get("sparse"):+ git("sparse-checkout", "init", "--cone")+ if git("remote", "get-url", "origin") != source["url"]:+ raise SystemExit(f"Unexpected upstream remote in {target}")+ try:+ current = git("rev-parse", "--verify", "HEAD", quiet=True)+ except subprocess.CalledProcessError:+ current = ""+ if current != source["commit"] and current and git("status", "--porcelain"):+ raise SystemExit(f"Save your edits in {target} before changing its source pin")if source.get("sparse"):- git("sparse-checkout", "init", "--cone")git("sparse-checkout", "set", *source["sparse"])- if git("remote", "get-url", "origin") != source["url"]:- raise SystemExit(f"Unexpected upstream remote in {target}")- if source.get("sparse"):- git("sparse-checkout", "set", *source["sparse"])- try:- current = git("rev-parse", "HEAD")- except subprocess.CalledProcessError:- current = ""- if current != source["commit"]:- if current and git("status", "--porcelain"):- raise SystemExit(f"Save your edits in {target} before changing its source pin")- git("fetch", "--depth", "1", "--filter=blob:none", "origin", source["commit"])- git("checkout", "--detach", source["commit"])- print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+ if current != source["commit"]:+ git("fetch", "--quiet", "--depth", "1", "--filter=blob:none", "origin", source["commit"])+ git("checkout", "--quiet", "--detach", source["commit"])+ print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+++if __name__ == "__main__":+ fetch_sources(Path(__file__).resolve().parent.parent)diff --git a/store/agents/juce-agent-toolkit/toolchain/studio_fetch.py b/store/agents/juce-agent-toolkit/toolchain/studio_fetch.pyindex 88a670b25..7b7d2613a 100644--- a/store/agents/juce-agent-toolkit/toolchain/studio_fetch.py+++ b/store/agents/juce-agent-toolkit/toolchain/studio_fetch.py@@ -1,34 +1,47 @@-"""Fetch reviewed source pins without installing a service or changing user configuration."""+"""Fetch reviewed source pins without installing services or changing user configuration."""import jsonimport osfrom pathlib import Path+import reimport subprocess-root = Path(__file__).resolve().parent.parent-sources = json.loads((root / "upstream.lock.json").read_text())-for source in sources:- target = root / source["directory"]- def git(*args):- return subprocess.check_output(["git", "-C", str(target), *args], text=True,- env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()- if not (target / ".git").exists():- target.mkdir(parents=True, exist_ok=True)- git("init", "-q")- git("remote", "add", "origin", source["url"])++def fetch_sources(root):+ root = Path(root).resolve()+ sources = json.loads((root / "upstream.lock.json").read_text())+ for source in sources:+ directory = source["directory"]+ if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9._-]*", directory):+ raise ValueError("Upstream directories must be package-local names")+ if not re.fullmatch(r"[0-9a-f]{40}", source["commit"]):+ raise ValueError("Upstream sources must use full commit pins")+ target = root / directory+ target.resolve().relative_to(root)+ def git(*args, quiet=False):+ return subprocess.check_output(["git", "-C", str(target), *args], text=True,+ stderr=subprocess.DEVNULL if quiet else None,+ env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()+ if not (target / ".git").exists():+ target.mkdir(parents=True, exist_ok=True)+ git("init", "-q")+ git("remote", "add", "origin", source["url"])+ if source.get("sparse"):+ git("sparse-checkout", "init", "--cone")+ if git("remote", "get-url", "origin") != source["url"]:+ raise SystemExit(f"Unexpected upstream remote in {target}")+ try:+ current = git("rev-parse", "--verify", "HEAD", quiet=True)+ except subprocess.CalledProcessError:+ current = ""+ if current != source["commit"] and current and git("status", "--porcelain"):+ raise SystemExit(f"Save your edits in {target} before changing its source pin")if source.get("sparse"):- git("sparse-checkout", "init", "--cone")git("sparse-checkout", "set", *source["sparse"])- if git("remote", "get-url", "origin") != source["url"]:- raise SystemExit(f"Unexpected upstream remote in {target}")- if source.get("sparse"):- git("sparse-checkout", "set", *source["sparse"])- try:- current = git("rev-parse", "HEAD")- except subprocess.CalledProcessError:- current = ""- if current != source["commit"]:- if current and git("status", "--porcelain"):- raise SystemExit(f"Save your edits in {target} before changing its source pin")- git("fetch", "--depth", "1", "--filter=blob:none", "origin", source["commit"])- git("checkout", "--detach", source["commit"])- print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+ if current != source["commit"]:+ git("fetch", "--quiet", "--depth", "1", "--filter=blob:none", "origin", source["commit"])+ git("checkout", "--quiet", "--detach", source["commit"])+ print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+++if __name__ == "__main__":+ fetch_sources(Path(__file__).resolve().parent.parent)diff --git a/store/agents/simskill/toolchain/studio_fetch.py b/store/agents/simskill/toolchain/studio_fetch.pyindex 88a670b25..7b7d2613a 100644--- a/store/agents/simskill/toolchain/studio_fetch.py+++ b/store/agents/simskill/toolchain/studio_fetch.py@@ -1,34 +1,47 @@-"""Fetch reviewed source pins without installing a service or changing user configuration."""+"""Fetch reviewed source pins without installing services or changing user configuration."""import jsonimport osfrom pathlib import Path+import reimport subprocess-root = Path(__file__).resolve().parent.parent-sources = json.loads((root / "upstream.lock.json").read_text())-for source in sources:- target = root / source["directory"]- def git(*args):- return subprocess.check_output(["git", "-C", str(target), *args], text=True,- env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()- if not (target / ".git").exists():- target.mkdir(parents=True, exist_ok=True)- git("init", "-q")- git("remote", "add", "origin", source["url"])++def fetch_sources(root):+ root = Path(root).resolve()+ sources = json.loads((root / "upstream.lock.json").read_text())+ for source in sources:+ directory = source["directory"]+ if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9._-]*", directory):+ raise ValueError("Upstream directories must be package-local names")+ if not re.fullmatch(r"[0-9a-f]{40}", source["commit"]):+ raise ValueError("Upstream sources must use full commit pins")+ target = root / directory+ target.resolve().relative_to(root)+ def git(*args, quiet=False):+ return subprocess.check_output(["git", "-C", str(target), *args], text=True,+ stderr=subprocess.DEVNULL if quiet else None,+ env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()+ if not (target / ".git").exists():+ target.mkdir(parents=True, exist_ok=True)+ git("init", "-q")+ git("remote", "add", "origin", source["url"])+ if source.get("sparse"):+ git("sparse-checkout", "init", "--cone")+ if git("remote", "get-url", "origin") != source["url"]:+ raise SystemExit(f"Unexpected upstream remote in {target}")+ try:+ current = git("rev-parse", "--verify", "HEAD", quiet=True)+ except subprocess.CalledProcessError:+ current = ""+ if current != source["commit"] and current and git("status", "--porcelain"):+ raise SystemExit(f"Save your edits in {target} before changing its source pin")if source.get("sparse"):- git("sparse-checkout", "init", "--cone")git("sparse-checkout", "set", *source["sparse"])- if git("remote", "get-url", "origin") != source["url"]:- raise SystemExit(f"Unexpected upstream remote in {target}")- if source.get("sparse"):- git("sparse-checkout", "set", *source["sparse"])- try:- current = git("rev-parse", "HEAD")- except subprocess.CalledProcessError:- current = ""- if current != source["commit"]:- if current and git("status", "--porcelain"):- raise SystemExit(f"Save your edits in {target} before changing its source pin")- git("fetch", "--depth", "1", "--filter=blob:none", "origin", source["commit"])- git("checkout", "--detach", source["commit"])- print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+ if current != source["commit"]:+ git("fetch", "--quiet", "--depth", "1", "--filter=blob:none", "origin", source["commit"])+ git("checkout", "--quiet", "--detach", source["commit"])+ print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+++if __name__ == "__main__":+ fetch_sources(Path(__file__).resolve().parent.parent)diff --git a/store/agents/simskill/view.mjs b/store/agents/simskill/view.mjsindex fa854665e..cc7ccc839 100644--- a/store/agents/simskill/view.mjs+++ b/store/agents/simskill/view.mjs@@ -1,23 +1,26 @@import {canvas,round,line,circle,words,toolbar,badge,label,el} from '/graphics.mjs';export function mount(stage,api){- let p=api.getParameters(),result,index=0,playing=true,rate=8,now=0,start=0,last='',follow=false,bounds;+ let p=api.getParameters(),result,index=0,playing=true,rate=8,now=0,start=0,last='',follow=false,followId=null,bounds;label(stage,'Every little journey has somewhere to be.');const tag=badge(stage,'TRAFFIC REPLAY');const screen=canvas(stage,(ctx,w,h,t)=>{now=t;const size=Math.min(w-50,h-170),left=(w-size)/2,top=70,s=size/400;bounds={left,top,s};const map=(x,y)=>[left+x*s,top+(400-y)*s];+ const frames=result?.data?.frames;if(frames?.length&&playing)index=Math.floor(((t-start)*rate/2)%frames.length);const frame=frames?.[index];+ const tracked=follow&&(frame?.cars.find(car=>car.id===followId)??frame?.cars[0]);if(tracked)followId=tracked.id;+ ctx.save();ctx.beginPath();ctx.rect(0,58,w,h-128);ctx.clip();if(tracked){const [x,y]=map(tracked.x,tracked.y);ctx.translate(w/2,top+size/2);ctx.scale(2.6,2.6);ctx.translate(-x,-y);}round(ctx,left,top,size,size,14,'#2e4230');const mid=left+size/2,cy=top+size/2,road=28;ctx.fillStyle='#b9bfaa';ctx.fillRect(left,cy-road/2-4,size,road+8);ctx.fillRect(mid-road/2-4,top,road+8,size);ctx.fillStyle='#39433c';ctx.fillRect(left,cy-road/2,size,road);ctx.fillRect(mid-road/2,top,road,size);for(let i=0;i<4;i++){const x=left+(i%2?size*.67:size*.13),y=top+(i>1?size*.67:size*.13);round(ctx,x+3,y+5,size*.19,size*.16,4,'#11271955');round(ctx,x,y,size*.19,size*.16,4,['#acb68d','#7d9475','#889780','#b4ae8c'][i]);line(ctx,[[x+5,y+6],[x+size*.19-5,y+6]],'#e5e6c333',1);circle(ctx,x+size*.1,y+size*.23,9,'#698952');circle(ctx,x+size*.16,y+size*.23,7,'#76975b');}ctx.setLineDash([6,8]);line(ctx,[[left,cy],[mid-22,cy]],'#b6c3a04d',1);line(ctx,[[mid+22,cy],[left+size,cy]],'#b6c3a04d',1);line(ctx,[[mid,top],[mid,cy-22]],'#b6c3a04d',1);line(ctx,[[mid,cy+22],[mid,top+size]],'#b6c3a04d',1);ctx.setLineDash([]);- const frames=result?.data?.frames;- if(frames?.length){if(playing)index=Math.floor(((t-start)*rate/2)%frames.length);const frame=frames[index];scrub.value=index;tag.textContent=`SUMO · ${frame.time.toFixed(0)} S`;- frame.cars.forEach((car,i)=>{const [x,y]=map(car.x,car.y);ctx.save();ctx.translate(x,y);ctx.rotate(car.angle*Math.PI/180);round(ctx,-1,-2.5,2,5,1,car.speed<.1?'#e79c75':'#d5e9a2');ctx.restore();if(follow&&i===0){circle(ctx,x,y,10,'#e5f8bd25');words(ctx,car.id,x+11,y-7,'#e5f8bd',9);}});- if(w>570){words(ctx,'CITY CLOCK',24,69,'#a7c292',9);words(ctx,`${frame.time.toFixed(0)} s`,24,98,'#e1edc5',23);words(ctx,`${frame.cars.length} moving stories`,24,122,'#9cb78b',10);}- }else words(ctx,'Run the city to record its traffic.',left,top+size/2,'#d5e9a2',11);+ if(frames?.length){scrub.value=index;tag.textContent=`SUMO · ${frame.time.toFixed(0)} S`;+ frame.cars.forEach((car,i)=>{const [x,y]=map(car.x,car.y);ctx.save();ctx.translate(x,y);ctx.rotate(car.angle*Math.PI/180);round(ctx,-1,-2.5,2,5,1,car.speed<.1?'#e79c75':'#d5e9a2');ctx.restore();if(tracked&&car.id===tracked.id){circle(ctx,x,y,10,'#e5f8bd25');words(ctx,car.id,x+11,y-7,'#e5f8bd',9);}});+ ctx.restore();+ if(w>570){round(ctx,15,48,150,90,9,'#182c23df');words(ctx,'CITY CLOCK',24,69,'#a7c292',9);words(ctx,`${frame.time.toFixed(0)} s`,24,98,'#e1edc5',23);words(ctx,`${frame.cars.length} moving stories`,24,122,'#9cb78b',10);}+ }else{ctx.restore();words(ctx,'Run the city to record its traffic.',left,top+size/2,'#d5e9a2',11);}words(ctx,`${result?.parameters.green??p.green}s RECORDED EAST–WEST GREEN`,left,top+size+20,'#9cb78b',9);},api.signal);screen.element.setAttribute('aria-label','SUMO traffic replay on a four-way city intersection');const bar=toolbar(stage,[['Pause traffic',b=>{playing=!playing;if(playing)start=now-index*2/rate;b.textContent=playing?'Pause traffic':'Play traffic';b.setAttribute('aria-pressed',String(playing));}],['8× speed',b=>{rate=rate===8?16:rate===16?1:8;start=now-index*2/rate;b.textContent=`${rate}× speed`;}],['Follow a car',b=>{follow=!follow;b.textContent=follow?'See the city':'Follow a car';b.setAttribute('aria-pressed',String(follow));}]]);const scrub=el('input');scrub.type='range';scrub.min=0;scrub.max=1;scrub.value=0;scrub.style.width='95px';scrub.setAttribute('aria-label','Traffic replay position');scrub.addEventListener('input',()=>{playing=false;index=Number(scrub.value);bar.firstChild.textContent='Play traffic';});bar.append(scrub);- return {update(params,r,motion){p=params;result=r;screen.motion(motion);if(r?.data?.frames&&r.id!==last){last=r.id;start=now;index=0;scrub.max=r.data.frames.length-1;}}};+ return {update(params,r,motion){p=params;result=r;screen.motion(motion);if(r?.data?.frames&&r.id!==last){last=r.id;start=now;index=0;followId=null;scrub.max=r.data.frames.length-1;}}};}diff --git a/store/tools/README.md b/store/tools/README.mdindex ba7dfe725..fce508f61 100644--- a/store/tools/README.md+++ b/store/tools/README.md@@ -28,3 +28,18 @@ A package installs alone, so each one carries a copy (`toolchain/runtimes.sh` innode store/tools/sync-runtimes.mjs # rewrite every copynode store/tools/sync-runtimes.mjs --check # exit 1 on a copy that drifted or a package missing one```++## Specialist studio runtime copies++`studio_runtime.py` validates project controls, runs one named action, verifies its artifacts,+and writes immutable results plus the Harness verdict. `studio_fetch.py` fetches reviewed+commit pins without overwriting local source changes. Every specialist package carries its+own copy for sparse installs. After editing the canonical files, run:++```sh+node store/tools/sync-studios.mjs+node store/tools/sync-studios.mjs --check+```++The shared [Studio Viewer test guide](../viewers/studio-viewer/TESTING.md) covers the runtime,+pin fetching, domain workflows, browser controls, and actual Harness lifecycle.diff --git a/store/tools/studio_fetch.py b/store/tools/studio_fetch.pyindex 88a670b25..7b7d2613a 100644--- a/store/tools/studio_fetch.py+++ b/store/tools/studio_fetch.py@@ -1,34 +1,47 @@-"""Fetch reviewed source pins without installing a service or changing user configuration."""+"""Fetch reviewed source pins without installing services or changing user configuration."""import jsonimport osfrom pathlib import Path+import reimport subprocess-root = Path(__file__).resolve().parent.parent-sources = json.loads((root / "upstream.lock.json").read_text())-for source in sources:- target = root / source["directory"]- def git(*args):- return subprocess.check_output(["git", "-C", str(target), *args], text=True,- env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()- if not (target / ".git").exists():- target.mkdir(parents=True, exist_ok=True)- git("init", "-q")- git("remote", "add", "origin", source["url"])++def fetch_sources(root):+ root = Path(root).resolve()+ sources = json.loads((root / "upstream.lock.json").read_text())+ for source in sources:+ directory = source["directory"]+ if not re.fullmatch(r"[a-zA-Z0-9][a-zA-Z0-9._-]*", directory):+ raise ValueError("Upstream directories must be package-local names")+ if not re.fullmatch(r"[0-9a-f]{40}", source["commit"]):+ raise ValueError("Upstream sources must use full commit pins")+ target = root / directory+ target.resolve().relative_to(root)+ def git(*args, quiet=False):+ return subprocess.check_output(["git", "-C", str(target), *args], text=True,+ stderr=subprocess.DEVNULL if quiet else None,+ env={**os.environ, "GIT_LFS_SKIP_SMUDGE": "1"}).strip()+ if not (target / ".git").exists():+ target.mkdir(parents=True, exist_ok=True)+ git("init", "-q")+ git("remote", "add", "origin", source["url"])+ if source.get("sparse"):+ git("sparse-checkout", "init", "--cone")+ if git("remote", "get-url", "origin") != source["url"]:+ raise SystemExit(f"Unexpected upstream remote in {target}")+ try:+ current = git("rev-parse", "--verify", "HEAD", quiet=True)+ except subprocess.CalledProcessError:+ current = ""+ if current != source["commit"] and current and git("status", "--porcelain"):+ raise SystemExit(f"Save your edits in {target} before changing its source pin")if source.get("sparse"):- git("sparse-checkout", "init", "--cone")git("sparse-checkout", "set", *source["sparse"])- if git("remote", "get-url", "origin") != source["url"]:- raise SystemExit(f"Unexpected upstream remote in {target}")- if source.get("sparse"):- git("sparse-checkout", "set", *source["sparse"])- try:- current = git("rev-parse", "HEAD")- except subprocess.CalledProcessError:- current = ""- if current != source["commit"]:- if current and git("status", "--porcelain"):- raise SystemExit(f"Save your edits in {target} before changing its source pin")- git("fetch", "--depth", "1", "--filter=blob:none", "origin", source["commit"])- git("checkout", "--detach", source["commit"])- print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+ if current != source["commit"]:+ git("fetch", "--quiet", "--depth", "1", "--filter=blob:none", "origin", source["commit"])+ git("checkout", "--quiet", "--detach", source["commit"])+ print(f'ok {source["name"]} at {source["commit"][:12]}', flush=True)+++if __name__ == "__main__":+ fetch_sources(Path(__file__).resolve().parent.parent)diff --git a/store/viewers/studio-viewer/package.json b/store/viewers/studio-viewer/package.jsonindex 35a31cb12..21026c842 100644--- a/store/viewers/studio-viewer/package.json+++ b/store/viewers/studio-viewer/package.json@@ -8,7 +8,10 @@"test:coverage": "c8 --reporter=text --reporter=json --reporter=json-summary --include=server.mjs --include=web/music.mjs --check-coverage --lines=100 --branches=100 --functions=100 --statements=100 node --test test/*.test.mjs","test:ui": "node test/ui.e2e.mjs","test:webkit": "STUDIO_TEST_BROWSER=webkit node test/studios.e2e.mjs",- "coverage:browser": "node test/browser-coverage.mjs"+ "coverage:browser": "node test/browser-coverage.mjs",+ "test:workflows": "node test/workflows.mjs",+ "test:workflow-coverage": "node test/workflows.mjs --coverage",+ "test:result-views": "node test/result-views.e2e.mjs"},"devDependencies": {"playwright": "1.58.2",diff --git a/store/viewers/studio-viewer/server.mjs b/store/viewers/studio-viewer/server.mjsindex 571b32959..bbe6e9891 100644--- a/store/viewers/studio-viewer/server.mjs+++ b/store/viewers/studio-viewer/server.mjs@@ -85,9 +85,9 @@ export async function createStudio({workspace, packageDir, port = 0, jobTimeout}};const server = http.createServer(async (req,res) => {- const send = (status, data, type = 'application/json; charset=utf-8') => {+ const send = (status, data, type = 'application/json; charset=utf-8', raw = false) => {res.writeHead(status, {'Content-Type':type, 'Cache-Control':'no-store', 'X-Content-Type-Options':'nosniff', 'Content-Security-Policy':"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' blob: data:; media-src 'self' blob:; connect-src 'self'; frame-ancestors 'self'"});- res.end(type.startsWith('application/json') ? JSON.stringify(data) : data);+ res.end(!raw && type.startsWith('application/json') ? JSON.stringify(data) : data);};try {const expectedHost = `127.0.0.1:${server.address().port}`;@@ -154,10 +154,26 @@ export async function createStudio({workspace, packageDir, port = 0, jobTimeoutif (s.size > 256*1024*1024) throw new Problem(413,'Open this large artifact from your workspace.');const type = TYPES[extname(target)] ?? 'application/octet-stream';if (url.searchParams.has('download')) res.setHeader('Content-Disposition',`attachment; filename="${target.split(sep).at(-1).replace(/[^a-zA-Z0-9._-]/g,'_')}"`);+ res.setHeader('Accept-Ranges','bytes');+ // WebKit probes audio with bytes=0-1 and requires a proper partial response.+ if (req.method === 'GET' && req.headers.range) {+ const match = /^bytes=(\d*)-(\d*)$/.exec(req.headers.range);+ let start = 0, end = s.size-1;+ if (match && (match[1] || match[2])) {+ if (match[1]) {start=Number(match[1]);if (match[2]) end=Math.min(end,Number(match[2]));}+ else start=Math.max(0,s.size-Number(match[2]));+ } else start=s.size;+ if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start>end || start>=s.size) {+ res.setHeader('Content-Range',`bytes */${s.size}`);+ throw new Problem(416,'This byte range is outside the artifact.');+ }+ res.setHeader('Content-Range',`bytes ${start}-${end}/${s.size}`);+ res.setHeader('Content-Length',end-start+1);+ return send(206,(await readFile(target)).subarray(start,end+1),type,true);+ }+ res.setHeader('Content-Length',s.size);const data = req.method === 'HEAD' ? Buffer.alloc(0):await readFile(target);- // JSON artifacts are already serialized bytes, unlike API responses.- if (type === 'application/json') return send(200,JSON.parse(data.length ? data.toString():'null'));- return send(200,data,type);+ return send(200,data,type,true);} catch(error) {const status = error.status ?? (error.code === 'ENOENT' ? 404:500);return send(status,{error:status === 500 ? 'The studio could not read the project. Check studio.json and the latest result.':error.message});diff --git a/store/viewers/studio-viewer/test/browser-coverage.mjs b/store/viewers/studio-viewer/test/browser-coverage.mjsindex 7238c6844..ce083d895 100644--- a/store/viewers/studio-viewer/test/browser-coverage.mjs+++ b/store/viewers/studio-viewer/test/browser-coverage.mjs@@ -10,7 +10,7 @@ const store=fileURLToPath(new URL('../../../',import.meta.url));const map=createCoverageMap({});for(const filename of await readdir(join(viewer,'test-results'))){if(!filename.endsWith('-browser-coverage.json'))continue;- const name=filename.replace('-browser-coverage.json','');+ const name=filename.replace('-browser-coverage.json','').split('--')[0];const entries=JSON.parse(await readFile(join(viewer,'test-results',filename),'utf8'));for(const entry of entries){if(!entry.url?.startsWith('http://127.0.0.1:'))continue;@@ -21,6 +21,7 @@ for(const filename of await readdir(join(viewer,'test-results'))){file=join(store,'agents',name,'view.mjs');}else if(['/studio.mjs','/graphics.mjs','/music.mjs'].includes(path))file=join(viewer,'web',path.slice(1));else continue;+ if(entry.source!==await readFile(file,'utf8'))throw Error(`Stale browser coverage for ${file}; rerun ${filename}.`);const converter=v8ToIstanbul(file,0,{source:entry.source});await converter.load();converter.applyCoverage(entry.functions);map.merge(converter.toIstanbul());}diff --git a/store/viewers/studio-viewer/test/fetch_test.py b/store/viewers/studio-viewer/test/fetch_test.pynew file mode 100644index 000000000..4b2920b8d--- /dev/null+++ b/store/viewers/studio-viewer/test/fetch_test.py@@ -0,0 +1,71 @@+"""A clean install and pin updates against actual isolated Git repositories."""+import contextlib+import io+import json+import os+from pathlib import Path+import runpy+import subprocess+import sys+import tempfile+import unittest++STORE=Path(__file__).resolve().parents[3]+coverage=None+if os.environ.get('STUDIO_COVERAGE'):+ from coverage import Coverage+ coverage=Coverage(branch=True,data_file=None,include=[str(STORE/'tools/studio_fetch.py')]);coverage.start()+sys.path.insert(0,str(STORE/'tools'))+from studio_fetch import fetch_sources++class FetchTests(unittest.TestCase):+ def setUp(self):+ self.temp=tempfile.TemporaryDirectory(prefix='studio-fetch-');self.addCleanup(self.temp.cleanup)+ self.root=Path(self.temp.name).resolve();self.package=self.root/'package';self.package.mkdir();self.source=self.root/'source';self.source.mkdir()+ self.git(self.source,'init','-q')+ self.git(self.source,'config','user.name','Local fixture');self.git(self.source,'config','user.email','[email protected]')+ self.git(self.source,'config','uploadpack.allowFilter','true')+ for name in ['included','excluded']:+ (self.source/name).mkdir();(self.source/name/'readme.txt').write_text(name)+ (self.source/'README.md').write_text('Original pinned fixture')+ self.git(self.source,'add','.');self.git(self.source,'commit','-qm','first')+ self.first=self.git(self.source,'rev-parse','HEAD')+ self.pin={'name':'Local source','url':self.source.as_uri(),'commit':self.first,'directory':'upstream','sparse':['included']}+ self.save()+ def git(self,path,*args):return subprocess.check_output(['git','-C',str(path),*args],text=True,stderr=subprocess.PIPE).strip()+ def save(self): (self.package/'upstream.lock.json').write_text(json.dumps([self.pin]))+ def fetch(self):+ with contextlib.redirect_stdout(io.StringIO()):fetch_sources(self.package)+ def test_fresh_sparse_fetch_is_idempotent_and_updates_clean_sources(self):+ self.fetch();target=self.package/'upstream'+ self.assertEqual(self.git(target,'rev-parse','HEAD'),self.first)+ self.assertTrue((target/'included/readme.txt').exists());self.assertFalse((target/'excluded').exists())+ self.fetch();self.assertEqual(self.git(target,'status','--porcelain'),'')+ (self.source/'README.md').write_text('Second source revision')+ self.git(self.source,'commit','-qam','second');self.pin['commit']=self.git(self.source,'rev-parse','HEAD');self.save();self.fetch()+ self.assertEqual((target/'README.md').read_text(),'Second source revision')+ def test_dirty_edits_and_remote_mismatches_are_preserved(self):+ self.fetch();target=self.package/'upstream';(target/'README.md').write_text('My local changes')+ (self.source/'README.md').write_text('New pin');self.git(self.source,'commit','-qam','second');self.pin['commit']=self.git(self.source,'rev-parse','HEAD');self.save()+ with self.assertRaisesRegex(SystemExit,'Save your edits'):self.fetch()+ self.assertEqual((target/'README.md').read_text(),'My local changes')+ self.git(target,'remote','set-url','origin','file:///not-the-source')+ with self.assertRaisesRegex(SystemExit,'Unexpected upstream'):self.fetch()+ def test_full_checkout_and_invalid_pins(self):+ self.pin['sparse']=[];self.save();self.fetch();self.assertTrue((self.package/'upstream/excluded/readme.txt').is_file())+ for directory,commit in [('../escape',self.first),('upstream','main'),('upstream','short')]:+ self.pin.update(directory=directory,commit=commit);self.save()+ with self.assertRaises(ValueError):self.fetch()+ self.pin.update(directory='outside',commit=self.first);self.save();(self.package/'outside').symlink_to(self.source,target_is_directory=True)+ with self.assertRaises(ValueError):self.fetch()+ def test_setup_entry_point_uses_its_own_package_location(self):+ # Execute the canonical source with a package-local filename, as the synchronized copy does.+ code=compile((STORE/'tools/studio_fetch.py').read_text(),str(STORE/'tools/studio_fetch.py'),'exec')+ with contextlib.redirect_stdout(io.StringIO()):exec(code,{'__name__':'__main__','__file__':str(self.package/'toolchain/studio_fetch.py')})+ self.assertEqual(self.git(self.package/'upstream','rev-parse','HEAD'),self.first)++if __name__=='__main__':+ result=unittest.TextTestRunner(verbosity=2).run(unittest.defaultTestLoader.loadTestsFromTestCase(FetchTests))+ if coverage:+ coverage.stop();coverage.json_report(outfile=str(Path(__file__).resolve().parent.parent/'test-results/fetch-python-coverage.json'))+ sys.exit(not result.wasSuccessful())diff --git a/store/viewers/studio-viewer/test/requirements.txt b/store/viewers/studio-viewer/test/requirements.txtnew file mode 100644index 000000000..447685c97--- /dev/null+++ b/store/viewers/studio-viewer/test/requirements.txt@@ -0,0 +1,2 @@+# Test instrumentation only; keep it outside the production package environments.+coverage==7.10.7diff --git a/store/viewers/studio-viewer/test/result-views.e2e.mjs b/store/viewers/studio-viewer/test/result-views.e2e.mjsnew file mode 100644index 000000000..a6f3cbe9a--- /dev/null+++ b/store/viewers/studio-viewer/test/result-views.e2e.mjs@@ -0,0 +1,43 @@+// Rendering contracts for optional native results. These explicit fixtures do not run applications.+import assert from 'node:assert/strict';+import {mkdtemp,mkdir,cp,readFile,writeFile,rm} from 'node:fs/promises';+import {tmpdir} from 'node:os';+import {join} from 'node:path';+import {fileURLToPath} from 'node:url';+import {chromium} from 'playwright';+import {createStudio} from '../server.mjs';++const viewer=fileURLToPath(new URL('../',import.meta.url));+const agents=fileURLToPath(new URL('../../../agents/',import.meta.url));+const root=await mkdtemp(join(tmpdir(),'studio-native-view-fixtures-'));+const browser=await chromium.launch({channel:'chrome',headless:true});+const scenarios=[['juce-agent-toolkit','Native JUCE · fixture','JUCE RECORDING'],['autoresearch-mlx','Native MLX','MLX EXPERIMENT'],['comfy-mcp','Native ComfyUI · fixture','COMFYUI OUTPUTS']];+try{+ for(const [name,engine,badge] of scenarios){+ const packageDir=join(agents,name),workspace=join(root,name);await cp(join(packageDir,'template'),workspace,{recursive:true});+ const project=JSON.parse(await readFile(join(workspace,'studio.json'),'utf8'));+ await mkdir(join(workspace,'out/runs/fixture'),{recursive:true});+ const result={spec:1,id:'fixture',title:'Native result rendering fixture',description:'An isolated UI contract fixture',createdAt:new Date().toISOString(),engine,parameters:project.parameters,metrics:[],artifacts:[],data:{}};+ const context=await browser.newContext();const page=await context.newPage();const errors=[];page.on('pageerror',e=>errors.push(e.message));+ if(name==='comfy-mcp'){+ const png=await page.evaluate(()=>{const c=document.createElement('canvas');c.width=c.height=80;const x=c.getContext('2d');x.fillStyle='#759576';x.fillRect(0,0,80,80);return c.toDataURL().split(',')[1];});+ await writeFile(join(workspace,'out/runs/fixture/image.png'),Buffer.from(png,'base64'));+ result.artifacts=[{label:'Fixture PNG',path:'out/runs/fixture/image.png'}];result.data={images:[{seed:null,name:'image.png'}]};+ }+ await writeFile(join(workspace,'out/latest.json'),JSON.stringify(result));await writeFile(join(workspace,'out/runs/fixture/result.json'),JSON.stringify(result));+ const studio=await createStudio({workspace,packageDir});+ try{+ await page.coverage.startJSCoverage({resetOnNavigation:false});await page.goto(studio.url);+ await page.waitForFunction(()=>document.getElementById('connection').textContent==='Workspace connected');+ assert.equal(await page.locator('.domain-badge').textContent(),badge);+ if(name==='comfy-mcp'){+ await page.getByRole('button',{name:'Inspect image 1',exact:true}).click();+ await page.getByRole('dialog').waitFor();assert.equal(await page.getByRole('dialog').getByRole('heading').textContent(),'ComfyUI output');+ await page.getByRole('button',{name:'Close',exact:true}).click();+ }+ assert.deepEqual(errors,[]);+ const coverage=await page.coverage.stopJSCoverage();await writeFile(join(viewer,'test-results',`${name}--native-fixture-browser-coverage.json`),JSON.stringify(coverage));+ console.log(`PASS ${name}: native result rendering contract`);+ }finally{await context.close();await studio.close();}+ }+}finally{await browser.close();await rm(root,{recursive:true,force:true});}diff --git a/store/viewers/studio-viewer/test/studios.e2e.mjs b/store/viewers/studio-viewer/test/studios.e2e.mjsindex b6a0f149d..e3f26db2a 100644--- a/store/viewers/studio-viewer/test/studios.e2e.mjs+++ b/store/viewers/studio-viewer/test/studios.e2e.mjs@@ -22,7 +22,7 @@ const domains={'autoresearch-mlx':async page=>{await page.getByRole('button',{name:'Hide held-out score',exact:true}).click();await page.getByRole('button',{name:'Show held-out score',exact:true}).click();await page.locator('canvas').focus();await page.keyboard.press('ArrowRight');await page.keyboard.press('ArrowLeft');await page.getByRole('button',{name:'Try another seed',exact:true}).click();},'ableton-ai':async page=>{await page.getByRole('button',{name:'Play loop',exact:true}).click();await page.getByRole('button',{name:'Pause loop',exact:true}).click();await page.getByRole('button',{name:'New variation',exact:true}).click();await page.locator('canvas').focus();await page.keyboard.press('ArrowRight');await page.keyboard.press('Enter');await page.getByRole('button',{name:'Play WAV',exact:true}).click();},'dimos':async page=>{await page.getByRole('button',{name:'Hide route',exact:true}).click();await page.getByRole('button',{name:'Show route',exact:true}).click();await page.getByRole('button',{name:'Replay mission',exact:true}).click();await page.getByRole('slider',{name:'Mission replay position'}).focus();await page.keyboard.press('ArrowRight');await page.locator('canvas').focus();await page.keyboard.press('ArrowLeft');},- 'simskill':async page=>{await page.getByRole('button',{name:'Pause traffic',exact:true}).click();await page.getByRole('button',{name:'Play traffic',exact:true}).click();await page.getByRole('button',{name:'8× speed',exact:true}).click();await page.getByRole('button',{name:'16× speed',exact:true}).click();await page.getByRole('button',{name:'1× speed',exact:true}).click();await page.getByRole('button',{name:'Follow a car',exact:true}).click();await page.getByRole('button',{name:'See the city',exact:true}).click();await page.getByRole('slider',{name:'Traffic replay position'}).focus();await page.keyboard.press('ArrowRight');},+ 'simskill':async page=>{await page.getByRole('button',{name:'Pause traffic',exact:true}).click();await page.getByRole('button',{name:'Play traffic',exact:true}).click();await page.getByRole('button',{name:'8× speed',exact:true}).click();await page.getByRole('button',{name:'16× speed',exact:true}).click();await page.getByRole('button',{name:'1× speed',exact:true}).click();await page.getByRole('button',{name:'Follow a car',exact:true}).click();await page.evaluate(()=>new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve))));await page.screenshot({path:join(output,'simskill-follow.png'),fullPage:true});await page.getByRole('button',{name:'See the city',exact:true}).click();await page.getByRole('slider',{name:'Traffic replay position'}).focus();await page.keyboard.press('ArrowRight');},'bonsai-mcp':async page=>{await page.getByRole('button',{name:'Floor plan',exact:true}).click();await page.getByRole('button',{name:'Next room',exact:true}).click();await page.getByRole('button',{name:'Orbit view',exact:true}).click();await page.getByRole('button',{name:'Separate floors',exact:true}).click();await page.getByRole('button',{name:'Bring together',exact:true}).click();const box=await page.locator('canvas').boundingBox();await page.mouse.move(box.x+box.width/2,box.y+100);await page.mouse.down();await page.mouse.move(box.x+box.width/2+70,box.y+100,{steps:5});await page.mouse.up();await page.locator('canvas').focus();await page.keyboard.press('ArrowRight');await page.keyboard.press('Enter');await page.getByRole('button',{name:'Floor plan',exact:true}).click();await page.locator('canvas').click({position:{x:box.width/2,y:box.height/2}});await page.getByRole('button',{name:'Orbit view',exact:true}).click();},'comfy-mcp':async page=>{await page.locator('.gallery button').first().click();await page.getByRole('button',{name:'Close',exact:true}).click();await page.getByRole('button',{name:'Inspect favourite',exact:true}).click();await page.keyboard.press('Escape');await page.getByRole('button',{name:'Another family',exact:true}).click();},};@@ -45,6 +45,11 @@ try{assert.equal(await page.locator('h1').textContent(),config.title);await page.locator('#run').waitFor({state:'visible'});await page.waitForFunction(()=>document.querySelector('#stage canvas')||document.querySelector('.gallery img')?.complete);+ if(name==='simskill'){+ const recorded=await(await fetch(studio.url+'/api/state')).json();const stopped=recorded.result.data.frames.findIndex(f=>f.cars.some(car=>car.speed<.1));assert.ok(stopped>=0);+ await page.getByRole('slider',{name:'Traffic replay position'}).evaluate((input,index)=>{input.value=index;input.dispatchEvent(new Event('input',{bubbles:true}));},stopped);+ await page.evaluate(()=>new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve))));+ }await page.screenshot({path:join(output,`${name}-wide.png`),fullPage:true});// A workspace with no successful output must still have usable previews and controls.await rename(join(workspace,'out'),join(workspace,'saved-output'));@@ -61,7 +66,7 @@ try{for(const c of config.controls.filter(c=>!c.hidden)){const input=page.locator(`[name="${c.id}"]`);if(c.type==='number'){await input.focus();await page.keyboard.press('ArrowRight');await page.keyboard.press('ArrowLeft');}- else if(c.type==='select'){for(const choice of c.options){await input.selectOption(choice.value);await page.evaluate(()=>new Promise(requestAnimationFrame));}await input.selectOption(c.value);}+ else if(c.type==='select'){for(const choice of c.options){await input.selectOption(choice.value);if(name==='bonsai-mcp'&&c.id==='use'){await page.getByRole('button',{name:'Floor plan',exact:true}).click();await page.evaluate(()=>new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve))));await page.getByRole('button',{name:'Orbit view',exact:true}).click();}await page.evaluate(()=>new Promise(requestAnimationFrame));}await input.selectOption(c.value);}else await input.fill(c.value);}// Keep the default valid robot goal after exercising map movement.diff --git a/store/viewers/studio-viewer/test/viewer.test.mjs b/store/viewers/studio-viewer/test/viewer.test.mjsindex 1de5dc140..9e430b0c7 100644--- a/store/viewers/studio-viewer/test/viewer.test.mjs+++ b/store/viewers/studio-viewer/test/viewer.test.mjs@@ -134,6 +134,24 @@ test('bounds output size and handles JSON HEAD downloads',async t=>{const head=await fetch(f.studio.url+'/artifacts/out/record.json',{method:'HEAD'});assert.equal(head.status,200);assert.equal(await head.text(),'');});+test('WebKit audio ranges, suffixes, and artifact downloads preserve exact bytes',async t=>{+ const f=await fixture(t);await mkdir(join(f.workspace,'out'));+ await writeFile(join(f.workspace,'out/record.wav'),'0123456789');+ for(const [range,wanted,contentRange] of [['bytes=0-1','01','bytes 0-1/10'],['bytes=7-','789','bytes 7-9/10'],['bytes=-3','789','bytes 7-9/10'],['bytes=8-99','89','bytes 8-9/10']]){+ const response=await fetch(f.studio.url+'/artifacts/out/record.wav',{headers:{Range:range}});+ assert.equal(response.status,206);assert.equal(await response.text(),wanted);+ assert.equal(response.headers.get('content-range'),contentRange);assert.equal(Number(response.headers.get('content-length')),wanted.length);+ }+ for(const range of ['bytes=10-','bytes=5-2','bytes=-0','bytes=-','bytes=0-1,3-4','nonsense','bytes=999999999999999999999-']){+ const response=await fetch(f.studio.url+'/artifacts/out/record.wav',{headers:{Range:range}});+ assert.equal(response.status,416,range);assert.equal(response.headers.get('content-range'),'bytes */10');+ }+ const content='{\n "answer": 42\n}\n';await writeFile(join(f.workspace,'out/record.json'),content);+ assert.equal(await(await fetch(f.studio.url+'/artifacts/out/record.json?download')).text(),content);+ const head=await fetch(f.studio.url+'/artifacts/out/record.wav',{method:'HEAD',headers:{Range:'bytes=0-1'}});+ assert.equal(head.status,200);assert.equal(head.headers.get('content-length'),'10');assert.equal(await head.text(),'');+});+test('manifest server entry point starts, serves a workspace, and stops cleanly',async t=>{const f=await fixture(t);const child=spawn(process.execPath,[fileURLToPath(new URL('../server.mjs',import.meta.url))],{env:{...process.env,HARNESS_WORKSPACE:f.workspace,HARNESS_DSH_DIR:f.packageDir,HARNESS_VIEWER_PORT:'0'},stdio:['ignore','pipe','pipe']});diff --git a/store/viewers/studio-viewer/test/workflows.mjs b/store/viewers/studio-viewer/test/workflows.mjsnew file mode 100644index 000000000..af244c364--- /dev/null+++ b/store/viewers/studio-viewer/test/workflows.mjs@@ -0,0 +1,39 @@+import {spawn} from 'node:child_process';+import {access,mkdir,readFile,writeFile} from 'node:fs/promises';+import {join,resolve} from 'node:path';+import {fileURLToPath} from 'node:url';++const viewer=fileURLToPath(new URL('../',import.meta.url));+const store=fileURLToPath(new URL('../../../',import.meta.url));+const names=(process.env.STUDIO_TEST_PACKAGES??'juce-agent-toolkit,foam-agent,autoresearch-mlx,ableton-ai,dimos,simskill,bonsai-mcp,comfy-mcp').split(',');+const coverage=process.argv.includes('--coverage');+const testTools=resolve(process.env.STUDIO_TEST_TOOLS??join(viewer,'test-results/python-tools'));+const output=join(viewer,'test-results');await mkdir(output,{recursive:true});+const report=[];+async function run(python,file,env){+ await access(python);+ return new Promise((ok,fail)=>{+ const child=spawn(python,[join(viewer,'test',file)],{cwd:join(store,'..'),env:{...process.env,...env},stdio:'inherit'});+ child.on('error',fail);child.on('close',code=>code===0?ok():fail(Error(`${file} exited ${code}`)));+ });+}+try{+ const env=coverage?{STUDIO_COVERAGE:'1',PYTHONPATH:testTools+(process.env.PYTHONPATH?':'+process.env.PYTHONPATH:'')}:{};+ await run(join(store,'agents',names[0],'.venv/bin/python'),'runtime_test.py',env);+ report.push({name:'runtime',status:'passed'});+ await run(join(store,'agents',names[0],'.venv/bin/python'),'fetch_test.py',env);+ report.push({name:'fetch',status:'passed'});+ for(const name of names){+ console.log(`\nChecking ${name} with its installed runtime`);+ await run(join(store,'agents',name,'.venv/bin/python'),'workflows_test.py',{...env,STUDIO_TEST_PACKAGE:name});+ report.push({name,status:'passed'});+ }+ if(coverage){+ for(const {name} of report){+ const data=JSON.parse(await readFile(join(output,`${name}-python-coverage.json`),'utf8'));+ const t=data.totals;+ console.log(`${name}: ${t.covered_lines}/${t.num_statements} statements; ${t.covered_branches}/${t.num_branches} branches`);+ if(t.missing_lines||t.missing_branches)throw Error(`${name} did not meet 100% coverage. Enable the documented native JUCE check.`);+ }+ }+}finally{await writeFile(join(output,'workflow-report.json'),JSON.stringify(report,null,2));}