comfy-ts 2.22.0 → 2.23.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.
- package/dist/{ServeApp-DuxYdaZZ.js → ServeApp-DolRCMHj.js} +51 -17
- package/dist/ServeApp-DolRCMHj.js.map +1 -0
- package/dist/cli.js +5 -5
- package/dist/{exampleAssets-1NHndnNB.js → exampleAssets-Duneoq6r.js} +330 -28
- package/dist/exampleAssets-Duneoq6r.js.map +1 -0
- package/dist/{findDefinedWorkflow-CRsBTTJK.js → findDefinedWorkflow-DjoJA8y7.js} +2 -2
- package/dist/{findDefinedWorkflow-CRsBTTJK.js.map → findDefinedWorkflow-DjoJA8y7.js.map} +1 -1
- package/dist/index.cjs +350 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +131 -19
- package/dist/index.d.ts +131 -19
- package/dist/index.js +350 -34
- package/dist/index.js.map +1 -1
- package/dist/{run-run-Y5ZI48vV.js → run-run-Cr0L9lCK.js} +5 -5
- package/dist/{run-run-Y5ZI48vV.js.map → run-run-Cr0L9lCK.js.map} +1 -1
- package/dist/{run-serve-CICU_wTL.js → run-serve---qA7o_m.js} +4 -4
- package/dist/{run-serve-CICU_wTL.js.map → run-serve---qA7o_m.js.map} +1 -1
- package/dist/{run-tui-CViJXsHL.js → run-tui-DxXiWo5J.js} +4 -4
- package/dist/{run-tui-CViJXsHL.js.map → run-tui-DxXiWo5J.js.map} +1 -1
- package/dist/{schemaDrift-CzjaIwZX.js → schemaDrift-BTxdABHi.js} +16 -2
- package/dist/{schemaDrift-CzjaIwZX.js.map → schemaDrift-BTxdABHi.js.map} +1 -1
- package/dist/serve-web.js +46 -43
- package/dist/web.d.ts +131 -19
- package/dist/web.js +350 -34
- package/dist/web.js.map +1 -1
- package/examples/comfy-cloud/sdk.d.ts +102 -1
- package/examples/rvion/18-world.cflow.ts +101 -0
- package/examples/world-explorer/serve.ts +171 -0
- package/examples/world-explorer/web/index.html +14 -0
- package/examples/world-explorer/web/main.tsx +200 -0
- package/examples/world-explorer/web/state.ts +212 -0
- package/examples/world-explorer/web/styles.css +131 -0
- package/examples/world-explorer/web/thumb.ts +21 -0
- package/examples/world-explorer/web/tsconfig.json +11 -0
- package/examples/world-explorer/world-state.ts +40 -0
- package/package.json +5 -7
- package/src/cli/serve/ServeApp.ts +27 -2
- package/src/cli/serve/resultHistory.ts +22 -4
- package/src/cli/serve/thumbs.ts +19 -8
- package/src/cli/serve/web/api.ts +4 -0
- package/src/cli/serve/web/components/Gallery.tsx +24 -1
- package/src/cli/serve/web/styles.ts +3 -0
- package/src/coreExports.ts +1 -0
- package/src/graph/ComfyNode.ts +12 -2
- package/src/host/ComfyHost.ts +153 -2
- package/src/host/ResilientWebsocket.ts +10 -0
- package/src/manager/script-update-manager.bun.ts +0 -7
- package/src/runner/ComfyExecution.ts +165 -20
- package/src/runner/ComfyWsApi.ts +2 -0
- package/src/runner/historyReplay.ts +53 -0
- package/src/runner/outputs3d.ts +18 -0
- package/src/sdk-generator/comfyui-sdk-codegen.ts +7 -2
- package/dist/ServeApp-DuxYdaZZ.js.map +0 -1
- package/dist/exampleAssets-1NHndnNB.js.map +0 -1
|
@@ -126589,54 +126589,112 @@ declare global {
|
|
|
126589
126589
|
| ((
|
|
126590
126590
|
x: Producer['MESH,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D_STL,FILE_3D_USDZ,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT,FILE_3D_SPLAT_ANY,FILE_3D_POINT_CLOUD_ANY,FILE_3D'],
|
|
126591
126591
|
) => Accepts['MESH,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D_STL,FILE_3D_USDZ,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT,FILE_3D_SPLAT_ANY,FILE_3D_POINT_CLOUD_ANY,FILE_3D'])
|
|
126592
|
+
| Accepts['MESH']
|
|
126593
|
+
| Accepts['FILE_3D_GLB']
|
|
126594
|
+
| ComfyNodeOutput<'FILE_3D_GLTF'>
|
|
126595
|
+
| Accepts['FILE_3D_OBJ']
|
|
126596
|
+
| Accepts['FILE_3D_FBX']
|
|
126597
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126598
|
+
| ComfyNodeOutput<'FILE_3D_USDZ'>
|
|
126599
|
+
| ComfyNodeOutput<'FILE_3D_PLY'>
|
|
126600
|
+
| ComfyNodeOutput<'FILE_3D_SPLAT'>
|
|
126601
|
+
| ComfyNodeOutput<'FILE_3D_SPZ'>
|
|
126602
|
+
| ComfyNodeOutput<'FILE_3D_KSPLAT'>
|
|
126603
|
+
| Accepts['FILE_3D_SPLAT_ANY']
|
|
126604
|
+
| Accepts['FILE_3D_POINT_CLOUD_ANY']
|
|
126605
|
+
| Accepts['FILE_3D']
|
|
126592
126606
|
'STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D':
|
|
126593
126607
|
| ComfyNodeOutput<'STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'>
|
|
126594
126608
|
| HasSingle['STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D']
|
|
126595
126609
|
| ((
|
|
126596
126610
|
x: Producer['STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'],
|
|
126597
126611
|
) => Accepts['STRING,FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'])
|
|
126612
|
+
| Accepts['STRING']
|
|
126613
|
+
| Accepts['FILE_3D_GLB']
|
|
126614
|
+
| ComfyNodeOutput<'FILE_3D_GLTF'>
|
|
126615
|
+
| Accepts['FILE_3D_FBX']
|
|
126616
|
+
| Accepts['FILE_3D_OBJ']
|
|
126617
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126618
|
+
| ComfyNodeOutput<'FILE_3D_USDZ'>
|
|
126619
|
+
| Accepts['FILE_3D']
|
|
126598
126620
|
'FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D':
|
|
126599
126621
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'>
|
|
126600
126622
|
| HasSingle['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D']
|
|
126601
126623
|
| ((
|
|
126602
126624
|
x: Producer['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'],
|
|
126603
126625
|
) => Accepts['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D_USDZ,FILE_3D'])
|
|
126626
|
+
| Accepts['FILE_3D_GLB']
|
|
126627
|
+
| ComfyNodeOutput<'FILE_3D_GLTF'>
|
|
126628
|
+
| Accepts['FILE_3D_FBX']
|
|
126629
|
+
| Accepts['FILE_3D_OBJ']
|
|
126630
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126631
|
+
| ComfyNodeOutput<'FILE_3D_USDZ'>
|
|
126632
|
+
| Accepts['FILE_3D']
|
|
126604
126633
|
'FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ':
|
|
126605
126634
|
| ComfyNodeOutput<'FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ'>
|
|
126606
126635
|
| HasSingle['FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ']
|
|
126607
126636
|
| ((
|
|
126608
126637
|
x: Producer['FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ'],
|
|
126609
126638
|
) => Accepts['FILE_3D,FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_KSPLAT,FILE_3D_SPZ'])
|
|
126639
|
+
| Accepts['FILE_3D']
|
|
126640
|
+
| Accepts['FILE_3D_SPLAT_ANY']
|
|
126641
|
+
| ComfyNodeOutput<'FILE_3D_PLY'>
|
|
126642
|
+
| ComfyNodeOutput<'FILE_3D_SPLAT'>
|
|
126643
|
+
| ComfyNodeOutput<'FILE_3D_KSPLAT'>
|
|
126644
|
+
| ComfyNodeOutput<'FILE_3D_SPZ'>
|
|
126610
126645
|
'FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT':
|
|
126611
126646
|
| ComfyNodeOutput<'FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT'>
|
|
126612
126647
|
| HasSingle['FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT']
|
|
126613
126648
|
| ((
|
|
126614
126649
|
x: Producer['FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT'],
|
|
126615
126650
|
) => Accepts['FILE_3D_SPLAT_ANY,FILE_3D_PLY,FILE_3D_SPLAT,FILE_3D_SPZ,FILE_3D_KSPLAT'])
|
|
126651
|
+
| Accepts['FILE_3D_SPLAT_ANY']
|
|
126652
|
+
| ComfyNodeOutput<'FILE_3D_PLY'>
|
|
126653
|
+
| ComfyNodeOutput<'FILE_3D_SPLAT'>
|
|
126654
|
+
| ComfyNodeOutput<'FILE_3D_SPZ'>
|
|
126655
|
+
| ComfyNodeOutput<'FILE_3D_KSPLAT'>
|
|
126616
126656
|
'MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID':
|
|
126617
126657
|
| ComfyNodeOutput<'MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID'>
|
|
126618
126658
|
| HasSingle['MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID']
|
|
126619
126659
|
| ((
|
|
126620
126660
|
x: Producer['MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID'],
|
|
126621
126661
|
) => Accepts['MODEL_TASK_ID,RIG_TASK_ID,RETARGET_TASK_ID,SEGMENT_TASK_ID'])
|
|
126662
|
+
| Accepts['MODEL_TASK_ID']
|
|
126663
|
+
| Accepts['RIG_TASK_ID']
|
|
126664
|
+
| Accepts['RETARGET_TASK_ID']
|
|
126665
|
+
| Accepts['SEGMENT_TASK_ID']
|
|
126622
126666
|
'FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D':
|
|
126623
126667
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'>
|
|
126624
126668
|
| HasSingle['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D']
|
|
126625
126669
|
| ((
|
|
126626
126670
|
x: Producer['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'],
|
|
126627
126671
|
) => Accepts['FILE_3D_GLB,FILE_3D_GLTF,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'])
|
|
126672
|
+
| Accepts['FILE_3D_GLB']
|
|
126673
|
+
| ComfyNodeOutput<'FILE_3D_GLTF'>
|
|
126674
|
+
| Accepts['FILE_3D_OBJ']
|
|
126675
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126676
|
+
| Accepts['FILE_3D']
|
|
126628
126677
|
'FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D':
|
|
126629
126678
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'>
|
|
126630
126679
|
| HasSingle['FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D']
|
|
126631
126680
|
| ((
|
|
126632
126681
|
x: Producer['FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'],
|
|
126633
126682
|
) => Accepts['FILE_3D_GLB,FILE_3D_FBX,FILE_3D_OBJ,FILE_3D_STL,FILE_3D'])
|
|
126683
|
+
| Accepts['FILE_3D_GLB']
|
|
126684
|
+
| Accepts['FILE_3D_FBX']
|
|
126685
|
+
| Accepts['FILE_3D_OBJ']
|
|
126686
|
+
| ComfyNodeOutput<'FILE_3D_STL'>
|
|
126687
|
+
| Accepts['FILE_3D']
|
|
126634
126688
|
'FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D':
|
|
126635
126689
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D'>
|
|
126636
126690
|
| HasSingle['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D']
|
|
126637
126691
|
| ((
|
|
126638
126692
|
x: Producer['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D'],
|
|
126639
126693
|
) => Accepts['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D_FBX,FILE_3D'])
|
|
126694
|
+
| Accepts['FILE_3D_GLB']
|
|
126695
|
+
| Accepts['FILE_3D_OBJ']
|
|
126696
|
+
| Accepts['FILE_3D_FBX']
|
|
126697
|
+
| Accepts['FILE_3D']
|
|
126640
126698
|
'*':
|
|
126641
126699
|
| string
|
|
126642
126700
|
| number
|
|
@@ -126650,18 +126708,27 @@ declare global {
|
|
|
126650
126708
|
| ((
|
|
126651
126709
|
x: Producer['FILE_3D_POINT_CLOUD_ANY,FILE_3D_PLY'],
|
|
126652
126710
|
) => Accepts['FILE_3D_POINT_CLOUD_ANY,FILE_3D_PLY'])
|
|
126711
|
+
| Accepts['FILE_3D_POINT_CLOUD_ANY']
|
|
126712
|
+
| ComfyNodeOutput<'FILE_3D_PLY'>
|
|
126653
126713
|
'FILE_3D_GLB,FILE_3D_OBJ,FILE_3D':
|
|
126654
126714
|
| ComfyNodeOutput<'FILE_3D_GLB,FILE_3D_OBJ,FILE_3D'>
|
|
126655
126715
|
| HasSingle['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D']
|
|
126656
126716
|
| ((x: Producer['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D']) => Accepts['FILE_3D_GLB,FILE_3D_OBJ,FILE_3D'])
|
|
126717
|
+
| Accepts['FILE_3D_GLB']
|
|
126718
|
+
| Accepts['FILE_3D_OBJ']
|
|
126719
|
+
| Accepts['FILE_3D']
|
|
126657
126720
|
'MHR_POSE_DATA,KIMODO_POSE_DATA':
|
|
126658
126721
|
| ComfyNodeOutput<'MHR_POSE_DATA,KIMODO_POSE_DATA'>
|
|
126659
126722
|
| HasSingle['MHR_POSE_DATA,KIMODO_POSE_DATA']
|
|
126660
126723
|
| ((x: Producer['MHR_POSE_DATA,KIMODO_POSE_DATA']) => Accepts['MHR_POSE_DATA,KIMODO_POSE_DATA'])
|
|
126724
|
+
| Accepts['MHR_POSE_DATA']
|
|
126725
|
+
| ComfyNodeOutput<'KIMODO_POSE_DATA'>
|
|
126661
126726
|
'MODEL_TASK_ID,SEGMENT_TASK_ID':
|
|
126662
126727
|
| ComfyNodeOutput<'MODEL_TASK_ID,SEGMENT_TASK_ID'>
|
|
126663
126728
|
| HasSingle['MODEL_TASK_ID,SEGMENT_TASK_ID']
|
|
126664
126729
|
| ((x: Producer['MODEL_TASK_ID,SEGMENT_TASK_ID']) => Accepts['MODEL_TASK_ID,SEGMENT_TASK_ID'])
|
|
126730
|
+
| Accepts['MODEL_TASK_ID']
|
|
126731
|
+
| Accepts['SEGMENT_TASK_ID']
|
|
126665
126732
|
WANVIDEOPROMPTEXTENDER_ARGS:
|
|
126666
126733
|
| ComfyNodeOutput<'WANVIDEOPROMPTEXTENDER_ARGS'>
|
|
126667
126734
|
| HasSingle['WANVIDEOPROMPTEXTENDER_ARGS']
|
|
@@ -126682,10 +126749,17 @@ declare global {
|
|
|
126682
126749
|
| ComfyNodeOutput<'BOUNDING_BOX,ARRAY,STRING'>
|
|
126683
126750
|
| HasSingle['BOUNDING_BOX,ARRAY,STRING']
|
|
126684
126751
|
| ((x: Producer['BOUNDING_BOX,ARRAY,STRING']) => Accepts['BOUNDING_BOX,ARRAY,STRING'])
|
|
126752
|
+
| Accepts['BOUNDING_BOX']
|
|
126753
|
+
| Accepts['ARRAY']
|
|
126754
|
+
| Accepts['STRING']
|
|
126685
126755
|
'INT,FLOAT,STRING,BOOLEAN':
|
|
126686
126756
|
| ComfyNodeOutput<'INT,FLOAT,STRING,BOOLEAN'>
|
|
126687
126757
|
| HasSingle['INT,FLOAT,STRING,BOOLEAN']
|
|
126688
126758
|
| ((x: Producer['INT,FLOAT,STRING,BOOLEAN']) => Accepts['INT,FLOAT,STRING,BOOLEAN'])
|
|
126759
|
+
| Accepts['INT']
|
|
126760
|
+
| Accepts['FLOAT']
|
|
126761
|
+
| Accepts['STRING']
|
|
126762
|
+
| Accepts['BOOLEAN']
|
|
126689
126763
|
FILE_3D_POINT_CLOUD_ANY:
|
|
126690
126764
|
| ComfyNodeOutput<'FILE_3D_POINT_CLOUD_ANY'>
|
|
126691
126765
|
| HasSingle['FILE_3D_POINT_CLOUD_ANY']
|
|
@@ -126750,6 +126824,8 @@ declare global {
|
|
|
126750
126824
|
| ComfyNodeOutput<'SAM3_TRACK_DATA,MASK'>
|
|
126751
126825
|
| HasSingle['SAM3_TRACK_DATA,MASK']
|
|
126752
126826
|
| ((x: Producer['SAM3_TRACK_DATA,MASK']) => Accepts['SAM3_TRACK_DATA,MASK'])
|
|
126827
|
+
| Accepts['SAM3_TRACK_DATA']
|
|
126828
|
+
| Accepts['MASK']
|
|
126753
126829
|
FACE_DETECTION_MODEL:
|
|
126754
126830
|
| ComfyNodeOutput<'FACE_DETECTION_MODEL'>
|
|
126755
126831
|
| HasSingle['FACE_DETECTION_MODEL']
|
|
@@ -126790,6 +126866,8 @@ declare global {
|
|
|
126790
126866
|
| ComfyNodeOutput<'FILE_3D_FBX,FILE_3D'>
|
|
126791
126867
|
| HasSingle['FILE_3D_FBX,FILE_3D']
|
|
126792
126868
|
| ((x: Producer['FILE_3D_FBX,FILE_3D']) => Accepts['FILE_3D_FBX,FILE_3D'])
|
|
126869
|
+
| Accepts['FILE_3D_FBX']
|
|
126870
|
+
| Accepts['FILE_3D']
|
|
126793
126871
|
LUMA_RAY32_KEYFRAME:
|
|
126794
126872
|
| ComfyNodeOutput<'LUMA_RAY32_KEYFRAME'>
|
|
126795
126873
|
| HasSingle['LUMA_RAY32_KEYFRAME']
|
|
@@ -126939,6 +127017,9 @@ declare global {
|
|
|
126939
127017
|
| ComfyNodeOutput<'FLOAT,INT,BOOLEAN'>
|
|
126940
127018
|
| HasSingle['FLOAT,INT,BOOLEAN']
|
|
126941
127019
|
| ((x: Producer['FLOAT,INT,BOOLEAN']) => Accepts['FLOAT,INT,BOOLEAN'])
|
|
127020
|
+
| Accepts['FLOAT']
|
|
127021
|
+
| Accepts['INT']
|
|
127022
|
+
| Accepts['BOOLEAN']
|
|
126942
127023
|
CAMERA_INFO_STATE:
|
|
126943
127024
|
| ComfyNodeOutput<'CAMERA_INFO_STATE'>
|
|
126944
127025
|
| HasSingle['CAMERA_INFO_STATE']
|
|
@@ -126959,6 +127040,9 @@ declare global {
|
|
|
126959
127040
|
| ComfyNodeOutput<'INT,FLOAT,BOOLEAN'>
|
|
126960
127041
|
| HasSingle['INT,FLOAT,BOOLEAN']
|
|
126961
127042
|
| ((x: Producer['INT,FLOAT,BOOLEAN']) => Accepts['INT,FLOAT,BOOLEAN'])
|
|
127043
|
+
| Accepts['INT']
|
|
127044
|
+
| Accepts['FLOAT']
|
|
127045
|
+
| Accepts['BOOLEAN']
|
|
126962
127046
|
SELECTEDDITBLOCKS:
|
|
126963
127047
|
| ComfyNodeOutput<'SELECTEDDITBLOCKS'>
|
|
126964
127048
|
| HasSingle['SELECTEDDITBLOCKS']
|
|
@@ -127458,6 +127542,8 @@ declare global {
|
|
|
127458
127542
|
| ComfyNodeOutput<'LATENT,IMAGE'>
|
|
127459
127543
|
| HasSingle['LATENT,IMAGE']
|
|
127460
127544
|
| ((x: Producer['LATENT,IMAGE']) => Accepts['LATENT,IMAGE'])
|
|
127545
|
+
| Accepts['LATENT']
|
|
127546
|
+
| Accepts['IMAGE']
|
|
127461
127547
|
FREEINITARGS:
|
|
127462
127548
|
| ComfyNodeOutput<'FREEINITARGS'>
|
|
127463
127549
|
| HasSingle['FREEINITARGS']
|
|
@@ -127622,10 +127708,14 @@ declare global {
|
|
|
127622
127708
|
| ComfyNodeOutput<'IMAGE,VIDEO'>
|
|
127623
127709
|
| HasSingle['IMAGE,VIDEO']
|
|
127624
127710
|
| ((x: Producer['IMAGE,VIDEO']) => Accepts['IMAGE,VIDEO'])
|
|
127711
|
+
| Accepts['IMAGE']
|
|
127712
|
+
| Accepts['VIDEO']
|
|
127625
127713
|
'IMAGE,MASK':
|
|
127626
127714
|
| ComfyNodeOutput<'IMAGE,MASK'>
|
|
127627
127715
|
| HasSingle['IMAGE,MASK']
|
|
127628
127716
|
| ((x: Producer['IMAGE,MASK']) => Accepts['IMAGE,MASK'])
|
|
127717
|
+
| Accepts['IMAGE']
|
|
127718
|
+
| Accepts['MASK']
|
|
127629
127719
|
LORA_MODEL:
|
|
127630
127720
|
| ComfyNodeOutput<'LORA_MODEL'>
|
|
127631
127721
|
| HasSingle['LORA_MODEL']
|
|
@@ -127666,6 +127756,8 @@ declare global {
|
|
|
127666
127756
|
| ComfyNodeOutput<'MODEL,CLIP'>
|
|
127667
127757
|
| HasSingle['MODEL,CLIP']
|
|
127668
127758
|
| ((x: Producer['MODEL,CLIP']) => Accepts['MODEL,CLIP'])
|
|
127759
|
+
| Accepts['MODEL']
|
|
127760
|
+
| Accepts['CLIP']
|
|
127669
127761
|
LTX_BLOCKS:
|
|
127670
127762
|
| ComfyNodeOutput<'LTX_BLOCKS'>
|
|
127671
127763
|
| HasSingle['LTX_BLOCKS']
|
|
@@ -127722,6 +127814,8 @@ declare global {
|
|
|
127722
127814
|
| ComfyNodeOutput<'FLOAT,INT'>
|
|
127723
127815
|
| HasSingle['FLOAT,INT']
|
|
127724
127816
|
| ((x: Producer['FLOAT,INT']) => Accepts['FLOAT,INT'])
|
|
127817
|
+
| Accepts['FLOAT']
|
|
127818
|
+
| Accepts['INT']
|
|
127725
127819
|
HISTOGRAM:
|
|
127726
127820
|
| ComfyNodeOutput<'HISTOGRAM'>
|
|
127727
127821
|
| HasSingle['HISTOGRAM']
|
|
@@ -127826,6 +127920,8 @@ declare global {
|
|
|
127826
127920
|
| ComfyNodeOutput<'INT,FLOAT'>
|
|
127827
127921
|
| HasSingle['INT,FLOAT']
|
|
127828
127922
|
| ((x: Producer['INT,FLOAT']) => Accepts['INT,FLOAT'])
|
|
127923
|
+
| Accepts['INT']
|
|
127924
|
+
| Accepts['FLOAT']
|
|
127829
127925
|
BBOX_LIST:
|
|
127830
127926
|
| ComfyNodeOutput<'BBOX_LIST'>
|
|
127831
127927
|
| HasSingle['BBOX_LIST']
|
|
@@ -128046,7 +128142,12 @@ declare global {
|
|
|
128046
128142
|
CURVE: ComfyNodeOutput<'CURVE'> | HasSingle['CURVE'] | ((x: Producer['CURVE']) => Accepts['CURVE'])
|
|
128047
128143
|
SPLAT: ComfyNodeOutput<'SPLAT'> | HasSingle['SPLAT'] | ((x: Producer['SPLAT']) => Accepts['SPLAT'])
|
|
128048
128144
|
TIMER: ComfyNodeOutput<'TIMER'> | HasSingle['TIMER'] | ((x: Producer['TIMER']) => Accepts['TIMER'])
|
|
128049
|
-
'BBOX,':
|
|
128145
|
+
'BBOX,':
|
|
128146
|
+
| ComfyNodeOutput<'BBOX,'>
|
|
128147
|
+
| HasSingle['BBOX,']
|
|
128148
|
+
| ((x: Producer['BBOX,']) => Accepts['BBOX,'])
|
|
128149
|
+
| Accepts['BBOX']
|
|
128150
|
+
| ComfyNodeOutput<''>
|
|
128050
128151
|
VQVAE: ComfyNodeOutput<'VQVAE'> | HasSingle['VQVAE'] | ((x: Producer['VQVAE']) => Accepts['VQVAE'])
|
|
128051
128152
|
BYTES: ComfyNodeOutput<'BYTES'> | HasSingle['BYTES'] | ((x: Producer['BYTES']) => Accepts['BYTES'])
|
|
128052
128153
|
CLIP: ComfyNodeOutput<'CLIP'> | HasSingle['CLIP'] | ((x: Producer['CLIP']) => Accepts['CLIP'])
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// turn one picture into a 360° world: Qwen-Image-Edit-2509 with Tencent's HY-Pano 2.0 LoRA (from
|
|
2
|
+
// HY-World 2.0) expands the picture into an equirectangular panorama, the same prompt template,
|
|
3
|
+
// size, steps and guidance as their pipeline_with_qwen_image.py. Its left and right edges meet:
|
|
4
|
+
// the viewer wraps it around you. MoGe then measures the panorama's depth all around and the
|
|
5
|
+
// world is saved as a textured mesh (glb) seen from its middle.
|
|
6
|
+
//
|
|
7
|
+
// run directly: bun examples/rvion/18-world.cflow.ts [path/to/image.png] [seed]
|
|
8
|
+
import { ComfyTS, exampleImagePath, v } from 'comfy-ts'
|
|
9
|
+
|
|
10
|
+
const comfy = ComfyTS.create()
|
|
11
|
+
const host = comfy.host({ id: 'windows-1' })
|
|
12
|
+
await host.loadSchemaFromCache()
|
|
13
|
+
|
|
14
|
+
/** HY-Pano 2.0's own prompt template (hyworld2/panogen/pipeline_with_qwen_image.py) */
|
|
15
|
+
const PANO_PREFIX =
|
|
16
|
+
'Create a **ERP** panoramic expansion of the provided image. Preserve the original style, lighting, and fine details seamlessly throughout the extended areas, extend according to: '
|
|
17
|
+
const PANO_SUFFIX = ' 8k UHD, masterpiece, razor-sharp details.'
|
|
18
|
+
const PANO_NEGATIVE =
|
|
19
|
+
'低分辨率,低画质,模糊。杂乱的背景,结构扭曲,模糊纹理,物体融合。构图混乱。过度光滑,画面具有AI感。人脸畸形。巨大物体,巨大建筑,近景特写,近景压迫,比例失调。车,车辆。画面上方的树叶。'
|
|
20
|
+
const PANO_LORA = 'world\\hy-pano-2-qwen-lora.safetensors'
|
|
21
|
+
/** HY-Pano's canvas and its edge blend width: 1952 - 32 = 1920, 2:1 */
|
|
22
|
+
const PANO_W = 1952
|
|
23
|
+
const PANO_H = 960
|
|
24
|
+
const BLEND = 32
|
|
25
|
+
|
|
26
|
+
const image = v.image(exampleImagePath('lioness_768x768.jpg'), {
|
|
27
|
+
presets: {
|
|
28
|
+
lioness: exampleImagePath('lioness_768x768.jpg'),
|
|
29
|
+
bear: exampleImagePath('bear_1024x1024.jpg'),
|
|
30
|
+
walrus: exampleImagePath('walrus_1344x768.jpg'),
|
|
31
|
+
deer: exampleImagePath('deer_768x1344.jpg'),
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
export const world = host.defineWorkflow({
|
|
36
|
+
id: 'world',
|
|
37
|
+
vars: {
|
|
38
|
+
image,
|
|
39
|
+
/** what the unseen sides hold; empty lets the model continue the picture */
|
|
40
|
+
extend: v.text(''),
|
|
41
|
+
seed: v.seed(42),
|
|
42
|
+
steps: v.int(40, { min: 8, max: 60 }),
|
|
43
|
+
cfg: v.float(7.5, { min: 1, max: 12 }),
|
|
44
|
+
},
|
|
45
|
+
build: async (b, vars, wf) => {
|
|
46
|
+
const picture = await image.loadInWorkflow(wf)
|
|
47
|
+
const clip = b.CLIPLoader({ clip_name: 'qwen_2.5_vl_7b_fp8_scaled.safetensors', type: 'qwen_image' })
|
|
48
|
+
const vae = b.VAELoader({ vae_name: 'qwen_image_vae.safetensors' })
|
|
49
|
+
const unet = b.UNETLoader({ unet_name: 'qwen_image_edit_2509_int8_convrot.safetensors', weight_dtype: 'default' })
|
|
50
|
+
const withLora = b.LoraLoaderModelOnly({ model: unet, lora_name: PANO_LORA, strength_model: 1 })
|
|
51
|
+
const encode = (prompt: string) =>
|
|
52
|
+
b.TextEncodeQwenImageEditPlus({ clip, prompt, vae, image1: picture })
|
|
53
|
+
const samples = b.KSampler({
|
|
54
|
+
model: b.ModelSamplingAuraFlow({ model: withLora, shift: 3.1 }),
|
|
55
|
+
positive: encode(`${PANO_PREFIX}${vars.extend}${PANO_SUFFIX}`),
|
|
56
|
+
negative: encode(PANO_NEGATIVE),
|
|
57
|
+
latent_image: b.EmptySD3LatentImage({ width: PANO_W, height: PANO_H, batch_size: 1 }),
|
|
58
|
+
seed: vars.seed,
|
|
59
|
+
steps: vars.steps,
|
|
60
|
+
cfg: vars.cfg,
|
|
61
|
+
sampler_name: 'euler',
|
|
62
|
+
scheduler: 'simple',
|
|
63
|
+
denoise: 1,
|
|
64
|
+
})
|
|
65
|
+
const raw = b.VAEDecode({ samples, vae })
|
|
66
|
+
// the seam: HY-Pano's own edge blend (circular_blend_edges), the last BLEND columns fade into
|
|
67
|
+
// the first ones, then leave; 1952 wide becomes an exact 2:1 that wraps without a cut
|
|
68
|
+
const strip = (x: number) => b.ImageCrop({ image: raw, width: BLEND, height: PANO_H, x, y: 0 })
|
|
69
|
+
const joined = b.ImageCompositeMasked({
|
|
70
|
+
destination: strip(PANO_W - BLEND),
|
|
71
|
+
source: strip(0),
|
|
72
|
+
x: 0,
|
|
73
|
+
y: 0,
|
|
74
|
+
mask: b['kjnodes.CreateGradientMask']({ invert: true, frames: 1, width: BLEND, height: PANO_H }),
|
|
75
|
+
})
|
|
76
|
+
const panorama = b.ImageCompositeMasked({
|
|
77
|
+
destination: b.ImageCrop({ image: raw, width: PANO_W - BLEND, height: PANO_H, x: 0, y: 0 }),
|
|
78
|
+
source: joined,
|
|
79
|
+
x: 0,
|
|
80
|
+
y: 0,
|
|
81
|
+
})
|
|
82
|
+
b.SaveImageWebsocket({ images: panorama }, { tag: 'panorama' })
|
|
83
|
+
// the world: MoGe reads 12 perspective views of the panorama, merges one distance map all
|
|
84
|
+
// around, and the textured mesh is that map seen from the middle
|
|
85
|
+
const geometry = b.MoGePanoramaInference({
|
|
86
|
+
moge_model: b.LoadMoGeModel({ model_name: 'moge_2_vitl_normal_fp16.safetensors' }),
|
|
87
|
+
image: panorama,
|
|
88
|
+
})
|
|
89
|
+
b.SaveGLB({ mesh: b.MoGePointMapToMesh({ moge_geometry: geometry }), filename_prefix: 'comfy-ts/world' })
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
export default world
|
|
94
|
+
|
|
95
|
+
if (import.meta.main) {
|
|
96
|
+
if (process.argv[2]) world.vars.image.set(process.argv[2])
|
|
97
|
+
if (process.argv[3]) world.vars.seed.set(Number(process.argv[3]))
|
|
98
|
+
const execution = await world.run({ log: true, save: { prefix: 'comfy-ts-example/world' } })
|
|
99
|
+
for (const img of execution.images) console.log(`🟢 ${img.tags.join(',')} ${img.absPath}`)
|
|
100
|
+
host.disconnect()
|
|
101
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// world explorer: one world of .comfy-ts/worlds/<name>/ drawn in the browser (a panorama to look around, a mesh to
|
|
2
|
+
// walk, a splat to orbit, the source picture), the view page of the `world` thread kind (world-kind.shipkit.ts).
|
|
3
|
+
// bun examples/world-explorer/serve.ts → http://127.0.0.1:8293/?key=<world>
|
|
4
|
+
// the hub serves this page again through its proxy: every path the page asks is RELATIVE, so the bundle is built with
|
|
5
|
+
// publicPath './' and the world files answer under `worlds/<name>/<file>`
|
|
6
|
+
import { closeSync, existsSync, openSync, readdirSync, readSync, renameSync, statSync } from 'node:fs'
|
|
7
|
+
import { join, resolve } from 'pathe'
|
|
8
|
+
|
|
9
|
+
const PORT = Number(process.env.PORT ?? 8293)
|
|
10
|
+
const ROOT = resolve(import.meta.dir, '../..')
|
|
11
|
+
const WORLDS = join(ROOT, '.comfy-ts/worlds')
|
|
12
|
+
const WEB = join(import.meta.dir, 'web')
|
|
13
|
+
|
|
14
|
+
/** the files a world may hold, in the order the page shows their tabs */
|
|
15
|
+
const FILES = ['panorama.png', 'world.glb', 'splat.ply', 'source.png', 'thumb.webp'] as const
|
|
16
|
+
/** a thumbnail is a few tens of KB: anything far past it is not one */
|
|
17
|
+
const THUMB_MAX = 2_000_000
|
|
18
|
+
|
|
19
|
+
type WorldFile = { name: string; v: string }
|
|
20
|
+
type World = { name: string; files: WorldFile[]; splatFov: number | null }
|
|
21
|
+
|
|
22
|
+
/** the vertical fov of the camera a SHARP ply was made for, from its `intrinsic` (fy at index 4) and `image_size`
|
|
23
|
+
* elements after the vertices; null when the header names none of them */
|
|
24
|
+
function splatFov(path: string): number | null {
|
|
25
|
+
const fd = openSync(path, 'r')
|
|
26
|
+
try {
|
|
27
|
+
const head = Buffer.alloc(4096)
|
|
28
|
+
readSync(fd, head, 0, head.length, 0)
|
|
29
|
+
const end = head.indexOf('end_header\n')
|
|
30
|
+
if (end < 0) return null
|
|
31
|
+
const lines = head.subarray(0, end).toString('latin1').split('\n')
|
|
32
|
+
const sizes: Record<string, number> = { float: 4, uint: 4, int: 4, uchar: 1, double: 8 }
|
|
33
|
+
let offset = end + 'end_header\n'.length
|
|
34
|
+
let el: { name: string; count: number; stride: number } | null = null
|
|
35
|
+
const els: { name: string; count: number; stride: number; at: number }[] = []
|
|
36
|
+
for (const l of lines) {
|
|
37
|
+
const w = l.trim().split(/\s+/)
|
|
38
|
+
if (w[0] === 'element') {
|
|
39
|
+
el = { name: String(w[1]), count: Number(w[2]), stride: 0 }
|
|
40
|
+
els.push({ ...el, at: 0 })
|
|
41
|
+
} else if (w[0] === 'property' && el != null) {
|
|
42
|
+
const last = els[els.length - 1]
|
|
43
|
+
if (last != null) last.stride += sizes[String(w[1])] ?? 4
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
for (const e of els) {
|
|
47
|
+
e.at = offset
|
|
48
|
+
offset += e.count * e.stride
|
|
49
|
+
}
|
|
50
|
+
const intr = els.find((e) => e.name === 'intrinsic')
|
|
51
|
+
const size = els.find((e) => e.name === 'image_size')
|
|
52
|
+
if (intr == null || size == null) return null
|
|
53
|
+
const buf = Buffer.alloc(8)
|
|
54
|
+
readSync(fd, buf, 0, 4, intr.at + 4 * 4)
|
|
55
|
+
const fy = buf.readFloatLE(0)
|
|
56
|
+
readSync(fd, buf, 0, 8, size.at)
|
|
57
|
+
const h = buf.readUInt32LE(4)
|
|
58
|
+
if (!(fy > 0 && h > 0)) return null
|
|
59
|
+
return (2 * Math.atan(h / 2 / fy) * 180) / Math.PI
|
|
60
|
+
} finally {
|
|
61
|
+
closeSync(fd)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const fovCache = new Map<string, number | null>()
|
|
66
|
+
|
|
67
|
+
function worldOf(name: string): World | null {
|
|
68
|
+
if (!/^[a-z0-9][a-z0-9-]*$/.test(name)) return null
|
|
69
|
+
const dir = join(WORLDS, name)
|
|
70
|
+
if (!existsSync(dir)) return null
|
|
71
|
+
const files: WorldFile[] = []
|
|
72
|
+
for (const f of FILES) {
|
|
73
|
+
const p = join(dir, f)
|
|
74
|
+
if (!existsSync(p)) continue
|
|
75
|
+
const s = statSync(p)
|
|
76
|
+
files.push({ name: f, v: `${s.size.toString(36)}-${Math.round(s.mtimeMs).toString(36)}` })
|
|
77
|
+
}
|
|
78
|
+
const ply = files.find((f) => f.name === 'splat.ply')
|
|
79
|
+
let fov: number | null = null
|
|
80
|
+
if (ply != null) {
|
|
81
|
+
const k = `${name}/${ply.v}`
|
|
82
|
+
if (!fovCache.has(k)) fovCache.set(k, splatFov(join(dir, ply.name)))
|
|
83
|
+
fov = fovCache.get(k) ?? null
|
|
84
|
+
}
|
|
85
|
+
return { name, files, splatFov: fov }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function worlds(): World[] {
|
|
89
|
+
if (!existsSync(WORLDS)) return []
|
|
90
|
+
return readdirSync(WORLDS)
|
|
91
|
+
.sort()
|
|
92
|
+
.map(worldOf)
|
|
93
|
+
.filter((w): w is World => w != null && w.files.length > 0)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** the page's bundle, in memory, built again when a file of web/ moved since */
|
|
97
|
+
let bundle: { stamp: string; files: Map<string, Blob> } | null = null
|
|
98
|
+
|
|
99
|
+
function webStamp(): string {
|
|
100
|
+
return readdirSync(WEB)
|
|
101
|
+
.map((f) => `${f}:${statSync(join(WEB, f)).mtimeMs}`)
|
|
102
|
+
.join('|')
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function built(): Promise<Map<string, Blob>> {
|
|
106
|
+
const stamp = webStamp()
|
|
107
|
+
if (bundle?.stamp === stamp) return bundle.files
|
|
108
|
+
const started = performance.now()
|
|
109
|
+
const r = await Bun.build({
|
|
110
|
+
entrypoints: [join(WEB, 'index.html')],
|
|
111
|
+
publicPath: './',
|
|
112
|
+
target: 'browser',
|
|
113
|
+
minify: true,
|
|
114
|
+
throw: false,
|
|
115
|
+
})
|
|
116
|
+
if (!r.success) throw new Error(`the page does not build:\n${r.logs.map(String).join('\n')}`)
|
|
117
|
+
const files = new Map<string, Blob>()
|
|
118
|
+
for (const o of r.outputs) files.set(o.path.replace(/^\.\//, ''), o)
|
|
119
|
+
bundle = { stamp, files }
|
|
120
|
+
console.log(`🟢 page built in ${Math.round(performance.now() - started)} ms (${[...files.keys()].join(', ')})`)
|
|
121
|
+
return files
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const json = (data: unknown, status = 200): Response =>
|
|
125
|
+
Response.json(data, { status, headers: { 'cache-control': 'no-store' } })
|
|
126
|
+
|
|
127
|
+
const server = Bun.serve({
|
|
128
|
+
port: PORT,
|
|
129
|
+
hostname: '127.0.0.1',
|
|
130
|
+
idleTimeout: 120,
|
|
131
|
+
async fetch(req) {
|
|
132
|
+
const url = new URL(req.url)
|
|
133
|
+
const path = decodeURIComponent(url.pathname).replace(/^\/+/, '')
|
|
134
|
+
if (path === 'api/worlds') return json(worlds())
|
|
135
|
+
// the page renders a world's thumbnail from its first view at the default camera and sends it here
|
|
136
|
+
const t = /^api\/thumb\/([^/]+)$/.exec(path)
|
|
137
|
+
if (t != null && req.method === 'POST') {
|
|
138
|
+
const w = worldOf(String(t[1]))
|
|
139
|
+
if (w == null) return json({ error: `no world ${t[1]}` }, 404)
|
|
140
|
+
const bytes = new Uint8Array(await req.arrayBuffer())
|
|
141
|
+
const webp = bytes.length > 12 && new TextDecoder().decode(bytes.subarray(8, 12)) === 'WEBP'
|
|
142
|
+
if (!webp || bytes.length > THUMB_MAX) return json({ error: 'a thumbnail is a webp under 2 MB' }, 400)
|
|
143
|
+
const dest = join(WORLDS, w.name, 'thumb.webp')
|
|
144
|
+
await Bun.write(`${dest}.tmp`, bytes)
|
|
145
|
+
renameSync(`${dest}.tmp`, dest)
|
|
146
|
+
console.log(`🟢 thumbnail of ${w.name}: ${bytes.length} bytes`)
|
|
147
|
+
return json({ ok: true, bytes: bytes.length })
|
|
148
|
+
}
|
|
149
|
+
const m = /^worlds\/([^/]+)\/([^/]+)$/.exec(path)
|
|
150
|
+
if (m != null) {
|
|
151
|
+
const w = worldOf(String(m[1]))
|
|
152
|
+
const f = w?.files.find((x) => x.name === m[2])
|
|
153
|
+
if (w == null || f == null) return json({ error: `no ${m[2]} in world ${m[1]}` }, 404)
|
|
154
|
+
// a world file weighs 60 to 80 MB: under its stamp it never changes, so the browser keeps it
|
|
155
|
+
const cache = url.searchParams.get('v') === f.v ? 'public, max-age=31536000, immutable' : 'no-cache'
|
|
156
|
+
return new Response(Bun.file(join(WORLDS, w.name, f.name)), { headers: { 'cache-control': cache } })
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const files = await built()
|
|
160
|
+
const file = files.get(path === '' ? 'index.html' : path)
|
|
161
|
+
if (file == null) return json({ error: `no ${path}` }, 404)
|
|
162
|
+
return new Response(file, { headers: { 'cache-control': 'no-cache' } })
|
|
163
|
+
} catch (e) {
|
|
164
|
+
const message = e instanceof Error ? e.message : String(e)
|
|
165
|
+
console.error(`🔴 ${message}`)
|
|
166
|
+
return new Response(message, { status: 500, headers: { 'content-type': 'text/plain; charset=utf-8' } })
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
})
|
|
170
|
+
|
|
171
|
+
console.log(`world explorer → http://127.0.0.1:${server.port}/ (${worlds().length} worlds in ${WORLDS})`)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>world explorer</title>
|
|
7
|
+
<meta name="shot-ready" content="wait" />
|
|
8
|
+
<link rel="stylesheet" href="./styles.css" />
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
<script type="module" src="./main.tsx"></script>
|
|
13
|
+
</body>
|
|
14
|
+
</html>
|