···11-# Agent instructions
11+# Agent guide
2233-* This project is a collection of custom elements for the web. Additionally it uses web workers and signals (using the 'alien-signals' library).
44-* The code is written in Javascript with Typescript annotations.
55-* Templates are written using the Vento templating language.
66-* Custom elements use 'lit-html' templates.
33+Before you write any code, read:
44+55+- The **why** document: `src/index.vto`
66+ (there might be a compiled version `dist/index.html`, if so prefer that)
77+- The **how** document: `docs/ARCHITECTURE.md`
88+99+1010+## Your responsibilities
1111+1212+As an agent, your job is to:
1313+- Keep the architecture described in `docs/ARCHITECTURE.md` intact.
1414+- Preserve the overall goals and constraints described in the 'why' document.
1515+1616+If you are unsure how to implement something:
1717+- Prefer a small, clean, testable implementation that matches the intent.
1818+- Do **not** invent new architecture without clear justification in comments.
+7-7
DESIGN.md
docs/ARCHITECTURE.md
···11-# Design
22-33-## Architecture
11+# Architecture
4253Diffuse provides a set of custom (DOM) elements (aka. web components) that can be combined into a working audio player or media browser living in a web view.
647588-### Components / Elements
66+## Components / Elements
97108There are various categories of these elements, and may have subcategories. Each element lives in its own directory, containing the code, documentation and other assets associated with that element. The directory for the elements is `src/components/`, each subdirectory is a category which in turn may have one or more subcategories. If a directory has an `element.js` then that directory represents the element, not a subcategory.
119···1917- The category named 'orchestrator'. These are compositions of other components, meaning they consume other components. These have attributes ending with `-selector` which is a DOM selector that points at the component that is the dependency.
2018- The category named 'configurator'. These take other components as DOM children with the same actions/methods as the configurator itself. They serve to delegate or combine.
21192020+A lot of components will have a worker (located in `worker.js` besides the `element.js`) which is connected to the element using `this.workerProxy()` in the constructor. The proxy itself may be stored on the class instance, but it is usually not required.
22212323-### Definitions
2222+2323+## Definitions
24242525`src/definitions/` are lexicons, JSON schemas that describe data in the system.
262627272828-### Themes
2828+## Themes
29293030Like orchestrator components, these are compositions of elements. Unlike orchestrators however, it doesn't compose by the use of selectors, instead we write the custom elements as HTML and use the DOM as the composition layer. Alternatively, custom elements can be created in Javascript and then added to the DOM from there.
313132323333-### Other directories
3333+## Other directories
34343535- `src/common`: Common Javascript code shared by various components and/or themes.
3636- `src/styles`: Common CSS shared by themes, the index page or constituents (part of themes).