@fps-games/editor 0.2.1-beta.3 → 0.2.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-info.json +44 -44
- package/dist/editor-commands/capabilities/assets.d.ts +8 -0
- package/dist/editor-commands/capabilities/assets.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/assets.js +41 -41
- package/dist/editor-commands/capabilities/assets.js.map +1 -0
- package/dist/editor-commands/capabilities/editor-state.d.ts +5 -0
- package/dist/editor-commands/capabilities/editor-state.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/editor-state.js +22 -22
- package/dist/editor-commands/capabilities/editor-state.js.map +1 -0
- package/dist/editor-commands/capabilities/hierarchy.d.ts +4 -0
- package/dist/editor-commands/capabilities/hierarchy.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/hierarchy.js +5 -5
- package/dist/editor-commands/capabilities/hierarchy.js.map +1 -0
- package/dist/editor-commands/capabilities/host-lifecycle.d.ts +11 -0
- package/dist/editor-commands/capabilities/host-lifecycle.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/host-lifecycle.js +149 -0
- package/dist/editor-commands/capabilities/host-lifecycle.js.map +1 -0
- package/dist/editor-commands/capabilities/prefabs.d.ts +5 -0
- package/dist/editor-commands/capabilities/prefabs.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/prefabs.js +93 -93
- package/dist/editor-commands/capabilities/prefabs.js.map +1 -0
- package/dist/editor-commands/capabilities/scene-objects.d.ts +8 -0
- package/dist/editor-commands/capabilities/scene-objects.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/scene-objects.js +480 -0
- package/dist/editor-commands/capabilities/scene-objects.js.map +1 -0
- package/dist/editor-commands/capabilities/selection.d.ts +5 -0
- package/dist/editor-commands/capabilities/selection.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/selection.js +60 -0
- package/dist/editor-commands/capabilities/selection.js.map +1 -0
- package/dist/editor-commands/capabilities/shadows.d.ts +5 -0
- package/dist/editor-commands/capabilities/shadows.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/shadows.js +74 -74
- package/dist/editor-commands/capabilities/shadows.js.map +1 -0
- package/dist/editor-commands/capabilities/transform.d.ts +5 -0
- package/dist/editor-commands/capabilities/transform.d.ts.map +1 -0
- package/dist/editor-commands/capabilities/transform.js +164 -0
- package/dist/editor-commands/capabilities/transform.js.map +1 -0
- package/dist/editor-commands/capabilities/ui-regions.d.ts +4 -0
- package/dist/editor-commands/capabilities/ui-regions.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/ui-regions.js +55 -57
- package/dist/editor-commands/capabilities/ui-regions.js.map +1 -0
- package/dist/editor-commands/capabilities/viewport.d.ts +5 -0
- package/dist/editor-commands/capabilities/viewport.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/capabilities/viewport.js +100 -100
- package/dist/editor-commands/capabilities/viewport.js.map +1 -0
- package/dist/editor-commands/command-sources.d.ts +7 -0
- package/dist/editor-commands/command-sources.d.ts.map +1 -0
- package/dist/editor-commands/command-sources.js +34 -0
- package/dist/editor-commands/command-sources.js.map +1 -0
- package/dist/editor-commands/diagnostics.d.ts +12 -0
- package/dist/editor-commands/diagnostics.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/diagnostics.js +4 -4
- package/dist/editor-commands/diagnostics.js.map +1 -0
- package/dist/{agent-bridge → editor-commands}/index.d.ts +1 -1
- package/dist/editor-commands/index.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/index.js +1 -1
- package/dist/editor-commands/index.js.map +1 -0
- package/dist/editor-commands/register.d.ts +4 -0
- package/dist/editor-commands/register.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/register.js +323 -286
- package/dist/editor-commands/register.js.map +1 -0
- package/dist/{agent-bridge → editor-commands}/shared.d.ts +80 -80
- package/dist/editor-commands/shared.d.ts.map +1 -0
- package/dist/{agent-bridge → editor-commands}/shared.js +29 -29
- package/dist/editor-commands/shared.js.map +1 -0
- package/dist/editor-commands/source-types.d.ts +110 -0
- package/dist/editor-commands/source-types.d.ts.map +1 -0
- package/dist/editor-commands/source-types.js.map +1 -0
- package/dist/editor-plugin-commands.d.ts +4 -0
- package/dist/editor-plugin-commands.d.ts.map +1 -0
- package/dist/editor-plugin-commands.js +18 -0
- package/dist/editor-plugin-commands.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/local-editor-commands.d.ts +2 -0
- package/dist/local-editor-commands.d.ts.map +1 -0
- package/dist/local-editor-commands.js +2 -0
- package/dist/local-editor-commands.js.map +1 -0
- package/dist/local-editor-harness.d.ts +35 -21
- package/dist/local-editor-harness.d.ts.map +1 -1
- package/dist/local-editor-harness.js +1721 -367
- package/dist/local-editor-harness.js.map +1 -1
- package/dist/local-editor-prefab-stage-transaction.d.ts +2 -1
- package/dist/local-editor-prefab-stage-transaction.d.ts.map +1 -1
- package/dist/local-editor-prefab-stage-transaction.js +6 -5
- package/dist/local-editor-prefab-stage-transaction.js.map +1 -1
- package/dist/local-editor-scene-view-interaction-runtime.d.ts.map +1 -1
- package/dist/local-editor-scene-view-interaction-runtime.js +2 -5
- package/dist/local-editor-scene-view-interaction-runtime.js.map +1 -1
- package/dist/playable-local-editor-entry.d.ts +10 -0
- package/dist/playable-local-editor-entry.d.ts.map +1 -1
- package/dist/playable-local-editor-entry.js +10 -2
- package/dist/playable-local-editor-entry.js.map +1 -1
- package/dist/playable-local-editor-host.d.ts +3 -32
- package/dist/playable-local-editor-host.d.ts.map +1 -1
- package/dist/playable-local-editor-host.js +6 -70
- package/dist/playable-local-editor-host.js.map +1 -1
- package/dist/playable-product-local-editor.d.ts +1 -2
- package/dist/playable-product-local-editor.d.ts.map +1 -1
- package/dist/playable-product-local-editor.js +0 -1
- package/dist/playable-product-local-editor.js.map +1 -1
- package/dist/playable-product-projection-preview.d.ts.map +1 -1
- package/dist/playable-product-projection-preview.js +1 -1
- package/dist/playable-product-projection-preview.js.map +1 -1
- package/dist/playable-product-scene-capabilities.d.ts +0 -2
- package/dist/playable-product-scene-capabilities.d.ts.map +1 -1
- package/dist/playable-product-scene-capabilities.js +33 -6
- package/dist/playable-product-scene-capabilities.js.map +1 -1
- package/dist/playable-runtime-babylon.d.ts +4 -0
- package/dist/playable-runtime-babylon.d.ts.map +1 -1
- package/dist/playable-runtime-babylon.js +4 -0
- package/dist/playable-runtime-babylon.js.map +1 -1
- package/dist/playable-sdk.d.ts +1 -1
- package/dist/playable-sdk.d.ts.map +1 -1
- package/dist/playable-sdk.js.map +1 -1
- package/dist/playable-standard-project.d.ts +0 -2
- package/dist/playable-standard-project.d.ts.map +1 -1
- package/dist/playable-standard-project.js +1 -2
- package/dist/playable-standard-project.js.map +1 -1
- package/dist/project-service-projection.d.ts +16 -0
- package/dist/project-service-projection.d.ts.map +1 -0
- package/dist/project-service-projection.js +67 -0
- package/dist/project-service-projection.js.map +1 -0
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.d.ts +18 -0
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.d.ts.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.js +54 -18
- package/node_modules/@fps-games/babylon-renderer/dist/post-process/babylon-default-pipeline.js.map +1 -1
- package/node_modules/@fps-games/babylon-renderer/package.json +9 -9
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +1 -0
- package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js +127 -13
- package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js +66 -1
- package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-babylon/package.json +6 -6
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.d.ts +32 -0
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.js +254 -0
- package/node_modules/@fps-games/editor-browser/dist/editor-command-service-client.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts +3 -1
- package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/index.js +2 -0
- package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.d.ts +68 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.js +650 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-command-center.js.map +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.d.ts +1 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.js +22 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-formal-surface-visibility.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.d.ts +8 -0
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.js +117 -6
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.d.ts +14 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.js +100 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-hierarchy-view.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +8 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +75 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +37 -12
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +25 -2
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +332 -107
- package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
- package/node_modules/@fps-games/editor-browser/package.json +7 -7
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.d.ts +107 -0
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.js +1211 -0
- package/node_modules/@fps-games/editor-core/dist/editor-authoring-host.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.d.ts +34 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.js +260 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-capability-adapter.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.d.ts +9 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.js +14 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-composed-authority.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.d.ts +18 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.js +113 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-observability.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.d.ts +82 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.js +1098 -0
- package/node_modules/@fps-games/editor-core/dist/editor-command-system.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.d.ts +6 -7
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.js +62 -103
- package/node_modules/@fps-games/editor-core/dist/editor-plugin-host.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.d.ts +30 -0
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.js +540 -0
- package/node_modules/@fps-games/editor-core/dist/editor-service-gateway.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.d.ts +9 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.js +61 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session-authority.js.map +1 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts +55 -0
- package/node_modules/@fps-games/editor-core/dist/editor-session.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/editor-session.js +247 -6
- package/node_modules/@fps-games/editor-core/dist/editor-session.js.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/index.d.ts +6 -2
- package/node_modules/@fps-games/editor-core/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-core/dist/index.js +6 -2
- package/node_modules/@fps-games/editor-core/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-core/package.json +6 -6
- package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-forge-play/dist/index.js +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/bridge-command/protocol.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/bridge-command/protocol.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js +41 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/document/helpers.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play-types.d.ts +27 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play-types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play-types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.js +214 -7
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/forge-play.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.js +11 -3
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/host-controller.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.d.ts +2 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.js +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/lifecycle.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/lifecycle.js +77 -31
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/lifecycle.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/types.d.ts +8 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.d.ts +21 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.js +90 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/asset-fields.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.d.ts +27 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.js +161 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/binding.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.d.ts +2 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.js +5 -92
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.d.ts +7 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.js +26 -9
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/scene-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.d.ts +9 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.js +19 -8
- package/node_modules/@fps-games/editor-playable-sdk/dist/material-binding/slot-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.d.ts +5 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.js +16 -4
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/material-override-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.d.ts +9 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.js +12 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/prefab-stage/stage-inspector.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.d.ts +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.js +10 -5
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/ground-decal.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.js +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.d.ts +17 -82
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.js +53 -57
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/project-host-services.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-session.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-session.js +3 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-session.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.d.ts +10 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.js +256 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-authoring-commands.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-scene-assembly.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-scene-assembly.js +7 -5
- package/node_modules/@fps-games/editor-playable-sdk/dist/product/standard-scene-assembly.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js +8 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.d.ts +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/inspectors.js +134 -12
- package/node_modules/@fps-games/editor-playable-sdk/dist/upgrade-doctor/inspectors.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-scene-workflow.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-scene-workflow.js +47 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-scene-workflow.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.d.ts +27 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.js +592 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/editor-service-vite.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts +3 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js +2 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/plugin.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/plugin.js +61 -6
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/plugin.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.d.ts +0 -2
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.js +1 -10
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-adapter.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js +21 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.d.ts +13 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.js +18 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-authoring-backend.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.d.ts +28 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.js +863 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-editor-service.js.map +1 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/types.d.ts +2 -0
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/types.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/types.js.map +1 -1
- package/node_modules/@fps-games/editor-playable-sdk/package.json +6 -6
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-capabilities.d.ts +1626 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-capabilities.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/{agent-bridge.js → editor-command-capabilities.js} +766 -620
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-capabilities.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.d.ts +69 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.js +22 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command-trace.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.d.ts +136 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.js +2 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-command.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.d.ts +225 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.d.ts.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.js +4 -0
- package/node_modules/@fps-games/editor-protocol/dist/editor-service.js.map +1 -0
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts +6 -3
- package/node_modules/@fps-games/editor-protocol/dist/index.d.ts.map +1 -1
- package/node_modules/@fps-games/editor-protocol/dist/index.js +6 -3
- package/node_modules/@fps-games/editor-protocol/dist/index.js.map +1 -1
- package/node_modules/@fps-games/editor-protocol/package.json +2 -2
- package/node_modules/@fps-games/editor-tooling/package.json +3 -3
- package/node_modules/@fps-games/editor-ui/package.json +1 -1
- package/node_modules/@fps-games/playable-assets/package.json +1 -1
- package/node_modules/@fps-games/playable-contracts/package.json +1 -1
- package/node_modules/@fps-games/playable-rendering/package.json +2 -2
- package/node_modules/@fps-games/playable-runtime/package.json +12 -12
- package/node_modules/@fps-games/playable-runtime-data/package.json +4 -4
- package/node_modules/@fps-games/playable-scene/package.json +2 -2
- package/node_modules/@fps-games/plugin-api/package.json +1 -1
- package/node_modules/@fps-games/plugin-assets/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-assets/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-assets/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-assets/package.json +6 -6
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.d.ts +1 -0
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.d.ts.map +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.js +78 -4
- package/node_modules/@fps-games/plugin-hierarchy/dist/kernel.js.map +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-hierarchy/package.json +5 -5
- package/node_modules/@fps-games/plugin-host/package.json +2 -2
- package/node_modules/@fps-games/plugin-markers/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-markers/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-markers/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-markers/package.json +5 -5
- package/node_modules/@fps-games/plugin-materials/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-materials/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-materials/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-materials/package.json +5 -5
- package/node_modules/@fps-games/plugin-rendering/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-rendering/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-rendering/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-rendering/package.json +5 -5
- package/node_modules/@fps-games/plugin-scene/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-scene/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-scene/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-scene/package.json +5 -5
- package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-shadow-map-experiment/package.json +5 -5
- package/node_modules/@fps-games/plugin-shadows/dist/version.d.ts +1 -1
- package/node_modules/@fps-games/plugin-shadows/dist/version.js +1 -1
- package/node_modules/@fps-games/plugin-shadows/dist/version.js.map +1 -1
- package/node_modules/@fps-games/plugin-shadows/package.json +7 -7
- package/package.json +23 -23
- package/dist/agent-bridge/capabilities/assets.d.ts +0 -8
- package/dist/agent-bridge/capabilities/assets.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/assets.js.map +0 -1
- package/dist/agent-bridge/capabilities/editor-state.d.ts +0 -5
- package/dist/agent-bridge/capabilities/editor-state.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/editor-state.js.map +0 -1
- package/dist/agent-bridge/capabilities/hierarchy.d.ts +0 -4
- package/dist/agent-bridge/capabilities/hierarchy.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/hierarchy.js.map +0 -1
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts +0 -11
- package/dist/agent-bridge/capabilities/host-lifecycle.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/host-lifecycle.js +0 -149
- package/dist/agent-bridge/capabilities/host-lifecycle.js.map +0 -1
- package/dist/agent-bridge/capabilities/prefabs.d.ts +0 -5
- package/dist/agent-bridge/capabilities/prefabs.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/prefabs.js.map +0 -1
- package/dist/agent-bridge/capabilities/scene-objects.d.ts +0 -8
- package/dist/agent-bridge/capabilities/scene-objects.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/scene-objects.js +0 -480
- package/dist/agent-bridge/capabilities/scene-objects.js.map +0 -1
- package/dist/agent-bridge/capabilities/selection.d.ts +0 -5
- package/dist/agent-bridge/capabilities/selection.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/selection.js +0 -60
- package/dist/agent-bridge/capabilities/selection.js.map +0 -1
- package/dist/agent-bridge/capabilities/shadows.d.ts +0 -5
- package/dist/agent-bridge/capabilities/shadows.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/shadows.js.map +0 -1
- package/dist/agent-bridge/capabilities/transform.d.ts +0 -5
- package/dist/agent-bridge/capabilities/transform.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/transform.js +0 -164
- package/dist/agent-bridge/capabilities/transform.js.map +0 -1
- package/dist/agent-bridge/capabilities/ui-regions.d.ts +0 -4
- package/dist/agent-bridge/capabilities/ui-regions.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/ui-regions.js.map +0 -1
- package/dist/agent-bridge/capabilities/viewport.d.ts +0 -5
- package/dist/agent-bridge/capabilities/viewport.d.ts.map +0 -1
- package/dist/agent-bridge/capabilities/viewport.js.map +0 -1
- package/dist/agent-bridge/capability-sources.d.ts +0 -7
- package/dist/agent-bridge/capability-sources.d.ts.map +0 -1
- package/dist/agent-bridge/capability-sources.js +0 -34
- package/dist/agent-bridge/capability-sources.js.map +0 -1
- package/dist/agent-bridge/diagnostics.d.ts +0 -12
- package/dist/agent-bridge/diagnostics.d.ts.map +0 -1
- package/dist/agent-bridge/diagnostics.js.map +0 -1
- package/dist/agent-bridge/index.d.ts.map +0 -1
- package/dist/agent-bridge/index.js.map +0 -1
- package/dist/agent-bridge/register.d.ts +0 -4
- package/dist/agent-bridge/register.d.ts.map +0 -1
- package/dist/agent-bridge/register.js.map +0 -1
- package/dist/agent-bridge/shared.d.ts.map +0 -1
- package/dist/agent-bridge/shared.js.map +0 -1
- package/dist/agent-bridge/source-types.d.ts +0 -110
- package/dist/agent-bridge/source-types.d.ts.map +0 -1
- package/dist/agent-bridge/source-types.js.map +0 -1
- package/dist/editor-plugin-agent-capabilities.d.ts +0 -4
- package/dist/editor-plugin-agent-capabilities.d.ts.map +0 -1
- package/dist/editor-plugin-agent-capabilities.js +0 -64
- package/dist/editor-plugin-agent-capabilities.js.map +0 -1
- package/dist/local-editor-agent-actions.d.ts +0 -43
- package/dist/local-editor-agent-actions.d.ts.map +0 -1
- package/dist/local-editor-agent-actions.js +0 -321
- package/dist/local-editor-agent-actions.js.map +0 -1
- package/dist/local-editor-agent-bridge-transport.d.ts +0 -129
- package/dist/local-editor-agent-bridge-transport.d.ts.map +0 -1
- package/dist/local-editor-agent-bridge-transport.js +0 -403
- package/dist/local-editor-agent-bridge-transport.js.map +0 -1
- package/dist/local-editor-agent-bridge.d.ts +0 -2
- package/dist/local-editor-agent-bridge.d.ts.map +0 -1
- package/dist/local-editor-agent-bridge.js +0 -2
- package/dist/local-editor-agent-bridge.js.map +0 -1
- package/dist/local-editor-agent-context.d.ts +0 -68
- package/dist/local-editor-agent-context.d.ts.map +0 -1
- package/dist/local-editor-agent-context.js +0 -716
- package/dist/local-editor-agent-context.js.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts +0 -22
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js +0 -106
- package/node_modules/@fps-games/editor-core/dist/agent-bridge.js.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.d.ts +0 -17
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.js +0 -14
- package/node_modules/@fps-games/editor-core/dist/agent-interaction.js.map +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.d.ts +0 -23
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.js +0 -47
- package/node_modules/@fps-games/editor-forge-play/dist/agent-transport.js.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.d.ts +0 -112
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.js +0 -159
- package/node_modules/@fps-games/editor-playable-sdk/dist/local-harness/agent-descriptions.js.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.d.ts +0 -15
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.js +0 -76
- package/node_modules/@fps-games/editor-playable-sdk/dist/vite/session-metadata.js.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts +0 -1622
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-bridge.js.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts +0 -68
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js +0 -23
- package/node_modules/@fps-games/editor-protocol/dist/agent-trace.js.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts +0 -187
- package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts.map +0 -1
- package/node_modules/@fps-games/editor-protocol/dist/agent.js +0 -5
- package/node_modules/@fps-games/editor-protocol/dist/agent.js.map +0 -1
- /package/dist/{agent-bridge → editor-commands}/source-types.js +0 -0
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
import { randomBytes, randomUUID, timingSafeEqual } from 'node:crypto';
|
|
2
|
+
import { readFileSync, unlinkSync } from 'node:fs';
|
|
3
|
+
import { chmod, mkdir, open, readFile, realpath, rename, unlink, } from 'node:fs/promises';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { createEditorServiceGateway, } from '@fps-games/editor-core';
|
|
6
|
+
import { EDITOR_SERVICE_DESCRIPTOR_SCHEMA_VERSION, EDITOR_SERVICE_GATEWAY_PATH, EDITOR_SERVICE_PROTOCOL_VERSION, } from '@fps-games/editor-protocol';
|
|
7
|
+
import { createFpsGameEditorProjectServiceAuthority } from './project-editor-service.js';
|
|
8
|
+
export const PLAYABLE_EDITOR_AGENT_RUNTIME_RELATIVE_PATH = path.join('node_modules', '.fps-editor', 'agent-runtime.json');
|
|
9
|
+
const ACTIVE_PROJECT_SERVICE_ROOTS = new Map();
|
|
10
|
+
const PROCESS_TERMINATION_SIGNALS = ['SIGHUP', 'SIGINT', 'SIGTERM'];
|
|
11
|
+
const PROCESS_OWNED_FILE_CLEANUPS = new Set();
|
|
12
|
+
const PROCESS_SIGNAL_HANDLERS = new Map();
|
|
13
|
+
let processExitCleanupInstalled = false;
|
|
14
|
+
export async function installPlayableEditorViteEditorService(input) {
|
|
15
|
+
if (input.options?.enabled === false)
|
|
16
|
+
return null;
|
|
17
|
+
const canonicalProjectRoot = await realpath(input.integration.projectRoot);
|
|
18
|
+
const descriptorPath = path.resolve(canonicalProjectRoot, PLAYABLE_EDITOR_AGENT_RUNTIME_RELATIVE_PATH);
|
|
19
|
+
assertDescriptorInsideProject(canonicalProjectRoot, descriptorPath);
|
|
20
|
+
const serviceInstanceId = input.credentials?.serviceInstanceId ?? randomUUID();
|
|
21
|
+
const token = input.credentials?.token ?? randomBytes(32).toString('base64url');
|
|
22
|
+
const tokenScopes = normalizeTokenScopes(input.options?.tokenScopes);
|
|
23
|
+
const startedAt = new Date().toISOString();
|
|
24
|
+
const activeOwner = ACTIVE_PROJECT_SERVICE_ROOTS.get(canonicalProjectRoot);
|
|
25
|
+
if (activeOwner)
|
|
26
|
+
throw new Error(`A live Editor Service already owns this project: ${activeOwner}.`);
|
|
27
|
+
ACTIVE_PROJECT_SERVICE_ROOTS.set(canonicalProjectRoot, serviceInstanceId);
|
|
28
|
+
let projectRootClaimed = true;
|
|
29
|
+
const releaseProcessProjectRoot = () => {
|
|
30
|
+
if (!projectRootClaimed)
|
|
31
|
+
return;
|
|
32
|
+
projectRootClaimed = false;
|
|
33
|
+
if (ACTIVE_PROJECT_SERVICE_ROOTS.get(canonicalProjectRoot) === serviceInstanceId) {
|
|
34
|
+
ACTIVE_PROJECT_SERVICE_ROOTS.delete(canonicalProjectRoot);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const descriptorDirectory = path.dirname(descriptorPath);
|
|
38
|
+
let projectLeaseOwner;
|
|
39
|
+
const projectLeasePath = `${descriptorPath}.owner`;
|
|
40
|
+
try {
|
|
41
|
+
await mkdir(descriptorDirectory, { recursive: true, mode: 0o700 });
|
|
42
|
+
await chmod(descriptorDirectory, 0o700);
|
|
43
|
+
assertDescriptorInsideProject(canonicalProjectRoot, await realpath(descriptorDirectory));
|
|
44
|
+
projectLeaseOwner = await claimDescriptorLock(projectLeasePath);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
releaseProcessProjectRoot();
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
let projectLeaseClaimed = true;
|
|
51
|
+
const cleanupOwnedFilesAtProcessExit = () => {
|
|
52
|
+
removeOwnedRuntimeDescriptorSync(descriptorPath, {
|
|
53
|
+
canonicalProjectRoot,
|
|
54
|
+
serviceInstanceId,
|
|
55
|
+
pid: process.pid,
|
|
56
|
+
token,
|
|
57
|
+
});
|
|
58
|
+
removeOwnedDescriptorLockSync(projectLeasePath, projectLeaseOwner);
|
|
59
|
+
};
|
|
60
|
+
const releaseProcessExitCleanup = registerProcessOwnedFileCleanup(cleanupOwnedFilesAtProcessExit);
|
|
61
|
+
const releaseProjectRoot = async () => {
|
|
62
|
+
if (!projectLeaseClaimed)
|
|
63
|
+
return;
|
|
64
|
+
projectLeaseClaimed = false;
|
|
65
|
+
try {
|
|
66
|
+
await removeOwnedDescriptorLock(projectLeasePath, projectLeaseOwner);
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
releaseProcessProjectRoot();
|
|
70
|
+
releaseProcessExitCleanup();
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
let authority;
|
|
74
|
+
try {
|
|
75
|
+
authority = await createFpsGameEditorProjectServiceAuthority({
|
|
76
|
+
projectRoot: canonicalProjectRoot,
|
|
77
|
+
project: input.options?.project,
|
|
78
|
+
serviceInstanceId,
|
|
79
|
+
server: input.server,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
await releaseProjectRoot();
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
let gateway;
|
|
87
|
+
let releaseBrowserCommandForwarder;
|
|
88
|
+
try {
|
|
89
|
+
gateway = createEditorServiceGateway({
|
|
90
|
+
canonicalProjectRoot,
|
|
91
|
+
packageVersion: input.integration.buildInfo.version,
|
|
92
|
+
buildKey: input.integration.buildInfo.cacheKey,
|
|
93
|
+
startedAt,
|
|
94
|
+
host: authority.host,
|
|
95
|
+
readTraces: authority.readTraces,
|
|
96
|
+
readDocumentExport: authority.readDocumentExport,
|
|
97
|
+
});
|
|
98
|
+
releaseBrowserCommandForwarder = authority.bindBrowserCommandForwarder(gateway.forwardBrowserCommand);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
await authority.dispose().catch(() => undefined);
|
|
102
|
+
await releaseProjectRoot();
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
const gatewayPath = EDITOR_SERVICE_GATEWAY_PATH;
|
|
106
|
+
let descriptor = null;
|
|
107
|
+
let descriptorPublication = null;
|
|
108
|
+
let disposal = null;
|
|
109
|
+
let disposed = false;
|
|
110
|
+
const gatewayMiddleware = async (request, response, next) => {
|
|
111
|
+
const requestUrl = new URL(request.url ?? '', 'http://fps-editor.local');
|
|
112
|
+
if (requestUrl.pathname !== gatewayPath)
|
|
113
|
+
return next();
|
|
114
|
+
setGatewayHeaders(request, response);
|
|
115
|
+
if (request.method === 'OPTIONS') {
|
|
116
|
+
response.statusCode = 204;
|
|
117
|
+
response.end();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (request.method !== 'POST') {
|
|
121
|
+
sendJson(response, 405, { ok: false, diagnostics: [{ severity: 'error', source: 'transport', code: 'http.methodNotAllowed', message: 'Editor Service Gateway requires POST.' }] });
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (!hasBearerToken(request.headers?.authorization, token)) {
|
|
125
|
+
sendJson(response, 401, { ok: false, diagnostics: [{ severity: 'error', source: 'transport', code: 'auth.invalidToken', message: 'Editor Service bearer token is invalid.' }] });
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
try {
|
|
129
|
+
const gatewayRequest = await readJsonBody(request);
|
|
130
|
+
const result = await gateway.handle(gatewayRequest, tokenScopes);
|
|
131
|
+
sendJson(response, result.ok ? 200 : 400, result);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
sendJson(response, 400, {
|
|
135
|
+
ok: false,
|
|
136
|
+
diagnostics: [{
|
|
137
|
+
severity: 'error',
|
|
138
|
+
source: 'transport',
|
|
139
|
+
code: 'request.invalidJson',
|
|
140
|
+
message: error instanceof Error ? error.message : String(error),
|
|
141
|
+
}],
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
try {
|
|
146
|
+
input.server.middlewares.use(gatewayMiddleware);
|
|
147
|
+
const middlewareStack = input.server.middlewares.stack;
|
|
148
|
+
const ownMiddlewareIndex = middlewareStack?.findIndex(layer => layer.handle === gatewayMiddleware) ?? -1;
|
|
149
|
+
const fallbackIndex = middlewareStack?.findIndex(layer => /vite(?:SpaFallback|IndexHtml|404)Middleware/.test(layer.handle?.name ?? '')) ?? -1;
|
|
150
|
+
if (middlewareStack && ownMiddlewareIndex >= 0 && fallbackIndex >= 0 && ownMiddlewareIndex > fallbackIndex) {
|
|
151
|
+
const [layer] = middlewareStack.splice(ownMiddlewareIndex, 1);
|
|
152
|
+
middlewareStack.splice(fallbackIndex, 0, layer);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
releaseBrowserCommandForwarder();
|
|
157
|
+
gateway.dispose();
|
|
158
|
+
await authority.dispose().catch(() => undefined);
|
|
159
|
+
await releaseProjectRoot();
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
const publishDescriptor = () => {
|
|
163
|
+
if (disposed || descriptor)
|
|
164
|
+
return Promise.resolve();
|
|
165
|
+
if (descriptorPublication)
|
|
166
|
+
return descriptorPublication;
|
|
167
|
+
const publication = (async () => {
|
|
168
|
+
const endpoint = resolveServerEndpoint(input.server, gatewayPath);
|
|
169
|
+
const candidate = {
|
|
170
|
+
schemaVersion: EDITOR_SERVICE_DESCRIPTOR_SCHEMA_VERSION,
|
|
171
|
+
protocolVersion: EDITOR_SERVICE_PROTOCOL_VERSION,
|
|
172
|
+
canonicalProjectRoot,
|
|
173
|
+
serviceInstanceId,
|
|
174
|
+
pid: process.pid,
|
|
175
|
+
endpoint,
|
|
176
|
+
startedAt,
|
|
177
|
+
packageName: '@fps-games/editor',
|
|
178
|
+
packageVersion: input.integration.buildInfo.version,
|
|
179
|
+
buildKey: input.integration.buildInfo.cacheKey,
|
|
180
|
+
token,
|
|
181
|
+
tokenScopes,
|
|
182
|
+
};
|
|
183
|
+
await claimRuntimeDescriptor(descriptorPath, candidate);
|
|
184
|
+
descriptor = candidate;
|
|
185
|
+
if (disposed) {
|
|
186
|
+
await removeOwnedDescriptor(descriptorPath, candidate);
|
|
187
|
+
descriptor = null;
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
input.logger?.info?.(`[fps-editor] Project Editor Service ready at ${endpoint}`);
|
|
191
|
+
})();
|
|
192
|
+
const trackedPublication = publication.finally(() => {
|
|
193
|
+
if (descriptorPublication === trackedPublication)
|
|
194
|
+
descriptorPublication = null;
|
|
195
|
+
});
|
|
196
|
+
descriptorPublication = trackedPublication;
|
|
197
|
+
return trackedPublication;
|
|
198
|
+
};
|
|
199
|
+
const onListening = () => {
|
|
200
|
+
void publishDescriptor().catch((error) => {
|
|
201
|
+
input.logger?.error?.(`[fps-editor] Failed to publish Agent runtime descriptor: ${formatError(error)}`);
|
|
202
|
+
void dispose();
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
const onClose = () => { void dispose(); };
|
|
206
|
+
input.server.httpServer?.once('close', onClose);
|
|
207
|
+
if (input.server.httpServer?.listening) {
|
|
208
|
+
try {
|
|
209
|
+
await publishDescriptor();
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
await dispose().catch(() => undefined);
|
|
213
|
+
throw error;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
else
|
|
217
|
+
input.server.httpServer?.once('listening', onListening);
|
|
218
|
+
async function dispose() {
|
|
219
|
+
if (disposal)
|
|
220
|
+
return disposal;
|
|
221
|
+
disposed = true;
|
|
222
|
+
disposal = (async () => {
|
|
223
|
+
input.server.httpServer?.off('listening', onListening);
|
|
224
|
+
input.server.httpServer?.off('close', onClose);
|
|
225
|
+
const activeMiddlewareStack = input.server.middlewares.stack;
|
|
226
|
+
const middlewareIndex = activeMiddlewareStack?.findIndex(layer => layer.handle === gatewayMiddleware) ?? -1;
|
|
227
|
+
if (middlewareIndex >= 0)
|
|
228
|
+
activeMiddlewareStack.splice(middlewareIndex, 1);
|
|
229
|
+
const errors = [];
|
|
230
|
+
try {
|
|
231
|
+
releaseBrowserCommandForwarder();
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
errors.push(error);
|
|
235
|
+
}
|
|
236
|
+
gateway.dispose();
|
|
237
|
+
try {
|
|
238
|
+
await descriptorPublication;
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
errors.push(error);
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
if (descriptor)
|
|
245
|
+
await removeOwnedDescriptor(descriptorPath, descriptor);
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
errors.push(error);
|
|
249
|
+
}
|
|
250
|
+
try {
|
|
251
|
+
await authority.dispose();
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
errors.push(error);
|
|
255
|
+
}
|
|
256
|
+
finally {
|
|
257
|
+
try {
|
|
258
|
+
await releaseProjectRoot();
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
errors.push(error);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (errors.length) {
|
|
265
|
+
const error = new Error('Editor Service disposal failed.');
|
|
266
|
+
error.errors = errors;
|
|
267
|
+
throw error;
|
|
268
|
+
}
|
|
269
|
+
})();
|
|
270
|
+
return disposal;
|
|
271
|
+
}
|
|
272
|
+
return Object.freeze({ descriptorPath, serviceInstanceId, dispose });
|
|
273
|
+
}
|
|
274
|
+
async function claimRuntimeDescriptor(descriptorPath, descriptor) {
|
|
275
|
+
const directory = path.dirname(descriptorPath);
|
|
276
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
277
|
+
assertDescriptorInsideProject(descriptor.canonicalProjectRoot, await realpath(directory));
|
|
278
|
+
const lockPath = `${descriptorPath}.lock`;
|
|
279
|
+
const lockOwner = await claimDescriptorLock(lockPath);
|
|
280
|
+
try {
|
|
281
|
+
await assertOwnedDescriptorLock(lockPath, lockOwner);
|
|
282
|
+
await assertDescriptorAvailable(descriptorPath, descriptor.canonicalProjectRoot);
|
|
283
|
+
const temporaryPath = `${descriptorPath}.${process.pid}.${randomUUID()}.tmp`;
|
|
284
|
+
let committed = false;
|
|
285
|
+
try {
|
|
286
|
+
const handle = await open(temporaryPath, 'wx', 0o600);
|
|
287
|
+
try {
|
|
288
|
+
await handle.writeFile(`${JSON.stringify(descriptor, null, 2)}\n`, 'utf8');
|
|
289
|
+
await handle.sync();
|
|
290
|
+
}
|
|
291
|
+
finally {
|
|
292
|
+
await handle.close();
|
|
293
|
+
}
|
|
294
|
+
await chmod(temporaryPath, 0o600);
|
|
295
|
+
await assertOwnedDescriptorLock(lockPath, lockOwner);
|
|
296
|
+
await rename(temporaryPath, descriptorPath);
|
|
297
|
+
committed = true;
|
|
298
|
+
}
|
|
299
|
+
finally {
|
|
300
|
+
if (!committed)
|
|
301
|
+
await unlink(temporaryPath).catch(() => undefined);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
finally {
|
|
305
|
+
await removeOwnedDescriptorLock(lockPath, lockOwner);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
function registerProcessOwnedFileCleanup(cleanup) {
|
|
309
|
+
PROCESS_OWNED_FILE_CLEANUPS.add(cleanup);
|
|
310
|
+
installProcessOwnedFileCleanupHooks();
|
|
311
|
+
let registered = true;
|
|
312
|
+
return () => {
|
|
313
|
+
if (!registered)
|
|
314
|
+
return;
|
|
315
|
+
registered = false;
|
|
316
|
+
PROCESS_OWNED_FILE_CLEANUPS.delete(cleanup);
|
|
317
|
+
if (PROCESS_OWNED_FILE_CLEANUPS.size === 0)
|
|
318
|
+
removeProcessOwnedFileCleanupHooks();
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
function installProcessOwnedFileCleanupHooks() {
|
|
322
|
+
if (processExitCleanupInstalled)
|
|
323
|
+
return;
|
|
324
|
+
processExitCleanupInstalled = true;
|
|
325
|
+
process.once('exit', cleanupProcessOwnedFiles);
|
|
326
|
+
for (const signal of PROCESS_TERMINATION_SIGNALS) {
|
|
327
|
+
const handler = () => {
|
|
328
|
+
cleanupProcessOwnedFiles();
|
|
329
|
+
removeProcessOwnedFileCleanupHooks();
|
|
330
|
+
queueMicrotask(() => {
|
|
331
|
+
try {
|
|
332
|
+
process.kill(process.pid, signal);
|
|
333
|
+
}
|
|
334
|
+
catch {
|
|
335
|
+
// The process may already be exiting through another signal handler.
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
PROCESS_SIGNAL_HANDLERS.set(signal, handler);
|
|
340
|
+
process.once(signal, handler);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function removeProcessOwnedFileCleanupHooks() {
|
|
344
|
+
if (!processExitCleanupInstalled)
|
|
345
|
+
return;
|
|
346
|
+
processExitCleanupInstalled = false;
|
|
347
|
+
process.off('exit', cleanupProcessOwnedFiles);
|
|
348
|
+
for (const [signal, handler] of PROCESS_SIGNAL_HANDLERS) {
|
|
349
|
+
process.off(signal, handler);
|
|
350
|
+
}
|
|
351
|
+
PROCESS_SIGNAL_HANDLERS.clear();
|
|
352
|
+
}
|
|
353
|
+
function cleanupProcessOwnedFiles() {
|
|
354
|
+
for (const cleanup of PROCESS_OWNED_FILE_CLEANUPS)
|
|
355
|
+
cleanup();
|
|
356
|
+
}
|
|
357
|
+
function removeOwnedRuntimeDescriptorSync(descriptorPath, owner) {
|
|
358
|
+
try {
|
|
359
|
+
const current = JSON.parse(readFileSync(descriptorPath, 'utf8'));
|
|
360
|
+
if (current.canonicalProjectRoot !== owner.canonicalProjectRoot
|
|
361
|
+
|| current.serviceInstanceId !== owner.serviceInstanceId
|
|
362
|
+
|| current.pid !== owner.pid
|
|
363
|
+
|| current.token !== owner.token)
|
|
364
|
+
return;
|
|
365
|
+
unlinkSync(descriptorPath);
|
|
366
|
+
}
|
|
367
|
+
catch {
|
|
368
|
+
// Process exit cleanup is best effort. Stale-owner recovery remains authoritative.
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
function removeOwnedDescriptorLockSync(lockPath, owner) {
|
|
372
|
+
try {
|
|
373
|
+
const current = parseDescriptorLockOwner(readFileSync(lockPath, 'utf8'));
|
|
374
|
+
if (!current || current.pid !== owner.pid || current.token !== owner.token)
|
|
375
|
+
return;
|
|
376
|
+
unlinkSync(lockPath);
|
|
377
|
+
}
|
|
378
|
+
catch {
|
|
379
|
+
// Process exit cleanup is best effort. Stale-owner recovery remains authoritative.
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
async function claimDescriptorLock(lockPath) {
|
|
383
|
+
const owner = { pid: process.pid, token: randomUUID() };
|
|
384
|
+
const serialized = `${JSON.stringify(owner)}\n`;
|
|
385
|
+
for (let attempt = 0; attempt < 8; attempt += 1) {
|
|
386
|
+
try {
|
|
387
|
+
const handle = await open(lockPath, 'wx', 0o600);
|
|
388
|
+
try {
|
|
389
|
+
await handle.writeFile(serialized, 'utf8');
|
|
390
|
+
await handle.chmod(0o600);
|
|
391
|
+
}
|
|
392
|
+
finally {
|
|
393
|
+
await handle.close();
|
|
394
|
+
}
|
|
395
|
+
return owner;
|
|
396
|
+
}
|
|
397
|
+
catch (error) {
|
|
398
|
+
if (error?.code !== 'EEXIST')
|
|
399
|
+
throw error;
|
|
400
|
+
}
|
|
401
|
+
const observed = await readFile(lockPath, 'utf8').catch(() => null);
|
|
402
|
+
if (observed === null)
|
|
403
|
+
continue;
|
|
404
|
+
const existing = parseDescriptorLockOwner(observed);
|
|
405
|
+
if (!existing || isProcessAlive(existing.pid)) {
|
|
406
|
+
throw new Error(`Editor Service descriptor lock has an ambiguous live owner at ${lockPath}.`);
|
|
407
|
+
}
|
|
408
|
+
const quarantine = `${lockPath}.stale.${process.pid}.${randomUUID()}`;
|
|
409
|
+
try {
|
|
410
|
+
await rename(lockPath, quarantine);
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
if (error?.code === 'ENOENT')
|
|
414
|
+
continue;
|
|
415
|
+
throw error;
|
|
416
|
+
}
|
|
417
|
+
const moved = await readFile(quarantine, 'utf8').catch(() => null);
|
|
418
|
+
if (moved !== observed) {
|
|
419
|
+
await rename(quarantine, lockPath).catch(() => undefined);
|
|
420
|
+
throw new Error(`Editor Service descriptor lock changed during stale-owner recovery at ${lockPath}.`);
|
|
421
|
+
}
|
|
422
|
+
await unlink(quarantine).catch(() => undefined);
|
|
423
|
+
}
|
|
424
|
+
throw new Error(`Editor Service descriptor lock could not be claimed at ${lockPath}.`);
|
|
425
|
+
}
|
|
426
|
+
function parseDescriptorLockOwner(source) {
|
|
427
|
+
try {
|
|
428
|
+
const value = JSON.parse(source);
|
|
429
|
+
return Number.isSafeInteger(value?.pid) && value.pid > 0 && typeof value.token === 'string' && value.token
|
|
430
|
+
? value
|
|
431
|
+
: null;
|
|
432
|
+
}
|
|
433
|
+
catch {
|
|
434
|
+
const legacyPid = Number(source.trim());
|
|
435
|
+
return Number.isSafeInteger(legacyPid) && legacyPid > 0
|
|
436
|
+
? { pid: legacyPid, token: `legacy:${legacyPid}` }
|
|
437
|
+
: null;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
async function assertOwnedDescriptorLock(lockPath, owner) {
|
|
441
|
+
const current = parseDescriptorLockOwner(await readFile(lockPath, 'utf8').catch(() => ''));
|
|
442
|
+
if (!current || current.pid !== owner.pid || current.token !== owner.token) {
|
|
443
|
+
throw new Error(`Editor Service descriptor lock ownership was lost at ${lockPath}.`);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
async function removeOwnedDescriptorLock(lockPath, owner) {
|
|
447
|
+
const current = parseDescriptorLockOwner(await readFile(lockPath, 'utf8').catch(() => ''));
|
|
448
|
+
if (current?.pid === owner.pid && current.token === owner.token) {
|
|
449
|
+
await unlink(lockPath).catch(() => undefined);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
async function assertDescriptorAvailable(descriptorPath, canonicalProjectRoot) {
|
|
453
|
+
const existing = await readDescriptor(descriptorPath);
|
|
454
|
+
if (!existing)
|
|
455
|
+
return;
|
|
456
|
+
if (existing.canonicalProjectRoot !== canonicalProjectRoot) {
|
|
457
|
+
throw new Error(`Editor Service descriptor project identity mismatch at ${descriptorPath}.`);
|
|
458
|
+
}
|
|
459
|
+
if (await isDescriptorHealthy(existing)) {
|
|
460
|
+
throw new Error(`A live Editor Service already owns this project: ${existing.serviceInstanceId}.`);
|
|
461
|
+
}
|
|
462
|
+
if (isProcessAlive(existing.pid)) {
|
|
463
|
+
throw new Error(`A live Editor Service owner is temporarily unreachable; refusing to replace ${existing.serviceInstanceId}.`);
|
|
464
|
+
}
|
|
465
|
+
await unlink(descriptorPath).catch((error) => {
|
|
466
|
+
if (error?.code !== 'ENOENT')
|
|
467
|
+
throw error;
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
async function readDescriptor(descriptorPath) {
|
|
471
|
+
try {
|
|
472
|
+
const value = JSON.parse(await readFile(descriptorPath, 'utf8'));
|
|
473
|
+
if (!value || typeof value !== 'object' || typeof value.serviceInstanceId !== 'string'
|
|
474
|
+
|| typeof value.canonicalProjectRoot !== 'string' || typeof value.endpoint !== 'string'
|
|
475
|
+
|| typeof value.token !== 'string' || !Number.isSafeInteger(value.pid)) {
|
|
476
|
+
throw new Error(`Editor Service runtime descriptor is malformed at ${descriptorPath}.`);
|
|
477
|
+
}
|
|
478
|
+
return value;
|
|
479
|
+
}
|
|
480
|
+
catch (error) {
|
|
481
|
+
if (error?.code === 'ENOENT')
|
|
482
|
+
return null;
|
|
483
|
+
throw error;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
async function isDescriptorHealthy(descriptor) {
|
|
487
|
+
if (!isProcessAlive(descriptor.pid))
|
|
488
|
+
return false;
|
|
489
|
+
const controller = new AbortController();
|
|
490
|
+
const timer = setTimeout(() => controller.abort(), 750);
|
|
491
|
+
try {
|
|
492
|
+
const response = await fetch(descriptor.endpoint, {
|
|
493
|
+
method: 'POST',
|
|
494
|
+
headers: { authorization: `Bearer ${descriptor.token}`, 'content-type': 'application/json' },
|
|
495
|
+
body: JSON.stringify({ kind: 'status' }),
|
|
496
|
+
signal: controller.signal,
|
|
497
|
+
});
|
|
498
|
+
if (!response.ok)
|
|
499
|
+
return false;
|
|
500
|
+
const body = await response.json();
|
|
501
|
+
return body?.ok === true
|
|
502
|
+
&& body?.kind === 'status'
|
|
503
|
+
&& body?.status?.serviceInstanceId === descriptor.serviceInstanceId
|
|
504
|
+
&& body?.status?.canonicalProjectRoot === descriptor.canonicalProjectRoot
|
|
505
|
+
&& body?.status?.protocolVersion === descriptor.protocolVersion;
|
|
506
|
+
}
|
|
507
|
+
catch {
|
|
508
|
+
return false;
|
|
509
|
+
}
|
|
510
|
+
finally {
|
|
511
|
+
clearTimeout(timer);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
function isProcessAlive(pid) {
|
|
515
|
+
try {
|
|
516
|
+
process.kill(pid, 0);
|
|
517
|
+
return true;
|
|
518
|
+
}
|
|
519
|
+
catch (error) {
|
|
520
|
+
return error?.code === 'EPERM';
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
async function removeOwnedDescriptor(descriptorPath, owner) {
|
|
524
|
+
const current = await readDescriptor(descriptorPath);
|
|
525
|
+
if (!current || current.serviceInstanceId !== owner.serviceInstanceId || current.token !== owner.token)
|
|
526
|
+
return;
|
|
527
|
+
await unlink(descriptorPath).catch((error) => {
|
|
528
|
+
if (error?.code !== 'ENOENT')
|
|
529
|
+
throw error;
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
function resolveServerEndpoint(server, gatewayPath) {
|
|
533
|
+
const address = server.httpServer?.address();
|
|
534
|
+
if (!address || typeof address === 'string')
|
|
535
|
+
throw new Error('Vite HTTP server address is unavailable.');
|
|
536
|
+
return `http://127.0.0.1:${address.port}${gatewayPath}`;
|
|
537
|
+
}
|
|
538
|
+
function normalizeTokenScopes(value) {
|
|
539
|
+
const defaults = ['read', 'write'];
|
|
540
|
+
const scopes = [...new Set(value ?? defaults)];
|
|
541
|
+
if (scopes.length === 0 || scopes.some(scope => scope !== 'read' && scope !== 'write')) {
|
|
542
|
+
throw new Error('Editor Service token scopes must contain read or write.');
|
|
543
|
+
}
|
|
544
|
+
return Object.freeze(scopes);
|
|
545
|
+
}
|
|
546
|
+
function assertDescriptorInsideProject(projectRoot, descriptorPath) {
|
|
547
|
+
const relative = path.relative(projectRoot, descriptorPath);
|
|
548
|
+
if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
|
549
|
+
throw new Error('Editor Service runtime descriptor must be inside the canonical project root.');
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
function hasBearerToken(header, expected) {
|
|
553
|
+
if (typeof header !== 'string' || !header.startsWith('Bearer '))
|
|
554
|
+
return false;
|
|
555
|
+
const received = Buffer.from(header.slice('Bearer '.length), 'utf8');
|
|
556
|
+
const target = Buffer.from(expected, 'utf8');
|
|
557
|
+
return received.length === target.length && timingSafeEqual(received, target);
|
|
558
|
+
}
|
|
559
|
+
async function readJsonBody(request) {
|
|
560
|
+
const chunks = [];
|
|
561
|
+
let bytes = 0;
|
|
562
|
+
for await (const chunk of request) {
|
|
563
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
564
|
+
bytes += buffer.byteLength;
|
|
565
|
+
if (bytes > 1024 * 1024)
|
|
566
|
+
throw new Error('Editor Service request body exceeds 1 MiB.');
|
|
567
|
+
chunks.push(buffer);
|
|
568
|
+
}
|
|
569
|
+
if (chunks.length === 0)
|
|
570
|
+
throw new Error('Editor Service request body is required.');
|
|
571
|
+
return JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
572
|
+
}
|
|
573
|
+
function setGatewayHeaders(request, response) {
|
|
574
|
+
response.setHeader('Cache-Control', 'no-store');
|
|
575
|
+
response.setHeader('Content-Type', 'application/json; charset=utf-8');
|
|
576
|
+
response.setHeader('X-Content-Type-Options', 'nosniff');
|
|
577
|
+
response.setHeader('Access-Control-Allow-Headers', 'authorization, content-type');
|
|
578
|
+
response.setHeader('Access-Control-Allow-Methods', 'POST, OPTIONS');
|
|
579
|
+
const origin = typeof request.headers?.origin === 'string' ? request.headers.origin : undefined;
|
|
580
|
+
if (origin) {
|
|
581
|
+
response.setHeader('Access-Control-Allow-Origin', origin);
|
|
582
|
+
response.setHeader('Vary', 'Origin');
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
function sendJson(response, statusCode, value) {
|
|
586
|
+
response.statusCode = statusCode;
|
|
587
|
+
response.end(`${JSON.stringify(value)}\n`);
|
|
588
|
+
}
|
|
589
|
+
function formatError(error) {
|
|
590
|
+
return error instanceof Error ? error.message : String(error);
|
|
591
|
+
}
|
|
592
|
+
//# sourceMappingURL=editor-service-vite.js.map
|