@patrick-lai/commission-ai-workshop
v0.1.0
Published
The CommissionAI Workshop render engine: the three.js scene, archetypes, simulation, pets, robots, grammar and edit rules, as TypeScript source.
Readme
commission-ai-workshop
The render engine behind CommissionAI's Workshop: the three.js scene, the item archetypes, the resident simulation, pets, robots, the item grammar and the edit rules. It is TypeScript source with no build step. CommissionAI keeps a byte-identical copy at the same paths, so no import in the app changed when this code moved here.
What is in it
| Folder | Purpose |
| --- | --- |
| src/features/workshop/scene | The three.js scene: rooms, town and city views, ambience, previews, thumbnails, picking, replay and the frame loop (createWorkshopScene) |
| src/features/workshop/archetypes | The item archetypes, as parts built from the grammar |
| src/features/workshop/sim | Grid, pathing, placement and the director that moves residents, pets and robots |
| src/features/workshop/pets, robots | Pet and robot bodies and poses |
| src/features/workshop/grammar | Part types, the registry and the shared helpers the archetypes use |
| src/features/workshop/edit | Layout and snapping for the edit mode |
| src/features/workshop/rules.ts | Hosting, slot and completion rules shared by the edit mode and the scene |
| src/features/workshop/communityAssets.ts | The registry that renders community-made item and pet geometry |
These are the only files that ship in the npm package, along with this README and the licence. The tests in tests/ do not ship; they live in the repository.
What is not here
The Workshop panels, stores, daemon, routes and wire types are not part of this package. They use the app's state, API client and design system, and the wire types are generated from the daemon. The engine only reads the wire types.
The host contract
The engine imports a few modules by relative path, so a host mirrors the CommissionAI layout. The repository holds an unpinned snapshot of each one so the engine can be typechecked and tested alone. The snapshot is not shipped and the host provides the real modules.
| Path | The engine uses | Snapshot |
| --- | --- | --- |
| src/lib/uiZoom.ts | uiZoom(): number and layoutLocal(client: number, origin: number): number, to turn pointer coordinates into layout coordinates when the app zooms its text size | exact copy |
| src/lib/releaseCheck.ts | attachReleaseCheckScene(scene), which returns a bench to report frames to, or null when no release check is running | exact copy |
| src/design/AgentMark.ts (or .tsx) | agentBrand(id: string): { name; color; ink; bg }, the label and colours of an agent | reduced to agentBrand; the real file also draws the marks |
| src/protocol/generated/index.ts | Types only: the 74 Workshop* wire types the engine reaches | pruned to those 74 types |
| src/protocol/generated/workshop*.ts | Catalog and archetype data that the tests load | exact copies, except that workshopDemoCatalog.ts drops a company name from its demo item names |
| src/features/workshop/townView.ts, src/dev/demoTown.ts | A town fixture for the tests only; the engine never imports them | exact copies |
| tests/mock.ts, tests/vitest.setup.ts | Test helpers (defined, partial) | exact copies |
The engine also needs three at 0.186.1, a DOM and WebGL at run time, and Vite's import.meta.env.MODE and DEV.
Pinned files
CommissionAI pins a copy of these paths by tree hash. Change them here, publish, then sync; a hand edit in the app fails its lint.
src/features/workshop/{scene,archetypes,sim,pets,robots,grammar,edit}src/features/workshop/rules.tsandsrc/features/workshop/communityAssets.ts- the
tests/workshop*files that run against this package: 62 test files and 4 helpers, found by name prefix inscripts/extracted.jsonin the app
Everything else under src/, tests/ and the root is this repository's own, or the host snapshot above. The other 50 workshop* tests exercise the app's panels and stores, so they stay in the app.
Develop
npm ci
npm run typecheck
npm testThe TypeScript flags are the app's: strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, noImplicitReturns and noImplicitOverride stay on. The app's lint rules apply to this source too: no comments, any, double casts or non-null assertions. Narrow instead.
Use it in CommissionAI
bash scripts/python.sh scripts/extracted.py sync workshop <checkout of this repository>License
MIT
