@adobe/data-ai 0.9.84 → 0.9.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,8 @@ pure, fully-tested source of truth for the feature. Modelling everything as
10
10
  a single value keeps each transform a small, trivially-testable function of
11
11
  state: collections of entity sub-types plus scalar fields.
12
12
 
13
+ Every feature that has ECS resources or transactions owns a `State` — including
14
+ a host whose aggregate is a single scalar (`{ playing: boolean }`) or even when there is no state in which case use `{}`.
13
15
  ```ts
14
16
  // state.ts — the aggregate, plus the namespace of transforms/derivations.
15
17
  export type State = {
@@ -8,9 +8,11 @@ paths:
8
8
  The bridge that keeps the ecs implementation honest against the `data/` spec.
9
9
  **Test-only**: imported solely by `*.test.ts` and in no facet barrel, so it never
10
10
  enters the runtime bundle (test-support may import the test framework — it is not
11
- a runtime declaration). **Feature-level**: one projection per feature, reused by
12
- every transaction test and the system tick-loop test — don't nest it under
13
- `transaction-database/`.
11
+ a runtime declaration). **Never call `fromState` / `toState` (or a shared
12
+ clear-all + reinsert helper used only for that projection) from systems,
13
+ transactions, or UI** — that is a full-store rewrite, not an O(1) ECS update.
14
+ **Feature-level**: one projection per feature, reused by every transaction test
15
+ and the system tick-loop test — don't nest it under `transaction-database/`.
14
16
 
15
17
  The property, per `{ before, args, after }` case:
16
18
  `toState(apply(fromState(before), args)) ≡ spec(before, args)`.
@@ -63,9 +63,8 @@ const plugin = Database.Plugin.create({
63
63
  HUD) are notified. Reserve direct `db.store` writes for the hot per-row paths
64
64
  (movement, aging) that run on every entity every frame and shouldn't pay
65
65
  per-entity transaction overhead.
66
- - **The step math lives in `data/`.** A system is the ecs wiring: it reads store
67
- rows, calls a pure `data/` step/derive function, writes the result back — same
68
- spec↔implementation discipline as transactions. No physics/game math inline.
66
+ - **Optimize for execution speed in systems** if there are multiple items, then make sure we are using efficient store queries and reading/writing minimal data columns. If this is not hot path, then the simplified data functions can be used, but in hot paths we only consider data functions to be specification. (ie: only use them if it's clearly not a hot path or you cannot write anything more performant by directly using ecs store)
67
+ - **The step math may live in `data/`.** but only for non-hot path
69
68
  - **Iterate archetypes per `archetypes.md`.** Express selection with
70
69
  `queryArchetypes(include, { exclude })`; when a system destroys/migrates rows
71
70
  (bullets expiring, entities dying) iterate **tail → head** so hole-fills don't
@@ -96,8 +95,8 @@ const plugin = Database.Plugin.create({
96
95
  - Games or simulations with immediate mode rendering may want to store a session
97
96
  resource of the canvas and render to it within a system. @adobe/data-gpu provides
98
97
  example patterns for doing this.
99
- - All or simulation systems should be optimized for performance.
100
- Avoid allocatin intermediate objects if possible, read directly from store.
98
+ - All simulation systems should be optimized for performance.
99
+ Avoid allocating intermediate objects if possible; read/write columns directly if hot-path. You can use transactions if needed, for instance if we are writing non hot path things which we have other things observing. (Only transactions are observable, not direct writes)
101
100
 
102
101
  ## Driving the loop — the scheduler
103
102
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adobe-data-ai",
3
- "version": "0.9.84",
3
+ "version": "0.9.86",
4
4
  "description": "Architecture skills for @adobe/data — data-oriented modelling, archetype iteration, hot-path performance, and related conventions.",
5
5
  "author": {
6
6
  "name": "Adobe"
package/README.md CHANGED
@@ -18,15 +18,22 @@ It installs two things:
18
18
 
19
19
  ## Install — Claude Code
20
20
 
21
- Skills load as a marketplace plugin; rules install into the project.
21
+ Skills load as a marketplace plugin; rules install into the project. Run these
22
+ three from a shell (agent-runnable):
22
23
 
23
24
  ```
24
- /plugin marketplace add adobe/data
25
- /plugin install adobe-data-ai@adobe-data-skills
25
+ claude plugin marketplace add adobe/data --scope project
26
+ claude plugin install adobe-data-ai@adobe-data-skills --scope project
26
27
  npx @adobe/data-ai@latest install
27
28
  ```
28
29
 
29
- - Skills → the `adobe-data-ai` plugin. **Update:** `/plugin` → update `adobe-data-ai`.
30
+ In an interactive Claude session you can instead use the slash-command form of
31
+ the first two — `/plugin marketplace add adobe/data` then
32
+ `/plugin install adobe-data-ai@adobe-data-skills` — but an agent driving a shell
33
+ should use the `claude plugin …` commands above (slash commands aren't
34
+ shell-runnable).
35
+
36
+ - Skills → the `adobe-data-ai` plugin. **Update:** `claude plugin update adobe-data-ai`.
30
37
  - Rules → `.claude/rules/adobe-data-ai/`. **Update:** re-run `npx @adobe/data-ai@latest install`.
31
38
 
32
39
  ## Install — Cursor (and Codex / other `.agents` agents)
@@ -58,3 +65,16 @@ by name when you want a single phase or a specialized flow: `build-data`,
58
65
  `build-ui`, `build-app-entry`; plus `build-game`, `meta-build` (phase-by-phase
59
66
  in subagents), `review` (audit output against the rules), and `structure`
60
67
  (reason about layout).
68
+
69
+ ## One-liner: install + build an app
70
+
71
+ Paste one of these into a shell, replacing the quoted text with your own app
72
+ description. It installs the bundle, then runs `build-application` headlessly on
73
+ your prompt.
74
+
75
+ This presumes you are already running the agent within the directory you want to use as your project root.
76
+
77
+ ```
78
+ Find the @adobe/data-ai package on npmjs and then install it in the current directory.
79
+ Next use it's /build-application skill to build <promt here>
80
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data-ai",
3
- "version": "0.9.84",
3
+ "version": "0.9.86",
4
4
  "description": "Cross-agent architecture skills for @adobe/data — installable as a Claude Code plugin or copied into any Agent-Skills-compatible agent (Cursor, Codex).",
5
5
  "type": "module",
6
6
  "private": false,
@@ -29,12 +29,12 @@
29
29
  "skills"
30
30
  ],
31
31
  "peerDependencies": {
32
- "@adobe/data": "0.9.84"
32
+ "@adobe/data": "0.9.86"
33
33
  },
34
34
  "devDependencies": {
35
35
  "typescript": "^5.8.3",
36
36
  "vitest": "^1.6.0",
37
- "@adobe/data": "0.9.84"
37
+ "@adobe/data": "0.9.86"
38
38
  },
39
39
  "license": "MIT",
40
40
  "scripts": {
@@ -1,10 +1,12 @@
1
1
  ---
2
2
  name: build-actions
3
- description: Build a feature's ecs action-database — async orchestration over services and transactions. If the feature has async flows.
3
+ description: Build a feature's ecs action-database — async orchestration over services and transactions. If the feature has async flows or side effects outside of the main store.
4
4
  input: feature
5
5
  output: feature
6
6
  ---
7
7
 
8
+ Skip if this feature doesn't contain or require actions.
9
+
8
10
  Create `ecs/action-database/`: `action-database.ts` (extends `ServiceDatabase`, adds `actions`
9
11
  from `./actions/index.js`) plus an `actions/` folder — one async orchestrator per file. An action
10
12
  takes `db: ServiceDatabase`, awaits `services/` ports, then commits **exactly one** transaction.
@@ -5,6 +5,8 @@ input: app
5
5
  output: app
6
6
  ---
7
7
 
8
- /build-feature (base — features/main)
9
- |> /build-feature (each peer feature)
10
- |> /build-app-entry
8
+ /graph-execute
9
+ /build-feature (base — features/main)
10
+ for each sub feature
11
+ /build-feature
12
+ /build-app-entry
@@ -5,6 +5,8 @@ input: feature
5
5
  output: feature
6
6
  ---
7
7
 
8
+ Skip if this feature doesn't contain or require computed values.
9
+
8
10
  Create `ecs/computed-database/`: `computed-database.ts` (extends the previous layer, adds
9
11
  `computed` from `./computed/index.js`) plus a `computed/` folder — one `cached` derived value
10
12
  per file + barrel. Derivation logic lives in `data/`; a computed only wires a db observable to it.
@@ -11,6 +11,10 @@ and other `data/` declarations):
11
11
  - one namespace folder per data type — `<type>/{<type>.ts, schema.ts, public.ts, <helper>.ts}`;
12
12
  - `data/state/` — the `State` aggregate plus its pure transforms/derivations.
13
13
 
14
+ **Always create `data/state/`** — even for a shell feature whose only field is a
15
+ boolean or enum. A feature with ECS resources/transactions but no `State` is
16
+ incomplete: the transaction must wrap a pure transform, not invent the logic. In rare circumstances, there may be no real state in a feature in which case the state type = {}
17
+
14
18
  The schema is the single source of truth; the type derives from it (`Schema.ToType`).
15
19
  Helpers are pure and unit-tested. Run this first — every other layer imports `data/`.
16
20
 
@@ -1,21 +1,18 @@
1
1
  ---
2
2
  name: build-feature
3
- description: Build a complete feature by piping the per-layer build-* skills bottom-up.
3
+ description: Build a complete feature step by step
4
4
  input: feature
5
5
  output: feature
6
6
  ---
7
7
 
8
- /build-data
9
- |> /build-services
10
- |> /build-core-database
11
- |> /build-indexes
12
- |> /build-transactions
13
- |> /build-computed
14
- |> /build-systems
15
- |> /build-service-database
16
- |> /build-actions
17
- |> /build-ui
18
-
19
- Run with /x-execute. Each step is a no-op for a layer the feature doesn't use
20
- (`build-systems` only for real-time features; `build-services` / `build-service-database` /
21
- `build-actions` only when the feature has async flows).
8
+ /graph-execute
9
+ /build-data
10
+ /build-services
11
+ /build-core-database
12
+ /build-indexes
13
+ /build-transactions
14
+ /build-computed
15
+ /build-service-database
16
+ /build-actions
17
+ /build-systems
18
+ /build-ui
@@ -15,5 +15,7 @@ transactions = moves/spawns, computed = score/status/winner, ui = view + input.
15
15
  (see data-lit-tictactoe).
16
16
  - **Real-time** adds the `build-systems` phase: a per-frame tick loop (movement,
17
17
  collision, lifetime) driven by the scheduler, over many entities in distinct
18
- archetypes. This is where components, archetypes, indexes, and systems all
19
- carry real weight — see `features/ecs/systems.md`.
18
+ archetypes. Systems must stay O(1) per touched entity — never project the whole
19
+ `State` into/out of the store each frame (see `features/ecs/systems.md`).
20
+ This is where components, archetypes, indexes, and systems all carry real
21
+ weight.
@@ -5,6 +5,8 @@ input: feature
5
5
  output: feature
6
6
  ---
7
7
 
8
+ Skip if this feature doesn't contain or require indexes.
9
+
8
10
  Create `ecs/index-database/`: `index-database.ts` (extends `CoreDatabase`, adds the `indexes`
9
11
  facet from `./indexes/index.js`) plus an `indexes/` folder — one index per file + an `index.ts`
10
12
  barrel.
@@ -5,6 +5,8 @@ input: feature
5
5
  output: feature
6
6
  ---
7
7
 
8
+ Skip if this feature doesn't contain or require services.
9
+
8
10
  Create the feature's `services/` layer: one `<name>-service/` namespace folder per async
9
11
  contract — an `interface` (validated with `AsyncDataService.IsValid`), async-only members,
10
12
  and `create*` factories.
@@ -5,6 +5,9 @@ input: feature
5
5
  output: feature
6
6
  ---
7
7
 
8
+ Skip if this feature doesn't contain or require systems.
9
+ Most games that use a canvas will use systems but most applications will not.
10
+
8
11
  Create `ecs/system-database/system-database.ts`: `Database.Plugin.create({ extends:
9
12
  Database.Plugin.combine(ComputedDatabase.plugin, scheduler), systems })` where the `systems`
10
13
  map is declared **inline** (see `features/ecs/systems.md` — inline is required for `db` to be
@@ -14,9 +17,6 @@ per-frame body helpers).
14
17
  - A system is a `SystemDeclaration`: `{ create, schedule?: { before?, after?, during? } }`.
15
18
  `create(db)` runs once (capture queries / index handles / closures); the returned function
16
19
  advances the world one tick. Return `void` for an init-only system (seeding entities).
17
- - The step math lives in `data/`; each system reads store rows, calls the pure `data/` step,
18
- writes back — via `db.store` (writable) for hot per-row work, or `db.transactions.*` for
19
- discrete events. Iterate archetypes per `archetypes.md` (tail→head when destroying rows).
20
20
  - Order under `schedule` (mirror the `data/` step's internal sequence); drive the loop by
21
21
  combining `scheduler` (rAF), gated by the `schedulerState` resource.
22
22
 
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: graph-execute
3
+ description: executes a graph of steps
4
+ input: piped function calls
5
+ ---
6
+
7
+ The input is a set of piped function calls where each call is represented by a slash skill invocation.
8
+
9
+ Each step must be completed independently before moving on to the next.
10
+
11
+ The output of each phase is generally either a returned result or written to the file system. You can pass some context including any previous result to the next phase, but you must never read the subsequent phases in advance.
12
+
13
+ Call each of these phases in a subagent so that they are not even aware that future phases will take place.