Skip to content

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.

test(studios): verify full Harness lifecycle and polish recovery interactions

Deec06a70daccb4
diff --git a/store/agents/ableton-ai/skills/ableton-ai/SKILL.md b/store/agents/ableton-ai/skills/ableton-ai/SKILL.md
index ef568678a..e04ea30e8 100644
--- a/store/agents/ableton-ai/skills/ableton-ai/SKILL.md
+++ b/store/agents/ableton-ai/skills/ableton-ai/SKILL.md
@@ -17,3 +17,15 @@ files under `$STUDIO_UPSTREAM` before using an upstream API. Keep controls withi
ranges, preserve the data needed to reproduce a comparison, and distinguish preview results from
native service or hardware output. The viewer supports history and artifact downloads; tell the
user which run contains the result, and what was actually measured.
+
+## Make a loop that can leave the viewer
+
+Choose a scale, tempo, density, and swing. Audition the step grid, keep a run, and verify
+`notes.json`, `loop.mid`, and `loop.wav`. A nonempty sixteen-character `pattern` mask overrides
+density; clear it to regenerate a seeded rhythm. The browser and exporter share a tested
+pattern algorithm, so note pitches, velocity, and timing remain reproducible.
+
+Read `$STUDIO_UPSTREAM/skills/ableton/SKILL.md` for real Live composition and its documented
+track/device/clip operations. The wrapper's `live` action is a read-only session snapshot; it
+does not import the MIDI, change a set, or start transport. Enable the pinned upstream control
+surface before using its native tools, and preserve the user's current session.
diff --git a/store/agents/autoresearch-mlx/skills/autoresearch-mlx/SKILL.md b/store/agents/autoresearch-mlx/skills/autoresearch-mlx/SKILL.md
index 63a1a97e2..556ef3854 100644
--- a/store/agents/autoresearch-mlx/skills/autoresearch-mlx/SKILL.md
+++ b/store/agents/autoresearch-mlx/skills/autoresearch-mlx/SKILL.md
@@ -17,3 +17,15 @@ files under `$STUDIO_UPSTREAM` before using an upstream API. Keep controls withi
ranges, preserve the data needed to reproduce a comparison, and distinguish preview results from
native service or hardware output. The viewer supports history and artifact downloads; tell the
user which run contains the result, and what was actually measured.
+
+## Run a controlled experiment
+
+Read `train.py`, `train.txt`, and `holdout.txt`. Save a baseline. Change one training choice
+or the editable training code, then run `train`. Inspect `evaluation.json`, the saved model,
+and `learning.csv`. Keep the holdout unchanged; the runner independently reopens the model
+with pickle disabled and computes its score. Data hashes define which earlier runs compare.
+Repeat promising changes with several seeds before presenting a conclusion.
+
+For Apple Silicon, read `$STUDIO_UPSTREAM/program.md` and `README.md`. Prepare a separate
+workspace `mlx/` checkout and its environment/data before running `mlx`. The CPU starter's
+bits-per-character score and the upstream bits-per-byte metric are different experiments.
diff --git a/store/agents/autoresearch-mlx/view.mjs b/store/agents/autoresearch-mlx/view.mjs
index ce807dab7..e48105eb0 100644
--- a/store/agents/autoresearch-mlx/view.mjs
+++ b/store/agents/autoresearch-mlx/view.mjs
@@ -3,12 +3,12 @@ export function mount(stage,api){
let result,hover=-1,showHoldout=true,p=api.getParameters();
const info=label(stage,'The interesting part is what actually happened.'),tag=badge(stage,'CPU EXPERIMENT');
const screen=canvas(stage,(ctx,w,h)=>{
- const left=58,right=w-28,top=52,bottom=h-80,curve=result?.data?.curve;
+ const left=58,right=w-28,top=w<500?80:60,bottom=h-115,curve=result?.data?.curve;
if(!curve){grid(ctx,w,h);words(ctx,'An experiment is a question you can measure.',30,h/2,'#b2d8d9',14);return;}
const values=curve.map(row=>row[1]),held=result.data.heldoutBpc,low=Math.min(...values,held)-.2,high=Math.max(...values,held)+.2,maxStep=curve.at(-1)[0];
const x=step=>left+step/maxStep*(right-left),y=value=>bottom-(value-low)/(high-low)*(bottom-top);
for(let i=0;i<5;i++){const value=low+(high-low)*i/4;line(ctx,[[left,y(value)],[right,y(value)]],'#ffffff12',1);words(ctx,value.toFixed(1),19,y(value)+4,'#88a7ab',10);}
- words(ctx,'BITS / CHARACTER',18,26,'#88a7ab',9);for(let i=0;i<5;i++)words(ctx,String(Math.round(maxStep*i/4)),x(maxStep*i/4)-5,bottom+23,'#88a7ab',10);
+ words(ctx,'BITS / CHARACTER',18,top-13,'#88a7ab',9);for(let i=0;i<5;i++)words(ctx,String(Math.round(maxStep*i/4)),x(maxStep*i/4)-5,bottom+23,'#88a7ab',10);
const points=curve.map(row=>[x(row[0]),y(row[1])]);ctx.beginPath();ctx.moveTo(left,bottom);points.forEach(pt=>ctx.lineTo(...pt));ctx.lineTo(right,bottom);ctx.closePath();const gradient=ctx.createLinearGradient(0,top,0,bottom);gradient.addColorStop(0,'#9fe1dc30');gradient.addColorStop(1,'#9fe1dc00');ctx.fillStyle=gradient;ctx.fill();line(ctx,points,'#a0e0da',2.5);
if(showHoldout){ctx.setLineDash([5,5]);line(ctx,[[left,y(held)],[right,y(held)]],'#dfb986',1);ctx.setLineDash([]);words(ctx,'HELD-OUT · FINAL EVALUATION',left+8,y(held)-8,'#dfb986',9);}
const i=hover>=0?Math.min(hover,curve.length-1):curve.length-1,pt=points[i];circle(ctx,...pt,5,'#a0e0da');circle(ctx,...pt,10,'#a0e0da25');words(ctx,`Step ${curve[i][0]} · ${curve[i][1].toFixed(3)} bits/char`,left,bottom+43,'#c4e9e5',11);
diff --git a/store/agents/bonsai-mcp/skills/bonsai-mcp/SKILL.md b/store/agents/bonsai-mcp/skills/bonsai-mcp/SKILL.md
index 9ba2e0e63..49e91a5ac 100644
--- a/store/agents/bonsai-mcp/skills/bonsai-mcp/SKILL.md
+++ b/store/agents/bonsai-mcp/skills/bonsai-mcp/SKILL.md
@@ -17,3 +17,14 @@ files under `$STUDIO_UPSTREAM` before using an upstream API. Keep controls withi
ranges, preserve the data needed to reproduce a comparison, and distinguish preview results from
native service or hardware output. The viewer supports history and artifact downloads; tell the
user which run contains the result, and what was actually measured.
+
+## Author and check building data
+
+Choose the footprint, storeys, height, and room use, then run `build`. Reopen `building.ifc`
+with IfcOpenShell, inspect spaces/walls/openings, and read the quantity sets. Match their
+areas and volumes to `quantities.csv`. The canvas is a schematic view; IFC is the source
+artifact for downstream editing. Preserve element identifiers when extending an existing model.
+
+Read `$STUDIO_UPSTREAM/docs/examples.md` for Bonsai edits and read-back verification,
+`docs/installation.md` for the bridge, and `docs/tools.md` before native commands. The
+wrapper's `bonsai` action only requests scene information from an existing Blender session.
diff --git a/store/agents/comfy-mcp/skills/comfy-mcp/SKILL.md b/store/agents/comfy-mcp/skills/comfy-mcp/SKILL.md
index c2b372060..e4fc04b7e 100644
--- a/store/agents/comfy-mcp/skills/comfy-mcp/SKILL.md
+++ b/store/agents/comfy-mcp/skills/comfy-mcp/SKILL.md
@@ -17,3 +17,15 @@ files under `$STUDIO_UPSTREAM` before using an upstream API. Keep controls withi
ranges, preserve the data needed to reproduce a comparison, and distinguish preview results from
native service or hardware output. The viewer supports history and artifact downloads; tell the
user which run contains the result, and what was actually measured.
+
+## Grow a reproducible family
+
+Choose a palette and seed, run `generate`, then inspect each study and its saved recipe.
+The SVG hashes verify reproducibility. These local vector studies do not use a diffusion
+model. Keep selected studies and their seed/parameters together when making a new family.
+
+For an installed ComfyUI, read `$STUDIO_UPSTREAM/README.md` and its `src/` tools before
+using the MCP workflow. Save API-format nodes in workspace `workflow.json`. The supplied
+EmptyImage/SaveImage workflow needs no model weights. Run `comfy` against loopback
+`COMFYUI_URL`, inspect its job history, and retain the returned PNGs. A timeout means the
+remote queue may still be running; inspect it before resubmitting expensive work.
diff --git a/store/agents/dimos/skills/dimos/SKILL.md b/store/agents/dimos/skills/dimos/SKILL.md
index 6f598841b..3bc24a2de 100644
--- a/store/agents/dimos/skills/dimos/SKILL.md
+++ b/store/agents/dimos/skills/dimos/SKILL.md
@@ -17,3 +17,15 @@ files under `$STUDIO_UPSTREAM` before using an upstream API. Keep controls withi
ranges, preserve the data needed to reproduce a comparison, and distinguish preview results from
native service or hardware output. The viewer supports history and artifact downloads; tell the
user which run contains the result, and what was actually measured.
+
+## Plan, execute, inspect
+
+Choose an open destination in the office or gallery. Run `simulate`, then inspect
+`mission.json` and `mission.xml`. Check arrival, final position, travel time, distance, and wall
+contacts. Replay uses the recorded MuJoCo positions. A destination inside the inflated
+obstacle boundary must fail explicitly; choose another destination instead of inventing a path.
+
+Read `$STUDIO_UPSTREAM/docs/quickstart.md` and `docs/installation/osx.md` before working with
+DimOS itself. The local starter is an original planar rover, not a Unitree simulation. The
+optional `dimos` action only reads daemon status. Simulation success never implies a physical
+robot reached its destination.
diff --git a/store/agents/foam-agent/skills/foam-agent/SKILL.md b/store/agents/foam-agent/skills/foam-agent/SKILL.md
index d50071561..e3024e542 100644
--- a/store/agents/foam-agent/skills/foam-agent/SKILL.md
+++ b/store/agents/foam-agent/skills/foam-agent/SKILL.md
@@ -17,3 +17,15 @@ files under `$STUDIO_UPSTREAM` before using an upstream API. Keep controls withi
ranges, preserve the data needed to reproduce a comparison, and distinguish preview results from
native service or hardware output. The viewer supports history and artifact downloads; tell the
user which run contains the result, and what was actually measured.
+
+## Compare flow cases
+
+Save a baseline, then vary shape or radius while holding inlet speed, viscosity, and solver
+steps fixed. Read `flow.csv` and `field.json`; check finite velocities, solid-boundary velocities,
+and the convergence record. A coarse flow picture does not establish drag or mesh convergence.
+Wind strength in `studio.json` is divided by 100 for the lattice inlet velocity.
+
+For real OpenFOAM work, read `$STUDIO_UPSTREAM/.claude/skills/foam.md` before constructing a
+case. The optional `openfoam` action checks the supplied cavity benchmark with active
+`blockMesh` and `icoFoam`. Preserve its boundary conditions when reproducing the benchmark.
+Upstream model/MCP planning requires its separate dependencies and credentials.
diff --git a/store/agents/foam-agent/view.mjs b/store/agents/foam-agent/view.mjs
index 39ddfcd64..e754f70ee 100644
--- a/store/agents/foam-agent/view.mjs
+++ b/store/agents/foam-agent/view.mjs
@@ -17,7 +17,7 @@ export function mount(stage,api){
if(!field)for(let row=0;row<19;row++){
const y0=top+row/18*fh,points=[];
for(let x=left;x<left+120*scaleX;x+=4){const near=Math.exp(-(((x-cx)/(30*scaleX))**2)),dy=(y0-cy),spread=Math.sign(dy)*p.radius*scaleY*Math.exp(-((dy/(p.radius*scaleY*2))**2))*near;points.push([x,y0+spread]);}
- line(ctx,points,field?'#b3e5e41b':'#b3e5e42f',.8);
+ line(ctx,points,'#b3e5e42f',.8);
if(!field){const x=left+((t*p.speed*22+row*53)%(120*scaleX)),near=Math.exp(-(((x-cx)/(30*scaleX))**2)),dy=y0-cy;circle(ctx,x,y0+Math.sign(dy)*p.radius*scaleY*Math.exp(-((dy/(p.radius*scaleY*2))**2))*near,1.4,'#a1dadba0');}
}
ctx.fillStyle='#cedad4';ctx.strokeStyle='#f0faf0';ctx.lineWidth=2;ctx.beginPath();
diff --git a/store/agents/juce-agent-toolkit/LICENSE-juce b/store/agents/juce-agent-toolkit/LICENSE-juce
new file mode 100644
index 000000000..d79898fc8
--- /dev/null
+++ b/store/agents/juce-agent-toolkit/LICENSE-juce
@@ -0,0 +1,53 @@
+# The JUCE Framework
+
+The JUCE Framework is an open source framework licensed under a combination of
+open source and commercial licences.
+
+The JUCE Framework modules are dual-licensed under the
+[AGPLv3](https://www.gnu.org/licenses/agpl-3.0.en.html) and the commercial [JUCE
+licence](https://juce.com/legal/juce-9-licence/).
+
+## The JUCE Licence
+
+If you are not licensing the JUCE Framework modules under the
+[AGPLv3](https://www.gnu.org/licenses/agpl-3.0.en.html) then by downloading,
+installing, or using the JUCE Framework, or combining the JUCE Framework with
+any other source code, object code, content or any other copyrightable work, you
+agree to the terms of the [JUCE 9 End User Licence
+Agreement](https://juce.com/legal/juce-9-licence/), and all incorporated terms
+including the [JUCE Privacy Policy](https://juce.com/legal/juce-privacy-policy/)
+and the [JUCE Website Terms of
+Service](https://juce.com/legal/juce-website-terms-of-service/), as applicable,
+which will bind you. If you do not agree to the terms of this Agreement, we will
+not license the JUCE Framework to you, and you must discontinue the installation
+or download process and cease use of the JUCE Framework.
+
+THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES,
+WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR A PARTICULAR PURPOSE, ARE DISCLAIMED.
+
+For more information, visit the [JUCE website](https://juce.com).
+
+Full licence terms:
+- [JUCE 9 End User Licence Agreement](https://juce.com/legal/juce-9-licence/)
+- [JUCE Privacy Policy](https://juce.com/legal/juce-privacy-policy/)
+- [JUCE Website Terms of Service](https://juce.com/legal/juce-website-terms-of-service/)
+
+The terms of the JUCE End User Licence Agreement define how you can use JUCE,
+and it is written to be as clear as possible. If you have a question, please
+review the [Licensing FAQ](https://juce.com/get-juce/#licensing-faq) and the
+EULA itself first; most questions are answered there. If you need confirmation
+that your specific usage of JUCE falls within the terms of the EULA, you must
+obtain your own legal advice. The JUCE team cannot provide compliance
+confirmations, nor any other legal advice.
+
+## The JUCE Framework Dependencies
+
+The JUCE modules, examples, bundled applications, and build system contain
+third-party software. A complete inventory of these dependencies, including
+their versions, licences, and the locations where they are vendored into this
+repository, is maintained in an SPDX software bill of materials:
+[JUCE.spdx.json](JUCE.spdx.json).
+
+The JUCE examples are licensed under the terms of the
+[ISC license](http://www.isc.org/downloads/software-support-policy/isc-license/).
diff --git a/store/agents/juce-agent-toolkit/THIRD_PARTY_NOTICES.md b/store/agents/juce-agent-toolkit/THIRD_PARTY_NOTICES.md
index 9b8edb9af..498e66571 100644
--- a/store/agents/juce-agent-toolkit/THIRD_PARTY_NOTICES.md
+++ b/store/agents/juce-agent-toolkit/THIRD_PARTY_NOTICES.md
@@ -7,3 +7,6 @@ License: MIT; JUCE: AGPL-3.0 or commercial. See `LICENSE-upstream` and the fetch
The original local starter and wrapper are MIT licensed. The native runtime and separately
installed applications retain their own licenses. No upstream endorsement is claimed.
+
+The JUCE 9.0.2 source pin is separately recorded in `upstream.lock.json`; its license is
+preserved in `LICENSE-juce`. This wrapper does not redistribute a prebuilt JUCE plugin.
diff --git a/store/agents/juce-agent-toolkit/skills/juce-agent-toolkit/SKILL.md b/store/agents/juce-agent-toolkit/skills/juce-agent-toolkit/SKILL.md
index f6c892a43..b4fad1aaf 100644
--- a/store/agents/juce-agent-toolkit/skills/juce-agent-toolkit/SKILL.md
+++ b/store/agents/juce-agent-toolkit/skills/juce-agent-toolkit/SKILL.md
@@ -17,3 +17,14 @@ files under `$STUDIO_UPSTREAM` before using an upstream API. Keep controls withi
ranges, preserve the data needed to reproduce a comparison, and distinguish preview results from
native service or hardware output. The viewer supports history and artifact downloads; tell the
user which run contains the result, and what was actually measured.
+
+## Make and validate an instrument
+
+Start by changing one audible property: waveform, pitch, attack, or brightness. Render the
+same four-note phrase before and after. Compare peak/RMS levels and listen to both WAV files.
+For native DSP changes, edit workspace `Source/main.cpp`, run `juce`, and inspect the measured
+recording. Keep the CMake target and WAV command arguments intact so the viewer can run it.
+
+For full plugins, read `$STUDIO_UPSTREAM/skills/juce-project-create/SKILL.md`, then the
+`juce-project-starter` and `juce-build-release` skills there. Plugin exports need their own host
+and audio checks. The offline renderer is the starter's verified native path.
diff --git a/store/agents/juce-agent-toolkit/view.mjs b/store/agents/juce-agent-toolkit/view.mjs
index f7689a21f..64d384c37 100644
--- a/store/agents/juce-agent-toolkit/view.mjs
+++ b/store/agents/juce-agent-toolkit/view.mjs
@@ -6,7 +6,7 @@ export function mount(stage,api){
grid(ctx,w,h,36);const center=h*.33,amplitude=h*.15;
const points=[];for(let x=20;x<w-20;x+=2){const a=x/w*7*Math.PI*2-t*2;let v=Math.sin(a);if(p.wave==='triangle')v=Math.asin(Math.sin(a))*2/Math.PI;if(p.wave==='saw')v=2*((a/(2*Math.PI))%1)-1;points.push([x,center+v*amplitude*p.brightness]);}
ctx.shadowBlur=20;ctx.shadowColor='#e6ac7550';line(ctx,points,'#f2bc88',2);ctx.shadowBlur=0;
- line(ctx,[[20,center],[w-20,center]],'#ffffff0a',1);words(ctx,`${p.frequency} Hz`,25,center+amplitude+24,'#ac998c',10);
+ line(ctx,[[20,center],[w-20,center]],'#ffffff0a',1);if(w>500)words(ctx,`${p.frequency} Hz`,25,center+amplitude+24,'#ac998c',10);
if(keyIndex>=0)circle(ctx,w-35,center+amplitude+20,4,'#f2bc88');
if(result?.data?.waveform){const wave=result.data.waveform;line(ctx,wave.map((v,i)=>[24+i/(wave.length-1)*(w-48),h-20-v*12]),'#bf9875',1);}
},api.signal);screen.element.setAttribute('aria-label','Oscillator waveform preview');
diff --git a/store/agents/simskill/LICENSE-sumo b/store/agents/simskill/LICENSE-sumo
new file mode 100644
index 000000000..e48e09634
--- /dev/null
+++ b/store/agents/simskill/LICENSE-sumo
@@ -0,0 +1,277 @@
+Eclipse Public License - v 2.0
+
+ THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+ PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+ OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+ a) in the case of the initial Contributor, the initial content
+ Distributed under this Agreement, and
+
+ b) in the case of each subsequent Contributor:
+ i) changes to the Program, and
+ ii) additions to the Program;
+ where such changes and/or additions to the Program originate from
+ and are Distributed by that particular Contributor. A Contribution
+ "originates" from a Contributor if it was added to the Program by
+ such Contributor itself or anyone acting on such Contributor's behalf.
+ Contributions do not include changes or additions to the Program that
+ are not Modified Works.
+
+"Contributor" means any person or entity that Distributes the Program.
+
+"Licensed Patents" mean patent claims licensable by a Contributor which
+are necessarily infringed by the use or sale of its Contribution alone
+or when combined with the Program.
+
+"Program" means the Contributions Distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement
+or any Secondary License (as applicable), including Contributors.
+
+"Derivative Works" shall mean any work, whether in Source Code or other
+form, that is based on (or derived from) the Program and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship.
+
+"Modified Works" shall mean any work in Source Code or other form that
+results from an addition to, deletion from, or modification of the
+contents of the Program, including, for purposes of clarity any new file
+in Source Code form that contains any contents of the Program. Modified
+Works shall not include works that contain only declarations,
+interfaces, types, classes, structures, or files of the Program solely
+in each case in order to link to, bind by name, or subclass the Program
+or Modified Works thereof.
+
+"Distribute" means the acts of a) distributing or b) making available
+in any manner that enables the transfer of a copy.
+
+"Source Code" means the form of a Program preferred for making
+modifications, including but not limited to software source code,
+documentation source, and configuration files.
+
+"Secondary License" means either the GNU General Public License,
+Version 2.0, or any later versions of that license, including any
+exceptions or additional permissions as identified by the initial
+Contributor.
+
+2. GRANT OF RIGHTS
+
+ a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
+ license to reproduce, prepare Derivative Works of, publicly display,
+ publicly perform, Distribute and sublicense the Contribution of such
+ Contributor, if any, and such Derivative Works.
+
+ b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such Contributor,
+ if any, in Source Code or other form. This patent license shall
+ apply to the combination of the Contribution and the Program if, at
+ the time the Contribution is added by the Contributor, such addition
+ of the Contribution causes such combination to be covered by the
+ Licensed Patents. The patent license shall not apply to any other
+ combinations which include the Contribution. No hardware per se is
+ licensed hereunder.
+
+ c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe the
+ patent or other intellectual property rights of any other entity.
+ Each Contributor disclaims any liability to Recipient for claims
+ brought by any other entity based on infringement of intellectual
+ property rights or otherwise. As a condition to exercising the
+ rights and licenses granted hereunder, each Recipient hereby
+ assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party
+ patent license is required to allow Recipient to Distribute the
+ Program, it is Recipient's responsibility to acquire that license
+ before distributing the Program.
+
+ d) Each Contributor represents that to its knowledge it has
+ sufficient copyright rights in its Contribution, if any, to grant
+ the copyright license set forth in this Agreement.
+
+ e) Notwithstanding the terms of any Secondary License, no
+ Contributor makes additional grants to any Recipient (other than
+ those set forth in this Agreement) as a result of such Recipient's
+ receipt of the Program under the terms of a Secondary License
+ (if permitted under the terms of Section 3).
+
+3. REQUIREMENTS
+
+3.1 If a Contributor Distributes the Program in any form, then:
+
+ a) the Program must also be made available as Source Code, in
+ accordance with section 3.2, and the Contributor must accompany
+ the Program with a statement that the Source Code for the Program
+ is available under this Agreement, and informs Recipients how to
+ obtain it in a reasonable manner on or through a medium customarily
+ used for software exchange; and
+
+ b) the Contributor may Distribute the Program under a license
+ different than this Agreement, provided that such license:
+ i) effectively disclaims on behalf of all other Contributors all
+ warranties and conditions, express and implied, including
+ warranties or conditions of title and non-infringement, and
+ implied warranties or conditions of merchantability and fitness
+ for a particular purpose;
+
+ ii) effectively excludes on behalf of all other Contributors all
+ liability for damages, including direct, indirect, special,
+ incidental and consequential damages, such as lost profits;
+
+ iii) does not attempt to limit or alter the recipients' rights
+ in the Source Code under section 3.2; and
+
+ iv) requires any subsequent distribution of the Program by any
+ party to be under a license that satisfies the requirements
+ of this section 3.
+
+3.2 When the Program is Distributed as Source Code:
+
+ a) it must be made available under this Agreement, or if the
+ Program (i) is combined with other material in a separate file or
+ files made available under a Secondary License, and (ii) the initial
+ Contributor attached to the Source Code the notice described in
+ Exhibit A of this Agreement, then the Program may be made available
+ under the terms of such Secondary Licenses, and
+
+ b) a copy of this Agreement must be included with each copy of
+ the Program.
+
+3.3 Contributors may not remove or alter any copyright, patent,
+trademark, attribution notices, disclaimers of warranty, or limitations
+of liability ("notices") contained within the Program from any copy of
+the Program which they Distribute, provided that Contributors may add
+their own appropriate notices.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities
+with respect to end users, business partners and the like. While this
+license is intended to facilitate the commercial use of the Program,
+the Contributor who includes the Program in a commercial product
+offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes
+the Program in a commercial product offering, such Contributor
+("Commercial Contributor") hereby agrees to defend and indemnify every
+other Contributor ("Indemnified Contributor") against any losses,
+damages and costs (collectively "Losses") arising from claims, lawsuits
+and other legal actions brought by a third party against the Indemnified
+Contributor to the extent caused by the acts or omissions of such
+Commercial Contributor in connection with its distribution of the Program
+in a commercial product offering. The obligations in this section do not
+apply to any claims or Losses relating to any actual or alleged
+intellectual property infringement. In order to qualify, an Indemnified
+Contributor must: a) promptly notify the Commercial Contributor in
+writing of such claim, and b) allow the Commercial Contributor to control,
+and cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may
+participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those performance
+claims and warranties, and if a court requires any other Contributor to
+pay any damages as a result, the Commercial Contributor must pay
+those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS"
+BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF
+TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
+PURPOSE. Each Recipient is solely responsible for determining the
+appropriateness of using and distributing the Program and assumes all
+risks associated with its exercise of rights under this Agreement,
+including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs
+or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT
+PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS
+SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
+EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the
+Program itself (excluding combinations of the Program with other software
+or hardware) infringes such Recipient's patent(s), then such Recipient's
+rights granted under Section 2(b) shall terminate as of the date such
+litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign the
+responsibility to serve as the Agreement Steward to a suitable separate
+entity. Each new version of the Agreement will be given a distinguishing
+version number. The Program (including Contributions) may always be
+Distributed subject to the version of the Agreement under which it was
+received. In addition, after a new version of the Agreement is published,
+Contributor may elect to Distribute the Program (including its
+Contributions) under the new version.
+
+Except as expressly stated in Sections 2(a) and 2(b) above, Recipient
+receives no rights or licenses to the intellectual property of any
+Contributor under this Agreement, whether expressly, by implication,
+estoppel or otherwise. All rights in the Program not expressly granted
+under this Agreement are reserved. Nothing in this Agreement is intended
+to be enforceable by any entity that is not a Contributor or Recipient.
+No third-party beneficiary rights are created under this Agreement.
+
+Exhibit A - Form of Secondary Licenses Notice
+
+"This Source Code may also be made available under the following
+Secondary Licenses when the conditions for such availability set forth
+in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
+version(s), and exceptions or additional permissions here}."
+
+ Simply including a copy of this Agreement, including this Exhibit A
+ is not sufficient to license the Source Code under Secondary Licenses.
+
+ If it is not possible or desirable to put the notice in a particular
+ file, then You may include the notice in a location (such as a LICENSE
+ file in a relevant directory) where a recipient would be likely to
+ look for such a notice.
+
+ You may add additional accurate notices of copyright ownership.
diff --git a/store/agents/simskill/NOTICE-sumo.md b/store/agents/simskill/NOTICE-sumo.md
new file mode 100644
index 000000000..8b29000e6
--- /dev/null
+++ b/store/agents/simskill/NOTICE-sumo.md
@@ -0,0 +1,139 @@
+# Notices for Eclipse Sumo
+
+This content is produced and maintained by the Eclipse Sumo project.
+
+* Project home: https://eclipse.dev/sumo
+
+## Trademarks
+
+Eclipse Sumo is a trademark of the Eclipse Foundation.
+
+## Copyright
+
+All content is the property of the respective authors or their employers. For
+more information regarding authorship of content, please consult the listed
+source code repository logs.
+
+## Declared Project Licenses
+
+This program and the accompanying materials are made available under the terms
+of the Eclipse Public License v. 2.0 which is available at
+http://www.eclipse.org/legal/epl-v20.html.
+This Source Code may also be made available under the following Secondary
+Licenses when the conditions for such availability set forth in the Eclipse
+Public License 2.0 are satisfied: GNU General Public License, version 2
+or later which is available at
+https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
+SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
+
+## Source Code
+
+The project maintains the following source code repositories:
+
+* https://github.com/eclipse-sumo/sumo
+
+## Third-party Content
+
+This project leverages the following third party content.
+
+Font Stash from 2017-09-23 (n/a)
+
+* License: Zlib AND (MIT OR LicenseRef-Public-Domain)
+* Project: https://github.com/memononen/fontstash
+* Source: https://github.com/memononen/fontstash
+
+FOX toolkit (1.6.58)
+
+* License: LicenseRef-Fox-Toolkit-Addendum-to-License AND
+ LicenseRef-Public-Domain AND X11
+* Project: http://www.fox-toolkit.org/
+* Source: ftp://ftp.fox-toolkit.org/pub/fox-1.6.58.zip
+
+Google Design Icons (n/a)
+
+* License: CC-BY-4.0
+* Project: http://google.com/design/
+
+odrSpiral from 2017-05-03 (n/a)
+
+* License: Apache-2.0
+* Project: https://github.com/DLR-TS/odrSpiral
+* Source: https://github.com/DLR-TS/odrSpiral
+
+OpenStreetMap data files (n/a)
+
+* License: ODbL-1.0
+* Project: http://www.openstreetmap.org/
+
+Proj - (9.0.0)
+
+* License: MIT AND LicenseRef-Public-Domain AND Apache-2.0
+* Project: https://proj.org/
+
+RTree (n/a)
+
+* License: LicenseRef-Permissive
+* Project: http://superliminal.com/sources/sources.htm
+* Source: http://superliminal.com/sources/RTreeTemplate.zip
+
+tcpip from 2012-09-28 (n/a)
+
+* License: BSD-3-Clause
+* Project: https://github.com/itm/shawn
+* Source: https://github.com/itm/shawn/tree/master/src/apps/tcpip
+
+Wix Installation Framework Templates (3.6)
+
+* License: CPL-1.0
+* Project: https://github.com/AnalogJ/Wix3.6Toolset
+* Source: https://github.com/AnalogJ/Wix3.6Toolset/tree/master/RC0-source/wix36-sources/src/ext/UIExtension/wixlib
+
+Xerces-C++ (3.2.4)
+
+* License: Apache-2.0
+* Project: http://xerces.apache.org/xerces-c/
+* Source: https://dlcdn.apache.org/xerces/c/3/sources/xerces-c-3.2.4.tar.gz
+
+JSON for Modern C++ (3.10.5)
+
+* License: MIT
+* Project: https://json.nlohmann.me/
+* Source: https://github.com/nlohmann/json/releases/tag/v3.10.5
+
+A C++ ZLib wrapper (1.0.6)
+
+* License: MIT
+* Project: https://github.com/mateidavid/zstr
+* Source: https://github.com/mateidavid/zstr/releases/tag/v1.0.6
+
+FMT (10.2.1)
+
+* License: MIT
+* Project: https://fmt.dev/
+* Source: https://github.com/fmtlib/fmt
+
+## Cryptography
+
+Content may contain encryption software. The country in which you are currently
+may have restrictions on the import, possession, and use, and/or re-export to
+another country, of encryption software. BEFORE using any encryption software,
+please check the country's laws, regulations and policies concerning the import,
+possession, or use, and re-export of encryption software, to see if this is
+permitted.
+
+## Derivative Works
+
+EPL requires that "derivative works" be licensed under the terms of the EPL
+whereas "separate modules of software" may be licensed arbitrarily. Please follow the links
+below for lists of files where modifications are considered derivative work.
+
+We currently consider all modifications to [src](src/README_Contributing.md) and [tools](tools/README_Contributing.md) (including the subdirectories) as derivative work except for the following cases:
+- TraCI client applications that use the public TraCI client libraries
+- separate modules residing in [src](src/README_Contributing.md)
+- car following models that inherit from MSCFModel (excluding [modifications of the existing models](src/microsim/cfmodels/README_Contributing.md))
+- lane changing models that inherit from MSAbstractLaneChangeModel (excluding [modifications of the existing models](src/microsim/lcmodels/README_Contributing.md))
+- simulation output modules (excluding [changes to the existing classes](src/microsim/output/README_Contributing.md))
+- vehicle device modules (excluding [changes to the existing classes](src/microsim/devices/README_Contributing.md))
+- network import modules (excluding [changes to the existing classes](src/netimport/README_Contributing.md))
+- network export modules (excluding [changes to the existing classes](src/netwrite/README_Contributing.md))
+- software that build upon the existing Python and Java tools libraries (excluding [changes to the existing](tools/README_Contributing.md))
diff --git a/store/agents/simskill/README.md b/store/agents/simskill/README.md
index 8a0f704d5..24053a0ce 100644
--- a/store/agents/simskill/README.md
+++ b/store/agents/simskill/README.md
@@ -21,9 +21,9 @@ Edit `studio.json`, then run:
"$STUDIO_TOOLCHAIN/run.sh" simulate # Wake up the city
```
-The native command is optional and fails with a useful message when its external runtime is
-unavailable. It never silently substitutes sample output. Use the upstream README in `upstream/`
-for full native application setup. See `INTEGRATION.md` for the exact bridge and local test scope.
+SUMO is the local simulator and is installed by setup. The first Intel Mac install compiles two
+headless tools and can take several minutes. Later installs reuse the pinned build. It never
+substitutes sample output. See `INTEGRATION.md` for the exact local test scope.
Every successful run owns a new folder under `out/runs/`, a `result.json` with parameters, engine,
source commit, timestamps, measured values, and downloadable artifacts. `.harness/verdict.json`
diff --git a/store/agents/simskill/THIRD_PARTY_NOTICES.md b/store/agents/simskill/THIRD_PARTY_NOTICES.md
index d5a9631e5..263f15ea0 100644
--- a/store/agents/simskill/THIRD_PARTY_NOTICES.md
+++ b/store/agents/simskill/THIRD_PARTY_NOTICES.md
@@ -7,3 +7,7 @@ License: Apache-2.0; SUMO EPL-2.0 / GPL-2.0. See `LICENSE-upstream` and the fetc
The original local starter and wrapper are MIT licensed. The native runtime and separately
installed applications retain their own licenses. No upstream endorsement is claimed.
+
+Eclipse SUMO 1.27.1: German Aerospace Center (DLR) and contributors. The source pin is
+recorded in `upstream.lock.json`; `LICENSE-sumo` and `NOTICE-sumo.md` preserve its notices.
+The Intel Mac build uses conda-forge Xerces, ICU, and libc++ with exact package build pins.
diff --git a/store/agents/simskill/skills/simskill/SKILL.md b/store/agents/simskill/skills/simskill/SKILL.md
index dc1e817c7..f776b23cd 100644
--- a/store/agents/simskill/skills/simskill/SKILL.md
+++ b/store/agents/simskill/skills/simskill/SKILL.md
@@ -17,3 +17,15 @@ files under `$STUDIO_UPSTREAM` before using an upstream API. Keep controls withi
ranges, preserve the data needed to reproduce a comparison, and distinguish preview results from
native service or hardware output. The viewer supports history and artifact downloads; tell the
user which run contains the result, and what was actually measured.
+
+## Compare a signal plan
+
+Record the baseline, then change east–west green time while holding demand, duration, and
+seed fixed. Inspect `trips.csv`, the generated network, and raw `traffic.xml`. Compare mean
+delay for completed trips together with the unfinished count and largest stopped queue.
+Do not drop unfinished vehicles when describing congestion.
+
+For custom networks, read `$STUDIO_UPSTREAM/.claude/skills/procedural-memory/` in this order:
+`create-single-intersection/SKILL.md`, `run-simulation/SKILL.md`, and
+`analyze-simulation-outputs/SKILL.md`. Those pinned procedures explain the native SUMO
+commands and raw outputs. The starter is an original intersection, not a calibrated city.
diff --git a/store/agents/simskill/toolchain/build-sumo.sh b/store/agents/simskill/toolchain/build-sumo.sh
index ebab6938a..d95b7f460 100755
--- a/store/agents/simskill/toolchain/build-sumo.sh
+++ b/store/agents/simskill/toolchain/build-sumo.sh
@@ -4,7 +4,8 @@
set -euo pipefail
cd "$(dirname "$0")/.."
. toolchain/runtimes.sh
-if [ -x .sumo/bin/sumo ] && [ -x .sumo/bin/netconvert ]; then exit 0; fi
+studio_sumo_pin="$(.venv/bin/python -c 'import json; print(next(s["commit"] for s in json.load(open("upstream.lock.json")) if s["directory"] == "sumo-src"))')"
+if [ -x .sumo/bin/sumo ] && [ -x .sumo/bin/netconvert ] && [ -f .sumo/.source-pin ] && [ "$(cat .sumo/.source-pin)" = "$studio_sumo_pin" ]; then exit 0; fi
harness_conda_env .sumo 'xerces-c=3.3.0=h32b985b_2' 'icu=78.3=py313hbf1d544_2' 'libcxx=23.1.1=h19cb2f5_0'
if [ "$(uname -s)" = Darwin ]; then
export SDKROOT="$(xcrun --show-sdk-path)"
@@ -22,5 +23,7 @@ studio_cmake="$PWD/.venv/bin/cmake"
-DISOLATED_BUILD=ON
"$studio_cmake" --build .build/sumo --target sumo netconvert -j 2
mkdir -p .sumo/bin
-cp .build/sumo/bin/sumo .build/sumo/bin/netconvert .sumo/bin/
+cp .build/sumo/src/sumo .build/sumo/src/netconvert .sumo/bin/
.sumo/bin/sumo --version
+.sumo/bin/netconvert --version
+printf '%s\n' "$studio_sumo_pin" > .sumo/.source-pin
diff --git a/store/agents/simskill/view.mjs b/store/agents/simskill/view.mjs
index b75b2fbdf..fa854665e 100644
--- a/store/agents/simskill/view.mjs
+++ b/store/agents/simskill/view.mjs
@@ -3,7 +3,7 @@ export function mount(stage,api){
let p=api.getParameters(),result,index=0,playing=true,rate=8,now=0,start=0,last='',follow=false,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-70),left=(w-size)/2,top=18,s=size/400;bounds={left,top,s};const map=(x,y)=>[left+x*s,top+(400-y)*s];
+ 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];
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);
@@ -12,10 +12,10 @@ export function mount(stage,api){
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,-2.5,-4.5,5,9,1.5,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);}});
+ 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);
- words(ctx,`${p.green}s EAST–WEST GREEN`,left,top+size+20,'#9cb78b',9);
+ 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);
diff --git a/store/viewers/studio-viewer/package-lock.json b/store/viewers/studio-viewer/package-lock.json
index 4cf00d700..20d7f441b 100644
--- a/store/viewers/studio-viewer/package-lock.json
+++ b/store/viewers/studio-viewer/package-lock.json
@@ -7,7 +7,9 @@
"name": "openharness-studio-viewer",
"devDependencies": {
"c8": "10.1.3",
- "playwright": "1.58.2"
+ "istanbul-lib-coverage": "3.2.2",
+ "playwright": "1.58.2",
+ "v8-to-istanbul": "9.3.0"
}
},
"node_modules/@bcoe/v8-coverage": {
diff --git a/store/viewers/studio-viewer/package.json b/store/viewers/studio-viewer/package.json
index 45b87b0ef..35a31cb12 100644
--- a/store/viewers/studio-viewer/package.json
+++ b/store/viewers/studio-viewer/package.json
@@ -4,7 +4,16 @@
"type": "module",
"scripts": {
"test": "node --test test/*.test.mjs",
- "test:browser": "node test/studios.e2e.mjs"
+ "test:browser": "node test/studios.e2e.mjs",
+ "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"
},
- "devDependencies": { "playwright": "1.58.2", "c8": "10.1.3" }
+ "devDependencies": {
+ "playwright": "1.58.2",
+ "c8": "10.1.3",
+ "istanbul-lib-coverage": "3.2.2",
+ "v8-to-istanbul": "9.3.0"
+ }
}
diff --git a/store/viewers/studio-viewer/server.mjs b/store/viewers/studio-viewer/server.mjs
index f7284996f..571b32959 100644
--- a/store/viewers/studio-viewer/server.mjs
+++ b/store/viewers/studio-viewer/server.mjs
@@ -76,7 +76,12 @@ export async function createStudio({workspace, packageDir, port = 0, jobTimeout
};
const endChild = () => {
if (child) {
- try { process.kill(-child.pid, 'SIGTERM'); } catch { child.kill('SIGTERM'); }
+ const current = child;
+ const signal = name => {try { process.kill(-current.pid,name); } catch { current.kill(name); }};
+ signal('SIGTERM');
+ const force = setTimeout(() => signal('SIGKILL'),1000);
+ force.unref();
+ current.once('close',() => clearTimeout(force));
}
};
const server = http.createServer(async (req,res) => {
@@ -159,7 +164,12 @@ export async function createStudio({workspace, packageDir, port = 0, jobTimeout
}
});
await new Promise((ok,fail) => {server.once('error',fail); server.listen(port,'127.0.0.1',ok);});
- return {server, url:`http://127.0.0.1:${server.address().port}`, close:async () => {clearTimeout(timer); endChild(); server.closeAllConnections(); await new Promise(ok => server.close(ok));}};
+ return {server, url:`http://127.0.0.1:${server.address().port}`, close:async () => {
+ clearTimeout(timer);
+ const stopped = child ? new Promise(ok => child.once('close',ok)) : Promise.resolve();
+ endChild();server.closeAllConnections();
+ await Promise.all([stopped,new Promise(ok => server.close(ok))]);
+ }};
}
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
diff --git a/store/viewers/studio-viewer/test/browser-coverage.mjs b/store/viewers/studio-viewer/test/browser-coverage.mjs
new file mode 100644
index 000000000..7238c6844
--- /dev/null
+++ b/store/viewers/studio-viewer/test/browser-coverage.mjs
@@ -0,0 +1,38 @@
+import {readFile,writeFile,readdir,mkdir} from 'node:fs/promises';
+import {fileURLToPath} from 'node:url';
+import {join,relative} from 'node:path';
+import v8ToIstanbul from 'v8-to-istanbul';
+import istanbul from 'istanbul-lib-coverage';
+const {createCoverageMap}=istanbul;
+
+const viewer=fileURLToPath(new URL('../',import.meta.url));
+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 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;
+ const path=new URL(entry.url).pathname;
+ let file;
+ if(path==='/domain.mjs'){
+ if(name==='ui')continue;
+ 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;
+ const converter=v8ToIstanbul(file,0,{source:entry.source});
+ await converter.load();converter.applyCoverage(entry.functions);map.merge(converter.toIstanbul());
+ }
+}
+const files={};
+for(const file of map.files().sort()){
+ const summary=map.fileCoverageFor(file).toSummary().toJSON();
+ files[relative(store,file)]=summary;
+ console.log(`${relative(store,file)}: ${summary.lines.pct}% lines, ${summary.branches.pct}% branches, ${summary.functions.pct}% functions`);
+}
+const summary={total:map.getCoverageSummary().toJSON(),files};
+await mkdir(join(viewer,'coverage'),{recursive:true});
+await writeFile(join(viewer,'coverage/browser-summary.json'),JSON.stringify(summary,null,2));
+await writeFile(join(viewer,'coverage/browser-final.json'),JSON.stringify(map.toJSON()));
+console.log('Browser total:',summary.total);
diff --git a/store/viewers/studio-viewer/test/studios.e2e.mjs b/store/viewers/studio-viewer/test/studios.e2e.mjs
index 15707dd5f..b6a0f149d 100644
--- a/store/viewers/studio-viewer/test/studios.e2e.mjs
+++ b/store/viewers/studio-viewer/test/studios.e2e.mjs
@@ -1,18 +1,19 @@
import assert from 'node:assert/strict';
-import {mkdtemp,mkdir,cp,readFile,writeFile,stat,rm} from 'node:fs/promises';
+import {mkdtemp,mkdir,cp,readFile,writeFile,stat,rm,rename} from 'node:fs/promises';
import {tmpdir} from 'node:os';
import {join} from 'node:path';
import {fileURLToPath} from 'node:url';
import {spawn} from 'node:child_process';
-import {chromium} from 'playwright';
+import {chromium,webkit} 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 names=(process.env.STUDIO_TEST_PACKAGES??'juce-agent-toolkit,foam-agent,autoresearch-mlx,ableton-ai,dimos,simskill,bonsai-mcp,comfy-mcp').split(',');
-const output=join(viewer,'test-results');await mkdir(output,{recursive:true});
+const webkitRun=process.env.STUDIO_TEST_BROWSER==='webkit';
+const output=join(viewer,'test-results',...(webkitRun?['webkit']:[]));await mkdir(output,{recursive:true});
const root=await mkdtemp(join(tmpdir(),'harness-studio-browser-'));
-const browser=await chromium.launch({channel:process.env.STUDIO_BROWSER_CHANNEL??'chrome',headless:true});
+const browser=webkitRun?await webkit.launch({headless:true}):await chromium.launch({channel:process.env.STUDIO_BROWSER_CHANNEL??'chrome',headless:true});
const report=[];
const exec=(command,args,cwd,env={})=>new Promise((ok,fail)=>{const p=spawn(command,args,{cwd,env:{...process.env,...env},stdio:['ignore','pipe','pipe']});let log='';p.stdout.on('data',b=>{log+=b;});p.stderr.on('data',b=>{log+=b;});p.on('error',fail);p.on('close',code=>code===0?ok(log):fail(Error(log)));});
const domains={
@@ -22,7 +23,7 @@ const domains={
'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');},
- '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');},
+ '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();},
};
try{
@@ -38,19 +39,29 @@ try{
const page=await context.newPage();const errors=[];
page.on('pageerror',e=>errors.push(e.message));
const requests=[];page.on('requestfailed',r=>requests.push(`${r.method()} ${r.url()}: ${r.failure()?.errorText}`));
- await page.coverage.startJSCoverage({resetOnNavigation:false});
+ if(!webkitRun)await page.coverage.startJSCoverage({resetOnNavigation:false});
try{
await page.goto(studio.url);await page.waitForFunction(()=>document.getElementById('connection').textContent==='Workspace connected');
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);
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'));
+ await page.reload();await page.waitForFunction(()=>document.getElementById('connection').textContent==='Workspace connected');
+ await page.evaluate(()=>new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve))));
+ assert.equal(await page.locator('#artifacts a').count(),0);
+ if(name==='juce-agent-toolkit')await page.getByRole('button',{name:'Play recording',exact:true}).click();
+ if(name==='ableton-ai'){await page.getByRole('button',{name:'Play WAV',exact:true}).click();await page.getByRole('button',{name:'Play loop',exact:true}).click();await page.getByRole('button',{name:'Pause motion',exact:true}).click();await page.getByRole('button',{name:'Resume motion',exact:true}).click();}
+ if(name==='comfy-mcp')await page.getByRole('button',{name:'Inspect favourite',exact:true}).click();
+ await rename(join(workspace,'saved-output'),join(workspace,'out'));
+ await page.reload();await page.waitForFunction(()=>document.getElementById('connection').textContent==='Workspace connected');
await domains[name](page);
const first=await (await fetch(studio.url+'/api/state')).json();
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'){await input.selectOption(c.options.at(-1).value);await input.selectOption(c.value);}
+ 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 await input.fill(c.value);
}
// Keep the default valid robot goal after exercising map movement.
@@ -66,7 +77,7 @@ try{
// A concurrent agent edit must not be overwritten by an older UI draft.
const c=config.controls.find(c=>c.type==='number');await page.locator(`[name="${c.id}"]`).focus();await page.keyboard.press('ArrowRight');
const project=JSON.parse(await readFile(join(workspace,'studio.json'),'utf8'));project.title+=' · edited by agent';await writeFile(join(workspace,'studio.json'),JSON.stringify(project));
- await page.locator('#remote').waitFor({state:'visible'});await page.getByRole('button',{name:'Load update',exact:true}).click();
+ await page.locator('#remote').waitFor({state:'visible'});await page.getByRole('button',{name:config.actions[0].label,exact:true}).click();await page.waitForFunction(()=>document.getElementById('notice').textContent.includes('agent changed'));assert.equal(JSON.parse(await readFile(join(workspace,'studio.json'),'utf8')).title,project.title);await page.getByRole('button',{name:'Load update',exact:true}).click();
await page.reload();await page.waitForFunction(()=>document.getElementById('connection').textContent==='Workspace connected');assert.equal((await(await fetch(studio.url+'/api/state')).json()).history.length,2);
await page.setViewportSize({width:390,height:844});await page.screenshot({path:join(output,`${name}-narrow.png`),fullPage:true});
assert.ok(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth+1),'narrow layout must not scroll horizontally');
@@ -74,8 +85,8 @@ try{
// Malformed agent output surfaces an error and recovers without losing artifacts.
const source=await readFile(join(workspace,'studio.json'),'utf8');await writeFile(join(workspace,'studio.json'),'unfinished');await page.waitForFunction(()=>document.getElementById('connection').textContent==='Reconnecting');await writeFile(join(workspace,'studio.json'),source);await page.waitForFunction(()=>document.getElementById('connection').textContent==='Workspace connected');
assert.deepEqual(errors,[],`${name}: browser errors`);assert.deepEqual(requests,[],`${name}: failed resource requests`);
- const coverage=await page.coverage.stopJSCoverage();await writeFile(join(output,`${name}-browser-coverage.json`),JSON.stringify(coverage));
- report.push({name,status:'passed',artifactCount:current.result.artifacts.length,engine:current.result.engine,workflows:['doctor','initialization','viewer','all controls','domain interactions','run','artifacts','download','history','pause','agent edit','reload','narrow layout','reduced motion','malformed project recovery']});
+ if(!webkitRun){const coverage=await page.coverage.stopJSCoverage();await writeFile(join(output,`${name}-browser-coverage.json`),JSON.stringify(coverage));}
+ report.push({name,status:'passed',artifactCount:current.result.artifacts.length,engine:current.result.engine,workflows:['doctor','initialization','viewer','empty state','all controls','domain interactions','run','artifacts','download','history','pause','agent edit','stale draft protection','reload','narrow layout','reduced motion','malformed project recovery']});
console.log(`PASS ${name}: ${report.at(-1).workflows.length} workflow checks, ${current.result.artifacts.length} artifacts`);
}finally{await context.close();await studio.close();}
}
diff --git a/store/viewers/studio-viewer/test/ui.e2e.mjs b/store/viewers/studio-viewer/test/ui.e2e.mjs
new file mode 100644
index 000000000..0fdc5d91e
--- /dev/null
+++ b/store/viewers/studio-viewer/test/ui.e2e.mjs
@@ -0,0 +1,83 @@
+import assert from 'node:assert/strict';
+import {mkdtemp,mkdir,writeFile,readFile,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 root=await mkdtemp(join(tmpdir(),'studio-ui-')),workspace=join(root,'workspace'),packageDir=join(root,'package');
+await mkdir(workspace);await mkdir(join(packageDir,'toolchain'),{recursive:true});
+const config={title:'Interaction lab',description:'An isolated viewer test',category:'Testing',scene:'Workbench',hint:'Try an idea',tip:'Saved results survive failures',credit:'Test fixture',previewLabel:'Ready to explore',empty:'Make your first artifact',
+ controls:[{id:'size',label:'Size',type:'number',min:1,max:9,value:3,integer:true,hint:'One small change'},
+ {id:'caption',label:'Caption',type:'text',value:'hello',maxLength:30},{id:'note',label:'Note',type:'text',value:''},
+ {id:'shape',label:'Shape',type:'select',value:'round',options:[{value:'round',label:'Round'},{value:'square',label:'Square'}]}],
+ actions:[{id:'make',label:'Make artifact'},{id:'fail',label:'Test failed run'},{id:'slow',label:'Test long run'}]};
+let project={spec:1,parameters:Object.fromEntries(config.controls.map(c=>[c.id,c.value]))};
+const save=async()=>writeFile(join(workspace,'studio.json'),JSON.stringify(project));await save();
+await writeFile(join(packageDir,'studio.config.json'),JSON.stringify(config));
+await writeFile(join(packageDir,'view.mjs'),`export function mount(stage,api){const button=document.createElement('button');button.textContent='Make from canvas';button.onclick=()=>{api.run();api.run();};stage.append(button);return {update(){},destroy(){}};}`);
+await writeFile(join(packageDir,'toolchain/run.sh'),`#!/usr/bin/env node
+const fs=require('node:fs'),path=require('node:path');
+const action=process.argv[2];
+if(action==='fail'){console.error('Fixture failed on purpose');process.exit(7);}
+else if(action==='slow'){console.log('Waiting for cancellation');setInterval(()=>{},1000);}
+else{
+ const root=process.env.HARNESS_WORKSPACE,id='run-'+Date.now(),out=path.join(root,'out/runs',id);
+ fs.mkdirSync(out,{recursive:true});fs.writeFileSync(path.join(out,'hello.txt'),'A saved idea');
+ const result={id,title:'A saved idea',description:'An actual fixture artifact',engine:'Local test fixture',parameters:JSON.parse(fs.readFileSync(path.join(root,'studio.json'))).parameters,
+ createdAt:new Date().toISOString(),metrics:[{label:'Ideas',value:1,unit:''}],artifacts:[{label:'Text',path:'out/runs/'+id+'/hello.txt'}]};
+ fs.writeFileSync(path.join(out,'result.json'),JSON.stringify(result));fs.writeFileSync(path.join(root,'out/latest.json'),JSON.stringify(result));
+}
+`,{mode:0o755});
+const studio=await createStudio({workspace,packageDir});
+const browser=await chromium.launch({channel:'chrome',headless:true});
+const page=await browser.newPage();const errors=[];page.on('pageerror',e=>errors.push(e.message));
+await page.coverage.startJSCoverage({resetOnNavigation:false});
+const connected=()=>page.waitForFunction(()=>document.getElementById('connection').textContent==='Workspace connected');
+const notice=message=>page.waitForFunction(m=>document.getElementById('notice').textContent.includes(m),message);
+const state=async()=>(await fetch(studio.url+'/api/state')).json();
+try{
+ // A transient module response must recover, including the module import cache.
+ let attempts=0;
+ await page.route('**/domain.mjs*',async route=>{if(attempts++===0)await route.fulfill({status:503,contentType:'text/javascript',body:'Unavailable'});else await route.continue();});
+ await page.goto(studio.url);await connected();assert.ok(attempts>=2);await page.unroute('**/domain.mjs*');
+ assert.match(await page.locator('#history').textContent(),/first run/);assert.equal(await page.locator('#result-title').textContent(),'Your next idea starts here');
+ project.parameters.caption='Saved by the agent';await save();await page.waitForFunction(()=>document.querySelector('[name=caption]').value==='Saved by the agent');
+ await page.getByLabel('Caption').fill('A small experiment');await page.getByLabel('Note',{exact:true}).fill('keep me');
+ await page.getByLabel('Shape',{exact:true}).selectOption('square');
+ await page.getByRole('button',{name:'Make from canvas',exact:true}).click();
+ await page.waitForFunction(()=>document.querySelectorAll('#history button').length===1);
+ const first=await state();assert.equal(first.project.parameters.caption,'A small experiment');assert.equal(first.project.parameters.note,'keep me');
+ assert.equal(first.history.length,1,'double canvas click must only start one run');
+ // A draft cannot overwrite a new agent edit, even after the polling revision advances.
+ await page.getByLabel('Caption').fill('Older unsaved draft');
+ project={...first.project,parameters:{...first.project.parameters,caption:'New agent edit'}};await save();
+ await page.locator('#remote').waitFor({state:'visible'});await page.getByRole('button',{name:'Make artifact',exact:true}).click();await notice('agent changed');
+ assert.equal((await state()).project.parameters.caption,'New agent edit');
+ await page.getByRole('button',{name:'Load update',exact:true}).click();assert.equal(await page.getByLabel('Caption').inputValue(),'New agent edit');
+ await page.route('**/api/run?id=*',route=>route.fulfill({status:404,contentType:'application/json',body:JSON.stringify({error:'History temporarily unavailable'})}));
+ await page.locator('#history button').click();await notice('History temporarily unavailable');await page.unroute('**/api/run?id=*');
+ await page.locator('#history button').click();await page.getByRole('button',{name:'Back to latest'}).click();
+ await page.getByRole('button',{name:'Test failed run',exact:true}).click();await notice('Fixture failed on purpose');
+ assert.equal((await state()).result.id,first.result.id);assert.equal(await page.locator('#artifacts a').count(),1);
+ await page.getByRole('button',{name:'Test long run',exact:true}).click();await page.getByRole('button',{name:'Stop run'}).waitFor();
+ await page.route('**/api/cancel',route=>route.fulfill({status:409,contentType:'application/json',body:JSON.stringify({error:'Try stopping again'})}));
+ await page.getByRole('button',{name:'Stop run'}).click();await notice('Try stopping again');await page.unroute('**/api/cancel');
+ await page.getByRole('button',{name:'Stop run'}).click();await notice('Run stopped');assert.equal((await state()).result.id,first.result.id);
+ await page.getByRole('button',{name:'Reset controls',exact:true}).click();
+ await page.getByRole('button',{name:'Make artifact',exact:true}).click();await page.waitForFunction(()=>document.querySelectorAll('#history button').length===2);
+ // A delayed poll must not build a second viewer while the first refresh is pending.
+ let polls=0;
+ await page.route('**/api/state',async route=>{polls++;await new Promise(r=>setTimeout(r,1500));await route.continue();});
+ await page.waitForFunction(()=>document.getElementById('connection').textContent==='Workspace connected');
+ await new Promise(r=>setTimeout(r,2800));assert.equal(await page.getByRole('button',{name:'Make from canvas'}).count(),1);assert.ok(polls<3);
+ await page.unroute('**/api/state');
+ assert.deepEqual(errors,[]);
+ await page.evaluate(()=>dispatchEvent(new Event('pagehide')));
+ const coverage=await page.coverage.stopJSCoverage();
+ const output=fileURLToPath(new URL('../test-results/',import.meta.url));await mkdir(output,{recursive:true});
+ await writeFile(join(output,'ui-browser-coverage.json'),JSON.stringify(coverage));
+ await writeFile(join(output,'ui-report.json'),JSON.stringify({status:'passed',checks:['empty state','module recovery','clean agent edit','text controls','canvas run','duplicate click','stale draft protection','history failure','failed run retention','cancel error','cancel run','retry','single refresh','page cleanup']},null,2));
+ console.log('PASS viewer recovery: 14 interaction checks');
+}finally{await browser.close();await studio.close();await rm(root,{recursive:true,force:true});}
diff --git a/store/viewers/studio-viewer/test/viewer.test.mjs b/store/viewers/studio-viewer/test/viewer.test.mjs
index f08ac849f..1de5dc140 100644
--- a/store/viewers/studio-viewer/test/viewer.test.mjs
+++ b/store/viewers/studio-viewer/test/viewer.test.mjs
@@ -85,6 +85,14 @@ test('cancellation also works when the platform cannot signal a process group',a
assert.equal((await f.req('/api/cancel',{})).status,200);
await until(f.state,s=>s.job.status==='cancelled');
});
+
+test('closing the viewer terminates jobs that ignore graceful cancellation',async t=>{
+ const f=await fixture(t,"trap '' TERM; echo ready; while :; do sleep 1; done");
+ await f.run();await until(f.state,s=>s.job.log.includes('ready'));
+ assert.equal((await f.req('/api/cancel',{})).status,200);
+ await f.studio.close();
+ await assert.rejects(fetch(f.studio.url+'/api/state'));
+});
test('confines files after symlink resolution and serves artifact downloads',async t=>{
const f=await fixture(t);await mkdir(join(f.workspace,'out'));await writeFile(join(f.root,'secret.txt'),'private');await symlink(join(f.root,'secret.txt'),join(f.workspace,'out/escape.txt'));
await writeFile(join(f.workspace,'out/sound.wav'),'RIFF');await writeFile(join(f.workspace,'out/data.json'),'{}');await writeFile(join(f.workspace,'out/unknown.xyz'),'hello');
diff --git a/store/viewers/studio-viewer/test/workflows_test.py b/store/viewers/studio-viewer/test/workflows_test.py
index 684b87d2a..a14d6f3fe 100644
--- a/store/viewers/studio-viewer/test/workflows_test.py
+++ b/store/viewers/studio-viewer/test/workflows_test.py
@@ -91,6 +91,19 @@ class StudioCase(unittest.TestCase):
self.assertTrue(verdict['ready']);self.assertTrue((self.workspace/verdict['artifact']).is_file())
class Instrument(StudioCase):
+ def test_portable_cmake_adapter_keeps_paths_and_parameters_as_arguments(self):
+ out=self.output();commands=[]
+ def compiler(argv,**kwargs):
+ commands.append(argv)
+ if str(argv[0]).endswith('HarnessTone'):w.render(self.p,out)
+ return ''
+ with patch.object(w.platform,'system',return_value='Linux'),patch.object(w,'command',side_effect=compiler):
+ result=w.juce(self.p,out)
+ self.assertEqual(len(commands),3)
+ self.assertIn('-DJUCE_ROOT='+str(PACKAGE/'juce'),commands[0])
+ self.assertEqual(commands[-1][1],out/'phrase.wav')
+ self.assertEqual(commands[-1][2],self.p['wave'])
+ self.assertGreater(len(result['data']['waveform']),100)
@unittest.skipUnless(os.environ.get('STUDIO_NATIVE_JUCE_WORKSPACE'),'Set STUDIO_NATIVE_JUCE_WORKSPACE for a real native compiler check')
def test_native_juce_produces_measured_audio(self):
native=Path(os.environ['STUDIO_NATIVE_JUCE_WORKSPACE']).resolve()
diff --git a/store/viewers/studio-viewer/web/graphics.mjs b/store/viewers/studio-viewer/web/graphics.mjs
index 044fc4cc4..9cb00fb61 100644
--- a/store/viewers/studio-viewer/web/graphics.mjs
+++ b/store/viewers/studio-viewer/web/graphics.mjs
@@ -3,8 +3,8 @@ export function toolbar(stage, buttons){const bar=el('div','','domain-toolbar');
export function badge(stage,text){const n=el('span',text,'domain-badge');stage.append(n);return n;}
export function label(stage,text){const n=el('div',text,'domain-label');stage.append(n);return n;}
export function canvas(stage, draw, signal){
- const c=el('canvas');c.setAttribute('role','img');stage.append(c);const ctx=c.getContext('2d');let animate=true,raf,frame=0;
- const paint=t=>{const box=c.getBoundingClientRect(),dpr=Math.min(devicePixelRatio||1,2);if(c.width!==Math.round(box.width*dpr)||c.height!==Math.round(box.height*dpr)){c.width=Math.round(box.width*dpr);c.height=Math.round(box.height*dpr);}ctx.setTransform(dpr,0,0,dpr,0,0);ctx.clearRect(0,0,box.width,box.height);if(animate&&!document.hidden)frame=t/1000;draw(ctx,box.width,box.height,frame);raf=requestAnimationFrame(paint);};raf=requestAnimationFrame(paint);signal.addEventListener('abort',()=>cancelAnimationFrame(raf));return {element:c,motion:value=>{animate=value;}};
+ const c=el('canvas');c.setAttribute('role','img');stage.append(c);const ctx=c.getContext('2d');let animate=true,raf,frame=0,previous=null;
+ const paint=t=>{const box=c.getBoundingClientRect(),dpr=Math.min(devicePixelRatio||1,2);if(c.width!==Math.round(box.width*dpr)||c.height!==Math.round(box.height*dpr)){c.width=Math.round(box.width*dpr);c.height=Math.round(box.height*dpr);}ctx.setTransform(dpr,0,0,dpr,0,0);ctx.clearRect(0,0,box.width,box.height);const elapsed=previous===null?0:(t-previous)/1000;previous=t;if(animate&&!document.hidden)frame+=Math.min(elapsed,.1);draw(ctx,box.width,box.height,frame);raf=requestAnimationFrame(paint);};raf=requestAnimationFrame(paint);signal.addEventListener('abort',()=>cancelAnimationFrame(raf));return {element:c,motion:value=>{animate=value;}};
}
export function grid(ctx,w,h,spacing=32){ctx.strokeStyle='#ffffff0a';ctx.lineWidth=1;for(let x=0;x<w;x+=spacing){ctx.beginPath();ctx.moveTo(x,0);ctx.lineTo(x,h);ctx.stroke();}for(let y=0;y<h;y+=spacing){ctx.beginPath();ctx.moveTo(0,y);ctx.lineTo(w,y);ctx.stroke();}}
export function round(ctx,x,y,w,h,r,fill,stroke){ctx.beginPath();ctx.roundRect(x,y,w,h,r);if(fill){ctx.fillStyle=fill;ctx.fill();}if(stroke){ctx.strokeStyle=stroke;ctx.stroke();}}
diff --git a/store/viewers/studio-viewer/web/index.html b/store/viewers/studio-viewer/web/index.html
index 5f7bc451a..c141b779f 100644
--- a/store/viewers/studio-viewer/web/index.html
+++ b/store/viewers/studio-viewer/web/index.html
@@ -10,7 +10,7 @@
<body>
<main id="app" aria-busy="true">
<header class="topbar"><a class="wordmark" href="/" aria-label="Reload studio"><span class="mark">h</span> HARNESS <span class="muted">/ STUDIO</span></a><span id="connection" class="connection">Connecting</span></header>
- <section class="heading"><div><p class="eyebrow" id="category">MAKE SOMETHING GOOD</p><h1 id="title">Opening your studio…</h1><p id="description" class="description">Your workspace will appear here.</p></div><div class="heading-actions"><button id="reset" class="quiet">Reset controls</button><button id="run" class="primary" disabled>Run</button></div></section>
+ <section class="heading"><div><p class="eyebrow" id="category">MAKE SOMETHING GOOD</p><h1 id="title">Opening your studio…</h1><p id="description" class="description">Your workspace will appear here.</p></div><div class="heading-actions"><button id="reset" class="quiet" disabled>Reset controls</button><button id="run" class="primary" disabled>Run</button></div></section>
<div id="notice" class="notice" role="status" hidden></div>
<div id="remote" class="notice" hidden>The agent saved new controls. <button id="refresh">Load update</button></div>
<section class="workspace">
diff --git a/store/viewers/studio-viewer/web/studio.mjs b/store/viewers/studio-viewer/web/studio.mjs
index c9553c3e9..894d021b7 100644
--- a/store/viewers/studio-viewer/web/studio.mjs
+++ b/store/viewers/studio-viewer/web/studio.mjs
@@ -1,6 +1,6 @@
const $ = id => document.getElementById(id);
const text = (tag, value, className) => {const e=document.createElement(tag);e.textContent=value;if(className)e.className=className;return e;};
-let state, parameters, domain, draftRevision, dirty=false, selected=null, motion=!matchMedia('(prefers-reduced-motion: reduce)').matches, lastResult='', pending=false, refreshing=false;
+let state, parameters, domain, draftRevision, dirty=false, selected=null, motion=!matchMedia('(prefers-reduced-motion: reduce)').matches, lastResult='', lastJob='', moduleAttempts=0, pending=false, refreshing=false;
const abort = new AbortController();
const artifactURL = path => '/artifacts/'+path.split('/').map(encodeURIComponent).join('/');
const announce = message => {$('announcement').textContent=message;};
@@ -20,8 +20,8 @@ function controls(config) {
let input;
if(c.type==='select'){input=document.createElement('select');for(const o of c.options){const opt=text('option',o.label);opt.value=o.value;input.append(opt);}}
else{input=document.createElement('input');input.type=c.type==='number'?'range':'text';if(c.type==='number'){input.min=c.min;input.max=c.max;input.step=c.step??1;}else input.maxLength=c.maxLength??500;}
- input.name=c.id;input.id=`control-${c.id}`;input.value=parameters[c.id];label.htmlFor=input.id;
- const update=()=>{output.value=c.type==='number'?`${input.value}${c.unit?' '+c.unit:''}`:'';};update();input.addEventListener('studio-value',update);
+ input.setAttribute('aria-label',c.label);input.name=c.id;input.id=`control-${c.id}`;input.value=parameters[c.id];label.htmlFor=input.id;
+ const update=()=>{output.value=c.type==='number'?`${input.value}${c.unit?' '+c.unit:''}`:'';if(c.type==='number')input.setAttribute('aria-valuetext',output.value);};update();input.addEventListener('studio-value',update);
input.addEventListener('input',()=>{update();setParameter(c.id,c.type==='number'?Number(input.value):input.value);});
head.append(caption,output);label.append(head,input);if(c.hint)label.append(text('small',c.hint));$('controls').append(label);
}
@@ -32,7 +32,7 @@ function renderResult(result){
$('result-title').textContent=result?.title??'Your next idea starts here';$('result-description').textContent=result?.description??state.config.empty;
$('provenance').textContent=result?.engine??state.config.previewLabel;
$('run-time').textContent=result?new Date(result.createdAt).toLocaleTimeString([],{hour:'2-digit',minute:'2-digit'}):'';
- for(const a of result?.artifacts??[]){const link=text('a',`↓ ${a.label}`,'artifact');link.href=artifactURL(a.path)+'?download';link.download='';$('artifacts').append(link);}
+ for(const a of result?.artifacts??[]){const link=text('a',`↓ ${a.label}`,'artifact');link.href=artifactURL(a.path)+'?download';link.download='';link.setAttribute('aria-label',`Download ${a.label}`);$('artifacts').append(link);}
domain?.update(parameters,result,motion);
}
function renderHistory(){
@@ -51,17 +51,19 @@ async function refresh(){
try{
const next=await api('/api/state');
const changed=state&&next.revision!==state.revision;
- if(!state){state=next;parameters={...state.project.parameters};const c=state.config;document.title=c.title+' · Harness';$('title').textContent=c.title;$('description').textContent=c.description;$('category').textContent=c.category.toUpperCase();$('scene-label').textContent=c.scene.toUpperCase();$('hint').textContent=c.hint;$('tip').textContent=c.tip;$('credit').textContent=c.credit;$('run').textContent=c.actions[0].label;for(const [key,value] of Object.entries(c.theme??{}))document.documentElement.style.setProperty('--'+key,value);controls(c);for(const a of c.actions.slice(1)){const b=text('button',a.label);b.type='button';b.title=a.description??a.label;b.addEventListener('click',()=>run(a.id));$('extra-actions').append(b);}const module=await import('/domain.mjs');$('stage').replaceChildren();domain=module.mount($('stage'),{getParameters:()=>parameters,setParameter,announce,artifactURL,signal:abort.signal,run:()=>run(c.actions[0].id)});}
+ if(!state){state=next;parameters={...state.project.parameters};const c=state.config;document.title=c.title+' · Harness';$('title').textContent=c.title;$('description').textContent=c.description;$('category').textContent=c.category.toUpperCase();$('scene-label').textContent=c.scene.toUpperCase();$('hint').textContent=c.hint;$('tip').textContent=c.tip;$('credit').textContent=c.credit;$('run').textContent=c.actions[0].label;for(const [key,value] of Object.entries(c.theme??{}))document.documentElement.style.setProperty('--'+key,value);controls(c);for(const a of c.actions.slice(1)){const b=text('button',a.label);b.type='button';b.setAttribute('aria-label',a.label);b.title=a.description??a.label;b.addEventListener('click',()=>run(a.id));$('extra-actions').append(b);}const module=await import(`/domain.mjs?attempt=${moduleAttempts++}`);$('stage').replaceChildren();domain=module.mount($('stage'),{getParameters:()=>parameters,setParameter,announce,artifactURL,signal:abort.signal,run:()=>run(c.actions[0].id)});}
state=next;
if(changed&&dirty){$('remote').hidden=false;}else if(changed){parameters={...state.project.parameters};draftRevision=state.revision;controls(state.config);$('remote').hidden=true;}
- $('connection').textContent='Workspace connected';$('app').setAttribute('aria-busy','false');
+ $('reset').disabled=false;$('connection').textContent='Workspace connected';$('app').setAttribute('aria-busy','false');
$('dirty').textContent=dirty?'UNSAVED':'SAVED';
const running=state.job?.status==='running';$('run').disabled=running||pending;for(const b of $('extra-actions').children)b.disabled=running||pending;
$('job-details').hidden=!state.job;$('log').textContent=state.job?.log??'';
- if(state.job?.status==='failed')notice(state.job.message,true);
+ const jobStamp=state.job?`${state.job.startedAt}:${state.job.status}`:'';
+ if(state.job?.status==='failed'&&jobStamp!==lastJob)notice(state.job.message,true);
else if(running){notice(state.job.message);if(!$('cancel')){const b=text('button','Stop run');b.id='cancel';b.addEventListener('click',async()=>{try{await api('/api/cancel',{});await refresh();}catch(e){notice(e.message,true);}});$('notice').append(' ',b);}}
- else if(state.job?.status==='cancelled')notice(state.job.message);
- else if(state.job?.status==='done')notice('');
+ else if(state.job?.status==='cancelled'&&jobStamp!==lastJob)notice(state.job.message);
+ else if(state.job?.status==='done'&&jobStamp!==lastJob)notice('');
+ lastJob=jobStamp;
const stamp=state.result?.id??'';
if(stamp!==lastResult||changed||!lastResult){lastResult=stamp;renderResult(selected??state.result);renderHistory();}
}catch(e){if(!domain){state=null;$('extra-actions').replaceChildren();}$('connection').textContent='Reconnecting';notice(e.message,true);}finally{refreshing=false;}