@air-jam/cli 0.9.3 → 1.0.0-beta.10

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.
Files changed (99) hide show
  1. package/README.md +128 -0
  2. package/dist/auth-profile.d.ts +5 -0
  3. package/dist/auth-profile.js +7 -0
  4. package/dist/auth-profile.js.map +1 -0
  5. package/dist/auth-sessions.d.ts +5 -0
  6. package/dist/auth-sessions.js +7 -0
  7. package/dist/auth-sessions.js.map +1 -0
  8. package/dist/chunk-7D4AYBAV.js +64 -0
  9. package/dist/chunk-7D4AYBAV.js.map +1 -0
  10. package/dist/chunk-LH7UO57C.js +23 -0
  11. package/dist/chunk-LH7UO57C.js.map +1 -0
  12. package/dist/chunk-PKTLVQXZ.js +82 -0
  13. package/dist/chunk-PKTLVQXZ.js.map +1 -0
  14. package/dist/chunk-SQE4NPZP.js +31 -0
  15. package/dist/chunk-SQE4NPZP.js.map +1 -0
  16. package/dist/{chunk-A4V2N4LX.js → chunk-U6V3HEBB.js} +6 -5
  17. package/dist/chunk-U6V3HEBB.js.map +1 -0
  18. package/dist/chunk-VEHNFPEO.js +224 -0
  19. package/dist/chunk-VEHNFPEO.js.map +1 -0
  20. package/dist/development.d.ts +4 -0
  21. package/dist/development.js +1 -1
  22. package/dist/game-analytics.d.ts +5 -0
  23. package/dist/game-analytics.js +7 -0
  24. package/dist/game-analytics.js.map +1 -0
  25. package/dist/game-app-id.d.ts +5 -0
  26. package/dist/game-app-id.js +7 -0
  27. package/dist/game-app-id.js.map +1 -0
  28. package/dist/game-media.d.ts +5 -0
  29. package/dist/game-media.js +7 -0
  30. package/dist/game-media.js.map +1 -0
  31. package/dist/index.js +688 -404
  32. package/dist/index.js.map +1 -1
  33. package/dist/scaffold.d.ts +8 -1
  34. package/dist/scaffold.js +6 -1
  35. package/dist/scaffold.js.map +1 -1
  36. package/package.json +8 -4
  37. package/runtime/local-network.d.mts +4 -6
  38. package/runtime/public-assets.mjs +62 -0
  39. package/runtime/source-fence.mjs +182 -0
  40. package/runtime/vite-config.d.mts +2 -1
  41. package/runtime/vite-config.mjs +6 -2
  42. package/runtime/vite-dev.mjs +18 -0
  43. package/runtime/vite-https.mjs +2 -3
  44. package/template-assets/bootstrap/AGENTS.md +56 -14
  45. package/template-assets/bootstrap/CLAUDE.md +0 -8
  46. package/template-assets/bootstrap/skills/airjam-mcp/SKILL.md +44 -0
  47. package/template-assets/bootstrap/skills/controller-ui/SKILL.md +2 -0
  48. package/template-assets/bootstrap/skills/game-architecture/SKILL.md +47 -3
  49. package/template-assets/bootstrap/skills/index.md +1 -1
  50. package/template-assets/bootstrap/skills/prefab-authoring/SKILL.md +10 -0
  51. package/template-assets/bootstrap/skills/r3f-3d-scene/SKILL.md +10 -0
  52. package/template-assets/documentation/for-agents/controller-ui/page.mdx +41 -2
  53. package/template-assets/documentation/for-agents/page.mdx +24 -2
  54. package/template-assets/documentation/for-agents/project-structure/page.mdx +0 -2
  55. package/template-assets/documentation/for-agents/state-and-rendering/page.mdx +19 -2
  56. package/template-assets/documentation/for-agents/supported-agents/page.mdx +18 -0
  57. package/template-assets/documentation/getting-started/debugging/page.mdx +7 -8
  58. package/template-assets/documentation/getting-started/dev-logs/page.mdx +0 -2
  59. package/template-assets/documentation/getting-started/game-ideas/page.mdx +1 -3
  60. package/template-assets/documentation/getting-started/introduction/page.mdx +71 -54
  61. package/template-assets/documentation/getting-started/migrating-legacy-games/page.mdx +308 -62
  62. package/template-assets/documentation/getting-started/quick-start/page.mdx +56 -79
  63. package/template-assets/documentation/how-it-works/architecture/page.mdx +91 -50
  64. package/template-assets/documentation/how-it-works/host-system/page.mdx +112 -109
  65. package/template-assets/documentation/manifest.json +112 -42
  66. package/template-assets/documentation/sdk/assets-and-theme/page.mdx +185 -0
  67. package/template-assets/documentation/sdk/hooks/page.mdx +108 -172
  68. package/template-assets/documentation/sdk/input-system/page.mdx +201 -231
  69. package/template-assets/documentation/sdk/networked-state/page.mdx +134 -52
  70. package/template-assets/documentation/sdk/settings/page.mdx +166 -0
  71. package/template-assets/documentation/sdk/ui-components/page.mdx +38 -27
  72. package/template-assets/managed/.airjam/ai-pack.json +65 -47
  73. package/template-assets/managed/docs/airjam/agent-gold-path.md +55 -7
  74. package/template-assets/managed/docs/airjam/agent-mcp.md +44 -0
  75. package/template-assets/managed/docs/airjam/composition-shell-contract.md +4 -0
  76. package/template-assets/managed/docs/airjam/debug-and-testing.md +18 -0
  77. package/template-assets/managed/docs/airjam/docs-index.md +18 -12
  78. package/template-assets/managed/docs/airjam/generated/architecture.md +91 -46
  79. package/template-assets/managed/docs/airjam/generated/assets-and-theme.md +188 -0
  80. package/template-assets/managed/docs/airjam/generated/controller-ui.md +41 -0
  81. package/template-assets/managed/docs/airjam/generated/debugging-and-logs.md +7 -6
  82. package/template-assets/managed/docs/airjam/generated/for-agents.md +24 -0
  83. package/template-assets/managed/docs/airjam/generated/game-ideas.md +1 -1
  84. package/template-assets/managed/docs/airjam/generated/host-system.md +112 -102
  85. package/template-assets/managed/docs/airjam/generated/input-system.md +199 -218
  86. package/template-assets/managed/docs/airjam/generated/introduction.md +71 -51
  87. package/template-assets/managed/docs/airjam/generated/migrating-legacy-games.md +308 -60
  88. package/template-assets/managed/docs/airjam/generated/networked-state.md +134 -50
  89. package/template-assets/managed/docs/airjam/generated/quick-start.md +56 -79
  90. package/template-assets/managed/docs/airjam/generated/sdk-hooks.md +108 -167
  91. package/template-assets/managed/docs/airjam/generated/settings.md +169 -0
  92. package/template-assets/managed/docs/airjam/generated/state-and-rendering.md +19 -0
  93. package/template-assets/managed/docs/airjam/generated/supported-agents.md +21 -0
  94. package/template-assets/managed/docs/airjam/generated/ui-components.md +38 -25
  95. package/template-assets/managed/docs/airjam/prefab-authoring.md +100 -0
  96. package/template-assets/managed/docs/airjam/preview-controllers.md +5 -2
  97. package/template-assets/managed/docs/airjam/r3f-3d-scene.md +66 -0
  98. package/template-assets/managed/docs/airjam/state-lanes-cookbook.md +15 -20
  99. package/dist/chunk-A4V2N4LX.js.map +0 -1
@@ -15,14 +15,14 @@
15
15
  {
16
16
  "path": "docs/airjam/agent-gold-path.md",
17
17
  "kind": "docs-local",
18
- "size": 5018,
19
- "sha256": "8419951ad3a1e92fed5b7c3714b0908c6e6bed3d661041d5692ee38337888dcd"
18
+ "size": 8394,
19
+ "sha256": "30cc7eb97cf1177dbb56fed6d5ab1b0723809236b65dfd531ed7bf7de2eaa185"
20
20
  },
21
21
  {
22
22
  "path": "docs/airjam/agent-mcp.md",
23
23
  "kind": "docs-local",
24
- "size": 7245,
25
- "sha256": "c878e2eebfbbc927dfce5548c0d7a4163feffd3965a82c8c5dc38a9ec385c42b"
24
+ "size": 9889,
25
+ "sha256": "1e712de9c1e758acf5c0d509726b87c39d18446ef22c718d117d6ff431b29e72"
26
26
  },
27
27
  {
28
28
  "path": "docs/airjam/canvas-2d-gameplay.md",
@@ -33,14 +33,14 @@
33
33
  {
34
34
  "path": "docs/airjam/composition-shell-contract.md",
35
35
  "kind": "docs-local",
36
- "size": 2666,
37
- "sha256": "91bf49cb98f3b94cabd145d960a9562786e73c029b3955904ef45a8f8bf71a06"
36
+ "size": 2891,
37
+ "sha256": "b67412d3fb3563ea3b20fc32fceaaa25759752b611fe05864c1b938eec4d23cc"
38
38
  },
39
39
  {
40
40
  "path": "docs/airjam/debug-and-testing.md",
41
41
  "kind": "docs-local",
42
- "size": 2889,
43
- "sha256": "65adf52e5cdcf0648ab56af1c0b639e30cf93495a85e2971b83168b571db97af"
42
+ "size": 3997,
43
+ "sha256": "efe08e5221067069d649605ed64ce7544453ddfcd3055b68c30bd07eb63c6afb"
44
44
  },
45
45
  {
46
46
  "path": "docs/airjam/development-loop.md",
@@ -51,68 +51,74 @@
51
51
  {
52
52
  "path": "docs/airjam/docs-index.md",
53
53
  "kind": "docs-local",
54
- "size": 2392,
55
- "sha256": "35c70672b7401b4f1e14abd8a88d9b50ecb8925b39245072474ac4fa88d27fb2"
54
+ "size": 2716,
55
+ "sha256": "b6c3be3b0aa221adafa4ad8245b5854ab043e8d6d8cd268abd9bb3bbecfbe4a6"
56
56
  },
57
57
  {
58
58
  "path": "docs/airjam/generated/architecture.md",
59
59
  "kind": "docs-generated",
60
- "size": 7115,
61
- "sha256": "1cbd763c55f77bc4bd0fb00605fd718daa63b8638c17313d12a1468f508fdf73"
60
+ "size": 12249,
61
+ "sha256": "6fd0abd0ddbf07ea7e9ae113ef7792cccdfc43c7b78496759fe1ccfb4df1d4ca"
62
+ },
63
+ {
64
+ "path": "docs/airjam/generated/assets-and-theme.md",
65
+ "kind": "docs-generated",
66
+ "size": 7617,
67
+ "sha256": "472c18703bd9a085ba3b0cf5d2726579c7c729070e01894093e49f9f6a5c7e54"
62
68
  },
63
69
  {
64
70
  "path": "docs/airjam/generated/controller-ui.md",
65
71
  "kind": "docs-generated",
66
- "size": 1578,
67
- "sha256": "fd54779b68ecffc359d29fad15a1bf17f965a2f8dd0602fbe3700a3237f906e2"
72
+ "size": 4722,
73
+ "sha256": "3f2c6ae3f7f012974f5eea1fbb0b136450edc86d5eee829b32bbcce858786dc7"
68
74
  },
69
75
  {
70
76
  "path": "docs/airjam/generated/debugging-and-logs.md",
71
77
  "kind": "docs-generated",
72
- "size": 4575,
73
- "sha256": "7998e1427b96d162986c193d32f30a97d35f92346c8d50a0a8b77019fb738897"
78
+ "size": 4698,
79
+ "sha256": "a5f8e4baf46ba5847db7be750d6cd3e9b207dd3b7243960b30a5e649a7a475b5"
74
80
  },
75
81
  {
76
82
  "path": "docs/airjam/generated/for-agents.md",
77
83
  "kind": "docs-generated",
78
- "size": 3916,
79
- "sha256": "fca62f1760b114bc62c6afa981da0107abafce7ce251adc3e38ae4d35b68432e"
84
+ "size": 5338,
85
+ "sha256": "9d856e6e5f4e914ec0c5870a6a31e6ba78916a4a12664a52f3d14f1715a96e67"
80
86
  },
81
87
  {
82
88
  "path": "docs/airjam/generated/game-ideas.md",
83
89
  "kind": "docs-generated",
84
- "size": 3034,
85
- "sha256": "e7ac9abc839ab21544e0cfa0075d353591cb277d5dbd65b121010c965e90f62e"
90
+ "size": 3042,
91
+ "sha256": "19560b89a8f6000855bf24add080983349bce78802e846a17f1b56c6e8c3d010"
86
92
  },
87
93
  {
88
94
  "path": "docs/airjam/generated/host-system.md",
89
95
  "kind": "docs-generated",
90
- "size": 9618,
91
- "sha256": "38561068538f6cd69bd8aa43d022bba6eee1eb6a635933d9d738ff305620ce8a"
96
+ "size": 9945,
97
+ "sha256": "c85a8d05570fbc71cbd7cf5771e75a2f8415b4eb034462a45c30db3ca97ced31"
92
98
  },
93
99
  {
94
100
  "path": "docs/airjam/generated/input-system.md",
95
101
  "kind": "docs-generated",
96
- "size": 6024,
97
- "sha256": "86395f226fc78c13eee4632998f60911d487739a027f82858371c8d233d4932f"
102
+ "size": 10486,
103
+ "sha256": "59076307117a834d830d2c1d7d06d9dd446a4117ccf38883ff9d08adb67e44c4"
98
104
  },
99
105
  {
100
106
  "path": "docs/airjam/generated/introduction.md",
101
107
  "kind": "docs-generated",
102
- "size": 5194,
103
- "sha256": "f6b2220d39b2a72e736f0f757ba01c948f09ae9063c98c202ec5bbe9ec749d58"
108
+ "size": 6004,
109
+ "sha256": "a5330d035f1a2bbc1c51cfe5b9d3ac6efdafc28cda31435b94f64495e962cd48"
104
110
  },
105
111
  {
106
112
  "path": "docs/airjam/generated/migrating-legacy-games.md",
107
113
  "kind": "docs-generated",
108
- "size": 11763,
109
- "sha256": "dadd93324cd6a1543f4d86124b44f6c7eb84333ae476a1d2026318e19ebeacdf"
114
+ "size": 31510,
115
+ "sha256": "372390766ea2b59606bbc1d727b2a115aaa9e3c3c232cf9d588b69e7abdfb7ed"
110
116
  },
111
117
  {
112
118
  "path": "docs/airjam/generated/networked-state.md",
113
119
  "kind": "docs-generated",
114
- "size": 7057,
115
- "sha256": "f6e8a0d752bc6a2a8bef82e9a4e9552f4f23e46e3d3dedacd4ac03076c4b0cb9"
120
+ "size": 10906,
121
+ "sha256": "5280e52df3cf817e925a613b2c375ab55e09df828011a71f3d6e0b402c57d01e"
116
122
  },
117
123
  {
118
124
  "path": "docs/airjam/generated/project-structure.md",
@@ -123,26 +129,38 @@
123
129
  {
124
130
  "path": "docs/airjam/generated/quick-start.md",
125
131
  "kind": "docs-generated",
126
- "size": 12468,
127
- "sha256": "52b9bdf13249976162d266ed895a606e4ff5df34749cf97c51357f9efdb52d08"
132
+ "size": 12777,
133
+ "sha256": "f8cd52e60a4f40e613f692d6d8f60c0817238c1b44b9db35959bc9f4958521d1"
128
134
  },
129
135
  {
130
136
  "path": "docs/airjam/generated/sdk-hooks.md",
131
137
  "kind": "docs-generated",
132
- "size": 16017,
133
- "sha256": "0697f9d3db87814784ab7919f41d40d2d8b0c399e98e0ac165ef8649052e0362"
138
+ "size": 16229,
139
+ "sha256": "275112a40a608a51588158931d9fb9b2496001ff4ba3b822d99f40ab0daa6bfb"
140
+ },
141
+ {
142
+ "path": "docs/airjam/generated/settings.md",
143
+ "kind": "docs-generated",
144
+ "size": 6969,
145
+ "sha256": "4efa779c48aa0701be630bb71a6bce1703525b670e84d0344c3c6376ceca9009"
134
146
  },
135
147
  {
136
148
  "path": "docs/airjam/generated/state-and-rendering.md",
137
149
  "kind": "docs-generated",
138
- "size": 3176,
139
- "sha256": "c9e52a44c5f865db217a5bb538d0ee64b82ef342c78bc85acc830c488e3c8198"
150
+ "size": 4136,
151
+ "sha256": "d62521b4bab84c3292b780255b72ab559fcdd7652ef431909e71db72d7735bf0"
152
+ },
153
+ {
154
+ "path": "docs/airjam/generated/supported-agents.md",
155
+ "kind": "docs-generated",
156
+ "size": 1492,
157
+ "sha256": "2452bf09b3b75ea9c34437e4df8bac6e58813049600c6a2e036cae312705372d"
140
158
  },
141
159
  {
142
160
  "path": "docs/airjam/generated/ui-components.md",
143
161
  "kind": "docs-generated",
144
- "size": 5410,
145
- "sha256": "4f01e900e2a2abdded844b3ba71ff872a277aeff3a425b359496a65bddd1301f"
162
+ "size": 6660,
163
+ "sha256": "deb0b2a40901dd29e40bd8c7aa6bbf8e447e09385b84e476cce098e5ce1c5cfc"
146
164
  },
147
165
  {
148
166
  "path": "docs/airjam/generated/unified-dev-logs.md",
@@ -159,26 +177,26 @@
159
177
  {
160
178
  "path": "docs/airjam/prefab-authoring.md",
161
179
  "kind": "docs-local",
162
- "size": 2887,
163
- "sha256": "0383338b0e68386433bc1847a6e2191fe6ce580625431d6332d11da6241ea92c"
180
+ "size": 6916,
181
+ "sha256": "4abedb9d6241011b115503b26c59579340f954a6d4480069f304b4ff857f501a"
164
182
  },
165
183
  {
166
184
  "path": "docs/airjam/preview-controllers.md",
167
185
  "kind": "docs-local",
168
- "size": 4464,
169
- "sha256": "d1189e966a7891abc265793d264a201b0cf8c56902342697999c70356f18cac5"
186
+ "size": 4812,
187
+ "sha256": "24f60c5fd41d25b12cdcef99d64a995b89e4266ee6b4378d56a8057e9386b5bc"
170
188
  },
171
189
  {
172
190
  "path": "docs/airjam/r3f-3d-scene.md",
173
191
  "kind": "docs-local",
174
- "size": 2979,
175
- "sha256": "7142a7e1a513f3a43a0838b48daf85cca9780ffca58f34db50c06a24a56176d0"
192
+ "size": 5610,
193
+ "sha256": "1768ec9fe9279081d978f1ce8e146532f7d3ff50b30fdac8c309ead3f9ac48ae"
176
194
  },
177
195
  {
178
196
  "path": "docs/airjam/state-lanes-cookbook.md",
179
197
  "kind": "docs-local",
180
- "size": 3206,
181
- "sha256": "5dde111762f1071ef5e7fc23ffe1adac07454662ad8dced7a42a8d40e4f6150b"
198
+ "size": 3476,
199
+ "sha256": "6d7f8550fa5a80cedd94d8ba4bafd93c0ab4e8ef74b500eaaf44fdaa9052b9e8"
182
200
  },
183
201
  {
184
202
  "path": "docs/airjam/visual-system.md",
@@ -187,5 +205,5 @@
187
205
  "sha256": "0eaa064c38b4568c200fbf5cadb96f16c7c738a29469c4c955fb1ac5f8077edf"
188
206
  }
189
207
  ],
190
- "contentDigest": "d5e870a50333e7ce47e53aad9348a78c0e9bf5a7337ca0287991778cb704c835"
208
+ "contentDigest": "153337331e5a84a9cd56a9c56b06d02a0bd26d24df2e074996c05799c69aa4ae"
191
209
  }
@@ -32,7 +32,10 @@ This is the shortest correct workflow for building and testing an Air Jam game.
32
32
  ## Canonical Files
33
33
 
34
34
  `src/airjam.config.ts`
35
- : Declares the runtime, metadata, controller path, and semantic game contract.
35
+ : Exports `airjam = defineAirJamGame(...)` from `@air-jam/sdk/core`: metadata, stores, simulation, input, bindings, controller path, agent and testing path. The entire graph stays free of React, the SDK root, TSX and CSS.
36
+
37
+ `src/app.tsx`
38
+ : Binds the declaration with `createAirJamApp(airjam, { runtime })` and mounts its Host and Controller.
36
39
 
37
40
  `src/game/contracts/agent.ts`
38
41
  : Owns the semantic agent contract. Keep snapshot projection and semantic actions here.
@@ -43,17 +46,18 @@ This is the shortest correct workflow for building and testing an Air Jam game.
43
46
  2. `host:*` actions are deterministic semantic host actions. Define them with `agentAction.host(...)` when the game needs precise host staging or reset verbs for testing, visual proof, or controlled setup.
44
47
  3. Store action dispatch returns an acknowledgement. Check it when outcome matters.
45
48
  4. For `airjam.invoke_game_session_action`, prefer the returned normalized `outcome` over guessing from the raw acknowledgement alone. A missing host acknowledgement with observed committed state change is still a meaningful success signal, not an automatic rejection.
46
- 5. `ctx.actorId` always means the dispatcher. If host code dispatches with `useStore.useActions()`, then `ctx.actorId` is the host.
47
- 6. If host code intentionally needs to run the same semantic player action as controller `X`, use `useStore.asPlayer("X")` explicitly.
48
- 7. If a store action needs a host-only local side effect like audio, sim refs, or one-shot UI effects, use `useStore.useHostActionListener(...)` instead of replicated queue-and-drain state.
49
+ 5. `ctx.actorId` always means the dispatcher. If host code dispatches with `gameStore.actions`, then `ctx.actorId` is the host.
50
+ 6. If host code intentionally needs to run the same semantic player action as controller `X`, use `gameStore.asPlayer("X")` explicitly.
51
+ 7. If a store action needs a host-only local side effect like audio, sim refs, or one-shot UI effects, use `useHostActionListener(gameStore, ...)` instead of replicated queue-and-drain state.
49
52
  8. `resultDescription` is documentation for agents and humans about the expected semantic effect. It does not automatically become runtime result data.
50
53
  9. If an action must return actual runtime result data, return `acceptAirJamAction(result)` from the store action and read the acknowledgement/result separately.
51
- 10. For host gameplay loops, prefer `useHostTick(...)` over hand-rolled `requestAnimationFrame` or `setInterval` loops unless you have a documented reason not to.
54
+ 10. Put per-step gameplay in a declared simulation (`defineAirJamSimulation`, declared with `defineAirJamGame({ simulation })`): step it with game time and `random` from its context, declare what agents see with `observe`, and draw it with `useSimulationFrame`. Never hand-roll `requestAnimationFrame` or `setInterval` gameplay loops.
55
+ 11. Store actions read time as `ctx.now` (game time), never `Date.now()`. Timers and deadlines are checked by the simulation; phones show values the host writes to the store, such as whole seconds left.
52
56
 
53
57
  ## Import Rules
54
58
 
55
- 1. Browser/runtime code imports runtime symbols from the normal Air Jam packages used by the template.
56
- 2. If you need imperative live replicated state in React-owned agent code, use `useStore.useLiveStateRef()`.
59
+ 1. Store definitions and simulations import from `@air-jam/sdk/core`, the framework-free runtime; components and hooks import from `@air-jam/sdk`, its React binding. The core imports no React, so the same game logic runs headless.
60
+ 2. Read live replicated state outside rendering with `gameStore.getState()`.
57
61
 
58
62
  ## Browser + MCP Pairing
59
63
 
@@ -65,3 +69,47 @@ This is the shortest correct workflow for building and testing an Air Jam game.
65
69
  6. Use visible preview controllers for UI smoke proof with real browser click/drag/release gestures.
66
70
  7. Do not synthesize pointer events into controller iframes from parent-page eval; use semantic game actions when reliable gameplay proof matters.
67
71
  8. If the agent environment cannot launch a browser, capture the existing room's canonical host and controller views through `airjam.capture_game_session_visuals`; do not start an unrelated browser or room.
72
+
73
+ ## One game declaration
74
+
75
+ Read `airjam.inspect_game` for the versioned `declaration`, including
76
+ `declaration.agent`, controls, controller path and metadata. The game's
77
+ `src/airjam.config.ts` exports `airjam = defineAirJamGame(...)` from
78
+ `@air-jam/sdk/core`; agent helpers also come from core. Keep React, the SDK
79
+ root, TSX and CSS out of its graph. `app.tsx` alone binds it with
80
+ `createAirJamApp(airjam, { runtime })`.
81
+
82
+ Capacity comes from `metadata.maxPlayers`. The `testing` path names a module
83
+ exporting `testing = defineAirJamTesting({ player, profiles, visual })` from
84
+ `@air-jam/devtools/testing`. Profiles author scripted policies only; a declared
85
+ player is offered as the reserved `model` policy in every profile. Optional
86
+ `visual.scenarios` uses the game's declared agent. A profile's `setup` brings
87
+ the room to where its test starts; its `handBack` returns the creator's room,
88
+ usually with `return_to_lobby`, once the test ends and before its players
89
+ leave, so the game never plays on without them. Profiles that join play already
90
+ under way hand it back too. Declare `handBack: []` only when the game has no
91
+ phase to leave, such as a shared counter; a missing one is reported as
92
+ `undeclared` in the run record. Do not duplicate identity in template flags or read config source with
93
+ regular expressions.
94
+
95
+ ## Declared settings
96
+
97
+ Declare creator tuning values with `defineAirJamSettings` and `setting` from
98
+ `@air-jam/sdk/core`, in the game declaration's `settings` field. Remove the
99
+ constants they replace. Read values in simulation create/step/observe contexts
100
+ and typed action contexts; host rendering uses `useAirJamSettings`. Controllers
101
+ show copies in replicated state. Lobby player choices stay store state.
102
+
103
+ Inspect descriptors in `airjam.inspect_game` → `declaration.settings`.
104
+ Use `airjam.read_game_settings({ gameSessionId })` for live values and revision,
105
+ then `airjam.update_game_settings({ gameSessionId, patch, expectedRevision })`
106
+ under host authority. Only `live: true` values can change; non-live values go
107
+ in `airjam.start_game_run({ settings, ... })` for a fresh room. Stale revisions
108
+ require a fresh read. Input log version 2 records initial values and ordered
109
+ settings updates for replay. See `docs/airjam/generated/settings.md`.
110
+
111
+ Declared assets and theme are read through `airjam.inspect_game` in
112
+ `declaration.assets` and `declaration.theme`. Keep sounds, images and loaded
113
+ files in `defineAirJamAssets`, colours and font families in `defineAirJamTheme`,
114
+ and pass both to `defineAirJamGame`. The React binding owns audio mounts and
115
+ theme CSS variables; games consume the declared objects and never duplicate them.
@@ -133,3 +133,47 @@ Before finishing meaningful work:
133
133
  The MCP config is project-local and scaffolded by default.
134
134
 
135
135
  Do not mutate global client configuration unless you explicitly mean to.
136
+
137
+ ## One game declaration
138
+
139
+ Read `airjam.inspect_game` for the versioned `declaration`, including
140
+ `declaration.agent`, controls, controller path and metadata. The game's
141
+ `src/airjam.config.ts` exports `airjam = defineAirJamGame(...)` from
142
+ `@air-jam/sdk/core`; agent helpers also come from core. Keep React, the SDK
143
+ root, TSX and CSS out of its graph. `app.tsx` alone binds it with
144
+ `createAirJamApp(airjam, { runtime })`.
145
+
146
+ Capacity comes from `metadata.maxPlayers`. The `testing` path names a module
147
+ exporting `testing = defineAirJamTesting({ player, profiles, visual })` from
148
+ `@air-jam/devtools/testing`. Profiles author scripted policies only; a declared
149
+ player is offered as the reserved `model` policy in every profile. Optional
150
+ `visual.scenarios` uses the game's declared agent. A profile's `setup` brings
151
+ the room to where its test starts; its `handBack` returns the creator's room,
152
+ usually with `return_to_lobby`, once the test ends and before its players
153
+ leave, so the game never plays on without them. Profiles that join play already
154
+ under way hand it back too. Declare `handBack: []` only when the game has no
155
+ phase to leave, such as a shared counter; a missing one is reported as
156
+ `undeclared` in the run record. Do not duplicate identity in template flags or read config source with
157
+ regular expressions.
158
+
159
+ ## Declared settings
160
+
161
+ Declare creator tuning values with `defineAirJamSettings` and `setting` from
162
+ `@air-jam/sdk/core`, in the game declaration's `settings` field. Remove the
163
+ constants they replace. Read values in simulation create/step/observe contexts
164
+ and typed action contexts; host rendering uses `useAirJamSettings`. Controllers
165
+ show copies in replicated state. Lobby player choices stay store state.
166
+
167
+ Inspect descriptors in `airjam.inspect_game` → `declaration.settings`.
168
+ Use `airjam.read_game_settings({ gameSessionId })` for live values and revision,
169
+ then `airjam.update_game_settings({ gameSessionId, patch, expectedRevision })`
170
+ under host authority. Only `live: true` values can change; non-live values go
171
+ in `airjam.start_game_run({ settings, ... })` for a fresh room. Stale revisions
172
+ require a fresh read. Input log version 2 records initial values and ordered
173
+ settings updates for replay. See `docs/airjam/generated/settings.md`.
174
+
175
+ Declared assets and theme are read through `airjam.inspect_game` in
176
+ `declaration.assets` and `declaration.theme`. Keep sounds, images and loaded
177
+ files in `defineAirJamAssets`, colours and font families in `defineAirJamTheme`,
178
+ and pass both to `defineAirJamGame`. The React binding owns audio mounts and
179
+ theme CSS variables; games consume the declared objects and never duplicate them.
@@ -19,6 +19,10 @@ The host lobby should expose:
19
19
  5. open join URL action
20
20
  6. primary start/play action
21
21
 
22
+ `JoinUrlField`, `JoinUrlControls` and `JoinQrOverlay` take `status={host.joinUrlStatus}`.
23
+ Keep the neutral loading state until phone reach resolves. When it is unavailable,
24
+ show the SDK explanation without an address or QR.
25
+
22
26
  The theme, layout, typography, and art direction stay game-owned.
23
27
 
24
28
  ## Required Controller Contract
@@ -65,6 +65,24 @@ Use direct file reads or broader filtering when you need:
65
65
  3. add focused tests when changing real behavior
66
66
  4. prefer observable behavior over implementation details
67
67
 
68
+ ## Decision-model Playtesting
69
+
70
+ Declare an `AirJamPlayerContract` from `@air-jam/devtools/testing` with `brief`
71
+ and `turn`. Return `{ state, question, options }` with 1 to 16 named options,
72
+ each carrying `when` and `control`, or `null` when the seat has nothing to do.
73
+ Zero options is invalid. A single sensible move, such as joining a lobby, is
74
+ allowed: the run owner takes that option's control directly with no model call
75
+ or cost. Do not add a fake alternative. Multiple options ask the model to choose.
76
+ The trace keeps the choice and control with the note `Only option; no model
77
+ asked.`; the seat's optional `answers.automatic` count distinguishes these
78
+ automatic answers in the run record.
79
+
80
+ In Studio, `studio_press_phone` taps, holds or types on one named mounted Studio phone
81
+ and returns its private screen in the same call. Coordinates are fractions 0..1 of
82
+ `studio_observe_current_game`'s `surface=phone` image. Tap a field before typing;
83
+ a hold captures while pressed, then releases. Reuse the requestId UUID for retries.
84
+ Guest/real phones and older runtimes return an explicit unavailable reason.
85
+
68
86
  ## Starter Template Testing Pattern
69
87
 
70
88
  If the project ships the starter testing layout, keep using it:
@@ -12,18 +12,24 @@ For broader public framework docs, use the hosted docs site after checking these
12
12
  ## Generated Canonical Docs
13
13
 
14
14
  1. [For Agents](./generated/for-agents.md)
15
- 2. [Project Structure](./generated/project-structure.md)
16
- 3. [Controller UI](./generated/controller-ui.md)
17
- 4. [State And Rendering](./generated/state-and-rendering.md)
18
- 5. [Introduction](./generated/introduction.md)
19
- 6. [Quick Start](./generated/quick-start.md)
20
- 7. [Architecture](./generated/architecture.md)
21
- 8. [Host System](./generated/host-system.md)
22
- 9. [SDK Hooks](./generated/sdk-hooks.md)
23
- 10. [Input System](./generated/input-system.md)
24
- 11. [Networked State](./generated/networked-state.md)
25
- 12. [Debugging And Logs](./generated/debugging-and-logs.md)
26
- 13. [Unified Dev Logs](./generated/unified-dev-logs.md)
15
+ 2. [Supported Agents](./generated/supported-agents.md)
16
+ 3. [Project Structure](./generated/project-structure.md)
17
+ 4. [Controller UI](./generated/controller-ui.md)
18
+ 5. [State And Rendering](./generated/state-and-rendering.md)
19
+ 6. [Introduction](./generated/introduction.md)
20
+ 7. [Quick Start](./generated/quick-start.md)
21
+ 8. [Architecture](./generated/architecture.md)
22
+ 9. [Host System](./generated/host-system.md)
23
+ 10. [SDK Hooks](./generated/sdk-hooks.md)
24
+ 11. [UI Components](./generated/ui-components.md)
25
+ 12. [Input System](./generated/input-system.md)
26
+ 13. [Networked State](./generated/networked-state.md)
27
+ 14. [Game Settings](./generated/settings.md)
28
+ 15. [Game Assets And Theme](./generated/assets-and-theme.md)
29
+ 16. [Debugging And Logs](./generated/debugging-and-logs.md)
30
+ 17. [Unified Dev Logs](./generated/unified-dev-logs.md)
31
+ 18. [Game Ideas](./generated/game-ideas.md)
32
+ 19. [Migrating Legacy Games](./generated/migrating-legacy-games.md)
27
33
 
28
34
  ## Local Supplements
29
35