@forgeax/game 0.2.4 → 0.3.0

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.
@@ -0,0 +1,242 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "forgeax.asset3d-search-result/1.0.0",
4
+ "title": "ForgeaX Asset3D Search Result",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "total",
10
+ "succeeded",
11
+ "failed",
12
+ "results"
13
+ ],
14
+ "properties": {
15
+ "schemaVersion": {
16
+ "const": "forgeax.asset3d-search-result/1.0.0"
17
+ },
18
+ "total": {
19
+ "type": "integer",
20
+ "minimum": 1,
21
+ "maximum": 16
22
+ },
23
+ "succeeded": {
24
+ "type": "integer",
25
+ "minimum": 0,
26
+ "maximum": 16
27
+ },
28
+ "failed": {
29
+ "type": "integer",
30
+ "minimum": 0,
31
+ "maximum": 16
32
+ },
33
+ "results": {
34
+ "type": "array",
35
+ "minItems": 1,
36
+ "maxItems": 16,
37
+ "items": {
38
+ "oneOf": [
39
+ {
40
+ "$ref": "#/$defs/success"
41
+ },
42
+ {
43
+ "$ref": "#/$defs/error"
44
+ }
45
+ ]
46
+ }
47
+ },
48
+ "receipt": {
49
+ "$ref": "receipt-1.0.0.json"
50
+ }
51
+ },
52
+ "allOf": [
53
+ {
54
+ "if": {
55
+ "properties": {
56
+ "succeeded": {
57
+ "minimum": 1
58
+ }
59
+ }
60
+ },
61
+ "then": {
62
+ "required": ["receipt"]
63
+ }
64
+ }
65
+ ],
66
+ "$defs": {
67
+ "queryIndex": {
68
+ "type": "integer",
69
+ "minimum": 0,
70
+ "maximum": 15
71
+ },
72
+ "safeId": {
73
+ "type": "string",
74
+ "minLength": 1,
75
+ "maxLength": 128,
76
+ "pattern": "^[A-Za-z0-9._-]+$",
77
+ "not": {
78
+ "enum": [".", ".."]
79
+ }
80
+ },
81
+ "sha256": {
82
+ "type": "string",
83
+ "pattern": "^[0-9a-f]{64}$"
84
+ },
85
+ "relativePath": {
86
+ "type": "string",
87
+ "minLength": 1,
88
+ "maxLength": 512,
89
+ "pattern": "^(?!/)(?!.*\\\\)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*//)[^\\u0000]+$"
90
+ },
91
+ "manifestEntry": {
92
+ "type": "object",
93
+ "additionalProperties": false,
94
+ "required": ["path", "role", "bytes", "sha256"],
95
+ "properties": {
96
+ "path": {
97
+ "$ref": "#/$defs/relativePath"
98
+ },
99
+ "role": {
100
+ "enum": [
101
+ "primary-model",
102
+ "animation",
103
+ "auxiliary-model",
104
+ "texture",
105
+ "metadata"
106
+ ]
107
+ },
108
+ "bytes": {
109
+ "type": "integer",
110
+ "minimum": 1,
111
+ "maximum": 134217728
112
+ },
113
+ "sha256": {
114
+ "$ref": "#/$defs/sha256"
115
+ }
116
+ }
117
+ },
118
+ "success": {
119
+ "type": "object",
120
+ "additionalProperties": false,
121
+ "required": [
122
+ "status",
123
+ "queryIndex",
124
+ "query",
125
+ "provider",
126
+ "providerAssetId",
127
+ "assetName",
128
+ "deliveredFormat",
129
+ "sha256",
130
+ "bytes",
131
+ "primaryModel",
132
+ "manifest",
133
+ "originSetDigest"
134
+ ],
135
+ "properties": {
136
+ "status": {
137
+ "const": "ok"
138
+ },
139
+ "queryIndex": {
140
+ "$ref": "#/$defs/queryIndex"
141
+ },
142
+ "query": {
143
+ "type": "string",
144
+ "minLength": 1,
145
+ "maxLength": 200
146
+ },
147
+ "provider": {
148
+ "const": "ea-3d"
149
+ },
150
+ "providerAssetId": {
151
+ "$ref": "#/$defs/safeId"
152
+ },
153
+ "assetName": {
154
+ "type": "string",
155
+ "minLength": 1,
156
+ "maxLength": 128
157
+ },
158
+ "deliveredFormat": {
159
+ "const": "glb"
160
+ },
161
+ "sha256": {
162
+ "$ref": "#/$defs/sha256"
163
+ },
164
+ "bytes": {
165
+ "type": "integer",
166
+ "minimum": 1,
167
+ "maximum": 268435456
168
+ },
169
+ "primaryModel": {
170
+ "$ref": "#/$defs/relativePath"
171
+ },
172
+ "manifest": {
173
+ "type": "array",
174
+ "minItems": 1,
175
+ "maxItems": 1024,
176
+ "items": {
177
+ "$ref": "#/$defs/manifestEntry"
178
+ }
179
+ },
180
+ "originSetDigest": {
181
+ "$ref": "#/$defs/sha256"
182
+ },
183
+ "downloaded_to": {
184
+ "type": "string",
185
+ "minLength": 1,
186
+ "maxLength": 512,
187
+ "pattern": "^(?!/)(?!.*\\\\)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*//)[^\\u0000]+$"
188
+ }
189
+ }
190
+ },
191
+ "error": {
192
+ "type": "object",
193
+ "additionalProperties": false,
194
+ "required": [
195
+ "status",
196
+ "queryIndex",
197
+ "query",
198
+ "code",
199
+ "retryable",
200
+ "message"
201
+ ],
202
+ "properties": {
203
+ "status": {
204
+ "const": "error"
205
+ },
206
+ "queryIndex": {
207
+ "$ref": "#/$defs/queryIndex"
208
+ },
209
+ "query": {
210
+ "type": "string",
211
+ "minLength": 1,
212
+ "maxLength": 200
213
+ },
214
+ "code": {
215
+ "enum": [
216
+ "asset_not_found",
217
+ "asset_identity_missing",
218
+ "search_timeout",
219
+ "search_upstream_error",
220
+ "download_timeout",
221
+ "download_origin_rejected",
222
+ "download_too_large",
223
+ "archive_rejected",
224
+ "conversion_failed",
225
+ "digest_failed",
226
+ "batch_timeout",
227
+ "internal_error"
228
+ ]
229
+ },
230
+ "retryable": {
231
+ "type": "boolean"
232
+ },
233
+ "message": {
234
+ "type": "string",
235
+ "minLength": 1,
236
+ "maxLength": 256,
237
+ "pattern": "^[^\\u0000-\\u001f\\u007f]+$"
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
@@ -1,94 +1,84 @@
1
1
  ---
2
2
  name: forgeax-game
3
- description: Build, run, and verify ForgeaX games through the bounded @forgeax/game MCP surface. Use when an agent must inspect a ForgeaX project, edit the active game, recover a broken local stack, launch the current game, or validate a game change in the real Studio and Play surfaces.
3
+ description: Build, preview, inspect, and repair a released ForgeaX Engine game through the @forgeax/game MCP connector.
4
4
  ---
5
5
 
6
- # ForgeaX Game
7
-
8
- Treat the project files as the source of truth and `@forgeax/game` as the ForgeaX
9
- control surface around them. The current host Agent (Codex, Claude Code, Cursor, or
10
- another supported client) writes the game code. Use MCP for project/runtime state and
11
- launching; use normal file, shell, and browser tools for implementation and
12
- verification. The plugin obtains the matching ForgeaX Runtime automatically; do not
13
- ask the user to clone ForgeaX Studio or start `bun fx`.
14
-
15
- ## Enter the loop
16
-
17
- 1. If the current directory is not a ForgeaX project, run `forgeax-game init --game
18
- <slug>` once. This creates the minimal project and prepares the managed Runtime.
19
- 2. Read `forgeax://status`. If the host cannot read MCP resources, call
20
- `forgeax_status_lite`.
21
- 3. Confirm the returned project root, active game, Runtime version, and Engine SDK
22
- commit before editing anything. The SDK and Runtime identities must match.
23
- 4. Read [references/engine-project.md](references/engine-project.md) before changing
24
- game code or assets.
25
- 5. Climb the Engine knowledge ladder in order, stopping as soon as the question is
26
- answered. Never invent an Engine symbol from memory — every rung is already on disk.
27
- 1. **`forgeax-engine-*` skills** — how this Engine is meant to be used: schedules,
28
- lifecycles, and the invariants a type signature cannot state. Start here for any
29
- "how do I ..." question; `forgeax-engine-ecs` governs components and systems.
30
- Read [references/engine-skills.md](references/engine-skills.md), derived from the
31
- Runtime package during the Game build, before choosing one. Ids do not track
32
- package names — importing `@forgeax/engine-render` does not mean a
33
- `forgeax-engine-render` skill exists. A guessed id fails the lookup silently.
34
- 2. **`.forgeax/engine-sdk/`** the exact API surface: `packages/*/dist/*.d.ts` for
35
- signatures, `templates/game-default/` or `templates/game-empty/` for projects
36
- that already work.
37
- Read [references/engine-authoring-traps.md](references/engine-authoring-traps.md)
38
- first: it lists the failures that render or run without error while still being
39
- wrong (fov units, dead keyboard, function-valued readpoints).
40
- 3. **Engine source** — the implementation. Read it when a skill plus the
41
- declarations still leave a real choice open, or when observed behavior
42
- contradicts them and you must trace an Engine-side bug. `forgeax://status`
43
- reports its path, also recorded as `sourceRoot` in `.forgeax/engine-sdk.json`.
44
- 6. Make the smallest coherent change in the active game's directory.
45
- 7. Call `forgeax_run_current_game`. It builds or reuses the static preview through the
46
- verified selected Runtime and reports the Runtime/Engine identity used by preview.
47
- 8. Open the returned Play URL and verify the requested behavior. Follow
48
- [references/validation.md](references/validation.md).
49
-
50
- ## Choose the right surface
51
-
52
- | Need | Surface |
53
- |:--|:--|
54
- | Project, game, service, or next-action status | `forgeax://status` |
55
- | Status when resources are unavailable | `forgeax_status_lite` |
56
- | Build/reuse the selected Runtime's static preview and obtain preview/log locations | `forgeax_run_current_game` |
57
- | Learn how the Engine is meant to be used | Installed `forgeax-engine-*` skills — ids in [references/engine-skills.md](references/engine-skills.md) |
58
- | Inspect Engine declarations, metadata, and examples | `.forgeax/engine-sdk/` |
59
- | Trace Engine behavior a skill and the declarations cannot settle | Engine source (`sourceRoot`) |
60
- | Diagnose a game that runs but renders or steers wrong | [references/engine-authoring-traps.md](references/engine-authoring-traps.md) |
61
- | Read or edit game source and assets | Host file tools |
62
- | Run focused tests or inspect runtime logs | Host shell tools |
63
- | Prove Studio, viewport, or Play behavior | Host browser tools |
64
- | Create a game or change the active game | `forgeax-game init` / `forgeax-game use` |
65
-
66
- Do not turn one-time setup or arbitrary shell execution into MCP calls. The bounded
67
- surface exists so the model sees only high-frequency game-loop operations.
68
-
69
- ## Recover deliberately
70
-
71
- - **No project:** run `forgeax-game init --game <slug>`; do not ask the user to prepare
72
- a ForgeaX checkout.
73
- - **No active game:** list `.forgeax/games/`, then run `forgeax-game use <slug>`.
74
- - **Runtime down:** call `forgeax_run_current_game`; it installs the platform-selected
75
- Runtime package, builds the active game, and serves the static preview. Do not
76
- silently fall back to a source checkout.
77
- - **Engine SDK missing:** run `forgeax-game upgrade` (or re-run `init`) before writing
78
- imports. Do not guess an API that is absent from the installed snapshot.
79
- - **Engine authoring skills missing or incomplete:** `forgeax://status` reports how many
80
- of the bundled `forgeax-engine-*` skills are installed. If any are missing, run
81
- `forgeax-game devkit install` and start a new session; writing game code without them
82
- means guessing at Engine conventions the skills already state.
83
- - **Wrong instance root:** stop and align the CLI working directory with the running
84
- ForgeaX server. Never write into a different checkout to make the check pass.
85
- - **Launch failure:** read the runtime log path returned by the tool. Browser-only
86
- exceptions still require the browser console.
87
- - **Viewport or Play defect:** reproduce through the real Studio UI. A direct curl to
88
- the Play server does not prove the embedded editor path.
89
-
90
- ## Finish with evidence
91
-
92
- Report the changed game and files, the MCP status/launch result, the exact browser
93
- surface exercised, and any remaining unverified boundary. A passing unit test is not
94
- evidence that the game rendered or behaved correctly.
6
+ # ForgeaX game development
7
+
8
+ Use this Skill for gameplay implementation and the edit-build-Preview-repair loop in
9
+ a standalone game created or bound by `forgeax-game init`. The host agent edits game code;
10
+ the connector owns Engine CLI execution and Preview lifecycle.
11
+
12
+ ## Start with identity
13
+
14
+ 1. Read the MCP resource `forgeax://status`. If the client cannot read resources,
15
+ call `forgeax_status_lite` with the game's current directory as `target_dir`.
16
+ 2. Confirm the status reports one consistent installed Engine version/commit and an
17
+ exact matching DevKit/carrier. Never hardcode a historical release identity.
18
+ 3. Read the game's `forge.json`, source, package declarations, and any Engine-owned
19
+ `skills/` installed with that game. Engine declarations are in its installed
20
+ `node_modules/@forgeax/engine*` packages; never substitute Studio or Editor source.
21
+
22
+ > [!IMPORTANT]
23
+ > In an empty directory, `forgeax-game init` creates the Engine-owned standalone game
24
+ > through the exact installed carrier. In an existing exact game it refreshes the
25
+ > binding idempotently. Standalone source is `<game-root>/src`; do not create Studio's
26
+ > hosted `.forgeax/games/<slug>` layout.
27
+
28
+ ## Edit and verify
29
+
30
+ 1. Make the smallest coherent game-source change using normal file tools. Mount browser
31
+ UI through the Engine Host `uiRoot` or `#game-ui`. The released standalone Host
32
+ provides `#game-ui`; do not mutate `document.body` directly.
33
+ 2. When turning the Empty template into a requested game, also replace the template
34
+ identity in `forge.json`, `package.json`, and README; document controls and keep
35
+ tests aligned. Export at least one named game-specific state transition or rule and
36
+ exercise it in a behavior test. Renaming the Empty test suite is not completion.
37
+ The run tool rejects changed gameplay with stale or superficial evidence.
38
+ 3. Call `forgeax_run_current_game` with the canonical game `target_dir`.
39
+ 4. Treat success only as the returned exact Engine/build/Preview identity. Open only
40
+ its returned loopback `preview_url`.
41
+ 5. When build or Preview fails, read `preview.stderr_log` and
42
+ `preview.stdout_log`, repair the game, and call the tool again.
43
+ 6. After a code change, do not reuse an old visual observation as evidence; the new
44
+ build digest and Preview instance must be observed.
45
+
46
+ ## Reuse 3D assets
47
+
48
+ - When the user asks for an existing, reusable, library, stock, or licensed 3D asset,
49
+ require the project-local `asset3d-search` MCP server and its `search_asset` tool.
50
+ - If that server or tool is absent, report `BLOCKED(asset-library-tools-missing)` and
51
+ run or recommend `forgeax-game asset3d doctor --json`. Do not describe procedural
52
+ primitives as the asset library, and do not silently substitute `forgeax_generate_3d`.
53
+ - Use `forgeax_generate_3d` only for an explicitly bespoke/generated asset or after a
54
+ library search found no acceptable candidate and the user approves generation.
55
+
56
+ > [!CAUTION]
57
+ > Any `forgeax_run_current_game` error means the current game is **not previewed**.
58
+ > Stop and report or repair that error. Never probe, reuse, open, or report an existing
59
+ > localhost port after a failed call; HTTP 200 is not Preview ownership evidence. Only
60
+ > a successful result containing `preview.status: ready`, `preview_url`, `preview.root`,
61
+ > `preview.build_digest`, and `preview.instance_id` authorizes a Preview claim.
62
+
63
+ The connector runs the exact installed Engine CLI with `build --json`, then starts or
64
+ reuses `preview --json`. When Engine exposes authenticated health, the connector binds
65
+ it to the canonical root, exact release, build digest, and Preview instance ID.
66
+ Released Engine 0.1.7 instead uses its documented minimal envelope plus an exact
67
+ served `forgeax-dist.json` SHA. PID alone is not ownership evidence in either mode.
68
+
69
+ ## Stop
70
+
71
+ For explicit teardown use:
72
+
73
+ ```bash
74
+ forgeax-game preview stop --target-dir <game-root>
75
+ ```
76
+
77
+ The connector signals only a verified owned child. A live unverifiable PID is
78
+ left untouched and reported as `preview_ownership_unverified`.
79
+
80
+ ## Scope
81
+
82
+ Image and 3D generation helpers may still be exposed, but this G0 Skill does not
83
+ claim Asset3D provider installation/import, Studio/Editor integration, visible Play,
84
+ or real EA/provider end-to-end acceptance.