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
import {readFile} from 'node:fs/promises';
import {validateProject,clone} from '../template/studio/project.mjs';
const root=new URL('../template/game/',import.meta.url);
export async function conservatory(){return validateProject({...JSON.parse(await readFile(new URL('project.json',root),'utf8')),rules:await readFile(new URL('rules.mjs',root),'utf8')});}
export function signalGarden(){
const actual=['EW','EW','SW','ES','EW','NW','NE','EW','EW'];
const p={spec:1,id:'signal-garden',title:'Signal Garden',subtitle:'Turn nine tiles into one unbroken path. A solo tabletop routing puzzle.',players:1,settings:[{id:'turn_limit',label:'Rotation budget','min':1,'max':60,'step':1,'value':24}],components:actual.map((port,i)=>({id:'tile-'+i,name:String(i+1),body:'',kind:'tile',widthMm:45,heightMm:45,quantity:1,color:i%2?'#a1ad87':'#536f62',ink:'#fff5d4',symbol:'',values:{ports:port},locked:i===4})),boards:[{id:'garden',name:'Signal Garden · west entrance / east exit',widthMm:135,heightMm:147,cols:3,rows:3,cells:Array.from({length:9},(_,i)=>({label:String(i+1),color:'#e3e7d6'}))}],rulebook:[{heading:'Connect the garden','body':'Place the nine numbered tiles on the matching board cells. The entrance is west of tile 1; the exit is east of tile 9. Rotate each tile clockwise any number of quarter-turns to choose a starting puzzle. Begin with the rotation budget shown below.'},{heading:'One decision at a time','body':'On each turn, rotate any tile 90 degrees clockwise and spend one rotation. Water can flow only when the ports on neighboring tiles face each other. You win as soon as a connected path reaches from the west entrance to the east exit. You lose when the rotation budget reaches zero with no connected path. The digital edition rotates each tile by a seeded number of quarter-turns at setup.'},{heading:'Physical edition','body':'Print the numbered tiles and board at actual size. Keep tiles in their numbered cells; rotate them in place. Mark remaining rotations with a pencil. To create a different route or larger game, edit the tile ports and the authored rules; this edition uses a 3 × 3 board.'}],rules:`
const dirs=['N','E','S','W'],vectors=[[0,-1],[1,0],[0,1],[-1,0]];
const ports=(s,p,i)=>[...p.components[i].values.ports].map(d=>(dirs.indexOf(d)+s.rotations[i])%4);
export function connected(s,p){const first=ports(s,p,0);if(!first.includes(3))return false;const seen=new Set([0]),todo=[0];while(todo.length){const i=todo.shift();if(i===8&&ports(s,p,i).includes(1))return true;for(const d of ports(s,p,i)){const [dx,dy]=vectors[d],x=i%3+dx,y=Math.floor(i/3)+dy,j=y*3+x;if(x>=0&&x<3&&y>=0&&y<3&&!seen.has(j)&&ports(s,p,j).includes((d+2)%4)){seen.add(j);todo.push(j);}}}return false;}
export function initial(p,ctx){const r=ctx.random('tile-rotation');return{player:0,rotations:p.components.map(()=>Math.floor(r()*4)),remaining:p.settings.find(s=>s.id==='turn_limit').value};}
export function outcome(s,p){return connected(s,p)?{title:'The garden is connected',winners:[0]}:s.remaining===0?{title:'The water has run out',winners:[]}:null;}
export function legal(s,p){return outcome(s,p)?[]:p.components.map((c,i)=>({id:'rotate-'+i,label:'Rotate tile '+(i+1)+' ↻',index:i}));}
export function apply(s,a){const n=JSON.parse(JSON.stringify(s));n.rotations[a.index]=(n.rotations[a.index]+1)%4;n.remaining--;return n;}
export function observe(s,player,p){return{title:'Find an unbroken path',message:'Connect the west of tile 1 to the east of tile 9. Each click rotates a tile clockwise.',scores:[{label:'Rotations left',value:s.remaining}],zones:[{id:'garden',label:'Nine tiles · one connected garden',board:'garden',items:p.components.map((c,i)=>({key:c.id,component:c.id,cell:i,rotation:s.rotations[i]*90,action:'rotate-'+i}))}]};}
export function validate(s,p){return p.players===1&&p.components.length===9&&s.rotations.length===9&&s.rotations.every(n=>Number.isInteger(n)&&n>=0&&n<4)&&Number.isInteger(s.remaining)&&s.remaining>=0||'Use nine tiles, one player and a nonnegative integer rotation budget.';}
export function bot(view,actions){return actions[0].id;}
`};return validateProject(p);
}
export function nightFerry(){return validateProject({spec:1,id:'night-ferry',title:'Night Ferry',subtitle:'Carry a little more, or come safely home. A push-your-luck game for two.',players:2,settings:[{id:'voyages',label:'Voyages per player',min:1,max:8,step:1,value:3},{id:'storm_limit',label:'Storms before cargo is lost',min:1,max:4,step:1,value:2}],components:[{id:'tea',name:'Moon tea',body:'Add the printed cargo value to this voyage.',kind:'card',widthMm:63,heightMm:88,quantity:6,color:'#48645c',ink:'#fff4df',symbol:'☾',values:{cargo:2,storm:0},locked:true},{id:'silk',name:'Ember silk',body:'Add the printed cargo value to this voyage.',kind:'card',widthMm:63,heightMm:88,quantity:4,color:'#9b5445',ink:'#fff4df',symbol:'✦',values:{cargo:4,storm:0},locked:false},{id:'storm',name:'Crosswind',body:'Add one storm. At the storm limit, this voyage loses all unbanked cargo.',kind:'card',widthMm:63,heightMm:88,quantity:5,color:'#354b6a',ink:'#fff4df',symbol:'≈',values:{cargo:0,storm:1},locked:false}],boards:[],rulebook:[{heading:'On the river','body':'Two ferry captains take turns carrying cargo along a night river. Each player makes the number of voyages listed in the rule settings. The highest banked cargo value wins; tied captains share the win.'},{heading:'Set up each voyage','body':'Shuffle the complete deck, including all cargo and storm cards. The active captain starts with no unbanked cargo or storms. Begin with Player 1, alternating captains after every voyage. Reshuffle all cards between voyages.'},{heading:'Draw or dock','body':'Draw reveals the next card: add its cargo value and storm value to the current voyage. If your storms reach the storm limit, lose this voyage’s unbanked cargo and end the voyage. Dock ends the voyage and adds its unbanked cargo to your banked score. You may dock before drawing. If the deck runs out after a safe draw, automatically bank the cargo and end the voyage.'},{heading:'Keep the score','body':'Record each captain’s banked cargo after every voyage. After both have made all their voyages, compare totals. The digital game uses a seeded shuffle for each voyage so a replay can be checked; physical play uses a normally shuffled deck.'}],rules:`
const setting=(p,id)=>p.settings.find(x=>x.id===id).value;
const comp=(p,id)=>p.components.find(c=>c.id===id);
function fresh(p,ctx){return ctx.shuffle(p.components.flatMap(c=>Array(c.quantity).fill(c.id)),'voyage');}
export function initial(p,ctx){return{player:0,round:1,scores:[0,0],cargo:0,storms:0,drawn:[],deck:fresh(p,ctx),done:false,last:'Choose whether to draw or dock.'};}
export function legal(s){return s.done?[]:[{id:'draw',label:'Draw · carry a little more'},{id:'dock',label:'Dock · bank '+s.cargo}];}
function finish(n,p,ctx,bank){if(bank)n.scores[n.player]+=n.cargo;const old=n.player;n.player=1-old;if(old===1)n.round++;if(n.round>setting(p,'voyages')){n.done=true;return;}n.cargo=0;n.storms=0;n.drawn=[];n.deck=fresh(p,ctx);}
export function apply(s,a,p,ctx){const n=JSON.parse(JSON.stringify(s));if(a.id==='dock'){n.last='Player '+(s.player+1)+' docked with '+s.cargo+' cargo.';finish(n,p,ctx,true);}else{const id=n.deck.shift(),c=comp(p,id);n.drawn.push(id);n.cargo+=c.values.cargo;n.storms+=c.values.storm;if(n.storms>=setting(p,'storm_limit')){n.last='Player '+(s.player+1)+' lost the unbanked cargo in a storm.';finish(n,p,ctx,false);}else if(!n.deck.length){n.last='The deck is empty; cargo was banked.';finish(n,p,ctx,true);}else n.last='You drew '+c.name+'.';}return n;}
export function outcome(s){if(!s.done)return null;const high=Math.max(...s.scores),winners=s.scores.flatMap((n,i)=>n===high?[i]:[]);return{title:winners.length===2?'The captains share the river':'Captain '+(winners[0]+1)+' wins',winners,scores:s.scores};}
export function observe(s,who,p){return{title:'Voyage '+Math.min(s.round,setting(p,'voyages'))+' · Captain '+(who+1),message:s.last,scores:[...s.scores.map((n,i)=>({label:'Captain '+(i+1)+' bank',value:n})),{label:'On the ferry',value:s.cargo},{label:'Storms',value:s.storms}],zones:[{id:'cargo',label:'This voyage · revealed cards',items:s.drawn.map((id,i)=>({key:'draw-'+i,component:id}))}]};}
export function validate(s,p){if(p.players!==2||!Number.isInteger(s.round)||s.round<1||s.cargo<0||s.storms<0||s.scores.some(n=>n<0))return'Invalid voyage state.';const used=[...s.deck,...s.drawn];for(const c of p.components)if(used.filter(id=>id===c.id).length!==c.quantity)return'Cards disappeared from the deck.';return true;}
export function bot(view,actions){return view.scores.find(x=>x.label==='On the ferry').value>=6?'dock':'draw';}
`});}
export async function fixtures(){return[await conservatory(),signalGarden(),nightFerry()];}
export function revise(p){const n=clone(p);if(p.id==='pocket-conservatory'){n.settings.find(s=>s.id==='pair_bonus').value=6;n.components.find(c=>c.id==='poppy').name='Golden poppy';n.components.find(c=>c.id==='poppy').color='#a8762d';}else if(p.id==='signal-garden'){n.settings[0].value=18;n.components[0].color='#276d7a';}else{n.settings.find(s=>s.id==='voyages').value=4;n.components.find(c=>c.id==='silk').values.cargo=5;n.components.find(c=>c.id==='silk').name='Festival silk';}return validateProject(n);}