@forgeax/engine-preview 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 +0 -6
- package/dist/.tsbuildinfo +1 -1
- package/dist/host/preview-host.d.ts +1 -2
- package/dist/index.mjs +17 -10
- package/dist/index.mjs.map +1 -1
- package/dist/material.mjs +3 -4
- package/dist/material.mjs.map +1 -1
- package/dist/mesh.mjs +3 -4
- package/dist/mesh.mjs.map +1 -1
- package/dist/texture.mjs +3 -4
- package/dist/texture.mjs.map +1 -1
- package/dist/vfx.mjs +3 -4
- package/dist/vfx.mjs.map +1 -1
- package/package.json +4 -5
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Plugin, type ToolPlugin } from '@forgeax/engine-plugin';
|
|
2
2
|
import { type ArtifactRef, type SnapshotRef } from '@forgeax/engine-tool-runtime';
|
|
3
|
-
import type { AssetKind } from '@forgeax/engine-types';
|
|
4
3
|
export interface PreviewAssetLoadResult<TAsset = unknown> {
|
|
5
4
|
readonly ok: true;
|
|
6
5
|
readonly value: TAsset;
|
|
@@ -12,7 +11,7 @@ export interface PreviewAssetLoadFailure {
|
|
|
12
11
|
readonly error: unknown;
|
|
13
12
|
}
|
|
14
13
|
export interface PreviewAssetRegistry {
|
|
15
|
-
readonly
|
|
14
|
+
readonly loadByGuid: <TAsset = unknown>(guid: string) => Promise<PreviewAssetLoadResult<TAsset> | PreviewAssetLoadFailure>;
|
|
16
15
|
}
|
|
17
16
|
export interface PreviewRenderRuntime {
|
|
18
17
|
readonly rendererReady: boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { defineToolPlugin } from '@forgeax/engine-plugin';
|
|
2
2
|
import { defineToolCapability, defineTool, validatePreviewArtifactManifest, createPreviewArtifactManifest } from '@forgeax/engine-tool-runtime';
|
|
3
3
|
export { createPreviewArtifactManifest, validatePreviewArtifactManifest } from '@forgeax/engine-tool-runtime';
|
|
4
|
-
import { builtinAssetKind } from '@forgeax/engine-runtime';
|
|
5
4
|
|
|
6
5
|
// src/domains/subject.ts
|
|
7
6
|
var previewHostCapability = defineToolCapability("preview.host");
|
|
@@ -97,7 +96,7 @@ function subjectFailure(code, expected, detail) {
|
|
|
97
96
|
error: {
|
|
98
97
|
code,
|
|
99
98
|
expected,
|
|
100
|
-
hint: "Load the requested GUID through AssetRegistry.
|
|
99
|
+
hint: "Load the requested GUID through AssetRegistry.loadByGuid and repair the owner facts before retrying.",
|
|
101
100
|
detail
|
|
102
101
|
}
|
|
103
102
|
};
|
|
@@ -601,6 +600,8 @@ function validateCanonicalKitReceipt(value) {
|
|
|
601
600
|
return invalid("transport");
|
|
602
601
|
return { ok: true, value };
|
|
603
602
|
}
|
|
603
|
+
|
|
604
|
+
// src/domains/material.ts
|
|
604
605
|
function isRecord4(value) {
|
|
605
606
|
return typeof value === "object" && value !== null;
|
|
606
607
|
}
|
|
@@ -680,10 +681,10 @@ async function executeMaterialPreview(args, input) {
|
|
|
680
681
|
"resource preview host to expose the existing AssetRegistry",
|
|
681
682
|
{ phase: "asset-registry", runId: input.runId }
|
|
682
683
|
);
|
|
683
|
-
const loaded = await input.assets.
|
|
684
|
+
const loaded = await input.assets.loadByGuid(args.guid);
|
|
684
685
|
if (!loaded.ok)
|
|
685
686
|
return assetLoadFailure(
|
|
686
|
-
"AssetRegistry.
|
|
687
|
+
"AssetRegistry.loadByGuid to resolve the requested material",
|
|
687
688
|
input.runId,
|
|
688
689
|
loaded.error
|
|
689
690
|
);
|
|
@@ -815,6 +816,8 @@ var materialPreview = defineTool(
|
|
|
815
816
|
})()
|
|
816
817
|
);
|
|
817
818
|
nativePreviewPlugin("material", materialPreview);
|
|
819
|
+
|
|
820
|
+
// src/domains/mesh.ts
|
|
818
821
|
function isRecord5(value) {
|
|
819
822
|
return typeof value === "object" && value !== null;
|
|
820
823
|
}
|
|
@@ -940,10 +943,10 @@ async function executeMeshPreview(args, input) {
|
|
|
940
943
|
"resource preview host to expose the existing AssetRegistry",
|
|
941
944
|
{ phase: "asset-registry", runId: input.runId }
|
|
942
945
|
);
|
|
943
|
-
const loaded = await input.assets.
|
|
946
|
+
const loaded = await input.assets.loadByGuid(args.guid);
|
|
944
947
|
if (!loaded.ok)
|
|
945
948
|
return assetLoadFailure(
|
|
946
|
-
"AssetRegistry.
|
|
949
|
+
"AssetRegistry.loadByGuid to resolve the requested mesh",
|
|
947
950
|
input.runId,
|
|
948
951
|
loaded.error
|
|
949
952
|
);
|
|
@@ -1089,6 +1092,8 @@ var meshPreview = defineTool(
|
|
|
1089
1092
|
})()
|
|
1090
1093
|
);
|
|
1091
1094
|
nativePreviewPlugin("mesh", meshPreview);
|
|
1095
|
+
|
|
1096
|
+
// src/domains/texture.ts
|
|
1092
1097
|
function isRecord6(value) {
|
|
1093
1098
|
return typeof value === "object" && value !== null;
|
|
1094
1099
|
}
|
|
@@ -1190,10 +1195,10 @@ async function executeTexturePreview(args, input) {
|
|
|
1190
1195
|
runId: input.runId
|
|
1191
1196
|
}
|
|
1192
1197
|
);
|
|
1193
|
-
const loaded = await input.assets.
|
|
1198
|
+
const loaded = await input.assets.loadByGuid(args.guid);
|
|
1194
1199
|
if (!loaded.ok)
|
|
1195
1200
|
return assetLoadFailure(
|
|
1196
|
-
"AssetRegistry.
|
|
1201
|
+
"AssetRegistry.loadByGuid to resolve the texture",
|
|
1197
1202
|
input.runId,
|
|
1198
1203
|
loaded.error
|
|
1199
1204
|
);
|
|
@@ -1346,6 +1351,8 @@ var texturePreview = defineTool(subjectDescriptor("texture"), (args, context) =>
|
|
|
1346
1351
|
);
|
|
1347
1352
|
});
|
|
1348
1353
|
nativePreviewPlugin("texture", texturePreview);
|
|
1354
|
+
|
|
1355
|
+
// src/domains/vfx.ts
|
|
1349
1356
|
function isRecord7(value) {
|
|
1350
1357
|
return typeof value === "object" && value !== null;
|
|
1351
1358
|
}
|
|
@@ -1534,10 +1541,10 @@ async function executeVfxPreview(args, input) {
|
|
|
1534
1541
|
runId: input.runId
|
|
1535
1542
|
}
|
|
1536
1543
|
);
|
|
1537
|
-
const loaded = await input.assets.
|
|
1544
|
+
const loaded = await input.assets.loadByGuid(args.guid);
|
|
1538
1545
|
if (!loaded.ok)
|
|
1539
1546
|
return assetLoadFailure(
|
|
1540
|
-
"AssetRegistry.
|
|
1547
|
+
"AssetRegistry.loadByGuid to resolve the VFX",
|
|
1541
1548
|
input.runId,
|
|
1542
1549
|
loaded.error
|
|
1543
1550
|
);
|