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,311 @@
|
|
|
1
|
+
import { Engine } from './graph/engine.ts';
|
|
2
|
+
import type { CookReport, Issue, NodeProgress, StopSignal } from './graph/engine.ts';
|
|
3
|
+
import type { ExportTarget, GraphSpec, NodeDef, NodeSpec } from './graph/types.ts';
|
|
4
|
+
import type { PackageResolver, Scope } from './graph/scope.ts';
|
|
5
|
+
import type { Sidecar } from './io/sidecars.ts';
|
|
6
|
+
export interface EditOp {
|
|
7
|
+
op: 'set' | 'add' | 'remove' | 'connect' | 'rename' | 'output' | 'vars' | 'bypass' | 'replace' | 'insert' | 'export';
|
|
8
|
+
node?: string;
|
|
9
|
+
/** op export: the named output (omitted: the default output) and its target (null removes it) */
|
|
10
|
+
output?: string;
|
|
11
|
+
export?: ExportTarget | null;
|
|
12
|
+
params?: Record<string, any>;
|
|
13
|
+
spec?: NodeSpec;
|
|
14
|
+
type?: string;
|
|
15
|
+
in?: any;
|
|
16
|
+
input?: number;
|
|
17
|
+
from?: string | null;
|
|
18
|
+
to?: string;
|
|
19
|
+
after?: string;
|
|
20
|
+
vars?: Record<string, any>;
|
|
21
|
+
value?: boolean;
|
|
22
|
+
note?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const NAME_RE: RegExp;
|
|
25
|
+
/** A file under <package>/inputs. */
|
|
26
|
+
export interface InputFile {
|
|
27
|
+
/** posix path relative to inputs/ (a file node reads it as "inputs/" + path) */
|
|
28
|
+
path: string;
|
|
29
|
+
/** metadata: an export's sidecar (io/sidecars.ts), which describes the file beside it and is not read as geometry */
|
|
30
|
+
kind: 'geometry' | 'image' | 'metadata' | 'other';
|
|
31
|
+
/** lower-case extension without the dot ("points.json" counts as one) */
|
|
32
|
+
ext: string;
|
|
33
|
+
size: number;
|
|
34
|
+
/** modification time, ms since the epoch */
|
|
35
|
+
mtime: number;
|
|
36
|
+
/** metadata: what it is, and the path (relative to inputs/) of the file or folder it describes, null when that is not there */
|
|
37
|
+
sidecar?: Sidecar;
|
|
38
|
+
}
|
|
39
|
+
/** Lower-case extension of a file name without the dot; ".points.json" is one extension, dot-files have none. */
|
|
40
|
+
export declare function inputExt(file: string): string;
|
|
41
|
+
export declare function inputKind(ext: string): InputFile['kind'];
|
|
42
|
+
export interface SessionOptions {
|
|
43
|
+
/**
|
|
44
|
+
* The inputs folder when it is not <dir>/inputs. `topotopo view` keeps its session in a scratch folder but puts
|
|
45
|
+
* inputs/ beside the graph file, where the graph's file nodes read "inputs/<name>" and the files outlive the viewer.
|
|
46
|
+
* load() does not create a folder given here: the first file written into it does (the viewer's upload route), so a
|
|
47
|
+
* graph that never gets a drop leaves no empty inputs/ beside it.
|
|
48
|
+
*/
|
|
49
|
+
inputs?: string;
|
|
50
|
+
/** Persistent exports directory; view mode places it beside the source graph. */
|
|
51
|
+
exports?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Who a session cook is for (Session.cook): "edit" a person's change in the viewer, "preview" what the viewer shows
|
|
55
|
+
* (a node, an output card), "export" an export, "cook" anything else (a reload, an agent's tool). A stop or a newer
|
|
56
|
+
* value stops cooks by kind (Session.stop).
|
|
57
|
+
*/
|
|
58
|
+
export type CookKind = 'cook' | 'edit' | 'preview' | 'export';
|
|
59
|
+
/** The cooks of one graph in progress (Session.activity). */
|
|
60
|
+
export interface CookActivity {
|
|
61
|
+
/** cooks in progress, and their kinds */
|
|
62
|
+
cooks: number;
|
|
63
|
+
kinds: CookKind[];
|
|
64
|
+
/** ms the graph has been cooking: since the oldest of them started, or the cook a newer value's cook followed */
|
|
65
|
+
elapsed: number;
|
|
66
|
+
/** the graph's node that has been cooking longest (null between nodes), ms since it started */
|
|
67
|
+
node: string | null;
|
|
68
|
+
nodeElapsed: number;
|
|
69
|
+
/** the node a nested cook inside it is on (an asset's, a foreach body's, a solver step's) */
|
|
70
|
+
inner: string | null;
|
|
71
|
+
/** a person stopped every one of them and they have not ended yet: a node runs to its end, the cook stops after it */
|
|
72
|
+
stopping: boolean;
|
|
73
|
+
/** one of them is stopping for a newer value, which cooks once it has ended */
|
|
74
|
+
superseded: boolean;
|
|
75
|
+
}
|
|
76
|
+
/** How the last cook of a whole graph (no target) ended (Session.lastCook). */
|
|
77
|
+
export interface CookOutcome {
|
|
78
|
+
ok: boolean;
|
|
79
|
+
ms: number;
|
|
80
|
+
/** it was stopped at this node */
|
|
81
|
+
stopped?: string;
|
|
82
|
+
/** its first error: the failing node and the message */
|
|
83
|
+
error?: Issue;
|
|
84
|
+
/** when it ended (ms since the epoch) */
|
|
85
|
+
at: number;
|
|
86
|
+
}
|
|
87
|
+
/** A var's value in a graph: its "vars" entry, else the default its "params" entry declares. */
|
|
88
|
+
export declare function graphVarValue(g: GraphSpec, k: string): unknown;
|
|
89
|
+
/**
|
|
90
|
+
* What a session value of var `k` depends on in a graph: the declared type, range and options, and the kind of the
|
|
91
|
+
* graph's value (a number, a string, a 3-vector …). null when the graph has no such var (neither in vars nor params).
|
|
92
|
+
*/
|
|
93
|
+
export declare function varDeclaration(g: GraphSpec, k: string): string | null;
|
|
94
|
+
/** Thrown by Session.edit when the edited graph does not validate; the stored graph is unchanged. */
|
|
95
|
+
export declare class EditRejected extends Error {
|
|
96
|
+
errors: Issue[];
|
|
97
|
+
constructor(errors: Issue[], notes?: string[]);
|
|
98
|
+
}
|
|
99
|
+
/** The folders a package makes in its own folder (Session.load): graphs, assets, exports and inputs. */
|
|
100
|
+
export declare const PACKAGE_FOLDERS: string[];
|
|
101
|
+
/** The extension of a package's manifest: a package is a folder holding one <id>.topo file (src/package.ts). */
|
|
102
|
+
export declare const MANIFEST_EXT = ".topo";
|
|
103
|
+
/** The .topo files directly in a folder, by name, sorted: one makes it a package. */
|
|
104
|
+
export declare function topoFiles(dir: string): string[];
|
|
105
|
+
/**
|
|
106
|
+
* The graph files of a folder by graph name: graphs/<name>.json, and in a package (a folder holding a .topo file) the
|
|
107
|
+
* graph files beside that file, not below it, whose name graphs/ does not have. A file there is a graph when it
|
|
108
|
+
* holds an object with "nodes"; an unreadable one is left out. The web app, `topotopo edit` and the MCP server read a
|
|
109
|
+
* package's graphs here.
|
|
110
|
+
*/
|
|
111
|
+
export declare function graphFiles(dir: string): Map<string, string>;
|
|
112
|
+
/**
|
|
113
|
+
* The packages used by the package that holds a session's folder (src/packages/registry.ts), attached by whoever opens
|
|
114
|
+
* it: a graph set or edited through the session that names a package it does not use yet adds it (first use).
|
|
115
|
+
*/
|
|
116
|
+
export interface SessionPackages {
|
|
117
|
+
/**
|
|
118
|
+
* add the packages a graph names that the package does not use yet, once the graph validates (nothing is written for
|
|
119
|
+
* one that does not); says what was added
|
|
120
|
+
*/
|
|
121
|
+
addFor(graph: GraphSpec): string[];
|
|
122
|
+
/**
|
|
123
|
+
* what a graph is checked with where nothing may be written (a dry run, a trial of a person's values): the package's
|
|
124
|
+
* packages, and those the graph names for the first time at the version build or edit would add, read where a library
|
|
125
|
+
* holds them, nothing copied; the notes say what build or edit add; `id` is the id of a scope that resolves with it
|
|
126
|
+
*/
|
|
127
|
+
dryRun(graph: GraphSpec): {
|
|
128
|
+
resolver: PackageResolver;
|
|
129
|
+
notes: string[];
|
|
130
|
+
id: string;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* the node type of an output of a package it does not use yet, read where a library it looks in holds the
|
|
134
|
+
* newest version (nothing copied): what help says about an output search found; null when none has it
|
|
135
|
+
*/
|
|
136
|
+
describe(name: string): NodeDef | null;
|
|
137
|
+
/** why the package's graphs cannot use packages, and how that changes (null when they can) */
|
|
138
|
+
notice(): string | null;
|
|
139
|
+
/** read again what changed on disk (the manifest, the lock, working folders followed this session); true if anything did */
|
|
140
|
+
refresh(): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* a stamp of what package names resolve to (the uses, the copies, the followed working folders): a result that may use
|
|
143
|
+
* a package is kept only while it stays the same (the viewer's previews, a person's stop)
|
|
144
|
+
*/
|
|
145
|
+
revision(): string;
|
|
146
|
+
/**
|
|
147
|
+
* while this session follows working folders (for looking): the scope exports cook in, resolving packages to their
|
|
148
|
+
* published copies; null while nothing is followed
|
|
149
|
+
*/
|
|
150
|
+
published?(): Scope | null;
|
|
151
|
+
/** what an export of the graph made while following says: the published versions it used (null: nothing to say) */
|
|
152
|
+
publishedNote?(graph: GraphSpec): string | null;
|
|
153
|
+
}
|
|
154
|
+
export declare class Session {
|
|
155
|
+
dir: string;
|
|
156
|
+
engine: Engine;
|
|
157
|
+
graphs: Map<string, GraphSpec>;
|
|
158
|
+
versions: Map<string, number>;
|
|
159
|
+
lastReport: Map<string, CookReport>;
|
|
160
|
+
/** how the last cook of each whole graph ended, stopped ones included (lastReport keeps the last one that ran through) */
|
|
161
|
+
lastCook: Map<string, CookOutcome>;
|
|
162
|
+
listeners: Set<(ev: {
|
|
163
|
+
graph: string;
|
|
164
|
+
version: number;
|
|
165
|
+
}) => void>;
|
|
166
|
+
/** told when the cooks of a graph start, move to another node (with that node's event), are asked to stop and end (see activity) */
|
|
167
|
+
activityListeners: Set<(graph: string, ev?: NodeProgress) => void>;
|
|
168
|
+
/** the packages used by the package that holds the session's folder, when whoever opened it attached them (src/packages/registry.ts) */
|
|
169
|
+
packages: SessionPackages | null;
|
|
170
|
+
/**
|
|
171
|
+
* Session values: var values a person set in the live viewer over a graph file (`topotopo view`). They shadow the
|
|
172
|
+
* graph's vars in this session's cooks without changing the graph, and stay when the graph is replaced (a reload
|
|
173
|
+
* of the file) unless the var's declaration changed (varDeclaration), the var is gone, or the graph now holds the
|
|
174
|
+
* same value itself. graph → var → value and the declaration it was set under.
|
|
175
|
+
*/
|
|
176
|
+
private sessions;
|
|
177
|
+
private running;
|
|
178
|
+
/** per graph: since when it has been cooking, through cooks that follow one another (a newer value's), and when it last fell idle */
|
|
179
|
+
private busy;
|
|
180
|
+
private holds;
|
|
181
|
+
/** per graph: the last whole-graph cook started, and the newest one whose outcome was recorded */
|
|
182
|
+
private cookSeq;
|
|
183
|
+
private recordedSeq;
|
|
184
|
+
private lastYield;
|
|
185
|
+
/** graphs kept in a package's own folder (graphFiles): their file, where they are saved; the others go in graphs/ */
|
|
186
|
+
private besidePackage;
|
|
187
|
+
/** the inputs folder given to the constructor (SessionOptions.inputs), if any */
|
|
188
|
+
private inputsAt;
|
|
189
|
+
private exportsAt;
|
|
190
|
+
constructor(dir: string, engine: Engine, opts?: SessionOptions);
|
|
191
|
+
get graphDir(): string;
|
|
192
|
+
get assetDir(): string;
|
|
193
|
+
get exportDir(): string;
|
|
194
|
+
/**
|
|
195
|
+
* files people drop in: meshes, guide curves and points, PNG masks and heightmaps (read as "inputs/<path>");
|
|
196
|
+
* <dir>/inputs unless the constructor was given another folder
|
|
197
|
+
*/
|
|
198
|
+
get inputDir(): string;
|
|
199
|
+
load(): {
|
|
200
|
+
graphs: number;
|
|
201
|
+
assets: number;
|
|
202
|
+
assetErrors: string[];
|
|
203
|
+
graphErrors: string[];
|
|
204
|
+
};
|
|
205
|
+
/** Where a graph is saved: its file beside the package's manifest, or graphs/<name>.json. */
|
|
206
|
+
graphFile(name: string): string;
|
|
207
|
+
private persist;
|
|
208
|
+
bump(name: string): void;
|
|
209
|
+
getGraph(name: string): GraphSpec;
|
|
210
|
+
setGraph(name: string, spec: GraphSpec): void;
|
|
211
|
+
deleteGraph(name: string): void;
|
|
212
|
+
/** The session values of a graph (the vars that differ from the graph's own), {} when there are none. */
|
|
213
|
+
sessionVars(name: string): Record<string, any>;
|
|
214
|
+
/**
|
|
215
|
+
* Set session values of a graph (null: back to the graph's value). They are not checked here: validate the graph
|
|
216
|
+
* with them first (Engine.validate on effectiveGraph). A value the graph holds itself is no session value.
|
|
217
|
+
*/
|
|
218
|
+
setSessionVars(name: string, vars: Record<string, any>): void;
|
|
219
|
+
/** The graph as its cooks see it: its vars with the session values over them. */
|
|
220
|
+
effectiveGraph(name: string): GraphSpec;
|
|
221
|
+
/** Keep the session values that still apply to the graph as it is now (see sessions). */
|
|
222
|
+
private settleSession;
|
|
223
|
+
/** What is cooking for a graph now, or null. */
|
|
224
|
+
activity(name: string): CookActivity | null;
|
|
225
|
+
/**
|
|
226
|
+
* Stop the cooks of a graph in progress (all, or those of the given kinds) at their next node boundary; returns how
|
|
227
|
+
* many were asked to. `superseded`: they stop for a newer value, and how they end is not the graph's last outcome.
|
|
228
|
+
*/
|
|
229
|
+
stop(name: string, kinds?: CookKind[], opts?: {
|
|
230
|
+
superseded?: boolean;
|
|
231
|
+
}): number;
|
|
232
|
+
/**
|
|
233
|
+
* Hold a graph as it is now (a person stopped its cooks): held() is true until the graph, its session values or the
|
|
234
|
+
* packages it can use change, and what cooks on its own (the viewer's previews) waits for that change instead of
|
|
235
|
+
* cooking it again.
|
|
236
|
+
*/
|
|
237
|
+
hold(name: string): void;
|
|
238
|
+
held(name: string): boolean;
|
|
239
|
+
private holdKey;
|
|
240
|
+
private notifyActivity;
|
|
241
|
+
/**
|
|
242
|
+
* The progress hook of one cook: tracks its nodes, and lets the event loop turn (requests, a stop, the progress the
|
|
243
|
+
* listeners send) before each of the graph's nodes cooks, which may hold the thread for long, and at least every
|
|
244
|
+
* 15 ms between the nodes of nested cooks and the steps of long nodes.
|
|
245
|
+
*/
|
|
246
|
+
private onNode;
|
|
247
|
+
/**
|
|
248
|
+
* Every file under inputs/, recursively: posix paths relative to it, sorted. Dot-files and dot-folders are skipped, as
|
|
249
|
+
* are the files an engine writes beside ours (*.import, *.uid, *.translation, *.uasset).
|
|
250
|
+
* An export's sidecar (a heightmap's .json, <file>.source.json …) is kind "metadata", with the file it describes.
|
|
251
|
+
*/
|
|
252
|
+
listInputs(): InputFile[];
|
|
253
|
+
/** Merge nodes/vars/output of `patch` into an existing graph (upsert). */
|
|
254
|
+
mergeGraph(name: string, patch: GraphSpec): GraphSpec;
|
|
255
|
+
/** Apply edit operations; returns the new graph (not yet stored) and notes. */
|
|
256
|
+
applyEdits(name: string, ops: EditOp[]): {
|
|
257
|
+
graph: GraphSpec;
|
|
258
|
+
notes: string[];
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* The one path for an edit, whoever makes it (the MCP edit tool, the viewer's controls): apply the ops, validate as a
|
|
262
|
+
* dry run sees the graph (an invalid result throws EditRejected listing the per-node errors, and stores, adds and
|
|
263
|
+
* writes nothing), add the packages the graph now names to the package (first use), store, cook at `frame`, then
|
|
264
|
+
* notify the listeners. They hear after the cook so that what they read (lastReport, cached geometry) is the new
|
|
265
|
+
* version's; a cook that throws still notifies, since the graph was stored. A cook that was stopped (`signal`,
|
|
266
|
+
* Session.stop) does not: whoever stopped it cooks again or tells the listeners.
|
|
267
|
+
*/
|
|
268
|
+
edit(name: string, ops: EditOp[], opts?: {
|
|
269
|
+
frame?: number;
|
|
270
|
+
kind?: CookKind;
|
|
271
|
+
signal?: StopSignal;
|
|
272
|
+
}): Promise<{
|
|
273
|
+
graph: GraphSpec;
|
|
274
|
+
notes: string[];
|
|
275
|
+
report: CookReport;
|
|
276
|
+
}>;
|
|
277
|
+
/**
|
|
278
|
+
* The scope a graph is checked in where nothing may be written (a dry run, a trial of a person's values): the
|
|
279
|
+
* engine's root, whose packages include those the graph names for the first time at the version build or edit would
|
|
280
|
+
* add (SessionPackages.dryRun), with notes that say so, under an id of its own. Nothing is copied or written.
|
|
281
|
+
*/
|
|
282
|
+
dryScope(graph: GraphSpec): {
|
|
283
|
+
scope: Scope;
|
|
284
|
+
notes: string[];
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Cook a graph (its output, or `target`) with its session values, as a cook of `kind`. Session.stop and `signal`
|
|
288
|
+
* stop it at a node boundary; activity() reports it while it runs. A cook of the whole graph records its outcome
|
|
289
|
+
* (lastCook) and, unless it was stopped, its report (lastReport), when no cook started after it has done so first.
|
|
290
|
+
* An export cooks with the published copies of the packages the session shows live, and records nothing.
|
|
291
|
+
*/
|
|
292
|
+
cook(name: string, target?: string, frame?: number, opts?: {
|
|
293
|
+
kind?: CookKind;
|
|
294
|
+
signal?: StopSignal;
|
|
295
|
+
}): Promise<CookReport>;
|
|
296
|
+
private watchers;
|
|
297
|
+
private watchTimers;
|
|
298
|
+
/**
|
|
299
|
+
* Follow what other processes write into graphs/ and assets/, and in a package the graph files beside its manifest (a
|
|
300
|
+
* second Session on the same folder: the web app's editor next to an MCP server, or a person editing the JSON). A
|
|
301
|
+
* graph file whose content differs from the stored graph replaces it and notifies the listeners; a removed file
|
|
302
|
+
* removes the graph. Our own writes read back equal, so they change nothing. An asset whose content changed is
|
|
303
|
+
* registered again and every graph is notified (any may use it); a removed asset stays registered until the next
|
|
304
|
+
* load(). Two writers to one graph: the last write wins.
|
|
305
|
+
*/
|
|
306
|
+
watch(): void;
|
|
307
|
+
/** Stop following the folders (watch()). */
|
|
308
|
+
unwatch(): void;
|
|
309
|
+
}
|
|
310
|
+
/** Register a folder's assets/*.json into a scope; an asset that uses one registered later is tried again. */
|
|
311
|
+
export declare function registerAssets(engine: Engine, scope: Scope, dir: string, problems: string[]): void;
|