@metamesh/cli 0.0.0-bootstrap.0 → 0.13.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.
Files changed (98) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +71 -5
  3. package/dist/authoring/artifacts.d.ts +11 -0
  4. package/dist/authoring/artifacts.d.ts.map +1 -0
  5. package/dist/authoring/artifacts.js +343 -0
  6. package/dist/authoring/artifacts.js.map +1 -0
  7. package/dist/authoring/capture/render-client.js +4222 -0
  8. package/dist/authoring/capture/render-client.js.LEGAL.txt +9 -0
  9. package/dist/authoring/capture/render-client.js.map +7 -0
  10. package/dist/authoring/check.d.ts +3 -0
  11. package/dist/authoring/check.d.ts.map +1 -0
  12. package/dist/authoring/check.js +117 -0
  13. package/dist/authoring/check.js.map +1 -0
  14. package/dist/authoring/environment.d.ts +19 -0
  15. package/dist/authoring/environment.d.ts.map +1 -0
  16. package/dist/authoring/environment.js +173 -0
  17. package/dist/authoring/environment.js.map +1 -0
  18. package/dist/authoring/errors.d.ts +11 -0
  19. package/dist/authoring/errors.d.ts.map +1 -0
  20. package/dist/authoring/errors.js +41 -0
  21. package/dist/authoring/errors.js.map +1 -0
  22. package/dist/authoring/render-client.d.ts +6 -0
  23. package/dist/authoring/render-client.d.ts.map +1 -0
  24. package/dist/authoring/render-client.js +55 -0
  25. package/dist/authoring/render-client.js.map +1 -0
  26. package/dist/authoring/render-scene.d.ts +22 -0
  27. package/dist/authoring/render-scene.d.ts.map +1 -0
  28. package/dist/authoring/render-scene.js +139 -0
  29. package/dist/authoring/render-scene.js.map +1 -0
  30. package/dist/authoring/render-types.d.ts +81 -0
  31. package/dist/authoring/render-types.d.ts.map +1 -0
  32. package/dist/authoring/render-types.js +2 -0
  33. package/dist/authoring/render-types.js.map +1 -0
  34. package/dist/authoring/render.d.ts +23 -0
  35. package/dist/authoring/render.d.ts.map +1 -0
  36. package/dist/authoring/render.js +243 -0
  37. package/dist/authoring/render.js.map +1 -0
  38. package/dist/authoring/run.d.ts +3 -0
  39. package/dist/authoring/run.d.ts.map +1 -0
  40. package/dist/authoring/run.js +304 -0
  41. package/dist/authoring/run.js.map +1 -0
  42. package/dist/authoring/types.d.ts +138 -0
  43. package/dist/authoring/types.d.ts.map +1 -0
  44. package/dist/authoring/types.js +2 -0
  45. package/dist/authoring/types.js.map +1 -0
  46. package/dist/authoring/worker.d.ts +15 -0
  47. package/dist/authoring/worker.d.ts.map +1 -0
  48. package/dist/authoring/worker.js +163 -0
  49. package/dist/authoring/worker.js.map +1 -0
  50. package/dist/authoring.d.ts +12 -0
  51. package/dist/authoring.d.ts.map +1 -0
  52. package/dist/authoring.js +9 -0
  53. package/dist/authoring.js.map +1 -0
  54. package/dist/docs/guides/agent-authoring.md +183 -0
  55. package/dist/docs/guides/package.md +72 -0
  56. package/dist/docs/manifest.json +554 -0
  57. package/dist/docs/reference/authoring/AUTHORING_PROTOCOL_VERSION.md +9 -0
  58. package/dist/docs/reference/authoring/AuthoringDiagnostic.md +19 -0
  59. package/dist/docs/reference/authoring/AuthoringEnvironment.md +14 -0
  60. package/dist/docs/reference/authoring/AuthoringError.md +15 -0
  61. package/dist/docs/reference/authoring/AuthoringFailure-type.md +15 -0
  62. package/dist/docs/reference/authoring/AuthoringKind.md +9 -0
  63. package/dist/docs/reference/authoring/AuthoringPhase.md +9 -0
  64. package/dist/docs/reference/authoring/CapturedBuffer.md +13 -0
  65. package/dist/docs/reference/authoring/CapturedGeometry.md +13 -0
  66. package/dist/docs/reference/authoring/CapturedPart.md +16 -0
  67. package/dist/docs/reference/authoring/CapturedResource.md +14 -0
  68. package/dist/docs/reference/authoring/CapturedRun.md +13 -0
  69. package/dist/docs/reference/authoring/CapturedRunManifest.md +38 -0
  70. package/dist/docs/reference/authoring/CheckOptions.md +14 -0
  71. package/dist/docs/reference/authoring/CheckSuccess.md +15 -0
  72. package/dist/docs/reference/authoring/DocumentationEntry.md +18 -0
  73. package/dist/docs/reference/authoring/DocumentationManifest.md +14 -0
  74. package/dist/docs/reference/authoring/DocumentationSearchResult.md +12 -0
  75. package/dist/docs/reference/authoring/InstalledAuthoringPackage.md +14 -0
  76. package/dist/docs/reference/authoring/RenderCamera.md +22 -0
  77. package/dist/docs/reference/authoring/RenderFormat.md +10 -0
  78. package/dist/docs/reference/authoring/RenderOptions.md +20 -0
  79. package/dist/docs/reference/authoring/RenderResult.md +15 -0
  80. package/dist/docs/reference/authoring/RenderView.md +10 -0
  81. package/dist/docs/reference/authoring/RenderedImage.md +23 -0
  82. package/dist/docs/reference/authoring/RunOptions.md +17 -0
  83. package/dist/docs/reference/authoring/RunSuccess.md +13 -0
  84. package/dist/docs/reference/authoring/authoringFailure-value.md +9 -0
  85. package/dist/docs/reference/authoring/checkAuthoringSource.md +9 -0
  86. package/dist/docs/reference/authoring/discoverAuthoringEnvironment.md +9 -0
  87. package/dist/docs/reference/authoring/inspectCapturedRun.md +11 -0
  88. package/dist/docs/reference/authoring/installAuthoringBrowser.md +13 -0
  89. package/dist/docs/reference/authoring/readCapturedRun.md +10 -0
  90. package/dist/docs/reference/authoring/renderCapturedRun.md +13 -0
  91. package/dist/docs/reference/authoring/runAuthoringSource.md +9 -0
  92. package/dist/docs/reference/authoring/searchAuthoringDocumentation.md +12 -0
  93. package/dist/docs/reference/authoring/showAuthoringDocumentation.md +11 -0
  94. package/dist/metamesh.d.ts +3 -0
  95. package/dist/metamesh.d.ts.map +1 -0
  96. package/dist/metamesh.js +183 -0
  97. package/dist/metamesh.js.map +1 -0
  98. package/package.json +51 -6
package/CHANGELOG.md ADDED
@@ -0,0 +1,27 @@
1
+ # @metamesh/cli
2
+
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2ebe03f: Ship exact-version offline documentation and a development-only authoring CLI for semantic
8
+ checking, generation, captured geometry inspection, and explicit Chromium previews. Use exact
9
+ package versions in documentation metadata and reject unsupported authoring artifact formats.
10
+ Provide generated command help and strict per-command argument validation, and enforce semantic
11
+ checking even when the consumer's TypeScript configuration disables it.
12
+
13
+ Publish lightweight model and Generator testing helpers as `@metamesh/testkit`. Move the
14
+ `metamesh` executable and Node authoring API into `@metamesh/cli`, which owns compiler, bundler,
15
+ renderer, and browser dependencies. Remove the former package name and authoring entry from
16
+ Testkit without compatibility aliases.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [2ebe03f]
21
+ - Updated dependencies [7e1b75d]
22
+ - Updated dependencies [3139981]
23
+ - @metamesh/modeling@0.13.0
24
+ - @metamesh/generator-sdk@0.13.0
25
+ - @metamesh/testkit@0.13.0
26
+
27
+ Local authoring tools extracted from the former Generator testing package.
package/README.md CHANGED
@@ -1,6 +1,72 @@
1
- # @metamesh/cli
1
+ # `@metamesh/cli`
2
2
 
3
- This inert prerelease enrolls the npm package name for trusted publishing.
4
- It contains no executable code, dependencies, or public exports.
5
- Publish enrollment only with the explicit bootstrap dist-tag; the intended
6
- MetaMesh release is prepared and reviewed separately.
3
+ Check, execute, inspect, and render trusted local MetaMesh source. The `metamesh` executable and
4
+ Node-only `/authoring` functions use the production engine and version-matched installed documentation.
5
+
6
+ > **Preview:** `0.x` minor releases may break compatibility. Patches remain compatible within the
7
+ > same minor line.
8
+
9
+ ## Installation
10
+
11
+ Install matching releases in the project where you author models:
12
+
13
+ ```bash
14
+ pnpm add @metamesh/modeling
15
+ pnpm add -D @metamesh/cli
16
+ ```
17
+
18
+ Add `@metamesh/generator-sdk` when your source defines Generators. Add `@metamesh/testkit` as a
19
+ development dependency when importing testing helpers. CLI internally reuses Testkit font fixtures
20
+ and its SDK contracts; neither package needs to be directly declared for standalone model authoring.
21
+ The compiler, bundler, Three renderer, and Playwright belong to CLI; Testkit does not install them.
22
+ Chromium is installed separately and never downloaded by checking or generation.
23
+
24
+ ## Local workflow
25
+
26
+ ```bash
27
+ pnpm exec metamesh environment
28
+ pnpm exec metamesh docs search "extrude"
29
+ pnpm exec metamesh docs show TOPIC_ID
30
+ pnpm exec metamesh check model.ts --kind model
31
+ pnpm exec metamesh run model.ts --kind model
32
+ pnpm exec metamesh inspect RUN_DIRECTORY
33
+ pnpm exec metamesh browser install
34
+ pnpm exec metamesh render RUN_DIRECTORY --views isometric,front,top,right
35
+ ```
36
+
37
+ `run` includes semantic TypeScript checking and executes in a disposable child process with a
38
+ 30-second default deadline. It saves each attempt beneath `.metamesh/runs` with source identity,
39
+ parameters, diagnostics, measurements, and hashed geometry buffers. `inspect` and `render` validate
40
+ those captured buffers without importing the original source. Use `--json` for one structured stdout
41
+ result; bounded author logs go to stderr. Exit codes are 0 for success, 1 for source or generation
42
+ failure, and 2 for invocation, environment, artifact, or tooling failure. This executes trusted local
43
+ code and is not a security sandbox.
44
+
45
+ For Generators, use `--kind generator`. Entries named-export `definition` and default-export the
46
+ Generator module envelope. Defaults merge with `--params parameters.json`, then strict validation
47
+ rejects unknown or invalid overrides. Standalone model entries default-export a `ModelProgram` and
48
+ receive no injected services. Both support normal local imports and installed dependencies; Studio's
49
+ virtual `@metamesh/project` module is unavailable.
50
+
51
+ Use `--help` on each command for parameters, fonts, resource limits, export, and image options.
52
+ `metamesh setup` prints skill installation and project-instruction guidance without modifying files.
53
+
54
+ ## Programmatic API and documentation
55
+
56
+ ```ts
57
+ import { inspectCapturedRun, runAuthoringSource } from "@metamesh/cli/authoring";
58
+
59
+ const result = await runAuthoringSource({ entry: "model.ts", kind: "model" });
60
+ if (result.success) {
61
+ console.log(await inspectCapturedRun(result.runDirectory));
62
+ }
63
+ ```
64
+
65
+ Resolve `@metamesh/cli/docs/manifest.json` for the installed Markdown reference. The
66
+ [authoring guide](https://metamesh.studio/docs/develop/agent-authoring) explains local font fixtures,
67
+ artifacts, rendering, and agent integration. The reusable authoring functions and command
68
+ implementation stay in this package; geometry and Generator contracts retain their existing owners.
69
+
70
+ ## License
71
+
72
+ [Apache-2.0](https://github.com/JasonKoolman/metamesh/blob/main/packages/cli/LICENSE).
@@ -0,0 +1,11 @@
1
+ import type { ModelSnapshot } from "@metamesh/modeling/engine";
2
+ import type { CapturedPart, CapturedRun, CapturedRunManifest } from "./types.js";
3
+ export declare function sha256(value: Uint8Array | string): string;
4
+ export declare function writeAtomicJson(file: string, value: unknown): Promise<void>;
5
+ export declare function captureSnapshot(directory: string, snapshot: ModelSnapshot, metadata: Omit<CapturedRunManifest, "resources" | "parts" | "bounds" | "stats" | "diagnostics" | "dependencies" | "export3mf">, export3mf?: ArrayBuffer): Promise<CapturedRunManifest>;
6
+ /** Reads only immutable captured files. It never imports or executes original author source. */
7
+ export declare function readCapturedRun(directory: string): Promise<CapturedRun>;
8
+ export declare function inspectCapturedRun(directory: string, partId?: string): Promise<Omit<CapturedRun, "resources"> & {
9
+ readonly selectedPart?: CapturedPart;
10
+ }>;
11
+ //# sourceMappingURL=artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/authoring/artifacts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAY/D,OAAO,KAAK,EAGV,YAAY,EAEZ,WAAW,EACX,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAIjF;AAED,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,IAAI,CACZ,mBAAmB,EACnB,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,GAAG,cAAc,GAAG,WAAW,CAC1F,EACD,SAAS,CAAC,EAAE,WAAW,GACtB,OAAO,CAAC,mBAAmB,CAAC,CAqD9B;AAsPD,gGAAgG;AAChG,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA0E7E;AAED,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,GAAG;IAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC,CAWpF"}
@@ -0,0 +1,343 @@
1
+ import { createHash } from "node:crypto";
2
+ import { mkdir, readFile, rename, stat, writeFile } from "node:fs/promises";
3
+ import { join, resolve } from "node:path";
4
+ import { defaultModelingLimits } from "@metamesh/modeling/engine";
5
+ import { analyzeTriangleMesh, composeTransform3, eulerTransform3, transformTriangleMesh, translationTransform3, } from "@metamesh/modeling/geometry";
6
+ import { authoringPackageNames, confinedFile } from "./environment.js";
7
+ import { AuthoringError, isRecord } from "./errors.js";
8
+ export function sha256(value) {
9
+ return createHash("sha256").update(value).digest("hex");
10
+ }
11
+ export async function writeAtomicJson(file, value) {
12
+ const temporary = `${file}.pending`;
13
+ await writeFile(temporary, `${JSON.stringify(value, null, 2)}\n`, { flag: "wx" });
14
+ await rename(temporary, file);
15
+ }
16
+ export async function captureSnapshot(directory, snapshot, metadata, export3mf) {
17
+ await mkdir(join(directory, "geometry"), { recursive: true });
18
+ const resources = [];
19
+ const parts = [];
20
+ const seen = new Map();
21
+ const store = async (path, bytes) => {
22
+ await writeFile(join(directory, path), bytes, { flag: "wx" });
23
+ return { path, bytes: bytes.byteLength, sha256: sha256(bytes) };
24
+ };
25
+ for (const part of snapshot.parts) {
26
+ const positions = part.geometry.positions;
27
+ const indices = part.geometry.indices;
28
+ const positionBytes = new Uint8Array(positions.buffer, positions.byteOffset, positions.byteLength);
29
+ const indexBytes = new Uint8Array(indices.buffer, indices.byteOffset, indices.byteLength);
30
+ const key = `${sha256(positionBytes)}:${sha256(indexBytes)}`;
31
+ let resourceId = seen.get(key);
32
+ if (resourceId === undefined) {
33
+ resourceId = `geometry-${resources.length}`;
34
+ seen.set(key, resourceId);
35
+ resources.push({
36
+ id: resourceId,
37
+ positions: await store(`geometry/${resourceId}.positions.f32`, positionBytes),
38
+ indices: await store(`geometry/${resourceId}.indices.u32`, indexBytes),
39
+ measurements: part.geometry.measurements,
40
+ });
41
+ }
42
+ parts.push({
43
+ id: part.id,
44
+ resourceId,
45
+ position: part.position,
46
+ rotation: part.rotation,
47
+ measurements: part.measurements,
48
+ ...(part.color === undefined ? {} : { color: part.color }),
49
+ });
50
+ }
51
+ const manifest = {
52
+ ...metadata,
53
+ bounds: snapshot.bounds,
54
+ stats: snapshot.stats,
55
+ diagnostics: snapshot.diagnostics,
56
+ dependencies: snapshot.dependencies,
57
+ resources,
58
+ parts,
59
+ ...(export3mf === undefined
60
+ ? {}
61
+ : { export3mf: await store("model.3mf", new Uint8Array(export3mf)) }),
62
+ };
63
+ await writeAtomicJson(join(directory, "manifest.json"), manifest);
64
+ return manifest;
65
+ }
66
+ function invalid(message) {
67
+ throw new AuthoringError("artifact", "INVALID_ARTIFACT", message);
68
+ }
69
+ const vector = (value) => Array.isArray(value) &&
70
+ value.length === 3 &&
71
+ value.every((number) => typeof number === "number" && Number.isFinite(number));
72
+ const bounds = (value) => isRecord(value) &&
73
+ vector(value.min) &&
74
+ vector(value.max) &&
75
+ value.min.every((number, axis) => number <= value.max[axis]);
76
+ const positiveInteger = (value) => typeof value === "number" && Number.isSafeInteger(value) && value > 0;
77
+ const identifier = (value) => typeof value === "string" && value.length <= 64 && /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(value);
78
+ const strings = (value) => Array.isArray(value) &&
79
+ value.every((item) => typeof item === "string") &&
80
+ new Set(value).size === value.length;
81
+ function jsonData(value, depth = 0) {
82
+ if (depth > 100)
83
+ return false;
84
+ if (value === null || typeof value === "string" || typeof value === "boolean")
85
+ return true;
86
+ if (typeof value === "number")
87
+ return Number.isFinite(value);
88
+ if (Array.isArray(value))
89
+ return value.every((item) => jsonData(item, depth + 1));
90
+ return isRecord(value) && Object.values(value).every((item) => jsonData(item, depth + 1));
91
+ }
92
+ function bufferDescriptor(value) {
93
+ return (isRecord(value) &&
94
+ typeof value.path === "string" &&
95
+ value.path.length > 0 &&
96
+ !isAbsolutePath(value.path) &&
97
+ positiveInteger(value.bytes) &&
98
+ value.bytes <= 1024 * 1024 * 1024 &&
99
+ typeof value.sha256 === "string" &&
100
+ /^[a-f0-9]{64}$/.test(value.sha256));
101
+ }
102
+ function isAbsolutePath(path) {
103
+ return (path.startsWith("/") ||
104
+ path.includes("\\") ||
105
+ path.includes(":") ||
106
+ path.split("/").some((item) => item === ".." || item === "." || item.length === 0));
107
+ }
108
+ function measurements(value) {
109
+ return (isRecord(value) &&
110
+ bounds(value.bounds) &&
111
+ ["signedVolume", "surfaceArea"].every((key) => typeof value[key] === "number" && Number.isFinite(value[key])) &&
112
+ positiveInteger(value.triangleCount) &&
113
+ positiveInteger(value.vertexCount) &&
114
+ (value.connectedComponentCount === undefined ||
115
+ positiveInteger(value.connectedComponentCount)) &&
116
+ (value.edgeCount === undefined || positiveInteger(value.edgeCount)));
117
+ }
118
+ function sameMeasurements(actual, recorded) {
119
+ return (actual.vertexCount === recorded.vertexCount &&
120
+ actual.triangleCount === recorded.triangleCount &&
121
+ actual.signedVolume === recorded.signedVolume &&
122
+ actual.surfaceArea === recorded.surfaceArea &&
123
+ actual.connectedComponentCount === recorded.connectedComponentCount &&
124
+ actual.edgeCount === recorded.edgeCount &&
125
+ JSON.stringify(actual.bounds) === JSON.stringify(recorded.bounds));
126
+ }
127
+ function manifestFrom(value) {
128
+ const stats = isRecord(value) && isRecord(value.stats) ? value.stats : undefined;
129
+ const policy = isRecord(value) && isRecord(value.policy) ? value.policy : undefined;
130
+ const limits = policy !== undefined && isRecord(policy.limits) ? policy.limits : undefined;
131
+ const dependencies = isRecord(value) && isRecord(value.dependencies) ? value.dependencies : undefined;
132
+ if (!isRecord(value) ||
133
+ value.formatVersion !== 1 ||
134
+ value.status !== "complete" ||
135
+ !identifier(value.runId) ||
136
+ typeof value.createdAt !== "string" ||
137
+ !Number.isFinite(Date.parse(value.createdAt)) ||
138
+ (value.kind !== "model" && value.kind !== "generator") ||
139
+ !isRecord(value.source) ||
140
+ typeof value.source.entry !== "string" ||
141
+ value.source.entry.length === 0 ||
142
+ value.source.entry.includes("\\") ||
143
+ value.source.entry.includes("\0") ||
144
+ typeof value.source.fingerprint !== "string" ||
145
+ !/^[a-f0-9]{64}$/.test(value.source.fingerprint) ||
146
+ !isRecord(value.packages) ||
147
+ !Object.entries(value.packages).every(([name, version]) => authoringPackageNames.includes(name) &&
148
+ typeof version === "string" &&
149
+ /^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)$/.test(version)) ||
150
+ typeof value.packages["@metamesh/modeling"] !== "string" ||
151
+ (value.kind === "generator" && typeof value.packages["@metamesh/generator-sdk"] !== "string") ||
152
+ new Set(Object.values(value.packages)).size !== 1 ||
153
+ !isRecord(value.parameters) ||
154
+ !jsonData(value.parameters) ||
155
+ !Array.isArray(value.assets) ||
156
+ !value.assets.every((asset) => isRecord(asset) &&
157
+ Object.keys(asset).length === 3 &&
158
+ typeof asset.faceId === "string" &&
159
+ /^[a-z0-9][a-z0-9/-]{0,159}$/.test(asset.faceId) &&
160
+ typeof asset.revision === "string" &&
161
+ /^[a-f0-9]{64}$/.test(asset.revision) &&
162
+ typeof asset.weight === "number" &&
163
+ Number.isInteger(asset.weight) &&
164
+ asset.weight >= 1 &&
165
+ asset.weight <= 1000) ||
166
+ !Array.isArray(value.diagnostics) ||
167
+ !value.diagnostics.every((issue) => isRecord(issue) &&
168
+ issue.severity === "warning" &&
169
+ typeof issue.message === "string" &&
170
+ issue.message.trim().length > 0 &&
171
+ (issue.parameterId === undefined ||
172
+ (typeof issue.parameterId === "string" &&
173
+ Object.hasOwn(value.parameters, issue.parameterId)))) ||
174
+ limits === undefined ||
175
+ !positiveInteger(limits.maxParts) ||
176
+ Object.keys(limits).length !== Object.keys(defaultModelingLimits).length ||
177
+ !Object.entries(defaultModelingLimits).every(([key, ceiling]) => positiveInteger(limits[key]) &&
178
+ limits[key] >= (key === "maxCircularSegments" ? 3 : 1) &&
179
+ limits[key] <= ceiling) ||
180
+ !positiveInteger(policy?.timeoutMs) ||
181
+ policy.timeoutMs > 3600000 ||
182
+ !bounds(value.bounds) ||
183
+ !isRecord(value.stats) ||
184
+ ![
185
+ "vertices",
186
+ "triangles",
187
+ "volumeMm3",
188
+ "bytes",
189
+ "buildMs",
190
+ "finalizationMs",
191
+ "generationMs",
192
+ ].every((key) => typeof stats?.[key] === "number" && Number.isFinite(stats[key])) ||
193
+ !["vertices", "triangles", "bytes"].every((key) => positiveInteger(stats?.[key])) ||
194
+ !["buildMs", "finalizationMs", "generationMs"].every((key) => typeof stats?.[key] === "number" && stats[key] >= 0) ||
195
+ dependencies === undefined ||
196
+ !strings(dependencies.modelParameters) ||
197
+ !Array.isArray(dependencies.computations) ||
198
+ !dependencies.computations.every((item) => isRecord(item) &&
199
+ identifier(item.id) &&
200
+ strings(item.parameters) &&
201
+ strings(item.computations)) ||
202
+ !Array.isArray(dependencies.parts) ||
203
+ !dependencies.parts.every((item) => isRecord(item) &&
204
+ identifier(item.id) &&
205
+ strings(item.parameters) &&
206
+ strings(item.computations)) ||
207
+ !Array.isArray(value.resources) ||
208
+ !Array.isArray(value.parts) ||
209
+ value.resources.length === 0 ||
210
+ value.parts.length === 0 ||
211
+ value.parts.length > limits.maxParts ||
212
+ value.resources.length > limits.maxParts ||
213
+ (value.export3mf !== undefined && !bufferDescriptor(value.export3mf)))
214
+ invalid("Unsupported, incomplete, or malformed captured-run manifest.");
215
+ const ids = new Set();
216
+ for (const resource of value.resources) {
217
+ if (!isRecord(resource) ||
218
+ !identifier(resource.id) ||
219
+ ids.has(resource.id) ||
220
+ !measurements(resource.measurements) ||
221
+ !bufferDescriptor(resource.positions) ||
222
+ !bufferDescriptor(resource.indices))
223
+ invalid("Invalid or duplicate captured geometry resource.");
224
+ ids.add(resource.id);
225
+ }
226
+ const partIds = new Set();
227
+ for (const part of value.parts) {
228
+ if (!isRecord(part) ||
229
+ !identifier(part.id) ||
230
+ partIds.has(part.id) ||
231
+ typeof part.resourceId !== "string" ||
232
+ !ids.has(part.resourceId) ||
233
+ !vector(part.position) ||
234
+ !vector(part.rotation) ||
235
+ !measurements(part.measurements) ||
236
+ (part.color !== undefined &&
237
+ (typeof part.color !== "string" || !/^#[a-f0-9]{6}$/i.test(part.color))))
238
+ invalid("Invalid or duplicate captured part placement.");
239
+ partIds.add(part.id);
240
+ }
241
+ const manifest = value;
242
+ const computations = new Set(manifest.dependencies.computations.map(({ id }) => id));
243
+ if (computations.size !== manifest.dependencies.computations.length ||
244
+ manifest.dependencies.parts.length !== manifest.parts.length ||
245
+ new Set(manifest.dependencies.parts.map(({ id }) => id)).size !== manifest.parts.length ||
246
+ manifest.dependencies.parts.some((part) => !partIds.has(part.id)) ||
247
+ [...manifest.dependencies.computations, ...manifest.dependencies.parts].some((item) => item.computations.some((id) => !computations.has(id))))
248
+ invalid("Invalid captured dependency identities or references.");
249
+ return manifest;
250
+ }
251
+ async function readBuffer(directory, descriptor) {
252
+ if (!bufferDescriptor(descriptor))
253
+ invalid("Invalid captured buffer descriptor.");
254
+ const file = await confinedFile(directory, descriptor.path);
255
+ if ((await stat(file)).size !== descriptor.bytes)
256
+ invalid(`Captured buffer length mismatch: ${descriptor.path}`);
257
+ const bytes = new Uint8Array(await readFile(file));
258
+ if (sha256(bytes) !== descriptor.sha256)
259
+ invalid(`Captured buffer digest mismatch: ${descriptor.path}`);
260
+ return bytes;
261
+ }
262
+ /** Reads only immutable captured files. It never imports or executes original author source. */
263
+ export async function readCapturedRun(directory) {
264
+ try {
265
+ const root = resolve(directory);
266
+ const manifestFile = await confinedFile(root, "manifest.json");
267
+ if ((await stat(manifestFile)).size > 16 * 1024 * 1024)
268
+ invalid("Captured manifest exceeds its size limit.");
269
+ const manifest = manifestFrom(JSON.parse(await readFile(manifestFile, "utf8")));
270
+ const resources = [];
271
+ let totalBytes = 0;
272
+ for (const resource of manifest.resources) {
273
+ totalBytes += resource.positions.bytes + resource.indices.bytes;
274
+ if (totalBytes > Math.min(512 * 1024 * 1024, manifest.policy.limits.maxBytes))
275
+ invalid("Captured geometry exceeds its resource byte limit.");
276
+ const positions = await readBuffer(root, resource.positions);
277
+ const indices = await readBuffer(root, resource.indices);
278
+ if (positions.length % 12 !== 0 || indices.length % 12 !== 0)
279
+ invalid("Captured mesh buffers require complete vertices and triangles.");
280
+ const geometry = {
281
+ id: resource.id,
282
+ positions: new Float32Array(positions.buffer),
283
+ indices: new Uint32Array(indices.buffer),
284
+ };
285
+ const facts = analyzeTriangleMesh(geometry, { requireClosed: true, includeTopology: true });
286
+ if (!sameMeasurements(facts, resource.measurements))
287
+ invalid(`Captured measurements do not match geometry ${resource.id}.`);
288
+ resources.push(geometry);
289
+ }
290
+ let vertices = 0;
291
+ let triangles = 0;
292
+ let volume = 0;
293
+ const aggregateBounds = {
294
+ min: [Infinity, Infinity, Infinity],
295
+ max: [-Infinity, -Infinity, -Infinity],
296
+ };
297
+ for (const part of manifest.parts) {
298
+ const resource = resources.find(({ id }) => id === part.resourceId);
299
+ const geometry = [...part.position, ...part.rotation].every((number) => number === 0)
300
+ ? resource
301
+ : transformTriangleMesh(resource, composeTransform3(translationTransform3(part.position), eulerTransform3(part.rotation)));
302
+ const facts = analyzeTriangleMesh(geometry, { requireClosed: true, includeTopology: true });
303
+ if (!sameMeasurements(facts, part.measurements))
304
+ invalid(`Captured placement measurements do not match part ${part.id}.`);
305
+ vertices += facts.vertexCount;
306
+ triangles += facts.triangleCount;
307
+ volume += facts.signedVolume;
308
+ for (let axis = 0; axis < 3; axis++) {
309
+ aggregateBounds.min[axis] = Math.min(aggregateBounds.min[axis], facts.bounds.min[axis]);
310
+ aggregateBounds.max[axis] = Math.max(aggregateBounds.max[axis], facts.bounds.max[axis]);
311
+ }
312
+ }
313
+ if (vertices !== manifest.stats.vertices ||
314
+ triangles !== manifest.stats.triangles ||
315
+ volume !== manifest.stats.volumeMm3 ||
316
+ manifest.stats.bytes < totalBytes ||
317
+ manifest.stats.bytes > manifest.policy.limits.maxBytes ||
318
+ vertices > manifest.policy.limits.maxVertices ||
319
+ triangles > manifest.policy.limits.maxTriangles ||
320
+ JSON.stringify(aggregateBounds) !== JSON.stringify(manifest.bounds))
321
+ invalid("Captured aggregate facts do not match finalized part geometry.");
322
+ if (manifest.export3mf !== undefined)
323
+ await readBuffer(root, manifest.export3mf);
324
+ return { directory: root, manifest, resources };
325
+ }
326
+ catch (error) {
327
+ if (error instanceof AuthoringError)
328
+ throw error;
329
+ throw new AuthoringError("artifact", "INVALID_ARTIFACT", error instanceof Error ? error.message : String(error));
330
+ }
331
+ }
332
+ export async function inspectCapturedRun(directory, partId) {
333
+ const captured = await readCapturedRun(directory);
334
+ const selectedPart = partId === undefined ? undefined : captured.manifest.parts.find(({ id }) => id === partId);
335
+ if (partId !== undefined && selectedPart === undefined)
336
+ throw new AuthoringError("invocation", "PART_NOT_FOUND", `Captured run has no part ${partId}.`);
337
+ return {
338
+ directory: captured.directory,
339
+ manifest: captured.manifest,
340
+ ...(selectedPart === undefined ? {} : { selectedPart }),
341
+ };
342
+ }
343
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/authoring/artifacts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,E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