topotopo 0.3.0 → 0.5.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/NOTICE +40 -10
- package/README.md +475 -111
- package/dist/cli.js +328 -133
- package/dist/config.d.ts +48 -0
- package/dist/config.js +170 -0
- package/dist/core/analysis.d.ts +5 -1
- package/dist/core/analysis.js +8 -3
- package/dist/core/bake.d.ts +16 -8
- package/dist/core/bake.js +165 -29
- package/dist/core/bevel.d.ts +3 -1
- package/dist/core/bevel.js +238 -97
- package/dist/core/decimate.d.ts +65 -0
- package/dist/core/decimate.js +409 -3
- package/dist/core/erosion.d.ts +37 -0
- package/dist/core/erosion.js +41 -1
- package/dist/core/geometry.d.ts +5 -1
- package/dist/core/geometry.js +204 -4
- package/dist/core/heightfield.d.ts +27 -4
- package/dist/core/heightfield.js +54 -16
- package/dist/core/imageops.d.ts +6 -0
- package/dist/core/imageops.js +51 -0
- package/dist/core/intrinsics.d.ts +7 -0
- package/dist/core/intrinsics.js +94 -0
- package/dist/core/manifold.d.ts +12 -1
- package/dist/core/manifold.js +78 -6
- package/dist/core/materials.d.ts +11 -0
- package/dist/core/materials.js +56 -0
- package/dist/core/noise.d.ts +9 -0
- package/dist/core/noise.js +10 -1
- package/dist/core/packed.js +11 -0
- package/dist/core/particles.d.ts +1 -1
- package/dist/core/particles.js +1 -1
- package/dist/core/polymerge.d.ts +21 -0
- package/dist/core/polymerge.js +327 -0
- package/dist/core/rbd.js +13 -1
- package/dist/core/repair.d.ts +2 -0
- package/dist/core/repair.js +2 -0
- package/dist/core/report.d.ts +70 -0
- package/dist/core/report.js +275 -0
- package/dist/core/scatter.d.ts +1 -1
- package/dist/core/scatter.js +1 -1
- package/dist/core/scene.d.ts +20 -0
- package/dist/core/scene.js +72 -0
- package/dist/core/sha256.d.ts +4 -0
- package/dist/core/sha256.js +69 -0
- package/dist/core/shapes.d.ts +3 -0
- package/dist/core/shapes.js +34 -0
- package/dist/core/snippet-lib.d.ts +15 -2
- package/dist/core/snippet-lib.js +40 -14
- package/dist/core/solidify.d.ts +38 -0
- package/dist/core/solidify.js +356 -0
- package/dist/core/tangents.d.ts +54 -0
- package/dist/core/tangents.js +218 -0
- package/dist/core/texcoord.d.ts +4 -0
- package/dist/core/texcoord.js +14 -0
- package/dist/core/texnoise.d.ts +6 -1
- package/dist/core/texnoise.js +6 -2
- package/dist/core/texsdf.d.ts +131 -0
- package/dist/core/texsdf.js +637 -0
- package/dist/core/texture.d.ts +163 -9
- package/dist/core/texture.js +844 -20
- package/dist/core/topology.d.ts +32 -0
- package/dist/core/topology.js +238 -7
- package/dist/core/traceimage.d.ts +7 -0
- package/dist/core/traceimage.js +221 -0
- package/dist/core/tritri.d.ts +5 -0
- package/dist/core/tritri.js +120 -0
- package/dist/core/unwrap.d.ts +72 -0
- package/dist/core/unwrap.js +800 -0
- package/dist/core/usercode.d.ts +27 -0
- package/dist/core/usercode.js +87 -0
- package/dist/core/uv.d.ts +15 -16
- package/dist/core/uv.js +36 -189
- package/dist/core/uvislands.d.ts +62 -0
- package/dist/core/uvislands.js +574 -0
- package/dist/core/uvoverlap.d.ts +58 -0
- package/dist/core/uvoverlap.js +220 -0
- package/dist/core/uvpack.d.ts +64 -0
- package/dist/core/uvpack.js +628 -0
- package/dist/core/uvreport.d.ts +127 -0
- package/dist/core/uvreport.js +372 -0
- package/dist/core/wrangle.d.ts +6 -1
- package/dist/core/wrangle.js +27 -16
- package/dist/core/xatlas.d.ts +16 -1
- package/dist/core/xatlas.js +95 -61
- package/dist/engines.d.ts +63 -0
- package/dist/engines.js +180 -0
- package/dist/explain.d.ts +4 -3
- package/dist/explain.js +129 -12
- package/dist/graph/engine.d.ts +92 -29
- package/dist/graph/engine.js +298 -148
- package/dist/graph/expr.d.ts +6 -3
- package/dist/graph/expr.js +18 -8
- package/dist/graph/outputs.d.ts +23 -0
- package/dist/graph/outputs.js +41 -0
- package/dist/graph/packages.d.ts +72 -0
- package/dist/graph/packages.js +261 -0
- package/dist/graph/parallel.d.ts +3 -1
- package/dist/graph/parallel.js +4 -1
- package/dist/graph/params.d.ts +6 -0
- package/dist/graph/params.js +34 -7
- package/dist/graph/scope.d.ts +55 -0
- package/dist/graph/scope.js +14 -0
- package/dist/graph/types.d.ts +75 -12
- package/dist/graph/types.js +4 -2
- package/dist/graph/vars.d.ts +16 -0
- package/dist/graph/vars.js +80 -0
- package/dist/host/artifacts.d.ts +10 -1
- package/dist/host/artifacts.js +37 -6
- package/dist/host/cook.d.ts +241 -0
- package/dist/host/cook.js +844 -0
- package/dist/host/export-targets.d.ts +42 -5
- package/dist/host/export-targets.js +72 -13
- package/dist/host/godot-commands.d.ts +4 -0
- package/dist/host/godot-commands.js +21 -0
- package/dist/host/godot.d.ts +183 -0
- package/dist/host/godot.js +916 -0
- package/dist/host/node.d.ts +12 -7
- package/dist/host/node.js +27 -9
- package/dist/host/pool.js +51 -2
- package/dist/host/sidecars.d.ts +8 -0
- package/dist/host/sidecars.js +50 -0
- package/dist/host/types.d.ts +19 -6
- package/dist/host/version.d.ts +1 -0
- package/dist/host/version.js +3 -0
- package/dist/host/worker.js +5 -2
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3 -2
- package/dist/inspect.d.ts +84 -1
- package/dist/inspect.js +271 -24
- package/dist/io/common.d.ts +33 -5
- package/dist/io/export.js +2 -1
- package/dist/io/files.d.ts +23 -4
- package/dist/io/files.js +60 -8
- package/dist/io/gltf.js +355 -51
- package/dist/io/heightmap.d.ts +3 -0
- package/dist/io/heightmap.js +1 -0
- package/dist/io/import.js +10 -0
- package/dist/io/inspect-scene.d.ts +55 -0
- package/dist/io/inspect-scene.js +155 -0
- package/dist/io/kinds.d.ts +81 -0
- package/dist/io/kinds.js +163 -0
- package/dist/io/points.d.ts +2 -1
- package/dist/io/points.js +3 -1
- package/dist/io/sidecars.d.ts +24 -0
- package/dist/io/sidecars.js +57 -0
- package/dist/io/source.d.ts +65 -0
- package/dist/io/source.js +112 -0
- package/dist/io/targets.d.ts +47 -3
- package/dist/io/targets.js +149 -14
- package/dist/io/textures.js +21 -1
- package/dist/io/unreal.js +5 -1
- package/dist/mcp/docs.d.ts +10 -1
- package/dist/mcp/docs.js +816 -119
- package/dist/mcp/inputs.d.ts +12 -5
- package/dist/mcp/inputs.js +50 -13
- package/dist/mcp/server.js +70 -24
- package/dist/mcp/tools.d.ts +14 -7
- package/dist/mcp/tools.js +207 -108
- package/dist/mcp/verify.d.ts +2 -2
- package/dist/mcp/verify.js +1 -1
- package/dist/mcp/workspace.d.ts +15 -0
- package/dist/mcp/workspace.js +349 -0
- package/dist/nodes/attributes.js +198 -1
- package/dist/nodes/bake.js +207 -83
- package/dist/nodes/beam.d.ts +1 -0
- package/dist/nodes/beam.js +201 -0
- package/dist/nodes/bevel.js +54 -5
- package/dist/nodes/cloth.js +2 -0
- package/dist/nodes/code.js +22 -10
- package/dist/nodes/curves.js +440 -93
- package/dist/nodes/flow.js +53 -33
- package/dist/nodes/generate.js +13 -39
- package/dist/nodes/heightfield.js +248 -77
- package/dist/nodes/imageops.d.ts +1 -0
- package/dist/nodes/imageops.js +203 -0
- package/dist/nodes/index.d.ts +4 -0
- package/dist/nodes/index.js +4 -0
- package/dist/nodes/material.js +91 -23
- package/dist/nodes/measure.js +45 -18
- package/dist/nodes/particles.js +2 -0
- package/dist/nodes/pcg.js +6 -5
- package/dist/nodes/procedural.js +4 -3
- package/dist/nodes/rbd.js +1 -1
- package/dist/nodes/remesh.js +71 -15
- package/dist/nodes/scene.d.ts +1 -0
- package/dist/nodes/scene.js +55 -0
- package/dist/nodes/sdf.js +10 -5
- package/dist/nodes/solid.js +20 -5
- package/dist/nodes/solidify.d.ts +1 -0
- package/dist/nodes/solidify.js +52 -0
- package/dist/nodes/splines.d.ts +15 -1
- package/dist/nodes/splines.js +112 -105
- package/dist/nodes/texture.d.ts +21 -6
- package/dist/nodes/texture.js +1318 -185
- package/dist/nodes/topology.d.ts +7 -0
- package/dist/nodes/topology.js +133 -6
- package/dist/nodes/transform.js +11 -3
- package/dist/nodes/util.d.ts +1 -1
- package/dist/nodes/uv.js +192 -174
- package/dist/nodes/wasmcall.js +6 -2
- package/dist/open.d.ts +19 -0
- package/dist/open.js +12 -0
- package/dist/package.d.ts +288 -0
- package/dist/package.js +772 -0
- package/dist/packages/check.d.ts +32 -0
- package/dist/packages/check.js +169 -0
- package/dist/packages/commands.d.ts +57 -0
- package/dist/packages/commands.js +537 -0
- package/dist/packages/registry.d.ts +796 -0
- package/dist/packages/registry.js +2998 -0
- package/dist/packages/update.d.ts +124 -0
- package/dist/packages/update.js +476 -0
- package/dist/render/options.d.ts +2 -0
- package/dist/render/options.js +44 -5
- package/dist/render/pbr.d.ts +28 -0
- package/dist/render/pbr.js +378 -0
- package/dist/render/preview.d.ts +69 -0
- package/dist/render/preview.js +26 -0
- package/dist/render/raster.d.ts +78 -7
- package/dist/render/raster.js +600 -145
- package/dist/render/texview.d.ts +7 -1
- package/dist/render/texview.js +34 -2
- package/dist/scan.d.ts +61 -0
- package/dist/scan.js +228 -0
- package/dist/session.d.ts +311 -0
- package/dist/session.js +849 -0
- package/dist/viewer/app/api.js +48 -6
- package/dist/viewer/app/camera.js +1 -1
- package/dist/viewer/app/cooking.js +78 -0
- package/dist/viewer/app/embed.js +100 -0
- package/dist/viewer/app/export-popover.js +118 -16
- package/dist/viewer/app/grid.js +6 -2
- package/dist/viewer/app/guides.js +123 -1
- package/dist/viewer/app/keymap.js +7 -4
- package/dist/viewer/app/layers.js +5 -5
- package/dist/viewer/app/main.js +186 -53
- package/dist/viewer/app/markers.js +61 -1
- package/dist/viewer/app/outliner.js +72 -27
- package/dist/viewer/app/output-info.js +45 -0
- package/dist/viewer/app/outputs.css +147 -8
- package/dist/viewer/app/outputs.js +168 -54
- package/dist/viewer/app/packages.js +614 -0
- package/dist/viewer/app/props.js +177 -53
- package/dist/viewer/app/scene.js +35 -6
- package/dist/viewer/app/select.js +5 -4
- package/dist/viewer/app/selection.js +1 -1
- package/dist/viewer/app/status.js +12 -15
- package/dist/viewer/app/style.css +66 -8
- package/dist/viewer/app/units.js +1 -1
- package/dist/viewer/app/vars.js +48 -1
- package/dist/viewer/app/welcome.js +72 -0
- package/dist/viewer/graph-file.d.ts +62 -0
- package/dist/viewer/graph-file.js +175 -0
- package/dist/viewer/index.html +24 -11
- package/dist/viewer/json-edit.d.ts +13 -0
- package/dist/viewer/json-edit.js +274 -0
- package/dist/viewer/outputs.d.ts +49 -5
- package/dist/viewer/outputs.js +264 -56
- package/dist/viewer/packages.d.ts +121 -0
- package/dist/viewer/packages.js +584 -0
- package/dist/viewer/server.d.ts +24 -7
- package/dist/viewer/server.js +289 -31
- package/dist/web/app/web.css +419 -0
- package/dist/web/app/web.js +188 -0
- package/dist/web/bake.d.ts +34 -0
- package/dist/web/bake.js +153 -0
- package/dist/web/folder-page.d.ts +101 -0
- package/dist/web/folder-page.js +146 -0
- package/dist/web/folders.d.ts +280 -0
- package/dist/web/folders.js +970 -0
- package/dist/web/library.d.ts +91 -0
- package/dist/web/library.js +228 -0
- package/dist/web/markdown.d.ts +45 -0
- package/dist/web/markdown.js +677 -0
- package/dist/web/pages.d.ts +258 -0
- package/dist/web/pages.js +301 -0
- package/dist/web/server.d.ts +24 -0
- package/dist/web/server.js +1068 -0
- package/dist/workspace.d.ts +88 -105
- package/dist/workspace.js +359 -375
- package/integrations/godot/addons/topotopo/LICENSE +202 -0
- package/integrations/godot/addons/topotopo/README.md +57 -0
- package/integrations/godot/addons/topotopo/context_menu.gd +43 -0
- package/integrations/godot/addons/topotopo/dock.gd +266 -0
- package/integrations/godot/addons/topotopo/dock.tscn +72 -0
- package/integrations/godot/addons/topotopo/export_filter.gd +72 -0
- package/integrations/godot/addons/topotopo/gltf_instancing.gd +131 -0
- package/integrations/godot/addons/topotopo/icons/topotopo.svg +1 -0
- package/integrations/godot/addons/topotopo/inspector.gd +38 -0
- package/integrations/godot/addons/topotopo/instances_post_import.gd +111 -0
- package/integrations/godot/addons/topotopo/package.gd +23 -0
- package/integrations/godot/addons/topotopo/package_importer.gd +187 -0
- package/integrations/godot/addons/topotopo/plugin.cfg +7 -0
- package/integrations/godot/addons/topotopo/plugin.gd +970 -0
- package/integrations/godot/addons/topotopo/record.gd +435 -0
- package/integrations/godot/addons/topotopo/runner.gd +458 -0
- package/integrations/godot/addons/topotopo/tools/check.gd +42 -0
- package/integrations/godot/addons/topotopo/watcher.gd +199 -0
- package/kernels/pkg/README.md +23 -29
- package/kernels/pkg-simd/README.md +23 -29
- package/library/architecture/versions/1.0/architecture.topo +12 -0
- package/{shelf → library/architecture/versions/1.0/graphs}/arch.json +3 -3
- package/{shelf → library/architecture/versions/1.0/graphs}/beam_truss.json +6 -6
- package/{shelf → library/architecture/versions/1.0/graphs}/brick_wall.json +8 -8
- package/{shelf → library/architecture/versions/1.0/graphs}/door_frame.json +3 -3
- package/{shelf → library/architecture/versions/1.0/graphs}/hex_grid_floor.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/house.json +8 -8
- package/library/architecture/versions/1.0/graphs/lineup.json +42 -0
- package/{shelf → library/architecture/versions/1.0/graphs}/pillar.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/railing.json +5 -5
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_gable.json +2 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_hip.json +2 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/roof_skeleton.json +2 -1
- package/{shelf → library/architecture/versions/1.0/graphs}/scaffold.json +4 -4
- package/{shelf → library/architecture/versions/1.0/graphs}/spiral_stairs.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/stairs.json +6 -6
- package/{shelf → library/architecture/versions/1.0/graphs}/tile_floor.json +3 -2
- package/{shelf → library/architecture/versions/1.0/graphs}/wall_segment.json +10 -10
- package/{shelf → library/architecture/versions/1.0/graphs}/window_frame.json +2 -2
- package/library/architecture/versions/1.0/version.json +1119 -0
- package/{shelf → library/nature/versions/1.0/graphs}/bush.json +2 -2
- package/{shelf → library/nature/versions/1.0/graphs}/cliff_block.json +4 -3
- package/{shelf → library/nature/versions/1.0/graphs}/forest_patch.json +5 -5
- package/{shelf → library/nature/versions/1.0/graphs}/grass_clumps.json +2 -2
- package/library/nature/versions/1.0/graphs/lineup.json +24 -0
- package/{shelf → library/nature/versions/1.0/graphs}/log.json +6 -6
- package/{shelf → library/nature/versions/1.0/graphs}/rock.json +5 -4
- package/{shelf → library/nature/versions/1.0/graphs}/scatter_rocks.json +5 -5
- package/{shelf → library/nature/versions/1.0/graphs}/tree_lowpoly.json +3 -2
- package/library/nature/versions/1.0/nature.topo +12 -0
- package/library/nature/versions/1.0/version.json +534 -0
- package/{shelf → library/props/versions/1.0/graphs}/barrel.json +5 -4
- package/{shelf → library/props/versions/1.0/graphs}/crate.json +3 -3
- package/library/props/versions/1.0/graphs/lineup.json +18 -0
- package/{shelf → library/props/versions/1.0/graphs}/pallet.json +4 -3
- package/{shelf → library/props/versions/1.0/graphs}/pipe_run.json +3 -3
- package/{shelf → library/props/versions/1.0/graphs}/sandbag_wall.json +5 -5
- package/library/props/versions/1.0/props.topo +12 -0
- package/library/props/versions/1.0/version.json +336 -0
- package/{shelf → library/street/versions/1.0/graphs}/bench.json +5 -5
- package/{shelf → library/street/versions/1.0/graphs}/bollard.json +2 -1
- package/{shelf → library/street/versions/1.0/graphs}/cable.json +4 -4
- package/{shelf → library/street/versions/1.0/graphs}/fence.json +7 -7
- package/{shelf → library/street/versions/1.0/graphs}/lamp_post.json +2 -2
- package/library/street/versions/1.0/graphs/lineup.json +22 -0
- package/{shelf → library/street/versions/1.0/graphs}/road_strip.json +2 -2
- package/{shelf → library/street/versions/1.0/graphs}/sign_post.json +1 -1
- package/library/street/versions/1.0/street.topo +12 -0
- package/library/street/versions/1.0/version.json +421 -0
- package/package.json +23 -8
- package/dist/graph/migrate.d.ts +0 -23
- package/dist/graph/migrate.js +0 -58
- package/shelf/index.json +0 -190
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"graph": "lineup",
|
|
3
|
+
"bake": {},
|
|
4
|
+
"title": "Street",
|
|
5
|
+
"description": "TopoTopo's street package: roads with kerbs and sidewalks, lamp posts, bollards, benches, street signs, fences and hanging cables.",
|
|
6
|
+
"tags": [
|
|
7
|
+
"built-in"
|
|
8
|
+
],
|
|
9
|
+
"links": [],
|
|
10
|
+
"created": "2026-10-28",
|
|
11
|
+
"name": "topotopo/street"
|
|
12
|
+
}
|
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
{
|
|
2
|
+
"package": "topotopo/street",
|
|
3
|
+
"version": "1.0",
|
|
4
|
+
"note": "first version",
|
|
5
|
+
"published": "2026-10-30T12:01:50.950Z",
|
|
6
|
+
"big": false,
|
|
7
|
+
"hash": "c691773d575eb1a5653ba4ec43cd35a761ed26685272700b9e5e1586ef309c3b",
|
|
8
|
+
"outputs": {
|
|
9
|
+
"bench": {
|
|
10
|
+
"graph": "bench",
|
|
11
|
+
"node": "out",
|
|
12
|
+
"label": "Bench",
|
|
13
|
+
"kind": "mesh",
|
|
14
|
+
"tags": [
|
|
15
|
+
"bench",
|
|
16
|
+
"seating",
|
|
17
|
+
"park",
|
|
18
|
+
"street-furniture"
|
|
19
|
+
],
|
|
20
|
+
"description": "Park bench along X: wooden seat slats and an optional reclined backrest on cast-iron side frames (two, or three on long benches). The seat faces +Z. Pivot at the centre of the base. Pieces: bench_slats (wood), bench_frames (metal_dark). Every piece is closed.",
|
|
21
|
+
"sliders": {
|
|
22
|
+
"bench_length": {
|
|
23
|
+
"type": "float",
|
|
24
|
+
"default": 1.8,
|
|
25
|
+
"min": 0.6,
|
|
26
|
+
"max": 5,
|
|
27
|
+
"desc": "length along X (m)"
|
|
28
|
+
},
|
|
29
|
+
"seat_height": {
|
|
30
|
+
"type": "float",
|
|
31
|
+
"default": 0.45,
|
|
32
|
+
"min": 0.25,
|
|
33
|
+
"max": 0.8,
|
|
34
|
+
"desc": "seat height (m)"
|
|
35
|
+
},
|
|
36
|
+
"depth": {
|
|
37
|
+
"type": "float",
|
|
38
|
+
"default": 0.45,
|
|
39
|
+
"min": 0.25,
|
|
40
|
+
"max": 0.8,
|
|
41
|
+
"desc": "seat depth along Z (m)"
|
|
42
|
+
},
|
|
43
|
+
"slats": {
|
|
44
|
+
"type": "int",
|
|
45
|
+
"default": 5,
|
|
46
|
+
"min": 2,
|
|
47
|
+
"max": 10,
|
|
48
|
+
"desc": "seat slats"
|
|
49
|
+
},
|
|
50
|
+
"backrest": {
|
|
51
|
+
"type": "bool",
|
|
52
|
+
"default": true,
|
|
53
|
+
"desc": "add the backrest"
|
|
54
|
+
},
|
|
55
|
+
"seed": {
|
|
56
|
+
"type": "int",
|
|
57
|
+
"default": 0,
|
|
58
|
+
"min": 0,
|
|
59
|
+
"max": 1000,
|
|
60
|
+
"desc": "random seed of the slat tint"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"inputs": []
|
|
64
|
+
},
|
|
65
|
+
"bollard": {
|
|
66
|
+
"graph": "bollard",
|
|
67
|
+
"node": "out",
|
|
68
|
+
"label": "Bollard",
|
|
69
|
+
"kind": "mesh",
|
|
70
|
+
"tags": [
|
|
71
|
+
"bollard",
|
|
72
|
+
"barrier",
|
|
73
|
+
"street-furniture"
|
|
74
|
+
],
|
|
75
|
+
"description": "Street bollard: a round post with a domed top or a square post with a pyramid cap, an optional reflective band and a base ring. Pivot at the centre of the base. Pieces: bollard_body (metal_dark), bollard_band (reflective). Every piece is closed.",
|
|
76
|
+
"sliders": {
|
|
77
|
+
"height": {
|
|
78
|
+
"type": "float",
|
|
79
|
+
"default": 0.9,
|
|
80
|
+
"min": 0.3,
|
|
81
|
+
"max": 2,
|
|
82
|
+
"desc": "height (m)"
|
|
83
|
+
},
|
|
84
|
+
"radius": {
|
|
85
|
+
"type": "float",
|
|
86
|
+
"default": 0.1,
|
|
87
|
+
"min": 0.03,
|
|
88
|
+
"max": 0.4,
|
|
89
|
+
"desc": "post radius (half width for square) (m)"
|
|
90
|
+
},
|
|
91
|
+
"style": {
|
|
92
|
+
"type": "enum",
|
|
93
|
+
"default": "round",
|
|
94
|
+
"options": [
|
|
95
|
+
"round",
|
|
96
|
+
"square"
|
|
97
|
+
],
|
|
98
|
+
"desc": "post section"
|
|
99
|
+
},
|
|
100
|
+
"band": {
|
|
101
|
+
"type": "bool",
|
|
102
|
+
"default": true,
|
|
103
|
+
"desc": "reflective band near the top"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"inputs": []
|
|
107
|
+
},
|
|
108
|
+
"cable": {
|
|
109
|
+
"graph": "cable",
|
|
110
|
+
"node": "out",
|
|
111
|
+
"label": "Cable",
|
|
112
|
+
"kind": "mesh",
|
|
113
|
+
"tags": [
|
|
114
|
+
"cable",
|
|
115
|
+
"power-line",
|
|
116
|
+
"utility-pole",
|
|
117
|
+
"street-furniture"
|
|
118
|
+
],
|
|
119
|
+
"description": "Hanging cable between two points: a catenary that sags by `sag` below the straight line at mid-span, swept as a tube, with optional wooden poles (with a cross arm and insulators) standing on y = 0 under the ends. With the default end points the pivot is the foot of the first pole. Pieces: cable (rubber), cable_poles (wood_dark), cable_insulators (ceramic). Every piece is closed.",
|
|
120
|
+
"sliders": {
|
|
121
|
+
"start": {
|
|
122
|
+
"type": "vec3",
|
|
123
|
+
"default": [
|
|
124
|
+
0,
|
|
125
|
+
5,
|
|
126
|
+
0
|
|
127
|
+
],
|
|
128
|
+
"desc": "first end point (m)"
|
|
129
|
+
},
|
|
130
|
+
"end": {
|
|
131
|
+
"type": "vec3",
|
|
132
|
+
"default": [
|
|
133
|
+
10,
|
|
134
|
+
4.6,
|
|
135
|
+
0
|
|
136
|
+
],
|
|
137
|
+
"desc": "second end point (m)"
|
|
138
|
+
},
|
|
139
|
+
"sag": {
|
|
140
|
+
"type": "float",
|
|
141
|
+
"default": 0.8,
|
|
142
|
+
"min": 0,
|
|
143
|
+
"max": 10,
|
|
144
|
+
"desc": "drop below the straight line at mid-span (m)"
|
|
145
|
+
},
|
|
146
|
+
"radius": {
|
|
147
|
+
"type": "float",
|
|
148
|
+
"default": 0.015,
|
|
149
|
+
"min": 0.003,
|
|
150
|
+
"max": 0.2,
|
|
151
|
+
"desc": "cable radius (m)"
|
|
152
|
+
},
|
|
153
|
+
"segments": {
|
|
154
|
+
"type": "int",
|
|
155
|
+
"default": 32,
|
|
156
|
+
"min": 2,
|
|
157
|
+
"max": 200,
|
|
158
|
+
"desc": "segments along the cable"
|
|
159
|
+
},
|
|
160
|
+
"poles": {
|
|
161
|
+
"type": "bool",
|
|
162
|
+
"default": true,
|
|
163
|
+
"desc": "poles under both ends"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"inputs": []
|
|
167
|
+
},
|
|
168
|
+
"fence": {
|
|
169
|
+
"graph": "fence",
|
|
170
|
+
"node": "out",
|
|
171
|
+
"label": "Fence",
|
|
172
|
+
"kind": "mesh",
|
|
173
|
+
"tags": [
|
|
174
|
+
"fence",
|
|
175
|
+
"barrier",
|
|
176
|
+
"garden",
|
|
177
|
+
"along-curve"
|
|
178
|
+
],
|
|
179
|
+
"description": "Fence along a curve (input 0; without one, a straight run of `run_length` along +X from the origin) in three styles: picket (white pointed pickets on two rails), plank (horizontal boards) and rail (three ranch rails). Posts at even spacing including both ends. Sits on the curve (pivot = the curve). Pieces: fence_posts, fence_infill (paint_white, wood or wood_dark by style).",
|
|
180
|
+
"sliders": {
|
|
181
|
+
"run_length": {
|
|
182
|
+
"type": "float",
|
|
183
|
+
"default": 6,
|
|
184
|
+
"min": 0.5,
|
|
185
|
+
"max": 40,
|
|
186
|
+
"desc": "run length along +X when no curve is connected (m)"
|
|
187
|
+
},
|
|
188
|
+
"height": {
|
|
189
|
+
"type": "float",
|
|
190
|
+
"default": 1.1,
|
|
191
|
+
"min": 0.4,
|
|
192
|
+
"max": 2.5,
|
|
193
|
+
"desc": "fence height (m)"
|
|
194
|
+
},
|
|
195
|
+
"style": {
|
|
196
|
+
"type": "enum",
|
|
197
|
+
"default": "picket",
|
|
198
|
+
"options": [
|
|
199
|
+
"picket",
|
|
200
|
+
"plank",
|
|
201
|
+
"rail"
|
|
202
|
+
],
|
|
203
|
+
"desc": "infill style"
|
|
204
|
+
},
|
|
205
|
+
"post_spacing": {
|
|
206
|
+
"type": "float",
|
|
207
|
+
"default": 2,
|
|
208
|
+
"min": 0.5,
|
|
209
|
+
"max": 5,
|
|
210
|
+
"desc": "maximum distance between posts (m)"
|
|
211
|
+
},
|
|
212
|
+
"picket_spacing": {
|
|
213
|
+
"type": "float",
|
|
214
|
+
"default": 0.15,
|
|
215
|
+
"min": 0.08,
|
|
216
|
+
"max": 0.5,
|
|
217
|
+
"desc": "picket style: distance between pickets (m)"
|
|
218
|
+
},
|
|
219
|
+
"seed": {
|
|
220
|
+
"type": "int",
|
|
221
|
+
"default": 0,
|
|
222
|
+
"min": 0,
|
|
223
|
+
"max": 1000,
|
|
224
|
+
"desc": "random seed of the board tint"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"inputs": [
|
|
228
|
+
{
|
|
229
|
+
"index": 0,
|
|
230
|
+
"label": "curve to follow (polyline); optional"
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
"lamp_post": {
|
|
235
|
+
"graph": "lamp_post",
|
|
236
|
+
"node": "out",
|
|
237
|
+
"label": "Lamp post",
|
|
238
|
+
"kind": "mesh",
|
|
239
|
+
"tags": [
|
|
240
|
+
"lamp",
|
|
241
|
+
"street-light",
|
|
242
|
+
"lighting",
|
|
243
|
+
"street-furniture"
|
|
244
|
+
],
|
|
245
|
+
"description": "Street lamp: a tapered pole on a flared base with 1–4 curved arms carrying shades and glowing glass (arms 0 = a lantern on top of the pole). The first arm points along +X. Pivot at the centre of the base. Pieces: lamp_pole, lamp_arms, lamp_heads (metal_dark), lamp_glass (lamp_glass, emissive). Every piece is closed.",
|
|
246
|
+
"sliders": {
|
|
247
|
+
"height": {
|
|
248
|
+
"type": "float",
|
|
249
|
+
"default": 4.5,
|
|
250
|
+
"min": 1.5,
|
|
251
|
+
"max": 12,
|
|
252
|
+
"desc": "height of the lamp heads (m)"
|
|
253
|
+
},
|
|
254
|
+
"arm_length": {
|
|
255
|
+
"type": "float",
|
|
256
|
+
"default": 1,
|
|
257
|
+
"min": 0.2,
|
|
258
|
+
"max": 4,
|
|
259
|
+
"desc": "horizontal reach of each arm (m)"
|
|
260
|
+
},
|
|
261
|
+
"arms": {
|
|
262
|
+
"type": "int",
|
|
263
|
+
"default": 1,
|
|
264
|
+
"min": 0,
|
|
265
|
+
"max": 4,
|
|
266
|
+
"desc": "number of arms (0 = lantern on top)"
|
|
267
|
+
},
|
|
268
|
+
"pole_radius": {
|
|
269
|
+
"type": "float",
|
|
270
|
+
"default": 0.07,
|
|
271
|
+
"min": 0.03,
|
|
272
|
+
"max": 0.3,
|
|
273
|
+
"desc": "pole radius at the base (m)"
|
|
274
|
+
},
|
|
275
|
+
"lamp_size": {
|
|
276
|
+
"type": "float",
|
|
277
|
+
"default": 0.4,
|
|
278
|
+
"min": 0.15,
|
|
279
|
+
"max": 1.2,
|
|
280
|
+
"desc": "shade diameter (m)"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
"inputs": []
|
|
284
|
+
},
|
|
285
|
+
"lineup": {
|
|
286
|
+
"graph": "lineup",
|
|
287
|
+
"node": "lineup",
|
|
288
|
+
"label": "Street line-up",
|
|
289
|
+
"kind": "mesh",
|
|
290
|
+
"tags": [
|
|
291
|
+
"lineup",
|
|
292
|
+
"street"
|
|
293
|
+
],
|
|
294
|
+
"description": "TopoTopo's street package, its 7 outputs side by side at their defaults. The package's default output and its preview, from bench to sign_post along +X, 1 m apart.",
|
|
295
|
+
"sliders": {},
|
|
296
|
+
"inputs": []
|
|
297
|
+
},
|
|
298
|
+
"road_strip": {
|
|
299
|
+
"graph": "road_strip",
|
|
300
|
+
"node": "out",
|
|
301
|
+
"label": "Road",
|
|
302
|
+
"kind": "mesh",
|
|
303
|
+
"tags": [
|
|
304
|
+
"road",
|
|
305
|
+
"street",
|
|
306
|
+
"asphalt",
|
|
307
|
+
"sidewalk",
|
|
308
|
+
"along-curve"
|
|
309
|
+
],
|
|
310
|
+
"description": "Road along a curve (input 0; without one, a gentle 24 m S-curve along X): an asphalt ribbon of `width` centred on the curve with solid white edge lines, dashed lane lines between `lanes` lanes, and kerbs with sidewalks on both sides. Follows the curve's height (drape the curve on a terrain first). Pivot = the curve. Pieces: road_surface (asphalt), road_markings (road_paint), road_kerbs (concrete), road_sidewalks (paving).",
|
|
311
|
+
"sliders": {
|
|
312
|
+
"width": {
|
|
313
|
+
"type": "float",
|
|
314
|
+
"default": 7,
|
|
315
|
+
"min": 2,
|
|
316
|
+
"max": 30,
|
|
317
|
+
"desc": "asphalt width (m)"
|
|
318
|
+
},
|
|
319
|
+
"lanes": {
|
|
320
|
+
"type": "int",
|
|
321
|
+
"default": 2,
|
|
322
|
+
"min": 1,
|
|
323
|
+
"max": 8,
|
|
324
|
+
"desc": "number of lanes (dashed lines between them)"
|
|
325
|
+
},
|
|
326
|
+
"edge_lines": {
|
|
327
|
+
"type": "bool",
|
|
328
|
+
"default": true,
|
|
329
|
+
"desc": "solid lines 0.2 m inside both edges"
|
|
330
|
+
},
|
|
331
|
+
"dash_length": {
|
|
332
|
+
"type": "float",
|
|
333
|
+
"default": 3,
|
|
334
|
+
"min": 0.5,
|
|
335
|
+
"max": 10,
|
|
336
|
+
"desc": "length of the lane dashes (gaps are as long) (m)"
|
|
337
|
+
},
|
|
338
|
+
"kerb_height": {
|
|
339
|
+
"type": "float",
|
|
340
|
+
"default": 0.15,
|
|
341
|
+
"min": 0,
|
|
342
|
+
"max": 0.4,
|
|
343
|
+
"desc": "kerb height above the asphalt (m); 0 = no kerbs or sidewalks"
|
|
344
|
+
},
|
|
345
|
+
"sidewalk_width": {
|
|
346
|
+
"type": "float",
|
|
347
|
+
"default": 2,
|
|
348
|
+
"min": 0,
|
|
349
|
+
"max": 8,
|
|
350
|
+
"desc": "sidewalk width behind each kerb (m); 0 = none"
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"inputs": [
|
|
354
|
+
{
|
|
355
|
+
"index": 0,
|
|
356
|
+
"label": "road centre line (polyline); optional"
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
},
|
|
360
|
+
"sign_post": {
|
|
361
|
+
"graph": "sign_post",
|
|
362
|
+
"node": "out",
|
|
363
|
+
"label": "Street sign",
|
|
364
|
+
"kind": "mesh",
|
|
365
|
+
"tags": [
|
|
366
|
+
"sign",
|
|
367
|
+
"street-sign",
|
|
368
|
+
"text",
|
|
369
|
+
"street-furniture"
|
|
370
|
+
],
|
|
371
|
+
"description": "Street name sign: a post with a ball cap and a green blade (two crossed blades for a corner) carrying raised white lettering on both faces, scaled to fit. The first blade faces ±Z. Pivot at the centre of the base. Pieces: sign_post (galvanized), sign_panel (sign_green), sign_text (sign_white). Every piece is closed.",
|
|
372
|
+
"sliders": {
|
|
373
|
+
"height": {
|
|
374
|
+
"type": "float",
|
|
375
|
+
"default": 2.8,
|
|
376
|
+
"min": 1,
|
|
377
|
+
"max": 6,
|
|
378
|
+
"desc": "post height (m)"
|
|
379
|
+
},
|
|
380
|
+
"panel_width": {
|
|
381
|
+
"type": "float",
|
|
382
|
+
"default": 0.9,
|
|
383
|
+
"min": 0.3,
|
|
384
|
+
"max": 3,
|
|
385
|
+
"desc": "blade width (m)"
|
|
386
|
+
},
|
|
387
|
+
"panel_height": {
|
|
388
|
+
"type": "float",
|
|
389
|
+
"default": 0.22,
|
|
390
|
+
"min": 0.08,
|
|
391
|
+
"max": 1,
|
|
392
|
+
"desc": "blade height (m)"
|
|
393
|
+
},
|
|
394
|
+
"text": {
|
|
395
|
+
"type": "string",
|
|
396
|
+
"default": "MAIN ST",
|
|
397
|
+
"desc": "lettering on the first blade"
|
|
398
|
+
},
|
|
399
|
+
"cross_text": {
|
|
400
|
+
"type": "string",
|
|
401
|
+
"default": "1ST AVE",
|
|
402
|
+
"desc": "lettering on the second blade (empty = one blade)"
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
"inputs": []
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
"default": {
|
|
409
|
+
"graph": "lineup",
|
|
410
|
+
"node": "lineup",
|
|
411
|
+
"kind": "mesh",
|
|
412
|
+
"tags": [
|
|
413
|
+
"lineup",
|
|
414
|
+
"street"
|
|
415
|
+
],
|
|
416
|
+
"description": "TopoTopo's street package, its 7 outputs side by side at their defaults. The package's default output and its preview, from bench to sign_post along +X, 1 m apart.",
|
|
417
|
+
"sliders": {},
|
|
418
|
+
"inputs": []
|
|
419
|
+
},
|
|
420
|
+
"topotopo": "0.4.0"
|
|
421
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "topotopo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "An open-source procedural geometry engine: node graphs in JSON, cooked headless and deterministic, exported to Unreal, Blender and Houdini. Built for LLM agents through MCP, and for people through the CLI.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
24
|
-
"
|
|
24
|
+
"library/*/versions/**",
|
|
25
25
|
"assets/fonts",
|
|
26
26
|
"kernels/pkg",
|
|
27
27
|
"kernels/pkg-simd",
|
|
28
|
+
"integrations/godot/addons/**",
|
|
28
29
|
"!kernels/README.md",
|
|
29
30
|
"!kernels/LICENSE",
|
|
30
31
|
"README.md",
|
|
@@ -38,8 +39,11 @@
|
|
|
38
39
|
"mcp": "node src/mcp/server.ts",
|
|
39
40
|
"preview": "node scripts/preview.ts --examples",
|
|
40
41
|
"cook": "node src/cli.ts",
|
|
41
|
-
"test": "node test/smoke.ts && node test/golden.ts && node test/property.ts && node test/fuzz.ts && node test/docs.ts && node test/portability.ts && node test/examples.ts && node scripts/gen-notice.ts --check && node test/io.ts && node test/import.ts && node test/interop.ts && node test/mcp.ts && node test/engine.ts && node test/viewer.ts && node test/viewer-logic.ts && node test/topology.ts && node test/deform.ts && node test/cloth.ts && node test/arrays.ts && node test/bugs.ts && node test/uv.ts && node test/polyedit.ts && node test/bevel.ts && node test/measure.ts && node test/render.ts && node test/packed.ts && node test/heightfield.ts && node test/remesh.ts && node test/pcg.ts && node test/scatterkernel.ts && node test/splines.ts && node test/
|
|
42
|
+
"test": "node test/smoke.ts && node test/golden.ts && node test/property.ts && node test/fuzz.ts && node test/docs.ts && node test/portability.ts && node test/examples.ts && node scripts/gen-notice.ts --check && node test/io.ts && node test/import.ts && node test/interop.ts && node test/mcp.ts && node test/engine.ts && node test/scopes.ts && node test/packages.ts && node test/cook.ts && node test/viewer.ts && node test/viewer-logic.ts && node test/topology.ts && node test/deform.ts && node test/cloth.ts && node test/arrays.ts && node test/bugs.ts && node test/uv.ts && node test/polyedit.ts && node test/bevel.ts && node test/meshops.ts && node test/measure.ts && node test/render.ts && node test/packed.ts && node test/heightfield.ts && node test/remesh.ts && node test/pcg.ts && node test/scatterkernel.ts && node test/splines.ts && node test/builtin.ts && node test/textures.ts && node test/texnodes.ts && node test/imageops.ts && node test/pool.ts && node test/kernelsloader.ts && node test/kernels.ts && node test/sdfgrid.ts && node test/remeshquad.ts && node test/erosionkernel.ts && node test/erosionsimd.ts && node test/particles.ts && node test/rbd.ts && node test/limits.ts && node test/viewer-outputs.ts && node test/viewer-packages.ts && node test/library.ts && node test/web.ts && node test/tangents.ts && node test/pbr.ts && node test/materials.ts && node test/sockets.ts && node test/uvreport.ts && node test/solidify.ts && node test/llmbench.ts",
|
|
42
43
|
"test:limits": "node test/limits.ts",
|
|
44
|
+
"test:llmbench": "node test/llmbench.ts",
|
|
45
|
+
"bench:llm": "node bench/llm/run.ts",
|
|
46
|
+
"bench:llm:report": "node bench/llm/report.ts",
|
|
43
47
|
"kernels:build": "node scripts/kernels-build.ts",
|
|
44
48
|
"test:kernels": "node test/scatterkernel.ts && node test/kernelsloader.ts && node test/kernels.ts && node test/sdfgrid.ts && node test/remeshquad.ts && node test/erosionkernel.ts && node test/erosionsimd.ts",
|
|
45
49
|
"test:remeshquad": "node test/remeshquad.ts",
|
|
@@ -48,13 +52,22 @@
|
|
|
48
52
|
"test:pool": "node test/pool.ts --golden",
|
|
49
53
|
"test:particles": "node test/particles.ts",
|
|
50
54
|
"test:splines": "node test/splines.ts",
|
|
51
|
-
"test:uv": "node test/uv.ts",
|
|
55
|
+
"test:uv": "node test/uv.ts && node test/uvreport.ts",
|
|
56
|
+
"test:tangents": "node test/tangents.ts",
|
|
57
|
+
"test:sockets": "node test/sockets.ts",
|
|
58
|
+
"test:solidify": "node test/solidify.ts",
|
|
52
59
|
"test:render": "node test/render.ts",
|
|
60
|
+
"test:pbr": "node test/pbr.ts",
|
|
53
61
|
"test:remesh": "node test/remesh.ts",
|
|
54
62
|
"test:pcg": "node test/pcg.ts",
|
|
55
63
|
"test:cloth": "node test/cloth.ts",
|
|
56
|
-
"test:
|
|
57
|
-
"test:
|
|
64
|
+
"test:builtin": "node test/builtin.ts",
|
|
65
|
+
"test:packages": "node test/packages.ts",
|
|
66
|
+
"test:cook": "node test/cook.ts",
|
|
67
|
+
"test:godot": "node scripts/test-godot.mjs",
|
|
68
|
+
"test:textures": "node test/textures.ts && node test/texnodes.ts",
|
|
69
|
+
"test:texnodes": "node test/texnodes.ts",
|
|
70
|
+
"test:imageops": "node test/imageops.ts",
|
|
58
71
|
"test:smoke": "node test/smoke.ts",
|
|
59
72
|
"test:golden": "node test/golden.ts",
|
|
60
73
|
"test:update": "node test/golden.ts --update",
|
|
@@ -63,7 +76,8 @@
|
|
|
63
76
|
"test:portability": "node test/portability.ts",
|
|
64
77
|
"test:examples": "node test/examples.ts",
|
|
65
78
|
"test:interop": "node test/interop.ts",
|
|
66
|
-
"test:
|
|
79
|
+
"test:web": "node test/library.ts && node test/web.ts",
|
|
80
|
+
"test:viewer": "node test/viewer.ts && node test/viewer-logic.ts && node test/viewer-outputs.ts && node test/viewer-packages.ts",
|
|
67
81
|
"showcase": "node test/showcase.ts",
|
|
68
82
|
"export:demo": "node scripts/export-demo.ts",
|
|
69
83
|
"demo:footage": "node scripts/demo-footage.ts",
|
|
@@ -71,7 +85,7 @@
|
|
|
71
85
|
"docs": "node scripts/gen-docs.ts",
|
|
72
86
|
"site": "node scripts/gen-site.ts",
|
|
73
87
|
"site:check": "node scripts/check-site.ts",
|
|
74
|
-
"
|
|
88
|
+
"builtin": "node scripts/gen-builtin.ts",
|
|
75
89
|
"typecheck": "tsc --noEmit",
|
|
76
90
|
"notice": "node scripts/gen-notice.ts",
|
|
77
91
|
"notice:check": "node scripts/gen-notice.ts --check"
|
|
@@ -108,6 +122,7 @@
|
|
|
108
122
|
"xatlas-wasm": "0.1.3"
|
|
109
123
|
},
|
|
110
124
|
"devDependencies": {
|
|
125
|
+
"@anthropic-ai/sdk": "^1.4.0",
|
|
111
126
|
"@types/d3-delaunay": "^6.0.4",
|
|
112
127
|
"@types/node": "^26.6.4",
|
|
113
128
|
"@types/three": "^0.186.0",
|
package/dist/graph/migrate.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { GraphSpec, NodeSpec } from './types.ts';
|
|
2
|
-
export interface Migration {
|
|
3
|
-
/** version this migration upgrades from; it produces from + 1 */
|
|
4
|
-
from: number;
|
|
5
|
-
desc: string;
|
|
6
|
-
/** returns the upgraded graph; must not modify its argument (structuredClone it first when changing things) */
|
|
7
|
-
apply(g: GraphSpec): GraphSpec;
|
|
8
|
-
}
|
|
9
|
-
/** Registered migrations, ordered by `from`. Version 0 = unversioned graphs from before versioning existed. */
|
|
10
|
-
export declare const MIGRATIONS: Migration[];
|
|
11
|
-
/** Visit every node of a graph and of the graphs nested in its params (bodies), depth first. */
|
|
12
|
-
export declare function forEachNode(g: GraphSpec, fn: (spec: NodeSpec, name: string, graph: GraphSpec) => void): void;
|
|
13
|
-
export interface MigrationResult {
|
|
14
|
-
graph: GraphSpec;
|
|
15
|
-
/** descriptions of the migrations that ran */
|
|
16
|
-
applied: string[];
|
|
17
|
-
/** e.g. a document newer than this engine */
|
|
18
|
-
notes: string[];
|
|
19
|
-
}
|
|
20
|
-
/** Upgrade a graph document to GRAPH_VERSION; reports what ran. Returns the input object when nothing changes. */
|
|
21
|
-
export declare function migrateGraphDetailed(spec: GraphSpec): MigrationResult;
|
|
22
|
-
/** Upgrade a graph document to GRAPH_VERSION and stamp the version. */
|
|
23
|
-
export declare function migrateGraph(spec: GraphSpec): GraphSpec;
|
package/dist/graph/migrate.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// Graph format versioning. Every graph document carries `version`; older documents are upgraded
|
|
2
|
-
// in place by the registered migrations, in order, then stamped with GRAPH_VERSION.
|
|
3
|
-
//
|
|
4
|
-
// Migrations run on whole documents (a workspace graph, an asset graph, a file given to the CLI):
|
|
5
|
-
// Engine.cook at depth 0, Workspace load/save, MCP build. Nested graphs (foreach/solver bodies,
|
|
6
|
-
// node params of type "graph") belong to their parent document, so a migration that changes nodes
|
|
7
|
-
// must walk into them itself (see forEachNode). Nested cooks never migrate again.
|
|
8
|
-
import { GRAPH_VERSION } from './types.js';
|
|
9
|
-
/** Registered migrations, ordered by `from`. Version 0 = unversioned graphs from before versioning existed. */
|
|
10
|
-
export const MIGRATIONS = [
|
|
11
|
-
{ from: 0, desc: 'unversioned graph: no format changes, stamped as version 1', apply: (g) => g },
|
|
12
|
-
];
|
|
13
|
-
/** Visit every node of a graph and of the graphs nested in its params (bodies), depth first. */
|
|
14
|
-
export function forEachNode(g, fn) {
|
|
15
|
-
for (const [name, spec] of Object.entries(g.nodes ?? {})) {
|
|
16
|
-
if (!spec || typeof spec !== 'object')
|
|
17
|
-
continue;
|
|
18
|
-
fn(spec, name, g);
|
|
19
|
-
for (const v of Object.values(spec.params ?? {}))
|
|
20
|
-
if (v && typeof v === 'object' && !Array.isArray(v) && v.nodes && typeof v.nodes === 'object')
|
|
21
|
-
forEachNode(v, fn);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/** Upgrade a graph document to GRAPH_VERSION; reports what ran. Returns the input object when nothing changes. */
|
|
25
|
-
export function migrateGraphDetailed(spec) {
|
|
26
|
-
const applied = [], notes = [];
|
|
27
|
-
if (!spec || typeof spec !== 'object' || Array.isArray(spec))
|
|
28
|
-
return { graph: spec, applied, notes };
|
|
29
|
-
const raw = spec.version;
|
|
30
|
-
const from = raw === undefined || raw === null ? 0 : Number(raw);
|
|
31
|
-
if (!Number.isInteger(from) || from < 0) {
|
|
32
|
-
notes.push(`graph "version" must be a non-negative integer, got ${JSON.stringify(raw)}; treated as ${GRAPH_VERSION}`);
|
|
33
|
-
return { graph: stamp(spec), applied, notes };
|
|
34
|
-
}
|
|
35
|
-
if (from > GRAPH_VERSION) {
|
|
36
|
-
notes.push(`graph version ${from} is newer than this engine (${GRAPH_VERSION}); cooking it as is`);
|
|
37
|
-
return { graph: spec, applied, notes };
|
|
38
|
-
}
|
|
39
|
-
if (from === GRAPH_VERSION)
|
|
40
|
-
return { graph: spec, applied, notes };
|
|
41
|
-
let g = spec;
|
|
42
|
-
for (let v = from; v < GRAPH_VERSION; v++) {
|
|
43
|
-
const m = MIGRATIONS.find((x) => x.from === v);
|
|
44
|
-
if (!m)
|
|
45
|
-
throw new Error(`no migration registered from graph version ${v}`);
|
|
46
|
-
g = m.apply(g);
|
|
47
|
-
applied.push(`v${v} → v${v + 1}: ${m.desc}`);
|
|
48
|
-
}
|
|
49
|
-
return { graph: stamp(g), applied, notes };
|
|
50
|
-
}
|
|
51
|
-
/** Upgrade a graph document to GRAPH_VERSION and stamp the version. */
|
|
52
|
-
export function migrateGraph(spec) {
|
|
53
|
-
return migrateGraphDetailed(spec).graph;
|
|
54
|
-
}
|
|
55
|
-
function stamp(g) {
|
|
56
|
-
const { version: _v, ...rest } = g;
|
|
57
|
-
return { version: GRAPH_VERSION, ...rest };
|
|
58
|
-
}
|