@air-jam/cli 0.0.0-stage → 1.0.0-beta.1
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.
- package/LICENSE +21 -0
- package/README.md +273 -2
- package/bin/airjam.mjs +66 -0
- package/dist/ai-pack.d.ts +44 -0
- package/dist/ai-pack.js +15 -0
- package/dist/ai-pack.js.map +1 -0
- package/dist/auth-profile.d.ts +5 -0
- package/dist/auth-profile.js +7 -0
- package/dist/auth-profile.js.map +1 -0
- package/dist/auth-sessions.d.ts +5 -0
- package/dist/auth-sessions.js +7 -0
- package/dist/auth-sessions.js.map +1 -0
- package/dist/chunk-7D4AYBAV.js +64 -0
- package/dist/chunk-7D4AYBAV.js.map +1 -0
- package/dist/chunk-J5MAU4QZ.js +102 -0
- package/dist/chunk-J5MAU4QZ.js.map +1 -0
- package/dist/chunk-LH7UO57C.js +23 -0
- package/dist/chunk-LH7UO57C.js.map +1 -0
- package/dist/chunk-N7AI7HZK.js +529 -0
- package/dist/chunk-N7AI7HZK.js.map +1 -0
- package/dist/chunk-PKTLVQXZ.js +82 -0
- package/dist/chunk-PKTLVQXZ.js.map +1 -0
- package/dist/chunk-SQE4NPZP.js +31 -0
- package/dist/chunk-SQE4NPZP.js.map +1 -0
- package/dist/chunk-U6V3HEBB.js +939 -0
- package/dist/chunk-U6V3HEBB.js.map +1 -0
- package/dist/chunk-VEHNFPEO.js +224 -0
- package/dist/chunk-VEHNFPEO.js.map +1 -0
- package/dist/development.d.ts +102 -0
- package/dist/development.js +33 -0
- package/dist/development.js.map +1 -0
- package/dist/documentation.d.ts +27 -0
- package/dist/documentation.js +7 -0
- package/dist/documentation.js.map +1 -0
- package/dist/game-analytics.d.ts +5 -0
- package/dist/game-analytics.js +7 -0
- package/dist/game-analytics.js.map +1 -0
- package/dist/game-app-id.d.ts +5 -0
- package/dist/game-app-id.js +7 -0
- package/dist/game-app-id.js.map +1 -0
- package/dist/game-media.d.ts +5 -0
- package/dist/game-media.js +7 -0
- package/dist/game-media.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2468 -0
- package/dist/index.js.map +1 -0
- package/dist/scaffold.d.ts +6 -0
- package/dist/scaffold.js +20 -0
- package/dist/scaffold.js.map +1 -0
- package/package.json +82 -3
- package/runtime/local-network.d.mts +6 -0
- package/runtime/local-network.mjs +9 -0
- package/runtime/public-assets.mjs +62 -0
- package/runtime/source-fence.mjs +182 -0
- package/runtime/vite-config.d.mts +43 -0
- package/runtime/vite-config.mjs +134 -0
- package/runtime/vite-dev.mjs +18 -0
- package/runtime/vite-https.d.mts +11 -0
- package/runtime/vite-https.mjs +40 -0
- package/template-assets/bootstrap/.claude/launch.json +12 -0
- package/template-assets/bootstrap/AGENTS.md +290 -0
- package/template-assets/bootstrap/CLAUDE.md +55 -0
- package/template-assets/bootstrap/_gitignore +6 -0
- package/template-assets/bootstrap/skills/airjam-docs-workflow/SKILL.md +49 -0
- package/template-assets/bootstrap/skills/airjam-mcp/SKILL.md +100 -0
- package/template-assets/bootstrap/skills/canvas-2d-gameplay/SKILL.md +47 -0
- package/template-assets/bootstrap/skills/controller-ui/SKILL.md +71 -0
- package/template-assets/bootstrap/skills/debug-and-test/SKILL.md +72 -0
- package/template-assets/bootstrap/skills/game-architecture/SKILL.md +102 -0
- package/template-assets/bootstrap/skills/game-state-and-rendering/SKILL.md +44 -0
- package/template-assets/bootstrap/skills/host-surface/SKILL.md +52 -0
- package/template-assets/bootstrap/skills/index.md +36 -0
- package/template-assets/bootstrap/skills/prefab-authoring/SKILL.md +58 -0
- package/template-assets/bootstrap/skills/r3f-3d-scene/SKILL.md +61 -0
- package/template-assets/documentation/for-agents/controller-ui/page.mdx +99 -0
- package/template-assets/documentation/for-agents/page.mdx +120 -0
- package/template-assets/documentation/for-agents/project-structure/page.mdx +170 -0
- package/template-assets/documentation/for-agents/state-and-rendering/page.mdx +77 -0
- package/template-assets/documentation/for-agents/supported-agents/page.mdx +18 -0
- package/template-assets/documentation/getting-started/debugging/page.mdx +164 -0
- package/template-assets/documentation/getting-started/dev-logs/page.mdx +169 -0
- package/template-assets/documentation/getting-started/game-ideas/page.mdx +114 -0
- package/template-assets/documentation/getting-started/introduction/page.mdx +200 -0
- package/template-assets/documentation/getting-started/migrating-legacy-games/page.mdx +673 -0
- package/template-assets/documentation/getting-started/quick-start/page.mdx +310 -0
- package/template-assets/documentation/how-it-works/architecture/page.mdx +230 -0
- package/template-assets/documentation/how-it-works/host-system/page.mdx +270 -0
- package/template-assets/documentation/manifest.json +500 -0
- package/template-assets/documentation/sdk/assets-and-theme/page.mdx +185 -0
- package/template-assets/documentation/sdk/hooks/page.mdx +435 -0
- package/template-assets/documentation/sdk/input-system/page.mdx +240 -0
- package/template-assets/documentation/sdk/networked-state/page.mdx +295 -0
- package/template-assets/documentation/sdk/settings/page.mdx +155 -0
- package/template-assets/documentation/sdk/ui-components/page.mdx +268 -0
- package/template-assets/managed/.airjam/ai-pack.json +209 -0
- package/template-assets/managed/docs/airjam/agent-gold-path.md +115 -0
- package/template-assets/managed/docs/airjam/agent-mcp.md +179 -0
- package/template-assets/managed/docs/airjam/canvas-2d-gameplay.md +82 -0
- package/template-assets/managed/docs/airjam/composition-shell-contract.md +87 -0
- package/template-assets/managed/docs/airjam/debug-and-testing.md +104 -0
- package/template-assets/managed/docs/airjam/development-loop.md +51 -0
- package/template-assets/managed/docs/airjam/docs-index.md +64 -0
- package/template-assets/managed/docs/airjam/generated/architecture.md +223 -0
- package/template-assets/managed/docs/airjam/generated/assets-and-theme.md +188 -0
- package/template-assets/managed/docs/airjam/generated/controller-ui.md +102 -0
- package/template-assets/managed/docs/airjam/generated/debugging-and-logs.md +165 -0
- package/template-assets/managed/docs/airjam/generated/for-agents.md +123 -0
- package/template-assets/managed/docs/airjam/generated/game-ideas.md +107 -0
- package/template-assets/managed/docs/airjam/generated/host-system.md +261 -0
- package/template-assets/managed/docs/airjam/generated/input-system.md +241 -0
- package/template-assets/managed/docs/airjam/generated/introduction.md +195 -0
- package/template-assets/managed/docs/airjam/generated/migrating-legacy-games.md +674 -0
- package/template-assets/managed/docs/airjam/generated/networked-state.md +298 -0
- package/template-assets/managed/docs/airjam/generated/project-structure.md +171 -0
- package/template-assets/managed/docs/airjam/generated/quick-start.md +311 -0
- package/template-assets/managed/docs/airjam/generated/sdk-hooks.md +430 -0
- package/template-assets/managed/docs/airjam/generated/settings.md +158 -0
- package/template-assets/managed/docs/airjam/generated/state-and-rendering.md +80 -0
- package/template-assets/managed/docs/airjam/generated/supported-agents.md +21 -0
- package/template-assets/managed/docs/airjam/generated/ui-components.md +265 -0
- package/template-assets/managed/docs/airjam/generated/unified-dev-logs.md +170 -0
- package/template-assets/managed/docs/airjam/iconography.md +55 -0
- package/template-assets/managed/docs/airjam/prefab-authoring.md +212 -0
- package/template-assets/managed/docs/airjam/preview-controllers.md +129 -0
- package/template-assets/managed/docs/airjam/r3f-3d-scene.md +163 -0
- package/template-assets/managed/docs/airjam/state-lanes-cookbook.md +101 -0
- package/template-assets/managed/docs/airjam/visual-system.md +103 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# SDK UI Components
|
|
2
|
+
|
|
3
|
+
`@air-jam/sdk` is headless by default. `@air-jam/sdk/ui` provides optional, composable UI primitives you can drop into your own game layout.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {
|
|
7
|
+
SurfaceViewport,
|
|
8
|
+
PlayerAvatar,
|
|
9
|
+
RoomQrCode,
|
|
10
|
+
VolumeControls,
|
|
11
|
+
Button,
|
|
12
|
+
Slider,
|
|
13
|
+
} from "@air-jam/sdk/ui";
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Canonical Components
|
|
17
|
+
|
|
18
|
+
### `RoomQrCode`
|
|
19
|
+
|
|
20
|
+
Render a room join QR code from any URL string.
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { RoomQrCode } from "@air-jam/sdk/ui";
|
|
24
|
+
import { useAirJamHost } from "@air-jam/sdk";
|
|
25
|
+
|
|
26
|
+
const LobbyQr = () => {
|
|
27
|
+
const host = useAirJamHost();
|
|
28
|
+
|
|
29
|
+
if (host.joinUrlStatus !== "ready") {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<RoomQrCode
|
|
35
|
+
value={host.joinUrl}
|
|
36
|
+
size={180}
|
|
37
|
+
padding={1}
|
|
38
|
+
className="rounded-xl border border-white/20 bg-black/50 p-2"
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If you are rendering before the join URL has been resolved, prefer gating with `host.joinUrlStatus === "ready"` and show your own loading state until then.
|
|
45
|
+
|
|
46
|
+
Props:
|
|
47
|
+
|
|
48
|
+
- `value: string` (required)
|
|
49
|
+
- `size?: number` default `180`
|
|
50
|
+
- `padding?: number` default `1`
|
|
51
|
+
- `foregroundColor?: string` default `#111111`
|
|
52
|
+
- `backgroundColor?: string` default `#ffffff`
|
|
53
|
+
- `errorCorrectionLevel?: "L" | "M" | "Q" | "H"` default `"M"`
|
|
54
|
+
- `className?: string`
|
|
55
|
+
- `style?: CSSProperties`
|
|
56
|
+
- `alt?: string` default `"Room join QR code"`
|
|
57
|
+
|
|
58
|
+
Use it for:
|
|
59
|
+
|
|
60
|
+
- lobby overlays
|
|
61
|
+
- pause overlays
|
|
62
|
+
- spectator join prompts
|
|
63
|
+
|
|
64
|
+
Avoid:
|
|
65
|
+
|
|
66
|
+
- generating URLs manually when `host.joinUrl` / `controller.joinUrl` already exists
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### `PlayerAvatar`
|
|
71
|
+
|
|
72
|
+
Render a stable avatar ringed by player color from `PlayerProfile`. Set `isBot` when you want the same shell to represent an AI-controlled slot with a bot icon instead of player artwork.
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import { PlayerAvatar } from "@air-jam/sdk/ui";
|
|
76
|
+
|
|
77
|
+
<PlayerAvatar player={player} size="md" />;
|
|
78
|
+
<PlayerAvatar player={player} isBot size="md" />;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Props:
|
|
82
|
+
|
|
83
|
+
- `player: PlayerProfile` (required)
|
|
84
|
+
- `isBot?: boolean` render the shared bot icon instead of the player avatar image
|
|
85
|
+
- `size?: "sm" | "md" | "lg"` default `"md"`
|
|
86
|
+
- `className?: string`
|
|
87
|
+
|
|
88
|
+
Use it for:
|
|
89
|
+
|
|
90
|
+
- team strips
|
|
91
|
+
- connected player rows
|
|
92
|
+
- controller headers
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### `SurfaceViewport`
|
|
97
|
+
|
|
98
|
+
A game whose `inputModalities` include `'joystick'` always gets a landscape controller; the SDK applies it, so do not set orientation; lay it out with `GamepadLayout` from `@air-jam/sdk/ui`: the stick under the left thumb, the actions under the right in a square the same size, and only short status between them.
|
|
99
|
+
|
|
100
|
+
Own safe-area, orientation, and page-level UI scaling for a game surface.
|
|
101
|
+
It should fill the available screen while scaling the UI system proportionally, rather than letterboxing a fixed contained stage.
|
|
102
|
+
Internally it publishes a local `--airjam-ui-scale` into Tailwind's own spacing, text, radius, and container variables so normal Tailwind utilities keep working.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { SurfaceViewport } from "@air-jam/sdk/ui";
|
|
106
|
+
|
|
107
|
+
<SurfaceViewport className="bg-zinc-950">
|
|
108
|
+
<ControllerView />
|
|
109
|
+
</SurfaceViewport>;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Props:
|
|
113
|
+
|
|
114
|
+
- `orientation?: "portrait" | "landscape"`
|
|
115
|
+
- `children: ReactNode` (required)
|
|
116
|
+
- `designWidth?: number`
|
|
117
|
+
- `designHeight?: number`
|
|
118
|
+
- `uiScaleMultiplier?: number`
|
|
119
|
+
- `minScale?: number`
|
|
120
|
+
- `maxScale?: number`
|
|
121
|
+
- `lockOnGesture?: boolean` default `true`
|
|
122
|
+
- `className?: string`
|
|
123
|
+
- `contentClassName?: string`
|
|
124
|
+
- `style?: CSSProperties`
|
|
125
|
+
|
|
126
|
+
Use it for:
|
|
127
|
+
|
|
128
|
+
- controller routes that should keep a stable phone-like UI feel while still filling the screen
|
|
129
|
+
- host routes that should scale proportionally without collapsing into ordinary website behavior
|
|
130
|
+
|
|
131
|
+
Avoid:
|
|
132
|
+
|
|
133
|
+
- nesting multiple surface viewports
|
|
134
|
+
- treating it like a centered black-bar stage wrapper
|
|
135
|
+
- depending on arbitrary raw `px` values for most of the UI chrome when a normal Tailwind scale utility would do
|
|
136
|
+
- assuming native OS/browser lock is guaranteed everywhere
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### `VolumeControls`
|
|
141
|
+
|
|
142
|
+
Ready-made control block for master/music/sfx sliders bound to the shared platform settings runtime.
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
import { VolumeControls } from "@air-jam/sdk/ui";
|
|
146
|
+
|
|
147
|
+
<VolumeControls className="w-full max-w-xs" compact />;
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Mount it below `PlatformSettingsRuntime` when you want slider changes to persist in Arcade and inherit into embedded games.
|
|
151
|
+
|
|
152
|
+
Props:
|
|
153
|
+
|
|
154
|
+
- `className?: string`
|
|
155
|
+
- `compact?: boolean`
|
|
156
|
+
|
|
157
|
+
Use it for:
|
|
158
|
+
|
|
159
|
+
- in-game settings overlays
|
|
160
|
+
- pause/settings drawers
|
|
161
|
+
- Arcade- or platform-owned settings panels
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Phone Controls
|
|
166
|
+
|
|
167
|
+
`ControlButton`, `AxisButton` and `Stick` bind phone UI to the game's declared
|
|
168
|
+
controls and send them; see [Input System](/docs/sdk/input-system).
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
import { AxisButton, ControlButton, Stick } from "@air-jam/sdk/ui";
|
|
172
|
+
|
|
173
|
+
<Stick control={shipInput.move} knobClassName="bg-white/30" />
|
|
174
|
+
<AxisButton control={pongInput.direction} value={-1}>Up</AxisButton>
|
|
175
|
+
<ControlButton control={shipInput.fire} className="data-[active=true]:ring-2">
|
|
176
|
+
Fire
|
|
177
|
+
</ControlButton>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Each sets `data-active` while held. `Stick` takes `directions="4-way"`,
|
|
181
|
+
`deadzone`, `knob`, `knobClassName`, and a function child that draws the whole
|
|
182
|
+
stick from `{ value, active }`.
|
|
183
|
+
|
|
184
|
+
### `GamepadLayout`
|
|
185
|
+
|
|
186
|
+
Lays out a sideways controller like a gamepad: `left` and `right` thumb
|
|
187
|
+
squares of the same size, sized from the phone's short side and mirrored about
|
|
188
|
+
the centre, with a compact `center` column between them. `right` holds one
|
|
189
|
+
action, or several as a cluster around the main one. It fills its parent, so
|
|
190
|
+
put a header above it. See [Controller UI](/docs/for-agents/controller-ui#sideways-controllers).
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
import { ControlButton, GamepadLayout, Stick } from "@air-jam/sdk/ui";
|
|
194
|
+
|
|
195
|
+
<GamepadLayout
|
|
196
|
+
left={<Stick control={gameInput.move} className="rounded-full bg-white/10" />}
|
|
197
|
+
center={<span className="text-xs uppercase">Round 1</span>}
|
|
198
|
+
right={
|
|
199
|
+
<ControlButton control={gameInput.action} className="rounded-full">
|
|
200
|
+
Go
|
|
201
|
+
</ControlButton>
|
|
202
|
+
}
|
|
203
|
+
/>;
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Base Primitives
|
|
207
|
+
|
|
208
|
+
### `Button`
|
|
209
|
+
|
|
210
|
+
Styling primitive for consistent buttons.
|
|
211
|
+
|
|
212
|
+
```tsx
|
|
213
|
+
import { Button } from "@air-jam/sdk/ui";
|
|
214
|
+
|
|
215
|
+
<Button variant="secondary" size="lg">
|
|
216
|
+
Start Match
|
|
217
|
+
</Button>;
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Common props:
|
|
221
|
+
|
|
222
|
+
- `variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link"`
|
|
223
|
+
- `size?: "default" | "sm" | "lg" | "icon" | "icon-sm" | "icon-lg"`
|
|
224
|
+
- `asChild?: boolean`
|
|
225
|
+
|
|
226
|
+
### `Slider`
|
|
227
|
+
|
|
228
|
+
Styling primitive for ranges and tuning inputs.
|
|
229
|
+
|
|
230
|
+
```tsx
|
|
231
|
+
import { Slider } from "@air-jam/sdk/ui";
|
|
232
|
+
|
|
233
|
+
<Slider
|
|
234
|
+
value={[pointsToWin]}
|
|
235
|
+
min={3}
|
|
236
|
+
max={15}
|
|
237
|
+
step={1}
|
|
238
|
+
onValueChange={([value]) => setPointsToWin(value)}
|
|
239
|
+
/>;
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Composition Patterns
|
|
245
|
+
|
|
246
|
+
### Lobby Overlay
|
|
247
|
+
|
|
248
|
+
Combine:
|
|
249
|
+
|
|
250
|
+
- `RoomQrCode` for quick join
|
|
251
|
+
- `PlayerAvatar` for team roster
|
|
252
|
+
- `Button` for start/ready actions
|
|
253
|
+
|
|
254
|
+
### Controller Route
|
|
255
|
+
|
|
256
|
+
Combine:
|
|
257
|
+
|
|
258
|
+
- `SurfaceViewport` for shared full-screen UI scaling
|
|
259
|
+
- `PlayerAvatar` in a compact header
|
|
260
|
+
- `Button` + `Slider` for controls/options
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Anti-Patterns
|
|
265
|
+
|
|
266
|
+
- Do not build gameplay input on `Button`; bind controls with `ControlButton`, `AxisButton` and `Stick`.
|
|
267
|
+
- Do not rely on UI primitives for room/session lifecycle; lifecycle stays in headless SDK hooks.
|
|
268
|
+
- Do not fork component behavior in each game if composition solves it; prefer small wrappers around canonical primitives.
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 2,
|
|
3
|
+
"packVersion": "0.1.0",
|
|
4
|
+
"channel": "stable",
|
|
5
|
+
"releaseDate": "2026-03-29T00:00:00.000Z",
|
|
6
|
+
"source": {
|
|
7
|
+
"mode": "packaged-snapshot",
|
|
8
|
+
"package": "@air-jam/cli"
|
|
9
|
+
},
|
|
10
|
+
"scaffold": {
|
|
11
|
+
"template": null,
|
|
12
|
+
"createAirjamVersion": null
|
|
13
|
+
},
|
|
14
|
+
"managedFiles": [
|
|
15
|
+
{
|
|
16
|
+
"path": "docs/airjam/agent-gold-path.md",
|
|
17
|
+
"kind": "docs-local",
|
|
18
|
+
"size": 8394,
|
|
19
|
+
"sha256": "30cc7eb97cf1177dbb56fed6d5ab1b0723809236b65dfd531ed7bf7de2eaa185"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "docs/airjam/agent-mcp.md",
|
|
23
|
+
"kind": "docs-local",
|
|
24
|
+
"size": 9889,
|
|
25
|
+
"sha256": "1e712de9c1e758acf5c0d509726b87c39d18446ef22c718d117d6ff431b29e72"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"path": "docs/airjam/canvas-2d-gameplay.md",
|
|
29
|
+
"kind": "docs-local",
|
|
30
|
+
"size": 1808,
|
|
31
|
+
"sha256": "d19086c4d1c0b52fe64e91a6de068803db18f7879719e1e90dbaa26ef1be14ae"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"path": "docs/airjam/composition-shell-contract.md",
|
|
35
|
+
"kind": "docs-local",
|
|
36
|
+
"size": 2666,
|
|
37
|
+
"sha256": "91bf49cb98f3b94cabd145d960a9562786e73c029b3955904ef45a8f8bf71a06"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"path": "docs/airjam/debug-and-testing.md",
|
|
41
|
+
"kind": "docs-local",
|
|
42
|
+
"size": 3997,
|
|
43
|
+
"sha256": "efe08e5221067069d649605ed64ce7544453ddfcd3055b68c30bd07eb63c6afb"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"path": "docs/airjam/development-loop.md",
|
|
47
|
+
"kind": "docs-local",
|
|
48
|
+
"size": 2453,
|
|
49
|
+
"sha256": "a4a805fa89d199b2cd9282561339ca066a17f902b12ce73ba18f1cc066818d81"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"path": "docs/airjam/docs-index.md",
|
|
53
|
+
"kind": "docs-local",
|
|
54
|
+
"size": 2716,
|
|
55
|
+
"sha256": "b6c3be3b0aa221adafa4ad8245b5854ab043e8d6d8cd268abd9bb3bbecfbe4a6"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"path": "docs/airjam/generated/architecture.md",
|
|
59
|
+
"kind": "docs-generated",
|
|
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"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"path": "docs/airjam/generated/controller-ui.md",
|
|
71
|
+
"kind": "docs-generated",
|
|
72
|
+
"size": 4722,
|
|
73
|
+
"sha256": "3f2c6ae3f7f012974f5eea1fbb0b136450edc86d5eee829b32bbcce858786dc7"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"path": "docs/airjam/generated/debugging-and-logs.md",
|
|
77
|
+
"kind": "docs-generated",
|
|
78
|
+
"size": 4698,
|
|
79
|
+
"sha256": "a5f8e4baf46ba5847db7be750d6cd3e9b207dd3b7243960b30a5e649a7a475b5"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"path": "docs/airjam/generated/for-agents.md",
|
|
83
|
+
"kind": "docs-generated",
|
|
84
|
+
"size": 5338,
|
|
85
|
+
"sha256": "9d856e6e5f4e914ec0c5870a6a31e6ba78916a4a12664a52f3d14f1715a96e67"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"path": "docs/airjam/generated/game-ideas.md",
|
|
89
|
+
"kind": "docs-generated",
|
|
90
|
+
"size": 3042,
|
|
91
|
+
"sha256": "19560b89a8f6000855bf24add080983349bce78802e846a17f1b56c6e8c3d010"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"path": "docs/airjam/generated/host-system.md",
|
|
95
|
+
"kind": "docs-generated",
|
|
96
|
+
"size": 9945,
|
|
97
|
+
"sha256": "c85a8d05570fbc71cbd7cf5771e75a2f8415b4eb034462a45c30db3ca97ced31"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"path": "docs/airjam/generated/input-system.md",
|
|
101
|
+
"kind": "docs-generated",
|
|
102
|
+
"size": 10486,
|
|
103
|
+
"sha256": "59076307117a834d830d2c1d7d06d9dd446a4117ccf38883ff9d08adb67e44c4"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"path": "docs/airjam/generated/introduction.md",
|
|
107
|
+
"kind": "docs-generated",
|
|
108
|
+
"size": 6004,
|
|
109
|
+
"sha256": "a5330d035f1a2bbc1c51cfe5b9d3ac6efdafc28cda31435b94f64495e962cd48"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"path": "docs/airjam/generated/migrating-legacy-games.md",
|
|
113
|
+
"kind": "docs-generated",
|
|
114
|
+
"size": 31510,
|
|
115
|
+
"sha256": "63b66676c7578d37635e542f45149cd67dcc42229c1bf9364280ae76583586ec"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"path": "docs/airjam/generated/networked-state.md",
|
|
119
|
+
"kind": "docs-generated",
|
|
120
|
+
"size": 10906,
|
|
121
|
+
"sha256": "5280e52df3cf817e925a613b2c375ab55e09df828011a71f3d6e0b402c57d01e"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"path": "docs/airjam/generated/project-structure.md",
|
|
125
|
+
"kind": "docs-generated",
|
|
126
|
+
"size": 4418,
|
|
127
|
+
"sha256": "e8656cca6330442d6c3f990c37b82038867abaa672c50d8798b2e88c2f06d062"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"path": "docs/airjam/generated/quick-start.md",
|
|
131
|
+
"kind": "docs-generated",
|
|
132
|
+
"size": 12777,
|
|
133
|
+
"sha256": "f8cd52e60a4f40e613f692d6d8f60c0817238c1b44b9db35959bc9f4958521d1"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"path": "docs/airjam/generated/sdk-hooks.md",
|
|
137
|
+
"kind": "docs-generated",
|
|
138
|
+
"size": 16136,
|
|
139
|
+
"sha256": "d1182705433599ab958619c1c6607bf2cd353184fb14e715042589d7ad9c9358"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"path": "docs/airjam/generated/settings.md",
|
|
143
|
+
"kind": "docs-generated",
|
|
144
|
+
"size": 6382,
|
|
145
|
+
"sha256": "7bc2d29c42826085640a503601d6a2b42c9b2c7bdfc38908d58cd82b1ccf5c47"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"path": "docs/airjam/generated/state-and-rendering.md",
|
|
149
|
+
"kind": "docs-generated",
|
|
150
|
+
"size": 3176,
|
|
151
|
+
"sha256": "c9e52a44c5f865db217a5bb538d0ee64b82ef342c78bc85acc830c488e3c8198"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"path": "docs/airjam/generated/supported-agents.md",
|
|
155
|
+
"kind": "docs-generated",
|
|
156
|
+
"size": 1492,
|
|
157
|
+
"sha256": "2452bf09b3b75ea9c34437e4df8bac6e58813049600c6a2e036cae312705372d"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"path": "docs/airjam/generated/ui-components.md",
|
|
161
|
+
"kind": "docs-generated",
|
|
162
|
+
"size": 7169,
|
|
163
|
+
"sha256": "87a6e133af6d6ea32b09edd8a731293c4dd99fcbbe8b42c5a6bb79eaa9cdf9f1"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"path": "docs/airjam/generated/unified-dev-logs.md",
|
|
167
|
+
"kind": "docs-generated",
|
|
168
|
+
"size": 5592,
|
|
169
|
+
"sha256": "f210c6e197bc5029b281edbc8d28b74a40cde06f1de41aca89d762968f438bbb"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"path": "docs/airjam/iconography.md",
|
|
173
|
+
"kind": "docs-local",
|
|
174
|
+
"size": 1264,
|
|
175
|
+
"sha256": "d50f06e49d72dea63f82b9d8276480c5dc13007cdd66ac0371f8c08a6019a2e4"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"path": "docs/airjam/prefab-authoring.md",
|
|
179
|
+
"kind": "docs-local",
|
|
180
|
+
"size": 6916,
|
|
181
|
+
"sha256": "4abedb9d6241011b115503b26c59579340f954a6d4480069f304b4ff857f501a"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"path": "docs/airjam/preview-controllers.md",
|
|
185
|
+
"kind": "docs-local",
|
|
186
|
+
"size": 4813,
|
|
187
|
+
"sha256": "0844ba6b2ebd62250affeae6f3b1c6eabb439d1a8f77145916705b45198f0d16"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"path": "docs/airjam/r3f-3d-scene.md",
|
|
191
|
+
"kind": "docs-local",
|
|
192
|
+
"size": 5610,
|
|
193
|
+
"sha256": "1768ec9fe9279081d978f1ce8e146532f7d3ff50b30fdac8c309ead3f9ac48ae"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"path": "docs/airjam/state-lanes-cookbook.md",
|
|
197
|
+
"kind": "docs-local",
|
|
198
|
+
"size": 3476,
|
|
199
|
+
"sha256": "6d7f8550fa5a80cedd94d8ba4bafd93c0ab4e8ef74b500eaaf44fdaa9052b9e8"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"path": "docs/airjam/visual-system.md",
|
|
203
|
+
"kind": "docs-local",
|
|
204
|
+
"size": 2830,
|
|
205
|
+
"sha256": "0eaa064c38b4568c200fbf5cadb96f16c7c738a29469c4c955fb1ac5f8077edf"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"contentDigest": "3805c938cca3e8cbdbe75dbe6262703bcc69a34fcfc7f14238a12de06f4be19b"
|
|
209
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Agent Gold Path
|
|
2
|
+
|
|
3
|
+
This is the shortest correct workflow for building and testing an Air Jam game.
|
|
4
|
+
|
|
5
|
+
## Read This First
|
|
6
|
+
|
|
7
|
+
1. `src/airjam.config.ts`
|
|
8
|
+
2. `src/game/contracts/agent.ts` if it exists
|
|
9
|
+
3. `docs/airjam/state-lanes-cookbook.md` when you are deciding where state or effects belong
|
|
10
|
+
4. `docs/airjam/agent-mcp.md` when you need exact MCP operations
|
|
11
|
+
|
|
12
|
+
## Five-Step Mental Model
|
|
13
|
+
|
|
14
|
+
1. Need to see the game: use your built-in browser or in-app browser.
|
|
15
|
+
2. Need structured game state: use `airjam.open_game_session` then `airjam.read_game_session`.
|
|
16
|
+
3. Need to trigger a semantic game verb: use `airjam.invoke_game_session_action` with a `player:*` action id.
|
|
17
|
+
4. Need deterministic host staging or reset actions: use `host:*` session actions when the game exposes them.
|
|
18
|
+
5. Need visual proof: use the embedded browser when available, otherwise call `airjam.capture_game_session_visuals` on the room-owning session.
|
|
19
|
+
|
|
20
|
+
## Launch Rule
|
|
21
|
+
|
|
22
|
+
1. Treat project creation and package-manager mutation as single-writer work.
|
|
23
|
+
Wait for the active scaffold/install command to finish; never start
|
|
24
|
+
concurrent installs against the same workspace.
|
|
25
|
+
1. Use `pnpm run dev` for normal local development.
|
|
26
|
+
1. Use the committed `.claude/launch.json` when Claude Code Desktop preview launches the app. It runs `pnpm run dev -- --preview-managed` so Claude Preview sees Vite as the foreground process while Air Jam manages the local server in the background.
|
|
27
|
+
1. Do not replace the Air Jam dev flow with raw `pnpm exec vite` unless you intentionally want frontend-only rendering without the local Air Jam backend.
|
|
28
|
+
1. If you need HTTPS/secure local dev, use `pnpm run dev -- --secure`.
|
|
29
|
+
1. If local runtime state feels stale, use Air Jam status/log/reset tooling before debugging gameplay code.
|
|
30
|
+
1. After editing host-only runtime refs, physics loops, or `useHostActionListener` side effects, hard refresh the host or run `pnpm exec airjam reset local` if actions appear duplicated or rendered state no longer matches replicated state.
|
|
31
|
+
|
|
32
|
+
## Canonical Files
|
|
33
|
+
|
|
34
|
+
`src/airjam.config.ts`
|
|
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.
|
|
39
|
+
|
|
40
|
+
`src/game/contracts/agent.ts`
|
|
41
|
+
: Owns the semantic agent contract. Keep snapshot projection and semantic actions here.
|
|
42
|
+
|
|
43
|
+
## Action Rules
|
|
44
|
+
|
|
45
|
+
1. `player:*` actions act like a player or a semantic controller verb.
|
|
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.
|
|
47
|
+
3. Store action dispatch returns an acknowledgement. Check it when outcome matters.
|
|
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.
|
|
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.
|
|
52
|
+
8. `resultDescription` is documentation for agents and humans about the expected semantic effect. It does not automatically become runtime result data.
|
|
53
|
+
9. If an action must return actual runtime result data, return `acceptAirJamAction(result)` from the store action and read the acknowledgement/result separately.
|
|
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.
|
|
56
|
+
|
|
57
|
+
## Import Rules
|
|
58
|
+
|
|
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()`.
|
|
61
|
+
|
|
62
|
+
## Browser + MCP Pairing
|
|
63
|
+
|
|
64
|
+
1. Browser is the visual truth.
|
|
65
|
+
2. Air Jam MCP is the agent-control and runtime-inspection path.
|
|
66
|
+
3. Use both together instead of forcing browser automation to do semantic work.
|
|
67
|
+
4. In Claude Code or similar preview surfaces, keep host and preview controllers in the same visible preview screen when possible.
|
|
68
|
+
5. Add multiple preview controllers from the host preview workspace when you need multiple local players; do not open unrelated OS browser tabs unless the user asks for tabs.
|
|
69
|
+
6. Use visible preview controllers for UI smoke proof with real browser click/drag/release gestures.
|
|
70
|
+
7. Do not synthesize pointer events into controller iframes from parent-page eval; use semantic game actions when reliable gameplay proof matters.
|
|
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.
|