@nebula-spatial/studio 0.0.0-stage → 0.1.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 (251) hide show
  1. package/README.md +206 -3
  2. package/dist/ai/contract.d.ts +73 -0
  3. package/dist/ai/host.d.ts +28 -0
  4. package/dist/asset/dependency-scan.d.ts +78 -0
  5. package/dist/asset/intake.d.ts +84 -0
  6. package/dist/asset/layout-detect.d.ts +40 -0
  7. package/dist/asset/media-type.d.ts +10 -0
  8. package/dist/asset/model-inspection.d.ts +127 -0
  9. package/dist/asset/record.d.ts +35 -0
  10. package/dist/asset/remote-asset-resolver.d.ts +36 -0
  11. package/dist/asset/repairs.d.ts +53 -0
  12. package/dist/asset/resource-locator.d.ts +15 -0
  13. package/dist/asset/revision-diff.d.ts +33 -0
  14. package/dist/asset/source-contracts.d.ts +21 -0
  15. package/dist/asset/source-paths.d.ts +15 -0
  16. package/dist/asset/usd-inspection.d.ts +39 -0
  17. package/dist/asset/usd-source-metadata.d.ts +142 -0
  18. package/dist/asset/visual-intake.d.ts +27 -0
  19. package/dist/asset/visual-record.d.ts +22 -0
  20. package/dist/asset/web-intake.d.ts +46 -0
  21. package/dist/asset-source-BExlEcRt.js +444 -0
  22. package/dist/assets/usd-export-worker-BsGubtAE.js +1 -0
  23. package/dist/builders-BAXRR5o5.js +1854 -0
  24. package/dist/core/asset-task.d.ts +105 -0
  25. package/dist/core/context.d.ts +23 -0
  26. package/dist/core/host.d.ts +432 -0
  27. package/dist/core/persistence-controller.d.ts +58 -0
  28. package/dist/core/plugins.d.ts +139 -0
  29. package/dist/core/scene-tree.d.ts +62 -0
  30. package/dist/core/versions.d.ts +2 -0
  31. package/dist/core/when.d.ts +13 -0
  32. package/dist/core/write-policy.d.ts +29 -0
  33. package/dist/delivery/build-plan.d.ts +2 -0
  34. package/dist/delivery/contracts.d.ts +362 -0
  35. package/dist/delivery/digest.d.ts +3 -0
  36. package/dist/delivery/evidence.d.ts +10 -0
  37. package/dist/delivery/export-evidence.d.ts +3 -0
  38. package/dist/delivery/index.d.ts +9 -0
  39. package/dist/delivery/prim-name.d.ts +17 -0
  40. package/dist/delivery/profile.d.ts +4 -0
  41. package/dist/doc/builders.d.ts +99 -0
  42. package/dist/doc/command.d.ts +195 -0
  43. package/dist/doc/domain-extensions.d.ts +34 -0
  44. package/dist/doc/node-facts.d.ts +87 -0
  45. package/dist/doc/physics-facts.d.ts +74 -0
  46. package/dist/doc/placement-policy.d.ts +71 -0
  47. package/dist/doc/random-placement.d.ts +30 -0
  48. package/dist/doc/scene-graph.d.ts +80 -0
  49. package/dist/doc/scene-regions.d.ts +29 -0
  50. package/dist/doc/schema.d.ts +452 -0
  51. package/dist/doc/task.d.ts +71 -0
  52. package/dist/doc/validate.d.ts +68 -0
  53. package/dist/editor/asset-source.d.ts +15 -0
  54. package/dist/editor/editor.d.ts +246 -0
  55. package/dist/editor/index.d.ts +22 -0
  56. package/dist/editor/shortcuts.d.ts +2 -0
  57. package/dist/editor/types.d.ts +143 -0
  58. package/dist/editor/ui-plugins.d.ts +64 -0
  59. package/dist/editor.js +1755 -0
  60. package/dist/editorial-BkAFWfbg.js +83 -0
  61. package/dist/export-evidence-B_0zRmb8.js +5027 -0
  62. package/dist/generalization/domain.d.ts +10 -0
  63. package/dist/generalization/generalization.d.ts +371 -0
  64. package/dist/generalization/index.d.ts +11 -0
  65. package/dist/generalization.js +1659 -0
  66. package/dist/history/undo-stack.d.ts +74 -0
  67. package/dist/index.d.ts +91 -0
  68. package/dist/index.js +2839 -0
  69. package/dist/persist/content-addressed.d.ts +11 -0
  70. package/dist/persist/create-scene-package-from-host.d.ts +7 -0
  71. package/dist/persist/indexeddb-store.d.ts +69 -0
  72. package/dist/persist/scene-file.d.ts +52 -0
  73. package/dist/persist/scene-package.d.ts +8 -0
  74. package/dist/persist/snapshot.d.ts +5 -0
  75. package/dist/physics-facts-tfQYyNTD.js +337 -0
  76. package/dist/placement-policy-DY_FNRDu.js +405 -0
  77. package/dist/ports/asset-ingestor.d.ts +41 -0
  78. package/dist/ports/asset-source.d.ts +57 -0
  79. package/dist/ports/delivery.d.ts +13 -0
  80. package/dist/ports/persistence.d.ts +29 -0
  81. package/dist/project/asset-catalog.d.ts +21 -0
  82. package/dist/project/contracts.d.ts +272 -0
  83. package/dist/project/editorial.d.ts +16 -0
  84. package/dist/project/identity.d.ts +20 -0
  85. package/dist/project/index.d.ts +9 -0
  86. package/dist/project/scene-document.d.ts +5 -0
  87. package/dist/project/source-dependencies.d.ts +7 -0
  88. package/dist/remote-asset-resolver-Cb8cfNmw.js +136 -0
  89. package/dist/scene/index.d.ts +12 -0
  90. package/dist/scene-graph-DBLKAhxa.js +681 -0
  91. package/dist/scene-session-BV1HnxNh.js +3506 -0
  92. package/dist/scene.js +244 -0
  93. package/dist/studio/delivery-catalog.d.ts +28 -0
  94. package/dist/studio/in-memory-asset-source.d.ts +15 -0
  95. package/dist/studio/index.d.ts +31 -0
  96. package/dist/studio/indexeddb-asset-source.d.ts +32 -0
  97. package/dist/studio/indexeddb-persistence.d.ts +13 -0
  98. package/dist/studio/remote-asset-importer.d.ts +56 -0
  99. package/dist/studio/source-package.d.ts +9 -0
  100. package/dist/studio/usd-export-client.d.ts +13 -0
  101. package/dist/studio/usd-export-protocol.d.ts +98 -0
  102. package/dist/studio/usd-export-worker.d.ts +1 -0
  103. package/dist/studio/usd-zip-reader.d.ts +14 -0
  104. package/dist/studio/web-asset-ingestor.d.ts +10 -0
  105. package/dist/studio/web-host.d.ts +8 -0
  106. package/dist/studio.js +5544 -0
  107. package/dist/util/asset-facts.d.ts +3 -0
  108. package/dist/util/data.d.ts +17 -0
  109. package/dist/util/diagnostics.d.ts +38 -0
  110. package/dist/util/geometry.d.ts +11 -0
  111. package/dist/util/hash.d.ts +9 -0
  112. package/dist/util/ids.d.ts +20 -0
  113. package/dist/util/math.d.ts +47 -0
  114. package/dist/util/ply-metadata.d.ts +19 -0
  115. package/dist/util/studio-source.d.ts +23 -0
  116. package/dist/version.d.ts +5 -0
  117. package/dist/view/appearance.d.ts +13 -0
  118. package/dist/view/authoring-appearance.d.ts +25 -0
  119. package/dist/view/bounds-preview.d.ts +34 -0
  120. package/dist/view/bounds.d.ts +11 -0
  121. package/dist/view/camera-zoom.d.ts +3 -0
  122. package/dist/view/geometry-anchors.d.ts +20 -0
  123. package/dist/view/gizmo-appearance.d.ts +5 -0
  124. package/dist/view/gizmo.d.ts +81 -0
  125. package/dist/view/group-selection.d.ts +13 -0
  126. package/dist/view/node-features.d.ts +39 -0
  127. package/dist/view/picking.d.ts +49 -0
  128. package/dist/view/placement.d.ts +48 -0
  129. package/dist/view/region-editing.d.ts +25 -0
  130. package/dist/view/rotation-guide.d.ts +36 -0
  131. package/dist/view/runtime-capabilities.d.ts +22 -0
  132. package/dist/view/scene-session.d.ts +258 -0
  133. package/dist/view/screen-bounds.d.ts +17 -0
  134. package/dist/view/selection-transform.d.ts +20 -0
  135. package/node_modules/@nebula-spatial/cad-loader/CHANGELOG.md +48 -0
  136. package/node_modules/@nebula-spatial/cad-loader/README.md +108 -0
  137. package/node_modules/@nebula-spatial/cad-loader/dist/core/cad-types.d.ts +26 -0
  138. package/node_modules/@nebula-spatial/cad-loader/dist/core/errors.d.ts +5 -0
  139. package/node_modules/@nebula-spatial/cad-loader/dist/core/index.d.ts +24 -0
  140. package/node_modules/@nebula-spatial/cad-loader/dist/core/index.js +2354 -0
  141. package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/bin-group-reader.d.ts +9 -0
  142. package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/bin-parser.d.ts +78 -0
  143. package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/dxbs-sidecar.d.ts +24 -0
  144. package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/geometry-segments.d.ts +20 -0
  145. package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/text-roundtrip.d.ts +4 -0
  146. package/node_modules/@nebula-spatial/cad-loader/dist/core/parser/types.d.ts +81 -0
  147. package/node_modules/@nebula-spatial/cad-loader/dist/core/runtime-text-decoder.d.ts +8 -0
  148. package/node_modules/@nebula-spatial/cad-loader/dist/core/types.d.ts +153 -0
  149. package/node_modules/@nebula-spatial/cad-loader/dist/core/utils/insert-bbox.d.ts +10 -0
  150. package/node_modules/@nebula-spatial/cad-loader/dist/core/utils/viewport-rect.d.ts +21 -0
  151. package/node_modules/@nebula-spatial/cad-loader/dist/index.d.ts +36 -0
  152. package/node_modules/@nebula-spatial/cad-loader/dist/index.js +5829 -0
  153. package/node_modules/@nebula-spatial/cad-loader/dist/loader/geo-loader.d.ts +59 -0
  154. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/automatic-external-resources.d.ts +26 -0
  155. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/external-variant-sidecar-fetch.d.ts +13 -0
  156. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/flow-control.d.ts +29 -0
  157. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/frame-budget-scheduler.d.ts +21 -0
  158. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-compact-executor.d.ts +19 -0
  159. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-local-adapter.d.ts +2 -0
  160. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-pipeline.d.ts +92 -0
  161. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-loader-worker-adapter.d.ts +13 -0
  162. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node-builder.d.ts +34 -0
  163. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node-load-sink.d.ts +28 -0
  164. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-node.d.ts +304 -0
  165. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare-worker-types.d.ts +94 -0
  166. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare.d.ts +38 -0
  167. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/geo-prepare.worker.d.ts +1 -0
  168. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/insert-model-builder.d.ts +10 -0
  169. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/insert-runtime-geometry.d.ts +15 -0
  170. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/line-canonical.d.ts +37 -0
  171. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/line-quality.d.ts +9 -0
  172. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/prepare-credit-gate.d.ts +20 -0
  173. package/node_modules/@nebula-spatial/cad-loader/dist/loader/internal/transport.d.ts +2 -0
  174. package/node_modules/@nebula-spatial/cad-loader/dist/render-resource/cad-render-node.d.ts +80 -0
  175. package/node_modules/@nebula-spatial/cad-loader/dist/render-resource/geo-node-cad-render-node.d.ts +12 -0
  176. package/node_modules/@nebula-spatial/cad-loader/dist/scene/geo-cad-line-geometry.d.ts +28 -0
  177. package/node_modules/@nebula-spatial/cad-loader/dist/scene/geo-cad-line-material.d.ts +18 -0
  178. package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/block-geometry-registry.d.ts +35 -0
  179. package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/insert-instance-table.d.ts +23 -0
  180. package/node_modules/@nebula-spatial/cad-loader/dist/scene/instancing/viewport-instance-presenter.d.ts +66 -0
  181. package/node_modules/@nebula-spatial/cad-loader/dist/selection/cad-insert-selection.d.ts +35 -0
  182. package/node_modules/@nebula-spatial/cad-loader/dist/selection/cad-text-selection.d.ts +31 -0
  183. package/node_modules/@nebula-spatial/cad-loader/dist/session/annotation-idle-gate.d.ts +14 -0
  184. package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-document-session.d.ts +187 -0
  185. package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-font-runtime.d.ts +11 -0
  186. package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-insert-id.d.ts +6 -0
  187. package/node_modules/@nebula-spatial/cad-loader/dist/session/cad-text-warmup.d.ts +38 -0
  188. package/node_modules/@nebula-spatial/cad-loader/dist/session/create-cad-document-session.d.ts +5 -0
  189. package/node_modules/@nebula-spatial/cad-loader/dist/session/load-session.d.ts +90 -0
  190. package/node_modules/@nebula-spatial/cad-loader/dist/session/viewport-coverage.d.ts +32 -0
  191. package/node_modules/@nebula-spatial/cad-loader/dist/shared/abort.d.ts +3 -0
  192. package/node_modules/@nebula-spatial/cad-loader/dist/shared/cad-display-color.d.ts +55 -0
  193. package/node_modules/@nebula-spatial/cad-loader/dist/shared/cad-load-source.d.ts +8 -0
  194. package/node_modules/@nebula-spatial/cad-loader/dist/shared/color-buffer.d.ts +6 -0
  195. package/node_modules/@nebula-spatial/cad-loader/dist/shared/constants.d.ts +11 -0
  196. package/node_modules/@nebula-spatial/cad-loader/dist/shared/display-color-buffer.d.ts +27 -0
  197. package/node_modules/@nebula-spatial/cad-loader/dist/shared/errors.d.ts +2 -0
  198. package/node_modules/@nebula-spatial/cad-loader/dist/shared/text-builder.d.ts +25 -0
  199. package/node_modules/@nebula-spatial/cad-loader/dist/shared/text-font.d.ts +12 -0
  200. package/node_modules/@nebula-spatial/cad-loader/dist/shared/types.d.ts +57 -0
  201. package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/insert-bbox.d.ts +1 -0
  202. package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/timing.d.ts +2 -0
  203. package/node_modules/@nebula-spatial/cad-loader/dist/shared/utils/viewport-rect.d.ts +1 -0
  204. package/node_modules/@nebula-spatial/cad-loader/dist/shared/viewer-theme.d.ts +2 -0
  205. package/node_modules/@nebula-spatial/cad-loader/dist/workers/geo-prepare.worker.js +2264 -0
  206. package/node_modules/@nebula-spatial/cad-loader/package.json +62 -0
  207. package/node_modules/@nebula-spatial/viewer/CHANGELOG.md +426 -0
  208. package/node_modules/@nebula-spatial/viewer/FBX-MATERIAL-CONVERSION.md +97 -0
  209. package/node_modules/@nebula-spatial/viewer/README.md +1056 -0
  210. package/node_modules/@nebula-spatial/viewer/USD-VISUAL-MATERIAL-SUPPORT.md +89 -0
  211. package/node_modules/@nebula-spatial/viewer/basis/basis_transcoder.js +19 -0
  212. package/node_modules/@nebula-spatial/viewer/basis/basis_transcoder.wasm +0 -0
  213. package/node_modules/@nebula-spatial/viewer/dist/asset-ir-DEOK9SqE.js +382 -0
  214. package/node_modules/@nebula-spatial/viewer/dist/assets/ground-grid.d.ts +6 -0
  215. package/node_modules/@nebula-spatial/viewer/dist/assets/source-types.d.ts +19 -0
  216. package/node_modules/@nebula-spatial/viewer/dist/assets/types.d.ts +393 -0
  217. package/node_modules/@nebula-spatial/viewer/dist/assets/usd-worker-Bom5cjz3.js +1392 -0
  218. package/node_modules/@nebula-spatial/viewer/dist/cad/text.d.ts +2 -0
  219. package/node_modules/@nebula-spatial/viewer/dist/cad/types.d.ts +368 -0
  220. package/node_modules/@nebula-spatial/viewer/dist/index-ByBlfVc0.js +12132 -0
  221. package/node_modules/@nebula-spatial/viewer/dist/index.d.ts +32 -0
  222. package/node_modules/@nebula-spatial/viewer/dist/index.js +26 -0
  223. package/node_modules/@nebula-spatial/viewer/dist/inspection/types.d.ts +112 -0
  224. package/node_modules/@nebula-spatial/viewer/dist/mjcf-visual-DVRa0w90.js +72 -0
  225. package/node_modules/@nebula-spatial/viewer/dist/mujoco-runtime-Dhx6Ua2u.js +463 -0
  226. package/node_modules/@nebula-spatial/viewer/dist/plugins.d.ts +179 -0
  227. package/node_modules/@nebula-spatial/viewer/dist/scene/instances.d.ts +36 -0
  228. package/node_modules/@nebula-spatial/viewer/dist/scene/types.d.ts +258 -0
  229. package/node_modules/@nebula-spatial/viewer/dist/session-B-j6KdA-.js +389 -0
  230. package/node_modules/@nebula-spatial/viewer/dist/session-B4AICTeJ.js +963 -0
  231. package/node_modules/@nebula-spatial/viewer/dist/session-BAG5cDYe.js +9153 -0
  232. package/node_modules/@nebula-spatial/viewer/dist/simulation/mujoco-runtime.d.ts +118 -0
  233. package/node_modules/@nebula-spatial/viewer/dist/simulation/mujoco-wasm-module.d.ts +11 -0
  234. package/node_modules/@nebula-spatial/viewer/dist/simulation/openusd-wasm-module.d.ts +10 -0
  235. package/node_modules/@nebula-spatial/viewer/dist/simulation/physics-runtime-state.d.ts +75 -0
  236. package/node_modules/@nebula-spatial/viewer/dist/simulation/types.d.ts +129 -0
  237. package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-inspection.d.ts +66 -0
  238. package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-query.d.ts +50 -0
  239. package/node_modules/@nebula-spatial/viewer/dist/simulation/usd-resource-policy.d.ts +28 -0
  240. package/node_modules/@nebula-spatial/viewer/dist/types.d.ts +278 -0
  241. package/node_modules/@nebula-spatial/viewer/dist/ui/types.d.ts +48 -0
  242. package/node_modules/@nebula-spatial/viewer/dist/urdf-session-kemAnBn8.js +3231 -0
  243. package/node_modules/@nebula-spatial/viewer/dist/usd-session-QtwGKI7v.js +6771 -0
  244. package/node_modules/@nebula-spatial/viewer/dist/version.d.ts +5 -0
  245. package/node_modules/@nebula-spatial/viewer/dist/viewer.d.ts +2 -0
  246. package/node_modules/@nebula-spatial/viewer/dist/xacro-CYTPS7mh.js +1537 -0
  247. package/node_modules/@nebula-spatial/viewer/openusd/openusd-runtime-manifest.json +15 -0
  248. package/node_modules/@nebula-spatial/viewer/openusd/openusd_probe.js +14 -0
  249. package/node_modules/@nebula-spatial/viewer/openusd/openusd_probe.wasm +0 -0
  250. package/node_modules/@nebula-spatial/viewer/package.json +66 -0
  251. package/package.json +87 -6
@@ -0,0 +1,11 @@
1
+ /** Content-addressed bytes used by IndexedDB and scene ZIP persistence. */
2
+ import type { SceneDocument } from '../doc/schema';
3
+ import type { StudioSourceBundle } from '../util/studio-source';
4
+ export interface ContentAddressedResource {
5
+ readonly sha256: string;
6
+ readonly mediaType: string;
7
+ readonly blob: Blob;
8
+ }
9
+ export declare function createContentAddressedResources(document: SceneDocument, sourceByRevisionId: ReadonlyMap<string, StudioSourceBundle>): Promise<readonly ContentAddressedResource[]>;
10
+ export declare function verifyContentAddressedResources(resources: readonly ContentAddressedResource[]): Promise<readonly ContentAddressedResource[]>;
11
+ export declare function sourceBundlesFromContentStore(document: SceneDocument, resources: readonly ContentAddressedResource[]): readonly StudioSourceBundle[];
@@ -0,0 +1,7 @@
1
+ import type { EditorialStateV1, ScenePackageArtifact, ScenePackageHostSource, ScenePackageInput, ScenePackageReadPorts } from '../project/contracts';
2
+ export declare function createScenePackageFromHost(host: ScenePackageHostSource, input: {
3
+ readonly editorial: EditorialStateV1;
4
+ readonly assetCatalog: ScenePackageInput['assetCatalog'];
5
+ readonly resourceManifest: ScenePackageInput['resourceManifest'];
6
+ readonly resources?: ScenePackageInput['resources'];
7
+ }, ports?: ScenePackageReadPorts): Promise<ScenePackageArtifact>;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * IndexedDB storage for canonical scene state and content-addressed resources.
3
+ * Scene state and resource bytes have separate contracts so local storage can
4
+ * implement the same boundaries as a remote asset platform.
5
+ */
6
+ import { type ContentAddressedResource } from './content-addressed';
7
+ import type { StudioStateSnapshot } from './snapshot';
8
+ import type { StudioAssetResourceLocator } from '../doc/schema';
9
+ export interface IndexedDbStudioStoreOptions {
10
+ readonly dbName?: string;
11
+ readonly indexedDB?: IDBFactory;
12
+ }
13
+ export declare const INDEXED_DB_STUDIO_NAME = "sim-studio.indexeddb";
14
+ export declare const INDEXED_DB_STUDIO_VERSION = 3;
15
+ export declare const INDEXED_DB_DOCUMENT_STORE = "documents";
16
+ export declare const INDEXED_DB_RESOURCE_STORE = "resources";
17
+ export declare const INDEXED_DB_SOURCE_STORE = "asset-sources";
18
+ export declare const INDEXED_DB_STORE_ERROR: {
19
+ readonly unavailable: "INDEXED_DB_STORE_UNAVAILABLE";
20
+ readonly openFailed: "INDEXED_DB_STORE_OPEN_FAILED";
21
+ readonly readFailed: "INDEXED_DB_STORE_READ_FAILED";
22
+ readonly writeFailed: "INDEXED_DB_STORE_WRITE_FAILED";
23
+ readonly invalidSnapshot: "INDEXED_DB_STORE_INVALID_SNAPSHOT";
24
+ readonly unsupportedFormat: "INDEXED_DB_STORE_UNSUPPORTED_FORMAT";
25
+ };
26
+ export declare class IndexedDbStoreError extends Error {
27
+ readonly code: string;
28
+ readonly cause?: unknown;
29
+ constructor(code: string, message: string, cause?: unknown);
30
+ }
31
+ export interface IndexedDbAssetSourceFile {
32
+ readonly locator: StudioAssetResourceLocator;
33
+ readonly mediaType?: string;
34
+ readonly byteSize?: number;
35
+ readonly sha256: string;
36
+ readonly blobSha256: string;
37
+ }
38
+ export interface IndexedDbLocalAssetSourceRecord {
39
+ readonly kind: 'local-package';
40
+ readonly revisionId: string;
41
+ readonly entryPath: string;
42
+ readonly files: readonly IndexedDbAssetSourceFile[];
43
+ }
44
+ export interface IndexedDbRemoteAssetSourceRecord {
45
+ readonly kind: 'remote-entry';
46
+ readonly revisionId: string;
47
+ readonly entryUrl: string;
48
+ readonly allowedScopes?: readonly {
49
+ readonly origin: string;
50
+ readonly pathPrefix: string;
51
+ }[];
52
+ }
53
+ export type IndexedDbAssetSourceRecord = IndexedDbLocalAssetSourceRecord | IndexedDbRemoteAssetSourceRecord;
54
+ export declare class IndexedDbStudioStore {
55
+ private readonly dbName;
56
+ private readonly factory;
57
+ private db;
58
+ private opening;
59
+ constructor(options?: IndexedDbStudioStoreOptions);
60
+ load(): Promise<StudioStateSnapshot | null>;
61
+ save(snapshot: StudioStateSnapshot): Promise<void>;
62
+ loadResources(hashes: readonly string[]): Promise<readonly ContentAddressedResource[]>;
63
+ saveResources(resources: readonly ContentAddressedResource[]): Promise<void>;
64
+ loadAssetSource(revisionId: string): Promise<IndexedDbAssetSourceRecord | null>;
65
+ saveAssetSource(source: IndexedDbAssetSourceRecord): Promise<void>;
66
+ deleteAssetSource(revisionId: string): Promise<void>;
67
+ close(): void;
68
+ private open;
69
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Canonical SceneDocument persistence.
3
+ *
4
+ * `document.json` is the single scene source. Assets and their package-relative
5
+ * resource descriptions are part of the document; resource bytes live in a
6
+ * content-addressed store keyed by SHA-256. Retired envelopes are rejected;
7
+ * older schema versions are rejected before current-shape validation.
8
+ */
9
+ import type { SceneDocument } from '../doc/schema';
10
+ import { type StudioDocumentDomainExtension } from '../doc/domain-extensions';
11
+ import type { Diagnostic } from '../util/diagnostics';
12
+ export declare const SCENE_DOCUMENT_FILE_NAME = "document.json";
13
+ export declare const SCENE_DOCUMENT_FORMAT = "sim-studio.document@7";
14
+ export declare const SCENE_FILE_DIAGNOSTIC: {
15
+ readonly notJson: "SCENE_FILE_NOT_JSON";
16
+ readonly unsupportedFormat: "SCENE_FILE_UNSUPPORTED_FORMAT";
17
+ readonly unsupportedVersion: "SCENE_FILE_UNSUPPORTED_VERSION";
18
+ readonly migrated: "SCENE_FILE_MIGRATED";
19
+ readonly invalidDocument: "SCENE_FILE_INVALID_DOCUMENT";
20
+ };
21
+ export interface SceneDocumentWrite {
22
+ readonly text: string;
23
+ readonly contentHash: string;
24
+ readonly diagnostics: readonly Diagnostic[];
25
+ }
26
+ export interface SceneDocumentRead {
27
+ readonly document: SceneDocument | null;
28
+ readonly contentHash: string | null;
29
+ /** Always null in the current strict reader. */
30
+ readonly migratedFrom: number | null;
31
+ readonly diagnostics: readonly Diagnostic[];
32
+ }
33
+ export interface SceneDocumentCodecOptions {
34
+ readonly domainExtensions?: readonly StudioDocumentDomainExtension[];
35
+ }
36
+ /**
37
+ * Normalises ordering and floating-point representation without changing scene
38
+ * facts. This is the canonical form used for both persistence and hashing.
39
+ */
40
+ export declare function normalizeSceneDocument(document: SceneDocument, options?: SceneDocumentCodecOptions): SceneDocument;
41
+ /** Hash of immutable scene facts; mutable updatedAt metadata is excluded. */
42
+ export declare function calculateSceneContentHash(document: SceneDocument, options?: SceneDocumentCodecOptions): string;
43
+ /**
44
+ * Recomputes a canonical hash at a historical schema version. Persistence
45
+ * adapters use this only to verify pre-migration snapshots before accepting
46
+ * their current canonical form as pending migration.
47
+ */
48
+ export declare function calculateSceneContentHashForVersion(document: SceneDocument, schemaVersion: number, options?: SceneDocumentCodecOptions): string;
49
+ export declare function serializeSceneDocument(document: SceneDocument, options?: SceneDocumentCodecOptions): SceneDocumentWrite;
50
+ export declare const writeSceneDocument: typeof serializeSceneDocument;
51
+ export declare function parseSceneDocument(text: string, options?: SceneDocumentCodecOptions): SceneDocumentRead;
52
+ export declare const readSceneDocument: typeof parseSceneDocument;
@@ -0,0 +1,8 @@
1
+ import type { LoadedScenePackage, ScenePackageArtifact, ScenePackageInput, ScenePackageReadPorts } from '../project/contracts';
2
+ export declare class ScenePackageError extends Error {
3
+ readonly code: string;
4
+ constructor(code: string, message: string);
5
+ }
6
+ export declare function createScenePackage(input: ScenePackageInput, _ports?: ScenePackageReadPorts): Promise<ScenePackageArtifact>;
7
+ export { createScenePackageFromHost } from './create-scene-package-from-host';
8
+ export declare function readScenePackage(bytes: ArrayBuffer | Uint8Array, ports?: ScenePackageReadPorts): Promise<LoadedScenePackage>;
@@ -0,0 +1,5 @@
1
+ /** Scene state shared by browser-local and remote persistence adapters. */
2
+ export interface StudioStateSnapshot {
3
+ readonly documentText: string;
4
+ readonly documentHash: string;
5
+ }
@@ -0,0 +1,337 @@
1
+ import { z as w, U, Z as D, _ as M, h as L, a7 as P, E as C, u as z, d as v, a as _, a3 as W, x as V } from "./scene-graph-DBLKAhxa.js";
2
+ const G = Object.freeze({
3
+ local: Object.freeze([0, 0, 0])
4
+ });
5
+ function K(n) {
6
+ return n.origin ?? G;
7
+ }
8
+ function k(n) {
9
+ const s = K(n);
10
+ return {
11
+ pivot: s,
12
+ local: R(s.local),
13
+ provenance: n.origin ? "authored" : "default"
14
+ };
15
+ }
16
+ const Z = Object.freeze([
17
+ "source",
18
+ "bounds-center",
19
+ "bounds-base",
20
+ "bounds-top",
21
+ "bounds-min-x",
22
+ "bounds-max-x",
23
+ "bounds-min-y",
24
+ "bounds-max-y",
25
+ "bounds-long-min",
26
+ "bounds-long-max",
27
+ "bounds-short-min",
28
+ "bounds-short-max",
29
+ "bounds-long-min-base",
30
+ "bounds-long-min-top",
31
+ "bounds-long-max-base",
32
+ "bounds-long-max-top",
33
+ "bounds-short-min-base",
34
+ "bounds-short-min-top",
35
+ "bounds-short-max-base",
36
+ "bounds-short-max-top",
37
+ "geometry-median",
38
+ "surface-center-of-mass",
39
+ "volume-center-of-mass"
40
+ ]);
41
+ function J(n, s, o = null) {
42
+ if (n === "source") return [0, 0, 0];
43
+ if (n === "geometry-median")
44
+ return y(o == null ? void 0 : o.median, "GEOMETRY_MEDIAN_UNAVAILABLE");
45
+ if (n === "surface-center-of-mass")
46
+ return y(o == null ? void 0 : o.surfaceCenterOfMass, "SURFACE_CENTER_OF_MASS_UNAVAILABLE");
47
+ if (n === "volume-center-of-mass")
48
+ return y(o == null ? void 0 : o.volumeCenterOfMass, "VOLUME_CENTER_OF_MASS_UNAVAILABLE");
49
+ if (!s) throw new Error("BOUNDS_UNAVAILABLE");
50
+ const e = O(s);
51
+ switch (n) {
52
+ case "bounds-center":
53
+ return e;
54
+ case "bounds-base":
55
+ return [e[0], e[1], s.min[2]];
56
+ case "bounds-top":
57
+ return [e[0], e[1], s.max[2]];
58
+ case "bounds-min-x":
59
+ return [s.min[0], e[1], e[2]];
60
+ case "bounds-max-x":
61
+ return [s.max[0], e[1], e[2]];
62
+ case "bounds-min-y":
63
+ return [e[0], s.min[1], e[2]];
64
+ case "bounds-max-y":
65
+ return [e[0], s.max[1], e[2]];
66
+ case "bounds-long-min":
67
+ case "bounds-long-max":
68
+ case "bounds-short-min":
69
+ case "bounds-short-max":
70
+ case "bounds-long-min-base":
71
+ case "bounds-long-min-top":
72
+ case "bounds-long-max-base":
73
+ case "bounds-long-max-top":
74
+ case "bounds-short-min-base":
75
+ case "bounds-short-min-top":
76
+ case "bounds-short-max-base":
77
+ case "bounds-short-max-top": {
78
+ const a = T(s)[0] >= T(s)[1], l = n.includes("-max"), m = n.startsWith("bounds-long") === a, d = n.endsWith("-base") ? s.min[2] : n.endsWith("-top") ? s.max[2] : e[2];
79
+ return m ? [e[0], l ? s.max[1] : s.min[1], d] : [l ? s.max[0] : s.min[0], e[1], d];
80
+ }
81
+ default:
82
+ return [0, 0, 0];
83
+ }
84
+ }
85
+ function T(n) {
86
+ return [
87
+ n.max[0] - n.min[0],
88
+ n.max[1] - n.min[1],
89
+ n.max[2] - n.min[2]
90
+ ];
91
+ }
92
+ function O(n) {
93
+ return [0, 1, 2].map((s) => (n.min[s] + n.max[s]) / 2);
94
+ }
95
+ function Y(n) {
96
+ return Array.from(
97
+ { length: 8 },
98
+ (s, o) => [
99
+ n[o & 1 ? "max" : "min"][0],
100
+ n[o & 2 ? "max" : "min"][1],
101
+ n[o & 4 ? "max" : "min"][2]
102
+ ]
103
+ );
104
+ }
105
+ function F(n, s) {
106
+ return M(
107
+ s.rotation,
108
+ n.map((e, t) => e * s.scale[t])
109
+ ).map((e, t) => {
110
+ const a = e + s.position[t];
111
+ return a === 0 ? 0 : a;
112
+ });
113
+ }
114
+ function N(n, s) {
115
+ const o = Y(n).map((e) => F(e, s));
116
+ return {
117
+ min: [0, 1, 2].map((e) => Math.min(...o.map((t) => t[e]))),
118
+ max: [0, 1, 2].map((e) => Math.max(...o.map((t) => t[e])))
119
+ };
120
+ }
121
+ function x(n) {
122
+ return n.length ? {
123
+ min: [0, 1, 2].map((s) => Math.min(...n.map((o) => o.min[s]))),
124
+ max: [0, 1, 2].map((s) => Math.max(...n.map((o) => o.max[s])))
125
+ } : null;
126
+ }
127
+ function E(n, s) {
128
+ var o, e;
129
+ switch (s.nodeType) {
130
+ case "asset":
131
+ return ((o = z(n, s.assetRevisionId)) == null ? void 0 : o.bounds) ?? null;
132
+ case "visual":
133
+ return ((e = C(n, s.visualRevisionId)) == null ? void 0 : e.bounds) ?? null;
134
+ case "domain":
135
+ return s.bounds ?? null;
136
+ case "placeholder":
137
+ return {
138
+ min: s.size.map((t) => -t / 2),
139
+ max: s.size.map((t) => t / 2)
140
+ };
141
+ case "group":
142
+ return x(
143
+ s.children.flatMap((t) => {
144
+ const a = E(n, t);
145
+ return a ? [N(a, L(
146
+ t.localTransform,
147
+ P(t)
148
+ ))] : [];
149
+ })
150
+ );
151
+ }
152
+ }
153
+ function I(n, s, o, e) {
154
+ const t = w(n.root, s);
155
+ if (!t) return null;
156
+ const a = U(n.root, s), l = D(n.root, s);
157
+ if (!a || !l) return null;
158
+ let u = (e == null ? void 0 : e(s)) ?? E(n, t);
159
+ const m = (o == null ? void 0 : o(s)) ?? null, d = t.nodeType === "group" ? t.children.map(
160
+ (i) => I(n, i.nodeId, o, e)
161
+ ) : [];
162
+ !u && t.nodeType === "group" && (u = x(
163
+ d.flatMap(
164
+ (i) => i != null && i.localBounds ? [N(i.localBounds, i.localTransform)] : []
165
+ )
166
+ ));
167
+ const p = m ?? (t.nodeType === "group" ? x(d.flatMap((i) => i != null && i.worldBounds ? [i.worldBounds] : [])) : u ? N(u, l) : null), h = m || d.some((i) => (i == null ? void 0 : i.boundsSource) === "runtime") ? "runtime" : p ? "document" : "unknown", b = k(t), f = F(b.local, l), g = a.position, r = M(t.localTransform.rotation, [0, 0, 1]), c = M(a.rotation, [0, 0, 1]);
168
+ return S({
169
+ nodeId: s,
170
+ nodeType: t.nodeType,
171
+ localTransform: t.localTransform,
172
+ worldTransform: a,
173
+ localBounds: u,
174
+ worldBounds: p,
175
+ boundsCenter: p ? O(p) : null,
176
+ boundsSource: h,
177
+ pivot: {
178
+ value: g,
179
+ source: "node-origin"
180
+ },
181
+ sourcePivot: { value: null, source: "unknown" },
182
+ sourceOrigin: {
183
+ local: [0, 0, 0],
184
+ world: l.position.map((i) => i === 0 ? 0 : i),
185
+ provenance: "asset-local"
186
+ },
187
+ origin: {
188
+ ...b,
189
+ world: f
190
+ },
191
+ orientation: {
192
+ localUpAxis: [0, 0, 1],
193
+ parentUpDirection: r,
194
+ worldUpDirection: c,
195
+ preset: j(r)
196
+ }
197
+ });
198
+ }
199
+ function X(n, s) {
200
+ const o = [...new Set(s)].filter(
201
+ (t) => t !== n.root.nodeId && w(n.root, t)
202
+ ), e = new Set(o);
203
+ return o.filter(
204
+ (t) => !W(n.root, t).slice(0, -1).some((a) => e.has(a.nodeId))
205
+ );
206
+ }
207
+ function H(n, s, o) {
208
+ const e = X(n, s), t = x(
209
+ e.flatMap((l) => {
210
+ var m;
211
+ const u = (m = I(n, l, o)) == null ? void 0 : m.worldBounds;
212
+ return u ? [u] : [];
213
+ })
214
+ ), a = t ? O(t) : null;
215
+ return S({
216
+ nodeIds: e,
217
+ worldBounds: t,
218
+ boundsCenter: a,
219
+ pivot: { value: a, source: a ? "bounds-center" : "unknown" }
220
+ });
221
+ }
222
+ function Q(n, s, o) {
223
+ const e = w(n.root, s);
224
+ if (!e) return null;
225
+ const t = o ?? E(n, e), a = t ? T(t) : null, l = e.nodeType === "group" ? "GROUP_DIMENSIONS" : t ? a.some((u) => !Number.isFinite(u) || u <= 1e-12) ? "DEGENERATE_BOUNDS" : null : "BOUNDS_UNAVAILABLE";
226
+ return S({
227
+ nodeId: s,
228
+ revisionId: e.nodeType === "asset" ? e.assetRevisionId : e.nodeType === "visual" ? e.visualRevisionId : null,
229
+ units: "m",
230
+ source: o ? "runtime" : t ? "document" : "unknown",
231
+ dimensions: a ? a.map(
232
+ (u, m) => u * Math.abs(e.localTransform.scale[m])
233
+ ) : null,
234
+ sourceDimensions: a,
235
+ scale: e.localTransform.scale,
236
+ editable: l === null,
237
+ reason: l
238
+ });
239
+ }
240
+ function S(n) {
241
+ return v(_(n));
242
+ }
243
+ function R(n) {
244
+ return [n[0], n[1], n[2]];
245
+ }
246
+ function y(n, s) {
247
+ if (!n || n.some((o) => !Number.isFinite(o)))
248
+ throw new Error(s);
249
+ return R(n);
250
+ }
251
+ function j(n) {
252
+ const s = Math.hypot(...n);
253
+ if (!Number.isFinite(s) || s <= 1e-12) return null;
254
+ const o = n.map((t) => t / s), e = 1e-6;
255
+ return Math.abs(o[0] - 1) <= e && Math.abs(o[1]) <= e && Math.abs(o[2]) <= e ? "+X" : Math.abs(o[0]) <= e && Math.abs(o[1] - 1) <= e && Math.abs(o[2]) <= e ? "+Y" : Math.abs(o[0]) <= e && Math.abs(o[1]) <= e && Math.abs(o[2] - 1) <= e ? "+Z" : null;
256
+ }
257
+ function $(n, s, o) {
258
+ var b, f, g;
259
+ const e = V(n, s);
260
+ if (!e) return null;
261
+ const t = o == null ? void 0 : o.physicsRuntime, a = t ? t.bodies.filter((r) => t.worldKind === "asset-session" || r.instanceId === s).map((r) => {
262
+ var c;
263
+ return {
264
+ id: r.id,
265
+ name: r.name,
266
+ sourcePath: r.sourcePath,
267
+ motionType: r.motionType,
268
+ massKg: r.mass,
269
+ centerOfMassM: r.centerOfMass,
270
+ centerOfMassFrame: "world",
271
+ principalInertiaKgM2: r.inertia,
272
+ inertiaFrame: "body-principal",
273
+ inertiaOrientationWorld: ((c = r.inertiaOrientationWorld) == null ? void 0 : c.length) === 9 ? r.inertiaOrientationWorld : null
274
+ };
275
+ }) : null, l = t ? t.joints.filter((r) => t.worldKind === "asset-session" || r.instanceId === s).map((r) => {
276
+ var c;
277
+ return {
278
+ name: r.name,
279
+ type: r.type,
280
+ position: r.position,
281
+ velocity: r.velocity,
282
+ range: r.range,
283
+ axis: ((c = r.axisWorld) == null ? void 0 : c.length) === 3 ? r.axisWorld : null,
284
+ axisFrame: "world"
285
+ };
286
+ }) : null, u = A((b = o == null ? void 0 : o.visualDiagnostics) == null ? void 0 : b.usd), m = A(u == null ? void 0 : u.physics), d = m == null ? void 0 : m.colliders, p = Array.isArray(d) ? d.flatMap((r) => {
287
+ const c = A(r);
288
+ return typeof (c == null ? void 0 : c.path) == "string" ? [
289
+ {
290
+ path: c.path,
291
+ geometryType: typeof c.typeName == "string" ? c.typeName : null,
292
+ source: "asset-inspection"
293
+ }
294
+ ] : [];
295
+ }) : ((f = e.physics.colliderPrimPaths) == null ? void 0 : f.map((r) => ({
296
+ path: r,
297
+ geometryType: null,
298
+ source: "override"
299
+ }))) ?? null, h = {
300
+ nodeId: s,
301
+ coordinateSystem: n.coordinateSystem,
302
+ authored: { physics: e.physics, initialJoints: ((g = e.initialPose) == null ? void 0 : g.joints) ?? null },
303
+ colliders: p,
304
+ bodies: a,
305
+ joints: l,
306
+ runtime: t ? {
307
+ source: t.worldKind,
308
+ status: t.status,
309
+ time: t.time,
310
+ timestepSeconds: t.timestep
311
+ } : null,
312
+ unavailable: [
313
+ ...p ? [] : ["colliders"],
314
+ ...a ? [] : ["bodies"],
315
+ ...l ? [] : ["joints"]
316
+ ]
317
+ };
318
+ return v(_(h));
319
+ }
320
+ function A(n) {
321
+ return n && typeof n == "object" && !Array.isArray(n) ? n : null;
322
+ }
323
+ export {
324
+ G as D,
325
+ Z as N,
326
+ I as a,
327
+ $ as b,
328
+ H as c,
329
+ J as d,
330
+ E as e,
331
+ O as f,
332
+ Q as g,
333
+ Y as h,
334
+ K as n,
335
+ k as r,
336
+ F as t
337
+ };