@forgeax/engine-app 0.1.4 → 0.1.6
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/README.md +20 -14
- package/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/create-app-error-retention.integration.test.d.ts +2 -0
- package/dist/__tests__/create-app-error-retention.integration.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-physics-plugin-failure.integration.test.d.ts +2 -0
- package/dist/__tests__/create-app-physics-plugin-failure.integration.test.d.ts.map +1 -0
- package/dist/animation-asset-lookup.d.ts +1 -2
- package/dist/animation-asset-lookup.d.ts.map +1 -1
- package/dist/create-app.d.ts +31 -10
- package/dist/create-app.d.ts.map +1 -1
- package/dist/engine-worker-runtime.mjs +72 -129
- package/dist/engine-worker-runtime.mjs.map +1 -1
- package/dist/errors.d.ts +3 -12
- package/dist/errors.d.ts.map +1 -1
- package/dist/execution/attached-world-swap.d.ts +1 -12
- package/dist/execution/attached-world-swap.d.ts.map +1 -1
- package/dist/execution/bootstrap-url.d.ts +5 -0
- package/dist/execution/bootstrap-url.d.ts.map +1 -0
- package/dist/execution/control.d.ts +0 -2
- package/dist/execution/control.d.ts.map +1 -1
- package/dist/execution/engine-worker.d.ts +1 -0
- package/dist/execution/engine-worker.d.ts.map +1 -1
- package/dist/execution/host-controller.d.ts.map +1 -1
- package/dist/execution/index.d.ts +1 -1
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/protocol.d.ts +4 -1
- package/dist/execution/protocol.d.ts.map +1 -1
- package/dist/execution/types.d.ts +17 -1
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/game-context.d.ts +1 -1
- package/dist/game-context.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +331 -362
- package/dist/index.mjs.map +1 -1
- package/dist/internal/assembled-engine-profile.d.ts.map +1 -1
- package/dist/internal/assets-world-plugin.d.ts +3 -17
- package/dist/internal/assets-world-plugin.d.ts.map +1 -1
- package/dist/internal/browser-remote-bridge.d.ts +1 -2
- package/dist/internal/browser-remote-bridge.d.ts.map +1 -1
- package/dist/internal/browser-rhi-debug-runtime.d.ts +1 -1
- package/dist/internal/browser-rhi-debug-runtime.d.ts.map +1 -1
- package/dist/internal/debug-draw.d.ts +9 -0
- package/dist/internal/debug-draw.d.ts.map +1 -0
- package/dist/internal/engine-profile-common.d.ts +2 -2
- package/dist/internal/engine-profile-common.d.ts.map +1 -1
- package/dist/internal/frame-loop.d.ts +7 -4
- package/dist/internal/frame-loop.d.ts.map +1 -1
- package/dist/internal/main-engine-profile.d.ts +4 -0
- package/dist/internal/main-engine-profile.d.ts.map +1 -1
- package/dist/internal/remote-serve-flag.d.ts +3 -7
- package/dist/internal/remote-serve-flag.d.ts.map +1 -1
- package/dist/internal/rhi-capture.d.ts +1 -1
- package/dist/internal/rhi-capture.d.ts.map +1 -1
- package/dist/internal/worker-engine-profile.d.ts +2 -0
- package/dist/internal/worker-engine-profile.d.ts.map +1 -1
- package/dist/renderer-plugin.d.ts +25 -0
- package/dist/renderer-plugin.d.ts.map +1 -0
- package/dist/tool-preview/bootstrap.d.ts.map +1 -1
- package/dist/types.d.ts +21 -61
- package/dist/types.d.ts.map +1 -1
- package/package.json +25 -26
- package/src/__tests__/callback-inference.test-d.ts +7 -3
- package/src/__tests__/consumer-migration.unit.test.ts +13 -0
- package/src/__tests__/create-app-error-retention.integration.test.ts +125 -0
- package/src/__tests__/create-app-features.test.ts +21 -10
- package/src/__tests__/create-app-listener-sync.test.ts +23 -19
- package/src/__tests__/create-app-physics-plugin-failure.integration.test.ts +142 -0
- package/src/__tests__/create-app-stop.test.ts +4 -12
- package/src/__tests__/create-app.test-d.ts +12 -11
- package/src/__tests__/create-app.test.ts +1 -60
- package/src/__tests__/create-renderer-error.integration.test.ts +3 -2
- package/src/__tests__/create-renderer-lifecycle.integration.test.ts +10 -5
- package/src/__tests__/draw-source-injected-world-update-visibility.test.ts +7 -13
- package/src/__tests__/draw-source-single-world-regression.test.ts +23 -24
- package/src/__tests__/engine-worker-bootstrap-channel.unit.test.ts +8 -0
- package/src/__tests__/engine-worker-world-swap.unit.test.ts +15 -22
- package/src/__tests__/errors-pointer-lock-failed.test.ts +4 -7
- package/src/__tests__/execution-bootstrap-isolation.unit.test.ts +5 -6
- package/src/__tests__/execution-frame-order.unit.test.ts +2 -2
- package/src/__tests__/execution-frame-protocol.unit.test.ts +3 -4
- package/src/__tests__/execution-public-api.test-d.ts +4 -0
- package/src/__tests__/frame-loop-time-elapsed.test.ts +1 -1
- package/src/__tests__/frame-loop-time.unit.test.ts +1 -1
- package/src/__tests__/frame-loop-world-array.test.ts +82 -73
- package/src/__tests__/plugin-profiles.unit.test.ts +3 -3
- package/src/__tests__/profiler-default-off.test.ts +1 -1
- package/src/__tests__/profiler-frame-token.test.ts +17 -30
- package/src/__tests__/profiler-phase-integration.test.ts +15 -27
- package/src/__tests__/surface-handoff.test.ts +1 -4
- package/src/__tests__/visibility-remote.integration.test.ts +2 -5
- package/src/__tests__/worker-execution-stop.test.ts +64 -7
- package/src/animation-asset-lookup.ts +2 -2
- package/src/create-app.ts +197 -296
- package/src/errors.ts +27 -39
- package/src/execution/attached-world-swap.ts +4 -38
- package/src/execution/bootstrap-url.ts +25 -0
- package/src/execution/control.ts +3 -7
- package/src/execution/engine-worker-runtime.ts +23 -40
- package/src/execution/engine-worker.ts +2 -0
- package/src/execution/host-controller.ts +8 -2
- package/src/execution/index.ts +1 -0
- package/src/execution/protocol.ts +4 -1
- package/src/execution/types.ts +18 -1
- package/src/game-context.ts +1 -1
- package/src/index.ts +11 -4
- package/src/internal/assembled-engine-profile.ts +3 -11
- package/src/internal/assets-world-plugin.ts +7 -53
- package/src/internal/browser-remote-bridge.ts +2 -3
- package/src/internal/browser-rhi-debug-runtime.ts +1 -1
- package/src/internal/debug-draw.ts +38 -0
- package/src/internal/engine-profile-common.ts +2 -3
- package/src/internal/frame-loop.ts +77 -63
- package/src/internal/main-engine-profile.ts +21 -17
- package/src/internal/remote-serve-flag.ts +5 -14
- package/src/internal/rhi-capture.ts +1 -1
- package/src/internal/worker-engine-profile.ts +10 -10
- package/src/renderer-plugin.ts +96 -0
- package/src/tool-preview/bootstrap.ts +1 -14
- package/src/types.ts +22 -77
- package/src/vite-env.d.ts +0 -2
- package/dist/__tests__/app-rebuild.test.d.ts +0 -2
- package/dist/__tests__/app-rebuild.test.d.ts.map +0 -1
- package/dist/__tests__/asset-registry-types.test-d.d.ts +0 -2
- package/dist/__tests__/asset-registry-types.test-d.d.ts.map +0 -1
- package/dist/__tests__/assets-runtime-assembly.integration.test.d.ts +0 -2
- package/dist/__tests__/assets-runtime-assembly.integration.test.d.ts.map +0 -1
- package/dist/__tests__/draw-source-headless-full-chain.test.d.ts +0 -2
- package/dist/__tests__/draw-source-headless-full-chain.test.d.ts.map +0 -1
- package/dist/__tests__/ecs-import.unit.test.d.ts +0 -2
- package/dist/__tests__/ecs-import.unit.test.d.ts.map +0 -1
- package/dist/__tests__/execution-world-health-owner.test-d.d.ts +0 -2
- package/dist/__tests__/execution-world-health-owner.test-d.d.ts.map +0 -1
- package/dist/__tests__/remote-serve-flag.test.d.ts +0 -2
- package/dist/__tests__/remote-serve-flag.test.d.ts.map +0 -1
- package/dist/assets-runtime-assembly.d.ts +0 -19
- package/dist/assets-runtime-assembly.d.ts.map +0 -1
- package/src/__tests__/app-rebuild.test.ts +0 -31
- package/src/__tests__/asset-registry-types.test-d.ts +0 -16
- package/src/__tests__/assets-runtime-assembly.integration.test.ts +0 -68
- package/src/__tests__/draw-source-headless-full-chain.test.ts +0 -226
- package/src/__tests__/ecs-import.unit.test.ts +0 -40
- package/src/__tests__/execution-world-health-owner.test-d.ts +0 -9
- package/src/__tests__/remote-serve-flag.test.ts +0 -24
- package/src/assets-runtime-assembly.ts +0 -70
package/README.md
CHANGED
|
@@ -128,6 +128,14 @@ the execution Fiber. Keep DOM UI on the Host side of that typed channel.
|
|
|
128
128
|
`ExecutionBootstrapHost.setPointerLockAllowed` is the one built-in
|
|
129
129
|
realm-to-Host control because browser input ownership remains on the Host.
|
|
130
130
|
|
|
131
|
+
> [!IMPORTANT]
|
|
132
|
+
> Runtime asset delivery in an execution realm uses `execution.assetCatalog`,
|
|
133
|
+
> a serializable `{ url, expectedScope? }` descriptor. Engine constructs the
|
|
134
|
+
> `CatalogSource` and `AssetRegistry` inside the selected realm, so an Engine
|
|
135
|
+
> Worker never captures a Host-side registry. `expectedScope` keeps a scoped
|
|
136
|
+
> game catalog tied to its `scopeId` and `generation`; `CreateAppOptions.assetCatalog`
|
|
137
|
+
> remains realm-bound and is rejected when `execution` is requested.
|
|
138
|
+
|
|
131
139
|
When `execution` is present, realm-bound `CreateAppOptions` (`features`,
|
|
132
140
|
`plugins`, RHI injection, draw source, membership
|
|
133
141
|
timing, and bundler import transport) are rejected instead of working only in a
|
|
@@ -151,21 +159,13 @@ therefore remains the owner of its feature and lifecycle:
|
|
|
151
159
|
```ts
|
|
152
160
|
import { createApp } from '@forgeax/engine-app';
|
|
153
161
|
import { createVfxRuntimeHost } from '@forgeax/engine-vfx-render';
|
|
154
|
-
import { vfxGpuEffectContribution } from '@forgeax/engine-vfx';
|
|
155
162
|
|
|
156
163
|
declare const canvas: HTMLCanvasElement;
|
|
157
164
|
declare const camera: import('@forgeax/engine-vfx-render').ParticleRenderCameraSource;
|
|
158
165
|
declare const bundler: import('@forgeax/engine-app').BundlerOptions;
|
|
159
166
|
|
|
160
167
|
const vfxHost = createVfxRuntimeHost({ camera });
|
|
161
|
-
const result = await createApp(
|
|
162
|
-
canvas,
|
|
163
|
-
{
|
|
164
|
-
features: [vfxHost.feature],
|
|
165
|
-
assetDecoders: [vfxGpuEffectContribution],
|
|
166
|
-
},
|
|
167
|
-
bundler,
|
|
168
|
-
);
|
|
168
|
+
const result = await createApp(canvas, { features: [vfxHost.feature] }, bundler);
|
|
169
169
|
if (!result.ok) {
|
|
170
170
|
console.error(result.error.code, result.error.hint);
|
|
171
171
|
throw result.error;
|
|
@@ -179,11 +179,6 @@ The app does not attach a VFX World or registry. Call
|
|
|
179
179
|
errors by `code`, `expected`, `hint`, and `detail`; do not treat a successful App
|
|
180
180
|
construction as proof that a particle asset is ready or visible.
|
|
181
181
|
|
|
182
|
-
The App default assembly includes a device-neutral `particle-effect` decoder.
|
|
183
|
-
VFX rendering selects the artifact-backed GPU owner explicitly with
|
|
184
|
-
`assetDecoders: [vfxGpuEffectContribution]`; the host then shares that decoder
|
|
185
|
-
lease instead of installing a competing kind.
|
|
186
|
-
|
|
187
182
|
## Frame-loop responsibility
|
|
188
183
|
|
|
189
184
|
Every frame follows one host-owned sequence:
|
|
@@ -212,6 +207,16 @@ app.stop();
|
|
|
212
207
|
await app.dispose();
|
|
213
208
|
```
|
|
214
209
|
|
|
210
|
+
`App.lastError` retains the most recent dispatch failure after the listener
|
|
211
|
+
callback runs, so an AI host can inspect the same object without scraping
|
|
212
|
+
console output:
|
|
213
|
+
|
|
214
|
+
| Fact | Recovery surface |
|
|
215
|
+
|:--|:--|
|
|
216
|
+
| `app-system-update-failed` | `detail.cause` preserves the original failure and `detail.systemName` identifies the owner when known. |
|
|
217
|
+
| Renderer or device failure | `app.onError` and `lastError` expose the closed error code with `expected`, `hint`, and discriminated `detail`. |
|
|
218
|
+
| No failure observed | `lastError` is `undefined`; do not infer readiness from App construction alone. |
|
|
219
|
+
|
|
215
220
|
Hosts that discover additional Worlds during bootstrap can update the routing pull
|
|
216
221
|
without creating a second frame loop:
|
|
217
222
|
|
|
@@ -368,6 +373,7 @@ the App owns the Cordis realm it assembled around them.
|
|
|
368
373
|
| `CreateAppOptions.time` | `TimePolicy` | Policy used only for the newly created canvas-form World. |
|
|
369
374
|
| `CreateAppOptions.features` | `readonly RenderFeature<unknown>[]` | Existing renderer feature seam, forwarded by reference and order. |
|
|
370
375
|
| `CreateAppOptions.execution` | `ExecutionOptions` | Selects `auto`, `main-serial`, `engine-worker`, or `shared` and names the bootstrap module. |
|
|
376
|
+
| `ExecutionOptions.assetCatalog` | `ExecutionAssetCatalog` | Supplies the serializable catalog URL and optional scope fence to the selected Engine realm. |
|
|
371
377
|
| `App.execution.report()` | `ExecutionReport` | Returns the schema-valid requested/actual tier, capabilities, health, performance, audio, and fault projection. |
|
|
372
378
|
| `App.execution.rebuild()` | `Promise<Result<ExecutionReport, AppError>>` | Rebuilds only a poisoned Worker World with a new identity. |
|
|
373
379
|
| `App.start()` | `Result<void, AppError>` | Arms the rAF loop. |
|