@forgeax/engine-assets-runtime 0.1.3 → 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 +442 -175
- package/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/aabb.unit.test.d.ts +2 -0
- package/dist/__tests__/aabb.unit.test.d.ts.map +1 -0
- package/dist/__tests__/artifact-integrity.unit.test.d.ts +2 -0
- package/dist/__tests__/artifact-integrity.unit.test.d.ts.map +1 -0
- package/dist/__tests__/artifact-io.unit.test.d.ts +2 -0
- package/dist/__tests__/artifact-io.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence-sdk.integration.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence-sdk.integration.test.d.ts.map +1 -0
- package/dist/__tests__/asset-evidence.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-evidence.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-kind.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-kind.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-catalog-reconcile.integration.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-catalog-reconcile.integration.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-catalog-reconcile.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-catalog-reconcile.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-catalog.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry-catalog.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry.pack-cache.test.d.ts +2 -0
- package/dist/__tests__/asset-registry.pack-cache.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry.unit.test.d.ts +2 -0
- package/dist/__tests__/asset-registry.unit.test.d.ts.map +1 -0
- package/dist/__tests__/asset-runtime-error-code-owner.test-d.d.ts +2 -0
- package/dist/__tests__/asset-runtime-error-code-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/catalog-replica.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-replica.unit.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-source-v2.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-source-v2.unit.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-source.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-source.unit.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-subscription-order.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-subscription-order.unit.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-subscription.unit.test.d.ts +2 -0
- package/dist/__tests__/catalog-subscription.unit.test.d.ts.map +1 -0
- package/dist/__tests__/decode-image-bytes-pass-through.test.d.ts +2 -0
- package/dist/__tests__/decode-image-bytes-pass-through.test.d.ts.map +1 -0
- package/dist/__tests__/decode-image-bytes.browser.test.d.ts +2 -0
- package/dist/__tests__/decode-image-bytes.browser.test.d.ts.map +1 -0
- package/dist/__tests__/decode-image-bytes.test-d.d.ts +2 -0
- package/dist/__tests__/decode-image-bytes.test-d.d.ts.map +1 -0
- package/dist/__tests__/decode-image-bytes.test.d.ts +2 -0
- package/dist/__tests__/decode-image-bytes.test.d.ts.map +1 -0
- package/dist/__tests__/dynamic-texture-store.unit.test.d.ts +2 -0
- package/dist/__tests__/dynamic-texture-store.unit.test.d.ts.map +1 -0
- package/dist/__tests__/errors-asset.unit.test.d.ts +2 -0
- package/dist/__tests__/errors-asset.unit.test.d.ts.map +1 -0
- package/dist/__tests__/inline-pack-loaders.unit.test.d.ts +2 -0
- package/dist/__tests__/inline-pack-loaders.unit.test.d.ts.map +1 -0
- package/dist/__tests__/instantiate-context.unit.test.d.ts +2 -0
- package/dist/__tests__/instantiate-context.unit.test.d.ts.map +1 -0
- package/dist/__tests__/instantiate-publication-fence.unit.test.d.ts +2 -0
- package/dist/__tests__/instantiate-publication-fence.unit.test.d.ts.map +1 -0
- package/dist/__tests__/instantiate.unit.test.d.ts +2 -0
- package/dist/__tests__/instantiate.unit.test.d.ts.map +1 -0
- package/dist/__tests__/loader-input-contract.unit.test.d.ts +2 -0
- package/dist/__tests__/loader-input-contract.unit.test.d.ts.map +1 -0
- package/dist/__tests__/loader-registry.unit.test.d.ts +2 -0
- package/dist/__tests__/loader-registry.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-dependency-invalidation.unit.test.d.ts +2 -0
- package/dist/__tests__/material-dependency-invalidation.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-generation-cache.unit.test.d.ts +2 -0
- package/dist/__tests__/material-generation-cache.unit.test.d.ts.map +1 -0
- package/dist/__tests__/material-load-consumer.test-d.d.ts +2 -0
- package/dist/__tests__/material-load-consumer.test-d.d.ts.map +1 -0
- package/dist/__tests__/material-ready.integration.test.d.ts +2 -0
- package/dist/__tests__/material-ready.integration.test.d.ts.map +1 -0
- package/dist/__tests__/material-stale-generation.unit.test.d.ts +2 -0
- package/dist/__tests__/material-stale-generation.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin-morph-v3.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin-morph-v3.test.d.ts.map +1 -0
- package/dist/__tests__/mesh-bin.unit.test.d.ts +2 -0
- package/dist/__tests__/mesh-bin.unit.test.d.ts.map +1 -0
- package/dist/__tests__/mipmap-generator.unit.test.d.ts +2 -0
- package/dist/__tests__/mipmap-generator.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pack-artifact-transcode-model-owner.test.d.ts +2 -0
- package/dist/__tests__/pack-artifact-transcode-model-owner.test.d.ts.map +1 -0
- package/dist/__tests__/pack-basis-load.integration.test.d.ts +2 -0
- package/dist/__tests__/pack-basis-load.integration.test.d.ts.map +1 -0
- package/dist/__tests__/payload-validate.unit.test.d.ts +2 -0
- package/dist/__tests__/payload-validate.unit.test.d.ts.map +1 -0
- package/dist/__tests__/plugin.test.d.ts +2 -0
- package/dist/__tests__/plugin.test.d.ts.map +1 -0
- package/dist/__tests__/registry-concurrency.bench.test.d.ts +2 -0
- package/dist/__tests__/registry-concurrency.bench.test.d.ts.map +1 -0
- package/dist/__tests__/registry-failure-retry.integration.test.d.ts +2 -0
- package/dist/__tests__/registry-failure-retry.integration.test.d.ts.map +1 -0
- package/dist/__tests__/registry-load-graph.integration.test.d.ts +2 -0
- package/dist/__tests__/registry-load-graph.integration.test.d.ts.map +1 -0
- package/dist/__tests__/registry-load-state.unit.test.d.ts +2 -0
- package/dist/__tests__/registry-load-state.unit.test.d.ts.map +1 -0
- package/dist/__tests__/registry-package-cache.unit.test.d.ts +2 -0
- package/dist/__tests__/registry-package-cache.unit.test.d.ts.map +1 -0
- package/dist/__tests__/registry-public-ready.unit.test.d.ts +2 -0
- package/dist/__tests__/registry-public-ready.unit.test.d.ts.map +1 -0
- package/dist/__tests__/resolve-asset-handle.unit.test.d.ts +2 -0
- package/dist/__tests__/resolve-asset-handle.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scene-handle-fields.unit.test.d.ts +2 -0
- package/dist/__tests__/scene-handle-fields.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scene-payload.unit.test.d.ts +2 -0
- package/dist/__tests__/scene-payload.unit.test.d.ts.map +1 -0
- package/dist/__tests__/scene-publication-fence.test.d.ts +2 -0
- package/dist/__tests__/scene-publication-fence.test.d.ts.map +1 -0
- package/dist/__tests__/scriptable-pack-public-surface.test-d.d.ts +2 -0
- package/dist/__tests__/scriptable-pack-public-surface.test-d.d.ts.map +1 -0
- package/dist/__tests__/static-rig.integration.test.d.ts +2 -0
- package/dist/__tests__/static-rig.integration.test.d.ts.map +1 -0
- package/dist/__tests__/validate-material.unit.test.d.ts +2 -0
- package/dist/__tests__/validate-material.unit.test.d.ts.map +1 -0
- package/dist/__tests__/video-pack-loader.integration.test.d.ts +2 -0
- package/dist/__tests__/video-pack-loader.integration.test.d.ts.map +1 -0
- package/dist/aabb.d.ts +3 -0
- package/dist/aabb.d.ts.map +1 -0
- package/dist/asset-registry.d.ts +552 -0
- package/dist/asset-registry.d.ts.map +1 -0
- package/dist/builtin-asset-registry.d.ts +22 -0
- package/dist/builtin-asset-registry.d.ts.map +1 -0
- package/dist/catalog-source.d.ts +2 -1
- package/dist/catalog-source.d.ts.map +1 -1
- package/dist/decode-image-bytes.d.ts +57 -0
- package/dist/decode-image-bytes.d.ts.map +1 -0
- package/dist/dynamic-texture-store.d.ts +89 -0
- package/dist/dynamic-texture-store.d.ts.map +1 -0
- package/dist/errors/asset.d.ts +201 -0
- package/dist/errors/asset.d.ts.map +1 -0
- package/dist/handles.d.ts +141 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/image-error.d.ts +6 -0
- package/dist/image-error.d.ts.map +1 -0
- package/dist/index.d.ts +32 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +7218 -114
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.ts +2 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.mjs +317 -3
- package/dist/internal.mjs.map +1 -1
- package/dist/loader-registry.d.ts +63 -0
- package/dist/loader-registry.d.ts.map +1 -0
- package/dist/loaders/inline-pack.d.ts +72 -0
- package/dist/loaders/inline-pack.d.ts.map +1 -0
- package/dist/loaders/mesh-bin.d.ts +21 -0
- package/dist/loaders/mesh-bin.d.ts.map +1 -0
- package/dist/loaders/pack-artifact.d.ts +20 -0
- package/dist/loaders/pack-artifact.d.ts.map +1 -0
- package/dist/material/dependency-graph.d.ts +9 -0
- package/dist/material/dependency-graph.d.ts.map +1 -0
- package/dist/material/generation-cache.d.ts +24 -0
- package/dist/material/generation-cache.d.ts.map +1 -0
- package/dist/material/inspection.d.ts +24 -0
- package/dist/material/inspection.d.ts.map +1 -0
- package/dist/material/loader.d.ts +59 -0
- package/dist/material/loader.d.ts.map +1 -0
- package/dist/material/runtime-shader.d.ts +14 -0
- package/dist/material/runtime-shader.d.ts.map +1 -0
- package/dist/mesh-bin.d.ts +3 -0
- package/dist/mesh-bin.d.ts.map +1 -0
- package/dist/mipmap-generator.d.ts +132 -0
- package/dist/mipmap-generator.d.ts.map +1 -0
- package/dist/payload-validate.d.ts +60 -0
- package/dist/payload-validate.d.ts.map +1 -0
- package/dist/plugin.d.ts +16 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/registry/artifact-io.d.ts +16 -0
- package/dist/registry/artifact-io.d.ts.map +1 -0
- package/dist/registry/asset-evidence.d.ts +13 -0
- package/dist/registry/asset-evidence.d.ts.map +1 -0
- package/dist/registry/catalog-state.d.ts +47 -0
- package/dist/registry/catalog-state.d.ts.map +1 -0
- package/dist/registry/catalog.d.ts +48 -0
- package/dist/registry/catalog.d.ts.map +1 -0
- package/dist/registry/instantiate.d.ts +153 -0
- package/dist/registry/instantiate.d.ts.map +1 -0
- package/dist/registry/load-by-guid.d.ts +247 -0
- package/dist/registry/load-by-guid.d.ts.map +1 -0
- package/dist/registry/load-state.d.ts +26 -0
- package/dist/registry/load-state.d.ts.map +1 -0
- package/dist/registry/runtime-projection.d.ts +16 -0
- package/dist/registry/runtime-projection.d.ts.map +1 -0
- package/dist/registry/scene-publication-fence.d.ts +38 -0
- package/dist/registry/scene-publication-fence.d.ts.map +1 -0
- package/dist/registry/validate-material.d.ts +77 -0
- package/dist/registry/validate-material.d.ts.map +1 -0
- package/dist/resolve-asset-handle.d.ts +43 -0
- package/dist/resolve-asset-handle.d.ts.map +1 -0
- package/dist/resolve-tileset-runtime.d.ts +23 -0
- package/dist/resolve-tileset-runtime.d.ts.map +1 -0
- package/dist/scene-handle-fields.d.ts +88 -0
- package/dist/scene-handle-fields.d.ts.map +1 -0
- package/dist/scene-payload.d.ts +15 -0
- package/dist/scene-payload.d.ts.map +1 -0
- package/dist/wire-default-loaders.d.ts +29 -0
- package/dist/wire-default-loaders.d.ts.map +1 -0
- package/package.json +22 -9
- package/src/__tests__/aabb.unit.test.ts +97 -0
- package/src/__tests__/artifact-integrity.unit.test.ts +99 -0
- package/src/__tests__/artifact-io.unit.test.ts +127 -0
- package/src/__tests__/asset-evidence-sdk.integration.test.ts +32 -0
- package/src/__tests__/asset-evidence.unit.test.ts +32 -0
- package/src/__tests__/{asset-kind.test.ts → asset-kind.unit.test.ts} +1 -1
- package/src/__tests__/asset-registry-catalog-reconcile.integration.test.ts +74 -0
- package/src/__tests__/asset-registry-catalog-reconcile.unit.test.ts +89 -0
- package/src/__tests__/asset-registry-catalog.unit.test.ts +170 -0
- package/src/__tests__/asset-registry.pack-cache.test.ts +96 -0
- package/src/__tests__/asset-registry.unit.test.ts +511 -0
- package/src/__tests__/asset-runtime-error-code-owner.test-d.ts +63 -0
- package/src/__tests__/catalog-replica.unit.test.ts +196 -0
- package/src/__tests__/catalog-source-v2.unit.test.ts +158 -0
- package/src/__tests__/catalog-source.unit.test.ts +126 -0
- package/src/__tests__/catalog-subscription-order.unit.test.ts +65 -0
- package/src/__tests__/catalog-subscription.unit.test.ts +28 -0
- package/src/__tests__/decode-image-bytes-pass-through.test.ts +34 -0
- package/src/__tests__/decode-image-bytes.browser.test.ts +102 -0
- package/src/__tests__/decode-image-bytes.test-d.ts +108 -0
- package/src/__tests__/decode-image-bytes.test.ts +90 -0
- package/src/__tests__/decode-image-mime-owner.test.ts +2 -5
- package/src/__tests__/dynamic-texture-store.unit.test.ts +115 -0
- package/src/__tests__/errors-asset.unit.test.ts +92 -0
- package/src/__tests__/inline-pack-loaders.unit.test.ts +548 -0
- package/src/__tests__/instantiate-context.unit.test.ts +65 -0
- package/src/__tests__/instantiate-publication-fence.unit.test.ts +158 -0
- package/src/__tests__/instantiate.unit.test.ts +684 -0
- package/src/__tests__/loader-input-contract.unit.test.ts +89 -0
- package/src/__tests__/loader-registry.unit.test.ts +101 -0
- package/src/__tests__/material-dependency-invalidation.unit.test.ts +14 -0
- package/src/__tests__/material-generation-cache.unit.test.ts +46 -0
- package/src/__tests__/material-load-consumer.test-d.ts +42 -0
- package/src/__tests__/material-ready.integration.test.ts +492 -0
- package/src/__tests__/material-stale-generation.unit.test.ts +152 -0
- package/src/__tests__/mesh-bin-morph-v3.test.ts +22 -0
- package/src/__tests__/mesh-bin.unit.test.ts +152 -0
- package/src/__tests__/mipmap-generator.unit.test.ts +202 -0
- package/src/__tests__/pack-artifact-transcode-model-owner.test.ts +32 -0
- package/src/__tests__/pack-basis-load.integration.test.ts +168 -0
- package/src/__tests__/payload-validate.unit.test.ts +285 -0
- package/src/__tests__/plugin.test.ts +55 -0
- package/src/__tests__/registry-concurrency.bench.test.ts +40 -0
- package/src/__tests__/registry-failure-retry.integration.test.ts +69 -0
- package/src/__tests__/registry-load-graph.integration.test.ts +246 -0
- package/src/__tests__/registry-load-state.unit.test.ts +35 -0
- package/src/__tests__/registry-package-cache.unit.test.ts +53 -0
- package/src/__tests__/registry-public-ready.unit.test.ts +38 -0
- package/src/__tests__/resolve-asset-handle.unit.test.ts +238 -0
- package/src/__tests__/scene-handle-fields.unit.test.ts +129 -0
- package/src/__tests__/scene-payload.unit.test.ts +151 -0
- package/src/__tests__/scene-publication-fence.test.ts +129 -0
- package/src/__tests__/scriptable-pack-public-surface.test-d.ts +16 -0
- package/src/__tests__/static-rig.integration.test.ts +8 -0
- package/src/__tests__/validate-material.unit.test.ts +359 -0
- package/src/__tests__/video-pack-loader.integration.test.ts +83 -0
- package/src/aabb.ts +107 -0
- package/src/asset-registry.ts +2040 -0
- package/src/builtin-asset-registry.ts +164 -0
- package/src/catalog-source.ts +14 -70
- package/src/decode-image-bytes.ts +126 -0
- package/src/dynamic-texture-store.ts +234 -0
- package/src/errors/asset.ts +347 -0
- package/src/handles.ts +180 -0
- package/src/image-error.ts +45 -0
- package/src/index.ts +177 -19
- package/src/internal.ts +2 -0
- package/src/loader-registry.ts +157 -0
- package/src/loaders/inline-pack.ts +837 -0
- package/src/loaders/mesh-bin.ts +304 -0
- package/src/loaders/pack-artifact.ts +665 -0
- package/src/material/dependency-graph.ts +46 -0
- package/src/material/generation-cache.ts +177 -0
- package/src/material/inspection.ts +46 -0
- package/src/material/loader.ts +326 -0
- package/src/material/runtime-shader.ts +133 -0
- package/src/mesh-bin.ts +5 -0
- package/src/mipmap-generator.ts +450 -0
- package/src/payload-validate.ts +573 -0
- package/src/plugin.ts +48 -0
- package/src/registry/artifact-io.ts +259 -0
- package/src/registry/asset-evidence.ts +51 -0
- package/src/registry/catalog-state.ts +409 -0
- package/src/registry/catalog.ts +369 -0
- package/src/registry/instantiate.ts +1056 -0
- package/src/registry/load-by-guid.ts +1657 -0
- package/src/registry/load-state.ts +115 -0
- package/src/registry/runtime-projection.ts +63 -0
- package/src/registry/scene-publication-fence.ts +256 -0
- package/src/registry/validate-material.ts +386 -0
- package/src/resolve-asset-handle.ts +147 -0
- package/src/resolve-tileset-runtime.ts +72 -0
- package/src/scene-handle-fields.ts +221 -0
- package/src/scene-payload.ts +207 -0
- package/src/wire-default-loaders.ts +79 -0
- package/dist/__tests__/asset-graph-red.integration.test.d.ts +0 -2
- package/dist/__tests__/asset-graph-red.integration.test.d.ts.map +0 -1
- package/dist/__tests__/asset-kind.test.d.ts +0 -2
- package/dist/__tests__/asset-kind.test.d.ts.map +0 -1
- package/dist/__tests__/asset-registry-core.integration.test.d.ts +0 -2
- package/dist/__tests__/asset-registry-core.integration.test.d.ts.map +0 -1
- package/dist/__tests__/asset-registry-public-api.test-d.d.ts +0 -2
- package/dist/__tests__/asset-registry-public-api.test-d.d.ts.map +0 -1
- package/dist/__tests__/asset-runtime-core-lifecycle.integration.test.d.ts +0 -2
- package/dist/__tests__/asset-runtime-core-lifecycle.integration.test.d.ts.map +0 -1
- package/dist/__tests__/asset-runtime-snapshot.unit.test.d.ts +0 -2
- package/dist/__tests__/asset-runtime-snapshot.unit.test.d.ts.map +0 -1
- package/dist/__tests__/catalog-session-red.unit.test.d.ts +0 -2
- package/dist/__tests__/catalog-session-red.unit.test.d.ts.map +0 -1
- package/dist/__tests__/registry-lifecycle-red.integration.test.d.ts +0 -2
- package/dist/__tests__/registry-lifecycle-red.integration.test.d.ts.map +0 -1
- package/src/__tests__/asset-graph-red.integration.test.ts +0 -113
- package/src/__tests__/asset-registry-core.integration.test.ts +0 -161
- package/src/__tests__/asset-registry-public-api.test-d.ts +0 -31
- package/src/__tests__/asset-runtime-core-lifecycle.integration.test.ts +0 -79
- package/src/__tests__/asset-runtime-snapshot.unit.test.ts +0 -23
- package/src/__tests__/catalog-session-red.unit.test.ts +0 -276
- package/src/__tests__/registry-lifecycle-red.integration.test.ts +0 -80
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { EcsError, EntityHandle, World } from '@forgeax/engine-ecs';
|
|
2
|
+
import type { PackError } from '@forgeax/engine-pack/errors';
|
|
3
|
+
import { type Result } from '@forgeax/engine-rhi';
|
|
4
|
+
import { type Asset, AssetError, type Handle, type SceneAsset, type SceneInstanceMount, type SkinAsset, type TagOf } from '@forgeax/engine-types';
|
|
5
|
+
import type { AssetRegistry } from '../asset-registry';
|
|
6
|
+
import { type ScenePublicationFence, type ScenePublicationFenceError } from './scene-publication-fence';
|
|
7
|
+
/**
|
|
8
|
+
* Resolver contract consumed by {@link postSpawnResolveJoints} (D-1: relocated
|
|
9
|
+
* here from scene-instances/post-spawn-resolve-joints.ts so the hook contract
|
|
10
|
+
* travels with the instantiate cluster into @forgeax/engine-assets-runtime).
|
|
11
|
+
*/
|
|
12
|
+
export interface SkinJointResolver {
|
|
13
|
+
resolveSkinAsset(skeletonHandleRaw: number): SkinAsset | undefined;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Post-spawn hook contract (D-1). A hook runs after instantiate spawns the
|
|
17
|
+
* scene subtree; the shipped implementation is runtime's `postSpawnResolveJoints`
|
|
18
|
+
* (auto-wire Skin.joints). Injected at the sole production assembly point
|
|
19
|
+
* (createRenderer) in w9/w10; when absent, instantiate skips joint wiring.
|
|
20
|
+
*/
|
|
21
|
+
export type PostSpawnHook = (world: World, resolver: SkinJointResolver, root: EntityHandle) => {
|
|
22
|
+
ok: true;
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
error: unknown;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Materialise a `SceneAsset` into an existing `World` and return the
|
|
29
|
+
* synthetic root `Entity` (feat-20260514 w31 sugar wrapper; AC-03 +
|
|
30
|
+
* requirements §IN-3; M3: returns Entity not SceneInstanceId).
|
|
31
|
+
*
|
|
32
|
+
* Before spawning, handle-type component fields (e.g. `assetHandle`,
|
|
33
|
+
* `material`, `skeleton`) containing GUID strings are resolved to fresh
|
|
34
|
+
* user-tier `Handle` numbers via `world.allocSharedRef` (feat-20260614 M8
|
|
35
|
+
* D-19 instantiate-time GUID->handle mint; supersedes the pre-D-17
|
|
36
|
+
* `resolveGuid` map). GUIDs that fail to parse or are not catalogued return
|
|
37
|
+
* `AssetError(code='asset-not-found')` with a hint containing the GUID,
|
|
38
|
+
* node localId, and field name.
|
|
39
|
+
*
|
|
40
|
+
* Errors propagate verbatim through the closed
|
|
41
|
+
* `AssetError | PackError | EcsError` union so AI users that already
|
|
42
|
+
* narrow `loadByGuid<SceneAsset>` results reuse the same `switch
|
|
43
|
+
* (err.code)` exhaustively (charter proposition 3 machine-readable
|
|
44
|
+
* union; plan-strategy §3.3 closed-union transparency).
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const sceneRes = await engine.assets.loadByGuid<SceneAsset>(roomGuid); // payload (D-17)
|
|
49
|
+
* if (!sceneRes.ok) return;
|
|
50
|
+
* const handle = world.allocSharedRef('SceneAsset', sceneRes.value); // mint column handle
|
|
51
|
+
* const r = engine.assets.instantiate(handle, world);
|
|
52
|
+
* if (!r.ok) {
|
|
53
|
+
* switch (r.error.code) {
|
|
54
|
+
* case 'asset-not-found':
|
|
55
|
+
* case 'pack-cyclic-reference':
|
|
56
|
+
* // ... AssetErrorCode | PackErrorCode | EcsErrorCode exhaustive
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function instantiate<T extends SceneAsset>(registry: AssetRegistry, handle: Handle<TagOf<T>, 'shared'>, world: World, parent?: EntityHandle, expectedPublication?: ScenePublicationFence): Result<EntityHandle, AssetError | PackError | EcsError | ScenePublicationFenceError>;
|
|
62
|
+
/**
|
|
63
|
+
* Materialise a `SceneAsset` FLAT into an existing `World` — the "edit the
|
|
64
|
+
* scene itself" registry entry (#655). Shares the GUID-resolution + shared-ref +
|
|
65
|
+
* SceneAssetResolver prelude with {@link instantiate}, but calls
|
|
66
|
+
* `worldInstantiateSceneFlat` instead of `worldInstantiateScene`: NO synthetic
|
|
67
|
+
* SceneInstance root, NO forced `ChildOf` on top-level members. The scene's own
|
|
68
|
+
* entities become plain top-level world entities; nested prefabs (`mounts[]`)
|
|
69
|
+
* still become their own SceneInstance anchors. Returns the set of top-level
|
|
70
|
+
* entity handles.
|
|
71
|
+
*
|
|
72
|
+
* Use this to OPEN a scene for authoring; use {@link instantiate} (anchor) at
|
|
73
|
+
* runtime / Play and for nested prefabs.
|
|
74
|
+
*
|
|
75
|
+
* The post-spawn Skin.joints hook (when wired via `registry.postSpawnHook`)
|
|
76
|
+
* runs once per top-level root: each GLB root keeps its own `ChildOf` subtree,
|
|
77
|
+
* so joint resolution is scoped to each subtree exactly as the anchor path
|
|
78
|
+
* scopes it to the single synthetic root.
|
|
79
|
+
*/
|
|
80
|
+
export declare function instantiateFlat<T extends SceneAsset>(registry: AssetRegistry, handle: Handle<TagOf<T>, 'shared'>, world: World, expectedPublication?: ScenePublicationFence): Result<EntityHandle[], AssetError | PackError | EcsError | ScenePublicationFenceError>;
|
|
81
|
+
/**
|
|
82
|
+
* m3-i2: Recursively resolve mounts[].source GUID strings.
|
|
83
|
+
* Returns a PackError-shaped object on cycle (R-9) or AssetError
|
|
84
|
+
* on child resolution failure.
|
|
85
|
+
*
|
|
86
|
+
* feat-20260713 M3 / w13: also down-drills `mounts[].overrides[].value`,
|
|
87
|
+
* resolving any GUID string bound to a `shared<...>` / `array<shared<...>>`
|
|
88
|
+
* schema field to a live handle (D-2). `guidToHandle` is the caller's per-scene
|
|
89
|
+
* dedup map (shared with the entity-field resolution in `_resolveSceneGuids`) so
|
|
90
|
+
* the same catalogued GUID mints exactly one user-tier handle across entity
|
|
91
|
+
* fields and override values (D-15/D-17 dedup contract); it defaults to a fresh
|
|
92
|
+
* map so standalone callers keep working. Override resolution runs for every
|
|
93
|
+
* mount regardless of `source` branch — an unresolvable GUID fail-fasts here,
|
|
94
|
+
* before any spawn (P3: no half-initialized member).
|
|
95
|
+
*/
|
|
96
|
+
export declare function resolveMountsRec(registry: AssetRegistry, mounts: readonly SceneInstanceMount[], world: World, visited: Set<string>, guidToHandle?: Map<string, number>, resolvedSceneHandles?: Map<string, number>): Result<SceneInstanceMount[], AssetError | {
|
|
97
|
+
readonly code: 'pack-cyclic-reference';
|
|
98
|
+
readonly expected: string;
|
|
99
|
+
readonly hint: string;
|
|
100
|
+
readonly detail: {
|
|
101
|
+
readonly code: 'pack-cyclic-reference';
|
|
102
|
+
readonly kind: 'mount-asset';
|
|
103
|
+
readonly cycle: readonly string[];
|
|
104
|
+
};
|
|
105
|
+
} | ScenePublicationFenceError>;
|
|
106
|
+
/**
|
|
107
|
+
* Resolve one GUID string to a live user-tier handle (feat-20260713 M3 / w13
|
|
108
|
+
* SSOT). Parses the GUID, uses `guidToHandle` as the per-resolution fast path,
|
|
109
|
+
* and on a miss looks the envelope up in the catalog + interns its shared ref
|
|
110
|
+
* by `(target, payload identity)` in the World. An unparseable / uncatalogued
|
|
111
|
+
* GUID returns `AssetError(code='asset-not-found')` with a breadcrumb hint
|
|
112
|
+
* (`fieldPath` + `location`) for AI-user debuggability (P3). Shared by the
|
|
113
|
+
* entity-field fallback in `_resolveSceneGuids` and the override-value down-drill
|
|
114
|
+
* in {@link resolveMountOverrides} so the parse/dedup/lookup/mint idiom has one
|
|
115
|
+
* home (architecture-principles §1 SSOT).
|
|
116
|
+
*/
|
|
117
|
+
export declare function resolveHandleGuid(registry: AssetRegistry, world: World, guidString: string, guidToHandle: Map<string, number>, fieldPath: string, location: string): Result<number, AssetError>;
|
|
118
|
+
/**
|
|
119
|
+
* tweak-20260609 M1 helper: build the per-sub-ref parent context for a
|
|
120
|
+
* SceneAsset child. feat-20260622 M3 / w9: re-sourced to lookup in the
|
|
121
|
+
* scene envelope's ``refs[]`` edges instead of walking entity components
|
|
122
|
+
* via extractSceneEntityHandleGuids (D-7). When the scene envelope is not
|
|
123
|
+
* found in the catalog, falls back to the entity-walk path (backward compat
|
|
124
|
+
* for call sites that lack a catalogued envelope).
|
|
125
|
+
*
|
|
126
|
+
* Texture edges (sourceField=undefined) produce ``componentField:
|
|
127
|
+
* undefined`` — the breadcrumb will show GUID+kind only, no per-entity
|
|
128
|
+
* detail (D-2: texture has no per-entity origin).
|
|
129
|
+
*/
|
|
130
|
+
export declare function buildSceneChildContext(registry: AssetRegistry, scene: Asset & {
|
|
131
|
+
kind: 'scene';
|
|
132
|
+
}, subGuidKey: string, sceneGuidKey?: string): {
|
|
133
|
+
sceneEntityId?: number;
|
|
134
|
+
componentField?: string;
|
|
135
|
+
sourceField?: {
|
|
136
|
+
componentName?: string;
|
|
137
|
+
fieldName: string;
|
|
138
|
+
arrayIndex?: number;
|
|
139
|
+
};
|
|
140
|
+
} | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* tweak-20260609 M1 helper: build the error-hint breadcrumb string
|
|
143
|
+
* containing the parent asset's GUID + kind, enriched with the
|
|
144
|
+
* caller-provided `parentContext` (entity localId + component.field).
|
|
145
|
+
*
|
|
146
|
+
* Per D-7 / B-8: the breadcrumb appears before the sub-asset's own hint,
|
|
147
|
+
* separated by " / ".
|
|
148
|
+
*/
|
|
149
|
+
export declare function buildBreadcrumbHint(parentGuidKey: string, parentKind: string, subGuidKey: string, parentContext?: {
|
|
150
|
+
sceneEntityId?: number;
|
|
151
|
+
componentField?: string;
|
|
152
|
+
}): string;
|
|
153
|
+
//# sourceMappingURL=instantiate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instantiate.d.ts","sourceRoot":"","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,CAAC,EACjC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CA+B5B;AAoHD;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,KAAK,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,EAChC,UAAU,EAAE,MAAM,EAClB,YAAY,CAAC,EAAE,MAAM,GAEnB;IACE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE;QACZ,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,GACD,SAAS,CA8FZ;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,GACA,MAAM,CAMR"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { AssetGuid } from '@forgeax/engine-pack/guid';
|
|
2
|
+
import { type Result, type RhiError } from '@forgeax/engine-rhi';
|
|
3
|
+
import { type Asset, type AssetCompression, AssetError, type AssetErrorCode, type AssetRef, type CatalogSubject, type ImageError, type ImageMetadata, type LoadContext, type ParseErrorDetail } from '@forgeax/engine-types';
|
|
4
|
+
import type { AssetRegistry } from '../asset-registry';
|
|
5
|
+
import { type MaterialLoadError, type MaterialLoadRequest, type MaterialReady } from '../material/loader';
|
|
6
|
+
/**
|
|
7
|
+
* Load an asset and all its transitively referenced sub-assets by GUID;
|
|
8
|
+
* returns `ok(handle)` only when the asset and every sub-asset are in the
|
|
9
|
+
* registry.
|
|
10
|
+
*
|
|
11
|
+
* **Post-condition:** `ok(payload)` is returned ONLY when the asset AND every
|
|
12
|
+
* transitively referenced sub-asset (per the asset envelope's `refs[]`) are
|
|
13
|
+
* present in this registry. The implementation walks `envelope.refs` and
|
|
14
|
+
* recursively calls `loadByGuid` on each ref before cataloguing the top-level
|
|
15
|
+
* asset. The resolved value is the PAYLOAD `T`
|
|
16
|
+
* (D-17), never a handle -- mint a column handle with
|
|
17
|
+
* `world.allocSharedRef('Kind', payload)` when one is needed (e.g. before
|
|
18
|
+
* `instantiate`).
|
|
19
|
+
*
|
|
20
|
+
* Two paths:
|
|
21
|
+
* - **Dev / fallback** (no `configurePackIndex` call): synchronous catalogue
|
|
22
|
+
* lookup wrapped in `Promise.resolve`. Returns `Err(asset-not-found)` if not
|
|
23
|
+
* catalogued.
|
|
24
|
+
* - **Prod** (after `configurePackIndex(url)`): fetches `pack-index.json`
|
|
25
|
+
* on the first call (cached as a `Map<guid, {packageUrl, kind}>`), then
|
|
26
|
+
* fetches the individual resource URL and parses the asset payload, then
|
|
27
|
+
* catalogues it (GUID -> payload) and returns the payload.
|
|
28
|
+
*
|
|
29
|
+
* Error union: `AssetError | PackError | ImageError | RhiError` (closed -- no
|
|
30
|
+
* new codes were introduced by the recursive walk; every code is pre-existing).
|
|
31
|
+
*
|
|
32
|
+
* An in-flight `Map` (D-5) deduplicates concurrent calls for the same GUID and
|
|
33
|
+
* prevents stack overflow on cycles (A->B->A).
|
|
34
|
+
*
|
|
35
|
+
* **Breaking-change classification:** this is a semantic strengthening, not a
|
|
36
|
+
* shape change. Sub-assets catalogued by a prior `catalog(guid, payload)` /
|
|
37
|
+
* `loadByGuid` call are protected by the catalogue fast-path: the recursive
|
|
38
|
+
* walk hits cache on every node and incurs zero additional fetch.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const res = await engine.assets.loadByGuid<SceneAsset>(sceneGuid);
|
|
43
|
+
* if (!res.ok) {
|
|
44
|
+
* switch (res.error.code) {
|
|
45
|
+
* case 'asset-not-found':
|
|
46
|
+
* // top GUID or any sub-asset GUID is missing from the catalog
|
|
47
|
+
* break;
|
|
48
|
+
* case 'asset-fetch-failed':
|
|
49
|
+
* // network / CORS
|
|
50
|
+
* break;
|
|
51
|
+
* case 'asset-parse-failed':
|
|
52
|
+
* // payload malformed
|
|
53
|
+
* break;
|
|
54
|
+
* // ... AssetErrorCode | PackErrorCode | ImageErrorCode | RhiErrorCode exhaustive
|
|
55
|
+
* }
|
|
56
|
+
* return;
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function loadByGuid<T = Asset>(registry: AssetRegistry, guid: AssetGuid, parentContext?: {
|
|
61
|
+
sceneEntityId?: number;
|
|
62
|
+
componentField?: string;
|
|
63
|
+
}): Promise<Result<T, AssetError | ImageError | RhiError>>;
|
|
64
|
+
export declare function loadMaterialReadyByGuid(registry: AssetRegistry, request: MaterialLoadRequest): Promise<MaterialReady | MaterialLoadError>;
|
|
65
|
+
/**
|
|
66
|
+
* feat-20260603-asset-import-loader-injection M1 / w6: load an
|
|
67
|
+
* upstream-branch kind (texture / font) straight from its catalog entry
|
|
68
|
+
* through the injected async loader, then register the produced POD. Replaces
|
|
69
|
+
* the bespoke `loadTextureFromEntry` / `loadFontFromEntry` methods; the decode
|
|
70
|
+
* / glyph-parse logic moved verbatim into the loader bodies (D-2 — loader is
|
|
71
|
+
* pure of `registerWithGuid`, which stays here).
|
|
72
|
+
*/
|
|
73
|
+
export declare function loadFromUpstreamEntry<T = Asset>(registry: AssetRegistry, guidKey: string, entry: {
|
|
74
|
+
packageUrl: string;
|
|
75
|
+
kind: string;
|
|
76
|
+
name?: string;
|
|
77
|
+
metadata?: ImageMetadata | undefined;
|
|
78
|
+
}): Promise<Result<T, AssetError | ImageError | RhiError>>;
|
|
79
|
+
/**
|
|
80
|
+
* Internal: prod fetch path for `loadByGuid`.
|
|
81
|
+
* Fetches pack-index.json (cached), then fetches the pack file, parses the
|
|
82
|
+
* asset payload, and registers it.
|
|
83
|
+
*/
|
|
84
|
+
export declare function loadByGuidProd<T = Asset>(registry: AssetRegistry, guid: AssetGuid, guidKey: string, parentContext?: {
|
|
85
|
+
sceneEntityId?: number;
|
|
86
|
+
componentField?: string;
|
|
87
|
+
}, ancestry?: ReadonlySet<string>): Promise<Result<T, AssetError | ImageError | RhiError>>;
|
|
88
|
+
/**
|
|
89
|
+
* Resolve the catalog entry for a GUID, lazily fetching the pack-index on
|
|
90
|
+
* first call. Returns `undefined` when the GUID is absent from the catalog.
|
|
91
|
+
*/
|
|
92
|
+
export declare function resolveCatalogEntry(registry: AssetRegistry, guidKey: string): Promise<{
|
|
93
|
+
packageUrl: string;
|
|
94
|
+
kind: string;
|
|
95
|
+
name?: string;
|
|
96
|
+
metadata?: ImageMetadata | undefined;
|
|
97
|
+
compression?: AssetCompression;
|
|
98
|
+
} | undefined>;
|
|
99
|
+
/**
|
|
100
|
+
* feat-20260618 M3 (D-2): once the pack-index is parsed, group every row by
|
|
101
|
+
* its `packageUrl` and register each package fully -- all of its GUIDs and
|
|
102
|
+
* their entry display names in one `registerPackage` call. Registering the
|
|
103
|
+
* whole package at once (rather than one GUID per load) means the package
|
|
104
|
+
* cardinality is known up front, so `resolveName` returns the basename for a
|
|
105
|
+
* genuinely single-asset package and the entry name for a multi-asset one,
|
|
106
|
+
* with no incremental 1->N promotion needed on the prod path. The name travels
|
|
107
|
+
* entry -> Package, never through the payload (Risk-3 JSON-roundtrip safety),
|
|
108
|
+
* and covers both the sync (parseAssetPayload) and async (texture/font) loads.
|
|
109
|
+
*/
|
|
110
|
+
export declare function registerPackagesFromIndex(registry: AssetRegistry, catalog: Map<string, {
|
|
111
|
+
packageUrl: string;
|
|
112
|
+
name?: string;
|
|
113
|
+
sourcePath?: string;
|
|
114
|
+
subject?: CatalogSubject;
|
|
115
|
+
}>): void;
|
|
116
|
+
/**
|
|
117
|
+
* Load an asset through the DDC (catalog entry -> fetch pack -> loader.load
|
|
118
|
+
* -> register). Returns `Err(asset-not-found)` or `Err(asset-fetch-failed)`
|
|
119
|
+
* on DDC miss (the caller then decides whether to route through the
|
|
120
|
+
* import transport).
|
|
121
|
+
*
|
|
122
|
+
* This path is IDENTICAL in studio and shipped forms -- the only difference
|
|
123
|
+
* between the two is whether `registry.importTransport` exists when the caller
|
|
124
|
+
* falls back to `transportOrFail` (AC-23 key invariant).
|
|
125
|
+
*/
|
|
126
|
+
export declare function ddcLoad<T = Asset>(registry: AssetRegistry, guid: AssetGuid, guidKey: string, entry: {
|
|
127
|
+
packageUrl: string;
|
|
128
|
+
kind: string;
|
|
129
|
+
name?: string;
|
|
130
|
+
metadata?: ImageMetadata | undefined;
|
|
131
|
+
compression?: AssetCompression;
|
|
132
|
+
}, parentContext?: {
|
|
133
|
+
sceneEntityId?: number;
|
|
134
|
+
componentField?: string;
|
|
135
|
+
}, ancestry?: ReadonlySet<string>): Promise<Result<T, AssetError | ImageError | RhiError>>;
|
|
136
|
+
/**
|
|
137
|
+
* M4 transport fallback: try the injected {@link ImportTransport} to lazily
|
|
138
|
+
* import a missing DDC, then re-enter the DDC load path. When no transport
|
|
139
|
+
* is wired (shipped form), fail fast with `asset-not-imported` (AC-22).
|
|
140
|
+
*/
|
|
141
|
+
export declare function transportOrFail<T = Asset>(registry: AssetRegistry, guid: AssetGuid, guidKey: string, _missReason: AssetErrorCode): Promise<Result<T, AssetError | ImageError | RhiError>>;
|
|
142
|
+
/**
|
|
143
|
+
* Register a parsed asset POD (the synchronous tail of the DDC load path:
|
|
144
|
+
* `registerWithGuid`). Material parent preload is handled asynchronously
|
|
145
|
+
* inside `ddcLoad` before calling this method; the registered asset is
|
|
146
|
+
* always fully resolved by the time it reaches here.
|
|
147
|
+
*
|
|
148
|
+
* Extracted from the old `loadByGuidProd` body so `ddcLoad` and
|
|
149
|
+
* `transportOrFail` share an identical load path (AC-23 key invariant).
|
|
150
|
+
*/
|
|
151
|
+
export declare function registerParsedAsset<T = Asset>(registry: AssetRegistry, guid: AssetGuid, asset: Asset, _guidKey: string, refs?: readonly AssetRef[]): Result<T, AssetError | ImageError | RhiError>;
|
|
152
|
+
/**
|
|
153
|
+
* Fetch a .pack.json file, find the asset entry matching guidKey, and
|
|
154
|
+
* reconstruct the Asset from its payload.
|
|
155
|
+
*/
|
|
156
|
+
/**
|
|
157
|
+
* bug-20260610: fetch one pack file and return the raw asset entry without
|
|
158
|
+
* parsing. Used by `loadByGuidProd` for material kinds so the caller can
|
|
159
|
+
* recursively preload `refs[]` (texture sub-assets) BEFORE the synchronous
|
|
160
|
+
* materialLoader runs and rewrites values handle fields to their refs[]
|
|
161
|
+
* GUID strings (feat-20260614 M8 / D-19: GUID verbatim, no handle minting).
|
|
162
|
+
*/
|
|
163
|
+
export declare function fetchPackEntry(_registry: AssetRegistry, packageUrl: string, guidKey: string): Promise<Result<{
|
|
164
|
+
kind: string;
|
|
165
|
+
payload: Record<string, unknown>;
|
|
166
|
+
refs?: string[];
|
|
167
|
+
}, AssetError>>;
|
|
168
|
+
/**
|
|
169
|
+
* Fetch one pack file, locate the requested asset entry, and either parse it
|
|
170
|
+
* inline or expose the entry to the caller (for kinds that need to preload
|
|
171
|
+
* `refs[]` BEFORE running the loader — currently 'material', whose
|
|
172
|
+
* values handle fields are rewritten to their refs[] GUID strings
|
|
173
|
+
* (feat-20260614 M8 / D-19: GUID verbatim, no handle minting at load time)).
|
|
174
|
+
*
|
|
175
|
+
* bug-20260610 Fix B (M3 / D-4): the fetch+parse result is cached per
|
|
176
|
+
* `packageUrl` in `packFileCache`; concurrent calls for the same URL share
|
|
177
|
+
* a single in-flight promise via `packFileInFlight`. Only the raw parsed
|
|
178
|
+
* body is cached — `parseAssetPayload` still runs per-call (CON-2).
|
|
179
|
+
*/
|
|
180
|
+
export declare function fetchPackFile(registry: AssetRegistry, packageUrl: string, guidKey: string, _kind: string): Promise<Result<{
|
|
181
|
+
asset: Asset;
|
|
182
|
+
refs: readonly string[];
|
|
183
|
+
}, AssetError>>;
|
|
184
|
+
/**
|
|
185
|
+
* Parse the asset payload from a pack-file entry and return the result.
|
|
186
|
+
* Extracted so cache-hit and in-flight-dedup paths share the same
|
|
187
|
+
* parseAssetPayload + error-wrapping logic.
|
|
188
|
+
*/
|
|
189
|
+
export declare function parseAndReturnAsset(registry: AssetRegistry, assetEntry: {
|
|
190
|
+
kind: string;
|
|
191
|
+
payload: Record<string, unknown>;
|
|
192
|
+
refs?: string[];
|
|
193
|
+
}): Result<{
|
|
194
|
+
asset: Asset;
|
|
195
|
+
refs: readonly string[];
|
|
196
|
+
}, AssetError>;
|
|
197
|
+
/**
|
|
198
|
+
* Fetch a pack file from the network, parse the JSON body, store the
|
|
199
|
+
* result in the cache, and return the requested asset entry.
|
|
200
|
+
*
|
|
201
|
+
* Registers the in-flight promise in `packFileInFlight` so concurrent
|
|
202
|
+
* callers share a single fetch. On success the body moves to
|
|
203
|
+
* `packFileCache`; on failure the in-flight entry is removed so
|
|
204
|
+
* subsequent retries re-fetch (D-7).
|
|
205
|
+
*/
|
|
206
|
+
export declare function fetchAndCachePackFile(registry: AssetRegistry, packageUrl: string, guidKey: string): Promise<Result<{
|
|
207
|
+
asset: Asset;
|
|
208
|
+
refs: readonly string[];
|
|
209
|
+
}, AssetError>>;
|
|
210
|
+
/**
|
|
211
|
+
* Reconstruct a typed `Asset` from a raw payload object.
|
|
212
|
+
*
|
|
213
|
+
* @param kind The asset kind discriminant (matches the pack entry or
|
|
214
|
+
* dev-register dispatch).
|
|
215
|
+
* @param payload The serialised asset payload (keys mirror the asset
|
|
216
|
+
* interface field names).
|
|
217
|
+
* @param refs Pack-file refs array for Handle fields — when a field
|
|
218
|
+
* value is `number` it resolves to `refs[N]` (glTF-style index).
|
|
219
|
+
* Optional to preserve compatibility with callers outside the pack
|
|
220
|
+
* ingestion path (e.g., direct `registerWithGuid`).
|
|
221
|
+
*/
|
|
222
|
+
export declare function parseAssetPayload(registry: AssetRegistry, kind: string, payload: Record<string, unknown>, refs?: string[]): Asset | Record<string, unknown> | undefined | {
|
|
223
|
+
readonly ok: false;
|
|
224
|
+
readonly error: ParseErrorDetail;
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Build the {@link LoadContext} passed to a loader's `load`.
|
|
228
|
+
* `fetchBinary` / `resolveRef` / `device` are wired for the async texture /
|
|
229
|
+
* font loaders (w6).
|
|
230
|
+
*/
|
|
231
|
+
export declare function makeLoadContext(registry: AssetRegistry): LoadContext;
|
|
232
|
+
/**
|
|
233
|
+
* Return a runtime snapshot of every catalogued asset. Each entry exposes
|
|
234
|
+
* `{ guid, kind, name }` where `kind` is the asset discriminant string
|
|
235
|
+
* from `payload.kind`. feat-20260614 M8 (D-15): the registry holds no
|
|
236
|
+
* handles -- entries are keyed by GUID (the catalogue key).
|
|
237
|
+
*
|
|
238
|
+
* AI-user narrowing flow (AC-11 + plan-strategy §7.4):
|
|
239
|
+
* ```ts
|
|
240
|
+
* for (const e of registry.inspect().assets) {
|
|
241
|
+
* if (e.kind === 'texture') {
|
|
242
|
+
* // re-query via registry.lookup(e.guid) to get the typed Asset value.
|
|
243
|
+
* }
|
|
244
|
+
* }
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
//# sourceMappingURL=load-by-guid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-by-guid.d.ts","sourceRoot":"","sources":["../../src/registry/load-by-guid.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAW,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,UAAU,EACV,KAAK,cAAc,EAEnB,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,WAAW,EAIhB,KAAK,gBA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,CA4CxE;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB,GACA,MAAM,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,UAAU,CAAC,CAwC/D;AAED;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,EAAE,UAAU,CAAC,CAAC,CAmExE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,IAAI,CAAC,EAAE,MAAM,EAAE,GAEb,KAAK,GACL,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvB,SAAS,GACT;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,CA2B3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,WAAW,CAuFpE;AAED;;;;;;;;;;;;;;GAcG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type LoadStatus = 'unloaded' | 'provisional' | 'ready' | 'failed';
|
|
2
|
+
export interface LoadRecord {
|
|
3
|
+
readonly status: LoadStatus;
|
|
4
|
+
readonly refs: readonly string[];
|
|
5
|
+
readonly value?: unknown;
|
|
6
|
+
readonly error?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export declare class LoadStateStore {
|
|
9
|
+
private readonly records;
|
|
10
|
+
get(guid: string): LoadRecord | undefined;
|
|
11
|
+
getReady<T = unknown>(guid: string): T | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Return a provisional value only for the internal SCC back-edge bridge.
|
|
14
|
+
* Public callers must use getReady so promotion remains the visibility gate.
|
|
15
|
+
*/
|
|
16
|
+
getProvisional<T = unknown>(guid: string): T | undefined;
|
|
17
|
+
begin(guid: string, refs: readonly string[]): LoadRecord;
|
|
18
|
+
resolveAsset(guid: string, value: unknown): void;
|
|
19
|
+
registerReady(guid: string, value: unknown): void;
|
|
20
|
+
promoteReady(guid: string): void;
|
|
21
|
+
fail(guid: string, error: unknown): readonly string[];
|
|
22
|
+
remove(guid: string): void;
|
|
23
|
+
clear(): void;
|
|
24
|
+
private provisionalGroup;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=load-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-state.d.ts","sourceRoot":"","sources":["../../src/registry/load-state.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEzE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AASD,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwC;IAEhE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIzC,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAKlD;;;OAGG;IACH,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAKxD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,UAAU;IAYxD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAUhD,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAMjD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAkBhC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE;IAWrD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI1B,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,gBAAgB;CAYzB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Result } from '@forgeax/engine-rhi';
|
|
2
|
+
import { AssetError, type CatalogProjection } from '@forgeax/engine-types';
|
|
3
|
+
import type { CatalogRecord } from './catalog';
|
|
4
|
+
export interface RuntimeProjection {
|
|
5
|
+
readonly subject: CatalogProjection['subject'];
|
|
6
|
+
readonly execution: CatalogProjection['execution'];
|
|
7
|
+
readonly lifecycle: CatalogProjection['lifecycle'];
|
|
8
|
+
readonly packageUrl: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolve the producer-declared runtime projection. Legacy rows return
|
|
12
|
+
* undefined so inline/dev assets retain their existing registration path;
|
|
13
|
+
* rows that publish any projection axis must publish all three axes.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveRuntimeProjection(guid: string, record: CatalogRecord): Result<RuntimeProjection | undefined, AssetError>;
|
|
16
|
+
//# sourceMappingURL=runtime-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-projection.d.ts","sourceRoot":"","sources":["../../src/registry/runtime-projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAqB,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACnD,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IACnD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAUD;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,GACpB,MAAM,CAAC,iBAAiB,GAAG,SAAS,EAAE,UAAU,CAAC,CAmCnD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Result } from '@forgeax/engine-rhi';
|
|
2
|
+
import type { AssetPublicationEnvelope, CatalogEntry, ScenePublicationFence as EngineScenePublicationFence } from '@forgeax/engine-types';
|
|
3
|
+
export declare const SCENE_PUBLICATION_FENCE_SCHEMA: "scene-publication-fence/1";
|
|
4
|
+
export declare const SCENE_PUBLICATION_RECOVERY_ACTIONS: readonly ["continue-last-known-good", "retry-rebuild", "fresh-reopen"];
|
|
5
|
+
export type ScenePublicationFence = EngineScenePublicationFence;
|
|
6
|
+
export type ScenePublicationFencePhase = 'publication' | 'catalog' | 'observation' | 'instantiate';
|
|
7
|
+
export interface ScenePublicationFenceError {
|
|
8
|
+
readonly code: 'asset-generation-fence-mismatch';
|
|
9
|
+
readonly phase: ScenePublicationFencePhase;
|
|
10
|
+
readonly hint: string;
|
|
11
|
+
readonly sourcePath?: string;
|
|
12
|
+
readonly sourceRevision?: string;
|
|
13
|
+
readonly expected?: ScenePublicationFence;
|
|
14
|
+
readonly actual?: ScenePublicationFence;
|
|
15
|
+
readonly currentGeneration?: number;
|
|
16
|
+
readonly lastKnownGood?: ScenePublicationFence;
|
|
17
|
+
readonly retryable: boolean;
|
|
18
|
+
readonly recoveryActions: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
export interface ScenePublicationObservation {
|
|
21
|
+
readonly fence: ScenePublicationFence;
|
|
22
|
+
readonly outputs: readonly string[];
|
|
23
|
+
}
|
|
24
|
+
/** Convert one complete Engine publication into the serializable Scene fence. */
|
|
25
|
+
export declare function createScenePublicationFence(publication: AssetPublicationEnvelope): Result<ScenePublicationFence, ScenePublicationFenceError>;
|
|
26
|
+
/** Parse the persisted fence without guessing legacy generation or identity. */
|
|
27
|
+
export declare function parseScenePublicationFence(value: unknown): Result<ScenePublicationFence, ScenePublicationFenceError>;
|
|
28
|
+
/** Compare all fence fields; no single generation or GUID may stand in for it. */
|
|
29
|
+
export declare function compareScenePublicationFences(expected: ScenePublicationFence, actual: ScenePublicationFence, lastKnownGood?: ScenePublicationFence): Result<ScenePublicationFence, ScenePublicationFenceError>;
|
|
30
|
+
/** Derive a fence only when every Catalog row for the source publication is present and aligned. */
|
|
31
|
+
export declare function scenePublicationFenceFromCatalog(entries: readonly CatalogEntry[], outputGuid: string): Result<ScenePublicationFence, ScenePublicationFenceError>;
|
|
32
|
+
export declare function observeScenePublication(input: {
|
|
33
|
+
readonly publication: AssetPublicationEnvelope;
|
|
34
|
+
readonly waitForOutput: (guid: string) => Promise<void>;
|
|
35
|
+
readonly timeoutMs?: number;
|
|
36
|
+
readonly lastKnownGood?: ScenePublicationFence;
|
|
37
|
+
}): Promise<Result<ScenePublicationObservation, ScenePublicationFenceError>>;
|
|
38
|
+
//# sourceMappingURL=scene-publication-fence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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AAwB,GACpC,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,CAAC,CA4C3D;AAED,gFAAgF;AAChF,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,CAAC,CA0B3D;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,qBAAqB,EAC7B,aAAa,CAAC,EAAE,qBAAqB,GACpC,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,CAAC,CAW3D;AAED,oGAAoG;AACpG,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,UAAU,EAAE,MAAM,GACjB,MAAM,CAAC,qBAAqB,EAAE,0BAA0B,CAAC,CAyB3D;AAED,wBAAsB,uBAAuB,CAAC,KAAK,EAAE;IACnD,QAAQ,CAAC,WAAW,EAAE,wBAAwB,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,aAAa,CAAC,EAAE,qBAAqB,CAAC;CAChD,GAAG,OAAO,CAAC,MAAM,CAAC,2BAA2B,EAAE,0BAA0B,CAAC,CAAC,CAoC3E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { CookedMaterialRecord } from '@forgeax/engine-pack';
|
|
2
|
+
import { AssetError, type MaterialAsset, type MaterialError } from '@forgeax/engine-types';
|
|
3
|
+
import type { AssetRegistry } from '../asset-registry';
|
|
4
|
+
/**
|
|
5
|
+
* Validate a MaterialAsset's passes[] against the ShaderRegistry's
|
|
6
|
+
* paramSchema (union semantics: all declared params across all passes
|
|
7
|
+
* must be satisfiable from values).
|
|
8
|
+
*
|
|
9
|
+
* - Empty / undefined passes[] → error
|
|
10
|
+
* - Each pass's shader must exist in ShaderRegistry
|
|
11
|
+
* - Union of all pass paramSchemas: params without `default` must
|
|
12
|
+
* appear in values with matching type
|
|
13
|
+
* - Extra keys in values are silently ignored (D-5)
|
|
14
|
+
*
|
|
15
|
+
* @returns AssetError on failure, null on success
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateMaterialPasses(registry: AssetRegistry, asset: MaterialAsset): AssetError | null;
|
|
18
|
+
export interface MaterialEffectiveRootIdentity {
|
|
19
|
+
readonly guid: string;
|
|
20
|
+
readonly layoutIdentity: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function validateMaterialCookIdentity(record: Pick<CookedMaterialRecord, 'guid' | 'receipt'>, root: MaterialEffectiveRootIdentity): MaterialError | null;
|
|
23
|
+
/**
|
|
24
|
+
* Sprite 9-slice values fail-fast validation
|
|
25
|
+
* (feat-20260527-sprite-nineslice M2 / w8, plan-strategy §D-1 + AC-08).
|
|
26
|
+
*
|
|
27
|
+
* Fires when:
|
|
28
|
+
* - asset.kind === 'material'
|
|
29
|
+
* - first pass shader === 'forgeax::sprite'
|
|
30
|
+
* - values.slices is present
|
|
31
|
+
*
|
|
32
|
+
* Six fail-fast branches (1:1 with w4 test):
|
|
33
|
+
* (1) any component is negative
|
|
34
|
+
* (2) slices.x + slices.z >= region.zw[0] (X-axis overlap)
|
|
35
|
+
* (3) slices.y + slices.w >= region.zw[1] (Y-axis overlap)
|
|
36
|
+
* (4) any component is NaN
|
|
37
|
+
* (5) any component is Infinity
|
|
38
|
+
* (6) length !== 4
|
|
39
|
+
*
|
|
40
|
+
* Reuses the existing 'asset-invalid-value' member of the closed
|
|
41
|
+
* `AssetErrorCode` 13-member union (no new code added per
|
|
42
|
+
* AGENTS.md §Error model). The `.expected` literal mirrors the AI-User
|
|
43
|
+
* Charter §3 string; `.hint` inlines the offending sum + the relevant
|
|
44
|
+
* `region.zw` numeral so AI users can copy-paste the prompt straight
|
|
45
|
+
* back into the IDE for self-recovery (plan-strategy §R-4).
|
|
46
|
+
*
|
|
47
|
+
* @returns AssetError on failure, null on success.
|
|
48
|
+
*/
|
|
49
|
+
export declare function validateSpriteSlices(_registry: AssetRegistry, asset: MaterialAsset): AssetError | null;
|
|
50
|
+
export declare function validateParamType(_registry: AssetRegistry, _name: string, type: string, value: unknown): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* feat-20260527-sprite-nineslice M4 / w18 (D-9): register-time soft-warn
|
|
53
|
+
* for sliceMode=1 (tile) bound to a sampler whose addressMode is not
|
|
54
|
+
* 'repeat'. Bumps `nineslice.tile-needs-repeat-sampler` once per offending
|
|
55
|
+
* catalogue call. Never throws -- the counter is the sole AI-user-facing
|
|
56
|
+
* signal (charter P3 machine-readable; AC-08 closed, never extends
|
|
57
|
+
* AssetErrorCode).
|
|
58
|
+
*
|
|
59
|
+
* feat-20260614 M8 (D-19): `values.sampler` is now an embedded GUID
|
|
60
|
+
* string (dash-form), resolved against the catalogue rather than a handle.
|
|
61
|
+
*/
|
|
62
|
+
export declare function detectTileNeedsRepeatSampler(registry: AssetRegistry, asset: MaterialAsset): void;
|
|
63
|
+
/**
|
|
64
|
+
* feat-20260613-material-paramschema-driven-binding M4 / w23 (D-5 graceful):
|
|
65
|
+
* Return the texture-field name set for the given material-shader id,
|
|
66
|
+
* derived from the registered shader's paramSchema via `derive(paramSchema)
|
|
67
|
+
* .textureFieldNames`. Returns `undefined` when the shader is not yet
|
|
68
|
+
* registered (cross-worktree shader-late-register, plan R-4).
|
|
69
|
+
*
|
|
70
|
+
* Used by `extractFrame` to know which values fields the shader
|
|
71
|
+
* declares as texture handles; the extract layer validates handle-vs-
|
|
72
|
+
* scalar typing and drops misclassified slots so the record stage's
|
|
73
|
+
* MISSING_TEXTURE_HANDLE fallback can take over (white default texture)
|
|
74
|
+
* rather than letting a stray handle reach `device.createBindGroup`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function materialShaderTextureFieldNames(registry: AssetRegistry, shaderId: string): ReadonlySet<string> | undefined;
|
|
77
|
+
//# sourceMappingURL=validate-material.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-material.d.ts","sourceRoot":"","sources":["../../src/registry/validate-material.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EACL,UAAU,EAEV,KAAK,aAAa,EAClB,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,aAAa,GACnB,UAAU,GAAG,IAAI,CAoFnB;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC,EACtD,IAAI,EAAE,6BAA6B,GAClC,aAAa,GAAG,IAAI,CAkBtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,aAAa,GACnB,UAAU,GAAG,IAAI,CA8GnB;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,OAAO,CAgCT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CA8BhG;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,MAAM,GACf,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAIjC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SharedRefStaleError, UniqueRefStaleError, World } from '@forgeax/engine-ecs';
|
|
2
|
+
import type { AssetGuid } from '@forgeax/engine-pack/guid';
|
|
3
|
+
import { type Result } from '@forgeax/engine-rhi';
|
|
4
|
+
import type { Asset, AssetError as AssetErrorType, Handle, MaterialAsset, MaterialError, MaterialPass } from '@forgeax/engine-types';
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a handle to its asset payload with two-tier slot-range dispatch.
|
|
7
|
+
*
|
|
8
|
+
* slot < BUILTIN_BASE -> BuiltinAssetRegistry.resolve(handle) (process-static)
|
|
9
|
+
* slot >= BUILTIN_BASE -> world.sharedRefs.resolve(handle) (user-tier RC)
|
|
10
|
+
*
|
|
11
|
+
* Callers must specify the expected asset type explicitly:
|
|
12
|
+
* `resolveAssetHandle<MeshAsset>(world, handle)`. The type parameter is an
|
|
13
|
+
* assertion -- the runtime dispatch returns the correct payload based on slot
|
|
14
|
+
* range; the type parameter mirrors the caller's expectation.
|
|
15
|
+
*
|
|
16
|
+
* @param world - The World owning the per-World SharedRefStore (user-tier).
|
|
17
|
+
* @param handle - The branded handle to resolve.
|
|
18
|
+
* @returns `Result.ok(payload)` on hit, `Result.err(AssetError)` on miss.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveAssetHandle<T extends Asset>(world: World, handle: Handle<string, 'shared'>): Result<T, AssetErrorType | SharedRefStaleError | UniqueRefStaleError>;
|
|
21
|
+
/**
|
|
22
|
+
* Walk a MaterialAsset parent chain to produce the inherited passes +
|
|
23
|
+
* shallow-merged values (W-1..W-7 semantics). feat-20260614 M8 (D-19):
|
|
24
|
+
* the starting material is resolved from a column `handle` via
|
|
25
|
+
* {@link resolveAssetHandle} (builtin / user-tier world.sharedRefs); each
|
|
26
|
+
* ancestor `material.parent` is an embedded GUID (AssetGuid) resolved through
|
|
27
|
+
* the AssetRegistry catalogue ({@link AssetRegistry.lookup}). The registry
|
|
28
|
+
* holds no handles -- it is the GUID->payload SSOT for parent resolution.
|
|
29
|
+
*
|
|
30
|
+
* Zero-cache (AC-04): every call builds the same table-shaped input and delegates
|
|
31
|
+
* inheritance semantics to the MaterialAsset resolver in `@forgeax/engine-types`.
|
|
32
|
+
* Compiler and runtime therefore share root-contract ownership and child-value
|
|
33
|
+
* override semantics instead of maintaining two subtly different walks.
|
|
34
|
+
*/
|
|
35
|
+
export declare function walkMaterialPassesOverSharedRefs(world: World, handle: Handle<'MaterialAsset', 'shared'>, registry: {
|
|
36
|
+
lookup(guid: AssetGuid | string): Asset | undefined;
|
|
37
|
+
}): Result<{
|
|
38
|
+
passes: MaterialPass[];
|
|
39
|
+
parameters: MaterialAsset['parameters'];
|
|
40
|
+
values: NonNullable<MaterialAsset['values']>;
|
|
41
|
+
colorSpace: MaterialAsset['colorSpace'];
|
|
42
|
+
}, AssetErrorType | MaterialError | SharedRefStaleError | UniqueRefStaleError>;
|
|
43
|
+
//# sourceMappingURL=resolve-asset-handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-asset-handle.d.ts","sourceRoot":"","sources":["../src/resolve-asset-handle.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC3F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EACV,KAAK,EACL,UAAU,IAAI,cAAc,EAC5B,MAAM,EACN,aAAa,EACb,aAAa,EACb,YAAY,EACb,MAAM,uBAAuB,CAAC;AAW/B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,KAAK,EAChD,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAC/B,MAAM,CAAC,CAAC,EAAE,cAAc,GAAG,mBAAmB,GAAG,mBAAmB,CAAC,CAiCvE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,EACzC,QAAQ,EAAE;IAAE,MAAM,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAA;CAAE,GAChE,MAAM,CACP;IACE,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACxC,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC7C,UAAU,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACzC,EACD,cAAc,GAAG,aAAa,GAAG,mBAAmB,GAAG,mBAAmB,CAC3E,CA+BA"}
|