@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 @@
|
|
|
1
|
+
{"version":3,"file":"editor-authoring-host.js","sourceRoot":"","sources":["../src/editor-authoring-host.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,6BAA6B,GAS9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,yBAAyB,GAQ1B,MAAM,4BAA4B,CAAC;AAWpC,OAAO,EACL,mCAAmC,EACnC,gCAAgC,EAChC,kCAAkC,EAClC,kCAAkC,GACnC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAwC9F,MAAM,sCAAsC,GAAG,MAAM,CAAC,mDAAmD,CAAC,CAAC;AAK3G,iFAAiF;AACjF,MAAM,UAAU,uCAAuC,CACrD,MAAe,EACf,OAAsB;IAEtB,IAAI,CAAC,MAAM,IAAI,OAAO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E,KAAa;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,eAAe,CAAC,CAAC;IAC/G,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAyB,EAAE,QAAgB;IAC3E,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;AACnE,CAAC","sourcesContent":["import {\n EDITOR_COMMAND_SCHEMA_VERSION,\n type EditorAuthoringEvent,\n type EditorAuthoringEventReadResult,\n type EditorAuthoringSnapshot,\n type EditorCommandDiagnostic,\n type EditorCommandExecutionResult,\n type EditorCommandInvocation,\n type EditorCommandJsonValue,\n type EditorCommandManifest,\n} from '@fps-games/editor-protocol';\nimport {\n createEditorCommandSystem,\n type CreateEditorCommandSystemOptions,\n type EditorCommandHandlerContext,\n type EditorCommandHandlerOutcome,\n type EditorCommandClient,\n type EditorCommandInvocationHandle,\n type EditorCommandRegistration,\n type EditorCommandSystem,\n} from './editor-command-system.js';\nimport type {\n AuthoringSourceDescriptor,\n} from './authoring-source.js';\nimport type {\n DocumentCommand,\n EditorSession,\n EditorSessionDispatchOptions,\n EditorSessionState,\n EditorSessionTransaction,\n} from './editor-session.js';\nimport {\n callWithEditorSessionWriteAuthority,\n claimEditorSessionWriteAuthority,\n releaseEditorSessionWriteAuthority,\n runWithEditorSessionWriteAuthority,\n} from './editor-session-authority.js';\nimport { authorizeCommandComposedRegistration } from './editor-command-composed-authority.js';\n\nexport interface EditorAuthoringHostCommandContext<TDocument, TPatch>\n extends EditorCommandHandlerContext {\n readonly session: EditorSession<TDocument, TPatch>;\n dispatch(\n command: DocumentCommand<TDocument, TPatch>,\n options?: EditorSessionDispatchOptions,\n ): EditorSessionState<TDocument>;\n}\n\nexport interface EditorAuthoringHostCommandRegistration<TDocument, TPatch, TInput = unknown, TOutput = unknown>\n extends Omit<EditorCommandRegistration<TInput, TOutput>, 'handler' | 'authorityTransaction'> {\n /**\n * Defaults to the active document revision. Transaction commands may bind\n * expectedRevision.document to their own stored transaction checkpoint.\n */\n readonly expectedRevisionPolicy?: 'current-document' | 'handler-validated';\n readonly handler: (\n input: TInput,\n context: EditorAuthoringHostCommandContext<TDocument, TPatch>,\n ) => EditorCommandHandlerOutcome<TOutput> | Promise<EditorCommandHandlerOutcome<TOutput>>;\n}\n\nexport interface CreateEditorAuthoringHostOptions<TDocument, TPatch> {\n readonly serviceInstanceId: string;\n readonly session: EditorSession<TDocument, TPatch>;\n readonly commandSystem?: EditorCommandSystem;\n readonly commandSystemOptions?: CreateEditorCommandSystemOptions;\n readonly eventLimit?: number;\n readonly now?: () => number;\n /** Defaults to true. Product hosts may reuse an injected Command System across document sessions. */\n readonly disposeCommandSystem?: boolean;\n}\n\n/** Opaque, operation-scoped access issued only to a command handler already holding the Host FIFO. */\nexport interface EditorAuthoringHostSerializedAccess {\n readonly serviceInstanceId: string;\n}\n\nconst CALL_WITH_SERIALIZED_SESSION_AUTHORITY = Symbol('fps.editor.call-with-serialized-session-authority');\ntype InternalSerializedAccess = EditorAuthoringHostSerializedAccess & {\n readonly [CALL_WITH_SERIALIZED_SESSION_AUTHORITY]: <TResult>(handler: () => TResult) => TResult;\n};\n\n/** @internal Adapter used by command handlers that already own the Host FIFO. */\nexport function callWithEditorAuthoringSerializedAccess<TResult>(\n access: unknown,\n handler: () => TResult,\n): TResult {\n if (!access || typeof access !== 'object'\n || !(CALL_WITH_SERIALIZED_SESSION_AUTHORITY in access)) {\n throw new Error('Editor Authoring Host serialized access is invalid or expired.');\n }\n return (access as InternalSerializedAccess)[CALL_WITH_SERIALIZED_SESSION_AUTHORITY](handler);\n}\n\n/** @internal Operation-scoped Session façade for a handler that already owns serialized Host access. */\nexport function createEditorAuthoringSerializedSessionView<TDocument, TPatch>(\n session: EditorSession<TDocument, TPatch>,\n serializedAccess: unknown,\n): EditorSession<TDocument, TPatch> {\n return createOperationScopedSessionView(\n session,\n () => callWithEditorAuthoringSerializedAccess(serializedAccess, () => undefined),\n handler => callWithEditorAuthoringSerializedAccess(serializedAccess, handler),\n );\n}\n\nexport interface EditorAuthoringHost<TDocument, TPatch> {\n readonly serviceInstanceId: string;\n readonly commandSystem: EditorCommandClient;\n registerCommand<TInput = unknown, TOutput = unknown>(\n registration: EditorAuthoringHostCommandRegistration<TDocument, TPatch, TInput, TOutput>,\n ): () => void;\n invoke<TOutput = unknown>(invocation: EditorCommandInvocation): EditorCommandInvocationHandle<TOutput>;\n execute<TOutput = unknown>(invocation: EditorCommandInvocation): Promise<EditorCommandExecutionResult<TOutput>>;\n getSnapshot(): EditorAuthoringSnapshot<TDocument>;\n readEvents(afterCursor?: number, expectedServiceInstanceId?: string): EditorAuthoringEventReadResult<TDocument>;\n markSaved(\n document: TDocument,\n options: {\n expectedDocumentRevision: number;\n source?: AuthoringSourceDescriptor;\n serializedAccess?: EditorAuthoringHostSerializedAccess;\n },\n ): Promise<EditorAuthoringSnapshot<TDocument>>;\n /** Atomically checkpoints the active scope and applies a related Session mutation in the same Host FIFO. */\n markSavedWithRelatedSession(\n document: TDocument,\n options: {\n expectedDocumentRevision: number;\n source?: AuthoringSourceDescriptor;\n resetHistory?: boolean;\n relatedSession: EditorSession<TDocument, TPatch>;\n expectedRelatedDocumentRevision: number;\n mutateRelatedSession(session: EditorSession<TDocument, TPatch>): unknown;\n serializedAccess?: EditorAuthoringHostSerializedAccess;\n },\n ): Promise<EditorAuthoringSnapshot<TDocument>>;\n reset(\n document: TDocument,\n source: AuthoringSourceDescriptor | undefined,\n options: { expectedDocumentRevision: number; serializedAccess?: EditorAuthoringHostSerializedAccess },\n ): Promise<EditorAuthoringSnapshot<TDocument>>;\n /** Atomically resets the active scope and a related Session in the same Host FIFO. */\n resetWithRelatedSession(\n document: TDocument,\n source: AuthoringSourceDescriptor | undefined,\n options: {\n expectedDocumentRevision: number;\n relatedSession: EditorSession<TDocument, TPatch>;\n expectedRelatedDocumentRevision: number;\n mutateRelatedSession(session: EditorSession<TDocument, TPatch>): unknown;\n serializedAccess?: EditorAuthoringHostSerializedAccess;\n },\n ): Promise<EditorAuthoringSnapshot<TDocument>>;\n /** Switches the active document scope after all earlier admitted writes settle. */\n switchSession(\n session: EditorSession<TDocument, TPatch>,\n options: {\n expectedDocumentRevision: number;\n serializedAccess?: EditorAuthoringHostSerializedAccess;\n },\n ): Promise<EditorAuthoringSnapshot<TDocument>>;\n /** Adapter for Browser command writes that must join the Host FIFO. */\n runExternalCommandMutation<TResult>(\n request: {\n commandId: string;\n requestId: string;\n idempotencyKey: string;\n expectedDocumentRevision: number;\n fingerprint: string;\n },\n handler: (session: EditorSession<TDocument, TPatch>) => TResult | Promise<TResult>,\n ): Promise<TResult>;\n /** Synchronous Browser command adapter. Fails closed while the FIFO is busy. */\n tryRunExternalCommandMutationImmediately<TResult>(\n request: {\n commandId: string;\n requestId: string;\n idempotencyKey: string;\n expectedDocumentRevision: number;\n fingerprint: string;\n },\n handler: (session: EditorSession<TDocument, TPatch>) => TResult,\n ): { ok: true; value: TResult; reused: boolean } | { ok: false; reason: 'busy' };\n /** Runs a synchronous external-command mutation under an active Host-issued serialized access. */\n runSerializedExternalMutation<TResult>(\n serializedAccess: EditorAuthoringHostSerializedAccess,\n expectedDocumentRevision: number,\n handler: (session: EditorSession<TDocument, TPatch>) => TResult,\n ): TResult;\n dispose(): void;\n /** Resolves after every started external operation has settled and authority is released. */\n drain(): Promise<void>;\n}\n\nconst DEFAULT_EVENT_LIMIT = 200;\nconst DEFAULT_HISTORY_VIEW_LIMIT = 200;\nconst EXTERNAL_COMMAND_SESSION_VIEW_METHODS = new Set<PropertyKey>([\n 'getState',\n 'getWorkingDocument',\n 'getSource',\n 'getSelection',\n 'isDirty',\n 'canUndo',\n 'canRedo',\n 'dispatch',\n 'undo',\n 'redo',\n 'rebaseExternalDocuments',\n]);\nconst SESSION_AUTHORITY_OWNERS = new WeakMap<object, object>();\nconst HOST_EXTERNAL_COMMAND_REGISTRARS = new WeakMap<\n object,\n <TInput = unknown, TOutput = unknown>(\n registration: EditorCommandRegistration<TInput, TOutput>,\n ) => () => void\n>();\n\n/** @internal Registration path bound to the Host that owns authoring authority. */\nexport function registerEditorAuthoringHostExternalCommand<\n TDocument,\n TPatch,\n TInput = unknown,\n TOutput = unknown,\n>(\n host: EditorAuthoringHost<TDocument, TPatch>,\n registration: EditorCommandRegistration<TInput, TOutput>,\n): () => void {\n const register = HOST_EXTERNAL_COMMAND_REGISTRARS.get(host);\n if (!register) throw new Error('Editor Authoring Host external command registration authority is unavailable.');\n return register(registration);\n}\n\nexport function createEditorAuthoringHost<TDocument, TPatch = unknown>(\n options: CreateEditorAuthoringHostOptions<TDocument, TPatch>,\n): EditorAuthoringHost<TDocument, TPatch> {\n const serviceInstanceId = normalizeRequiredId(options.serviceInstanceId, 'serviceInstanceId');\n const commandSystem = options.commandSystem ?? createEditorCommandSystem(options.commandSystemOptions);\n const ownsCommandSystem = options.commandSystem === undefined;\n const sessionAuthorityOwner = Object.freeze({ serviceInstanceId });\n const claimedSessions = new Set<object>();\n const reservedSessionCounts = new Map<object, number>();\n const trackedSessions = new Set<object>();\n let sessionClaimsReleased = false;\n const assertSessionAuthorityAvailable = (session: EditorSession<TDocument, TPatch>): void => {\n if (!session || typeof session !== 'object') throw new Error('Editor Authoring Host session is required.');\n const owner = SESSION_AUTHORITY_OWNERS.get(session);\n if (owner && owner !== sessionAuthorityOwner) {\n throw new Error('Editor Session already has a different write authority.');\n }\n };\n const claimSessionAuthority = (session: EditorSession<TDocument, TPatch>): void => {\n assertSessionAuthorityAvailable(session);\n claimEditorSessionWriteAuthority(session, sessionAuthorityOwner);\n try {\n runWithEditorSessionWriteAuthority(session, sessionAuthorityOwner, () => {\n session.detachDocumentReferencesForWriteAuthority();\n });\n } catch (error) {\n releaseEditorSessionWriteAuthority(session, sessionAuthorityOwner);\n throw error;\n }\n SESSION_AUTHORITY_OWNERS.set(session, sessionAuthorityOwner);\n claimedSessions.add(session);\n trackedSessions.add(session);\n };\n const reserveSessionAuthority = (session: EditorSession<TDocument, TPatch>) => {\n assertSessionAuthorityAvailable(session);\n if (claimedSessions.has(session)) {\n return Object.freeze({ establish() {}, release() {} });\n }\n const existingOwner = SESSION_AUTHORITY_OWNERS.get(session);\n claimEditorSessionWriteAuthority(session, sessionAuthorityOwner);\n if (!existingOwner) {\n try {\n runWithEditorSessionWriteAuthority(session, sessionAuthorityOwner, () => {\n session.detachDocumentReferencesForWriteAuthority();\n });\n } catch (error) {\n releaseEditorSessionWriteAuthority(session, sessionAuthorityOwner);\n throw error;\n }\n }\n SESSION_AUTHORITY_OWNERS.set(session, sessionAuthorityOwner);\n trackedSessions.add(session);\n reservedSessionCounts.set(session, (reservedSessionCounts.get(session) ?? 0) + 1);\n let active = true;\n const settle = (establish: boolean): void => {\n if (!active) return;\n active = false;\n const remaining = (reservedSessionCounts.get(session) ?? 1) - 1;\n if (remaining > 0) reservedSessionCounts.set(session, remaining);\n else reservedSessionCounts.delete(session);\n if (establish) claimedSessions.add(session);\n if (!claimedSessions.has(session) && !reservedSessionCounts.has(session)) {\n if (SESSION_AUTHORITY_OWNERS.get(session) === sessionAuthorityOwner) {\n SESSION_AUTHORITY_OWNERS.delete(session);\n }\n releaseEditorSessionWriteAuthority(session, sessionAuthorityOwner);\n trackedSessions.delete(session);\n }\n };\n return Object.freeze({\n establish: () => settle(true),\n release: () => settle(false),\n });\n };\n const releaseSessionAuthorities = (): void => {\n if (sessionClaimsReleased) return;\n sessionClaimsReleased = true;\n for (const session of trackedSessions) {\n if (SESSION_AUTHORITY_OWNERS.get(session) === sessionAuthorityOwner) {\n SESSION_AUTHORITY_OWNERS.delete(session);\n }\n releaseEditorSessionWriteAuthority(session as EditorSession<TDocument, TPatch>, sessionAuthorityOwner);\n }\n claimedSessions.clear();\n reservedSessionCounts.clear();\n trackedSessions.clear();\n };\n try {\n claimSessionAuthority(options.session);\n } catch (error) {\n if (ownsCommandSystem) commandSystem.dispose();\n throw error;\n }\n const eventLimit = normalizePositiveInteger(options.eventLimit, DEFAULT_EVENT_LIMIT);\n const now = options.now ?? Date.now;\n const events: EditorAuthoringEvent[] = [];\n const unregisterBuiltins: Array<() => void> = [];\n const ownedRegistrations = new Set<() => void>();\n const ownedCommandIds = new Set<string>();\n const handlerValidatedRevisionCommandIds = new Set<string>();\n let eventCursor = 0;\n let disposed = false;\n const authorityController = new AbortController();\n let writeQueue: Promise<void> = Promise.resolve();\n let writeAdmissionCount = 0;\n let externalOperationCount = 0;\n const activeExternalOperationIds = new Set<string>();\n let authorityReleased = false;\n let resolveDrained!: () => void;\n const drained = new Promise<void>(resolve => { resolveDrained = resolve; });\n const activeTransactions = new Map<string, EditorSessionTransaction<TDocument, TPatch>>();\n const externalCommandResults = new Map<string, {\n fingerprint: string;\n expectedDocumentRevision: number;\n result: Promise<unknown>;\n immediateValue?: unknown;\n hasImmediateValue?: boolean;\n }>();\n const activeSerializedAccess = new WeakSet<object>();\n let activeSession = options.session;\n\n const prepareEvent = (\n reason: EditorAuthoringEvent['reason'],\n state: EditorSessionState<TDocument>,\n timestamp: number,\n ): EditorAuthoringEvent => Object.freeze({\n cursor: eventCursor + 1,\n serviceInstanceId,\n reason,\n documentRevision: state.documentRevision,\n dirty: state.dirty,\n timestamp,\n });\n\n const commitEvent = (event: EditorAuthoringEvent): void => {\n eventCursor = event.cursor;\n events.push(event);\n while (events.length > eventLimit) events.shift();\n };\n\n const registerCommand: EditorAuthoringHost<TDocument, TPatch>['registerCommand'] = (registration) => {\n assertActive();\n const expectedRevisionPolicy = registration.expectedRevisionPolicy ?? 'current-document';\n if (expectedRevisionPolicy !== 'current-document'\n && expectedRevisionPolicy !== 'handler-validated') {\n throw new Error('Editor Authoring Host command expected revision policy is invalid.');\n }\n if (expectedRevisionPolicy === 'handler-validated'\n && (registration.manifest.target !== 'authoring' || registration.manifest.access !== 'write')) {\n throw new Error('Handler-validated revisions are reserved for authoring write commands.');\n }\n const isSerializedWrite = registration.manifest.target === 'authoring'\n && registration.manifest.access === 'write';\n const {\n expectedRevisionPolicy: _expectedRevisionPolicy,\n ...commandRegistration\n } = registration;\n const unregisterCommand = commandSystem.registerCommand({\n ...commandRegistration,\n authorityTransaction: 'isolated',\n handler: async (input, context) => {\n const readTransaction = isSerializedWrite ? undefined : activeSession.beginTransaction();\n const session = isSerializedWrite\n ? activeTransactions.get(context.operationId)?.session\n : readTransaction?.session;\n if (!session) {\n return {\n ok: false,\n diagnostics: [diagnostic(\n 'command.authorityUnavailable',\n `Authoring transaction is unavailable: ${context.commandId}`,\n )],\n };\n }\n try {\n return await registration.handler(input as never, {\n ...context,\n session,\n dispatch(command, dispatchOptions) {\n session.dispatch(command, dispatchOptions);\n return session.getState();\n },\n });\n } finally {\n readTransaction?.discard();\n }\n },\n });\n ownedCommandIds.add(registration.manifest.id);\n if (expectedRevisionPolicy === 'handler-validated') {\n handlerValidatedRevisionCommandIds.add(registration.manifest.id);\n }\n let active = true;\n const unregister = (): void => {\n if (!active) return;\n active = false;\n ownedRegistrations.delete(unregister);\n ownedCommandIds.delete(registration.manifest.id);\n handlerValidatedRevisionCommandIds.delete(registration.manifest.id);\n unregisterCommand();\n };\n ownedRegistrations.add(unregister);\n return unregister;\n };\n\n let releaseExecutionAuthority!: () => void;\n try {\n releaseExecutionAuthority = commandSystem.installExecutionInterceptor(async (context, execute) => {\n const isSerializedWrite = (context.authorityTransaction === 'composed'\n && context.manifest.access === 'write')\n || (context.manifest.target === 'authoring' && context.manifest.access === 'write');\n if (!isSerializedWrite) return execute();\n const admittedSession = activeSession;\n return enqueueWrite(async () => {\n if (authorityController.signal.aborted) return cancelledDiagnostic(context.commandId);\n if (context.signal.aborted) return cancelledDiagnostic(context.commandId);\n if (activeSession !== admittedSession && context.authorityTransaction !== 'composed') {\n return {\n ok: false,\n diagnostics: [diagnostic(\n 'command.documentScopeChanged',\n `Authoring document scope changed before execution: ${context.commandId}`,\n )],\n };\n }\n if (context.authorityTransaction !== 'composed' && !ownedCommandIds.has(context.commandId)) {\n return {\n ok: false,\n diagnostics: [diagnostic(\n 'command.authorityRegistrationRequired',\n `Authoring write command is not registered by this Host: ${context.commandId}`,\n )],\n };\n }\n const gate = validateAuthoringWriteInvocation(\n context,\n activeSession,\n handlerValidatedRevisionCommandIds.has(context.commandId),\n );\n if (gate) return { ok: false, diagnostics: [gate] };\n const beforeRevision = activeSession.getState({ cloneDocuments: false }).documentRevision;\n if (context.authorityTransaction === 'composed') {\n // The timestamp source is injectable and may throw. Resolve it before\n // a external command handler can mutate the authoritative Session.\n const eventTimestamp = now();\n externalOperationCount += 1;\n activeExternalOperationIds.add(context.operationId);\n const serializedAccess: InternalSerializedAccess = Object.freeze({\n serviceInstanceId,\n [CALL_WITH_SERIALIZED_SESSION_AUTHORITY]: <TResult>(handler: () => TResult): TResult => {\n if (!activeSerializedAccess.has(serializedAccess)) {\n throw new Error('Editor Authoring Host serialized access is invalid or expired.');\n }\n return callWithEditorSessionWriteAuthority(activeSession, sessionAuthorityOwner, handler);\n },\n });\n activeSerializedAccess.add(serializedAccess);\n try {\n try {\n const execution = callWithEditorSessionWriteAuthority(\n activeSession,\n sessionAuthorityOwner,\n () => execute(serializedAccess),\n );\n return await execution;\n } catch (error) {\n return {\n ok: false,\n diagnostics: [diagnostic(\n 'command.exception',\n error instanceof Error ? error.message : String(error),\n )],\n };\n }\n } finally {\n activeSerializedAccess.delete(serializedAccess);\n const next = activeSession.getState({ cloneDocuments: false });\n if (activeSession === admittedSession && next.documentRevision !== beforeRevision) {\n commitEvent(prepareEvent('document', next, eventTimestamp));\n }\n externalOperationCount -= 1;\n activeExternalOperationIds.delete(context.operationId);\n finishDisposal();\n }\n }\n const transaction = activeSession.beginTransaction();\n activeTransactions.set(context.operationId, transaction);\n let committed = false;\n try {\n const outcome = await executeWhileHostActive(execute, context.commandId);\n if (!outcome.ok) return outcome;\n if (context.signal.aborted) return cancelledDiagnostic(context.commandId);\n const reason = context.commandId === 'history.undo' || context.commandId === 'history.redo'\n ? 'history'\n : 'document';\n const draftState = transaction.session.getState({ cloneDocuments: false });\n const event = draftState.documentRevision !== beforeRevision\n ? prepareEvent(reason, draftState, now())\n : null;\n runWithEditorSessionWriteAuthority(activeSession, sessionAuthorityOwner, () => {\n transaction.commit(reason);\n });\n committed = true;\n if (event) commitEvent(event);\n return outcome;\n } finally {\n activeTransactions.delete(context.operationId);\n if (!committed) transaction.discard();\n }\n });\n }, { scopeId: serviceInstanceId });\n } catch (error) {\n releaseSessionAuthorities();\n if (ownsCommandSystem) commandSystem.dispose();\n throw error;\n }\n\n const host: EditorAuthoringHost<TDocument, TPatch> = {\n serviceInstanceId,\n commandSystem: createCommandClient(commandSystem),\n registerCommand,\n invoke(invocation) {\n assertActive();\n return commandSystem.invoke(invocation);\n },\n execute(invocation) {\n assertActive();\n return commandSystem.execute(invocation);\n },\n getSnapshot() {\n assertActive();\n return createSnapshot(activeSession.getState(), serviceInstanceId, eventCursor);\n },\n readEvents(afterCursor = eventCursor, expectedServiceInstanceId = serviceInstanceId) {\n assertActive();\n if (expectedServiceInstanceId !== serviceInstanceId) {\n return {\n kind: 'snapshot-required',\n reason: 'service.restarted',\n snapshot: host.getSnapshot(),\n };\n }\n const normalizedCursor = Number.isSafeInteger(afterCursor) && afterCursor >= 0\n ? afterCursor\n : 0;\n if (normalizedCursor > eventCursor) {\n return {\n kind: 'snapshot-required',\n reason: 'cursor.invalid',\n snapshot: host.getSnapshot(),\n };\n }\n const oldestCursor = events[0]?.cursor ?? eventCursor + 1;\n if (normalizedCursor < oldestCursor - 1) {\n return {\n kind: 'snapshot-required',\n reason: 'cursor.expired',\n snapshot: host.getSnapshot(),\n };\n }\n return {\n kind: 'events',\n serviceInstanceId,\n latestCursor: eventCursor,\n events: events.filter(event => event.cursor > normalizedCursor).map(event => ({ ...event })),\n };\n },\n async markSaved(document, markSavedOptions) {\n assertActive();\n if (!markSavedOptions || typeof markSavedOptions !== 'object'\n || !Number.isSafeInteger(markSavedOptions.expectedDocumentRevision)\n || markSavedOptions.expectedDocumentRevision < 0) {\n throw new Error('Editor save checkpoint expectedDocumentRevision must be a non-negative safe integer.');\n }\n const expectedDocumentRevision = markSavedOptions.expectedDocumentRevision;\n const serializedAccess = markSavedOptions.serializedAccess;\n const admittedSession = activeSession;\n const admission = admittedSession.beginTransaction();\n let admittedDocument!: TDocument;\n let admittedSource: AuthoringSourceDescriptor | undefined;\n try {\n admission.session.reset(document, markSavedOptions.source);\n admittedDocument = admission.session.getWorkingDocument();\n admittedSource = admission.session.getSource();\n } finally {\n admission.discard();\n }\n const commitCheckpoint = async (): Promise<EditorAuthoringSnapshot<TDocument>> => {\n assertActive();\n if (activeSession !== admittedSession) {\n throw new Error('Editor save checkpoint document scope changed before commit.');\n }\n const actualRevision = activeSession.getState({ cloneDocuments: false }).documentRevision;\n if (actualRevision !== expectedDocumentRevision) {\n throw new Error(\n `Editor save checkpoint revision mismatch: expected ${expectedDocumentRevision}, received ${actualRevision}.`,\n );\n }\n const transaction = activeSession.beginTransaction();\n let committed = false;\n try {\n const eventTimestamp = now();\n transaction.session.markSaved(admittedDocument, admittedSource);\n const draftState = transaction.session.getState({ cloneDocuments: false });\n const event = prepareEvent('saved', draftState, eventTimestamp);\n const state = runWithEditorSessionWriteAuthority(activeSession, sessionAuthorityOwner, () => (\n transaction.commit('saved')\n ));\n committed = true;\n commitEvent(event);\n return createSnapshot(state, serviceInstanceId, eventCursor);\n } finally {\n if (!committed) transaction.discard();\n }\n };\n if (serializedAccess) {\n assertSerializedAccess(serializedAccess);\n return commitCheckpoint();\n }\n return enqueueWrite(commitCheckpoint);\n },\n async markSavedWithRelatedSession(document, markSavedOptions) {\n assertActive();\n if (!markSavedOptions || typeof markSavedOptions !== 'object'\n || !Number.isSafeInteger(markSavedOptions.expectedDocumentRevision)\n || markSavedOptions.expectedDocumentRevision < 0) {\n throw new Error('Editor related save checkpoint expectedDocumentRevision must be a non-negative safe integer.');\n }\n if (!markSavedOptions.relatedSession || typeof markSavedOptions.relatedSession !== 'object') {\n throw new Error('Editor related save checkpoint Session is required.');\n }\n if (!Number.isSafeInteger(markSavedOptions.expectedRelatedDocumentRevision)\n || markSavedOptions.expectedRelatedDocumentRevision < 0) {\n throw new Error('Editor related save checkpoint expectedRelatedDocumentRevision must be a non-negative safe integer.');\n }\n if (typeof markSavedOptions.mutateRelatedSession !== 'function') {\n throw new Error('Editor related save checkpoint mutation is required.');\n }\n const expectedDocumentRevision = markSavedOptions.expectedDocumentRevision;\n const admittedSession = activeSession;\n const relatedSession = markSavedOptions.relatedSession;\n const expectedRelatedDocumentRevision = markSavedOptions.expectedRelatedDocumentRevision;\n const resetHistory = markSavedOptions.resetHistory === true;\n const mutateRelatedSession = markSavedOptions.mutateRelatedSession;\n const serializedAccess = markSavedOptions.serializedAccess;\n if (admittedSession === relatedSession) {\n throw new Error('Editor related save checkpoint requires a distinct Session.');\n }\n const admission = admittedSession.beginTransaction();\n let admittedDocument!: TDocument;\n let admittedSource: AuthoringSourceDescriptor | undefined;\n try {\n admission.session.reset(document, markSavedOptions.source);\n admittedDocument = admission.session.getWorkingDocument();\n admittedSource = admission.session.getSource();\n } finally {\n admission.discard();\n }\n const sessionReservation = reserveSessionAuthority(relatedSession);\n const commitCheckpoint = async (): Promise<EditorAuthoringSnapshot<TDocument>> => {\n assertActive();\n if (activeSession !== admittedSession) {\n throw new Error('Editor related save checkpoint document scope changed before commit.');\n }\n const actualRevision = activeSession.getState({ cloneDocuments: false }).documentRevision;\n if (actualRevision !== expectedDocumentRevision) {\n throw new Error(\n `Editor related save checkpoint revision mismatch: expected ${expectedDocumentRevision}, received ${actualRevision}.`,\n );\n }\n const actualRelatedRevision = relatedSession.getState({ cloneDocuments: false }).documentRevision;\n if (actualRelatedRevision !== expectedRelatedDocumentRevision) {\n throw new Error(\n `Editor related save checkpoint related revision mismatch: expected ${expectedRelatedDocumentRevision}, received ${actualRelatedRevision}.`,\n );\n }\n const activeTransaction = activeSession.beginTransaction();\n const relatedTransaction = relatedSession.beginTransaction();\n let committed = false;\n try {\n const eventTimestamp = now();\n activeTransaction.session.markSaved(admittedDocument, admittedSource, {\n resetHistory,\n });\n const relatedMutationResult = mutateRelatedSession(relatedTransaction.session);\n if (relatedMutationResult && typeof relatedMutationResult === 'object'\n && 'then' in relatedMutationResult && typeof relatedMutationResult.then === 'function') {\n throw new Error('Editor related save checkpoint mutation must be synchronous.');\n }\n const draftState = activeTransaction.session.getState({ cloneDocuments: false });\n const event = prepareEvent('saved', draftState, eventTimestamp);\n const preparedActive = activeTransaction.prepareCommit('saved');\n const preparedRelated = relatedTransaction.prepareCommit('saved');\n preparedActive.assertReady();\n preparedRelated.assertReady();\n const { activeCommit, relatedCommit } = runWithEditorSessionWriteAuthority(\n activeSession,\n sessionAuthorityOwner,\n () => runWithEditorSessionWriteAuthority(relatedSession, sessionAuthorityOwner, () => ({\n activeCommit: preparedActive.commit({ deferChangeNotification: true }),\n relatedCommit: preparedRelated.commit({ deferChangeNotification: true }),\n })),\n );\n committed = true;\n sessionReservation.establish();\n activeCommit.notifyChange();\n relatedCommit.notifyChange();\n commitEvent(event);\n return createSnapshot(activeCommit.state, serviceInstanceId, eventCursor);\n } finally {\n if (!committed) {\n activeTransaction.discard();\n relatedTransaction.discard();\n }\n }\n };\n try {\n const result = serializedAccess\n ? (assertSerializedAccess(serializedAccess), await commitCheckpoint())\n : await enqueueWrite(commitCheckpoint);\n return result;\n } catch (error) {\n sessionReservation.release();\n throw error;\n }\n },\n async reset(document, source, resetOptions) {\n assertActive();\n if (!resetOptions || !Number.isSafeInteger(resetOptions.expectedDocumentRevision)\n || resetOptions.expectedDocumentRevision < 0) {\n throw new Error('Editor reset expectedDocumentRevision must be a non-negative safe integer.');\n }\n const expectedDocumentRevision = resetOptions.expectedDocumentRevision;\n const serializedAccess = resetOptions.serializedAccess;\n const admittedSession = activeSession;\n const admission = admittedSession.beginTransaction();\n let admittedDocument!: TDocument;\n let admittedSource: AuthoringSourceDescriptor | undefined;\n try {\n admission.session.reset(document, source);\n admittedDocument = admission.session.getWorkingDocument();\n admittedSource = admission.session.getSource();\n } finally {\n admission.discard();\n }\n const commitReset = async () => {\n assertActive();\n if (activeSession !== admittedSession) {\n throw new Error('Editor reset document scope changed before commit.');\n }\n const actualRevision = activeSession.getState({ cloneDocuments: false }).documentRevision;\n if (actualRevision !== expectedDocumentRevision) {\n throw new Error(\n `Editor reset revision mismatch: expected ${expectedDocumentRevision}, received ${actualRevision}.`,\n );\n }\n const transaction = activeSession.beginTransaction();\n let committed = false;\n try {\n const eventTimestamp = now();\n transaction.session.reset(admittedDocument, admittedSource);\n const draftState = transaction.session.getState({ cloneDocuments: false });\n const event = prepareEvent('reset', draftState, eventTimestamp);\n const state = runWithEditorSessionWriteAuthority(activeSession, sessionAuthorityOwner, () => (\n transaction.commit('reset')\n ));\n committed = true;\n commitEvent(event);\n return createSnapshot(state, serviceInstanceId, eventCursor);\n } finally {\n if (!committed) transaction.discard();\n }\n };\n if (serializedAccess) {\n assertSerializedAccess(serializedAccess);\n return commitReset();\n }\n return enqueueWrite(commitReset);\n },\n async resetWithRelatedSession(document, source, resetOptions) {\n assertActive();\n if (!resetOptions || !Number.isSafeInteger(resetOptions.expectedDocumentRevision)\n || resetOptions.expectedDocumentRevision < 0) {\n throw new Error('Editor related reset expectedDocumentRevision must be a non-negative safe integer.');\n }\n if (!resetOptions.relatedSession || typeof resetOptions.relatedSession !== 'object') {\n throw new Error('Editor related reset Session is required.');\n }\n if (!Number.isSafeInteger(resetOptions.expectedRelatedDocumentRevision)\n || resetOptions.expectedRelatedDocumentRevision < 0) {\n throw new Error('Editor related reset expectedRelatedDocumentRevision must be a non-negative safe integer.');\n }\n if (typeof resetOptions.mutateRelatedSession !== 'function') {\n throw new Error('Editor related reset mutation is required.');\n }\n const admittedSession = activeSession;\n const relatedSession = resetOptions.relatedSession;\n const expectedDocumentRevision = resetOptions.expectedDocumentRevision;\n const expectedRelatedDocumentRevision = resetOptions.expectedRelatedDocumentRevision;\n const mutateRelatedSession = resetOptions.mutateRelatedSession;\n const serializedAccess = resetOptions.serializedAccess;\n if (admittedSession === relatedSession) {\n throw new Error('Editor related reset requires a distinct Session.');\n }\n const admission = admittedSession.beginTransaction();\n let admittedDocument!: TDocument;\n let admittedSource: AuthoringSourceDescriptor | undefined;\n try {\n admission.session.reset(document, source);\n admittedDocument = admission.session.getWorkingDocument();\n admittedSource = admission.session.getSource();\n } finally {\n admission.discard();\n }\n const sessionReservation = reserveSessionAuthority(relatedSession);\n const commitReset = async (): Promise<EditorAuthoringSnapshot<TDocument>> => {\n assertActive();\n if (activeSession !== admittedSession) {\n throw new Error('Editor related reset document scope changed before commit.');\n }\n const actualRevision = activeSession.getState({ cloneDocuments: false }).documentRevision;\n if (actualRevision !== expectedDocumentRevision) {\n throw new Error(\n `Editor related reset revision mismatch: expected ${expectedDocumentRevision}, received ${actualRevision}.`,\n );\n }\n const actualRelatedRevision = relatedSession.getState({ cloneDocuments: false }).documentRevision;\n if (actualRelatedRevision !== expectedRelatedDocumentRevision) {\n throw new Error(\n `Editor related reset related revision mismatch: expected ${expectedRelatedDocumentRevision}, received ${actualRelatedRevision}.`,\n );\n }\n const activeTransaction = activeSession.beginTransaction();\n const relatedTransaction = relatedSession.beginTransaction();\n let committed = false;\n try {\n const eventTimestamp = now();\n activeTransaction.session.reset(admittedDocument, admittedSource);\n const relatedMutationResult = mutateRelatedSession(relatedTransaction.session);\n if (relatedMutationResult && typeof relatedMutationResult === 'object'\n && 'then' in relatedMutationResult && typeof relatedMutationResult.then === 'function') {\n throw new Error('Editor related reset mutation must be synchronous.');\n }\n const draftState = activeTransaction.session.getState({ cloneDocuments: false });\n const event = prepareEvent('reset', draftState, eventTimestamp);\n const preparedActive = activeTransaction.prepareCommit('reset');\n const preparedRelated = relatedTransaction.prepareCommit('reset');\n preparedActive.assertReady();\n preparedRelated.assertReady();\n const { activeCommit, relatedCommit } = runWithEditorSessionWriteAuthority(\n activeSession,\n sessionAuthorityOwner,\n () => runWithEditorSessionWriteAuthority(relatedSession, sessionAuthorityOwner, () => ({\n activeCommit: preparedActive.commit({ deferChangeNotification: true }),\n relatedCommit: preparedRelated.commit({ deferChangeNotification: true }),\n })),\n );\n committed = true;\n sessionReservation.establish();\n activeCommit.notifyChange();\n relatedCommit.notifyChange();\n commitEvent(event);\n return createSnapshot(activeCommit.state, serviceInstanceId, eventCursor);\n } finally {\n if (!committed) {\n activeTransaction.discard();\n relatedTransaction.discard();\n }\n }\n };\n try {\n const result = serializedAccess\n ? (assertSerializedAccess(serializedAccess), await commitReset())\n : await enqueueWrite(commitReset);\n return result;\n } catch (error) {\n sessionReservation.release();\n throw error;\n }\n },\n async switchSession(session, switchOptions) {\n assertActive();\n if (!session || typeof session !== 'object') throw new Error('Editor Authoring Host session is required.');\n if (!switchOptions || !Number.isSafeInteger(switchOptions.expectedDocumentRevision)\n || switchOptions.expectedDocumentRevision < 0) {\n throw new Error('Editor scope switch expectedDocumentRevision must be a non-negative safe integer.');\n }\n const expectedDocumentRevision = switchOptions.expectedDocumentRevision;\n const serializedAccess = switchOptions.serializedAccess;\n const sessionReservation = reserveSessionAuthority(session);\n const admittedSession = activeSession;\n const switchActiveSession = async (): Promise<EditorAuthoringSnapshot<TDocument>> => {\n assertActive();\n if (activeSession !== admittedSession) {\n throw new Error('Editor scope changed before scope switch commit.');\n }\n const actualRevision = activeSession.getState({ cloneDocuments: false }).documentRevision;\n if (actualRevision !== expectedDocumentRevision) {\n throw new Error(\n `Editor scope switch revision mismatch: expected ${expectedDocumentRevision}, received ${actualRevision}.`,\n );\n }\n if (activeSession === session) return host.getSnapshot();\n const sourceState = activeSession.getState({ cloneDocuments: false });\n // Prepare every fallible target clone, timestamp, event and public\n // snapshot before changing either the target revision or active owner.\n const targetState = session.getState();\n const eventTimestamp = now();\n const scopeRevision = Math.max(\n sourceState.documentRevision,\n targetState.documentRevision,\n ) + 1;\n const scopeStructureSequence = Math.max(\n sourceState.documentStructureRevision,\n targetState.documentStructureRevision,\n ) + 1;\n const switchedState: EditorSessionState<TDocument> = {\n ...targetState,\n documentRevision: scopeRevision,\n documentStructureRevision: scopeStructureSequence,\n };\n const event = prepareEvent('rebase', switchedState, eventTimestamp);\n const snapshot = createSnapshot(switchedState, serviceInstanceId, event.cursor);\n runWithEditorSessionWriteAuthority(session, sessionAuthorityOwner, () => {\n session.advanceRevisionsForScopeSwitch(scopeRevision, scopeStructureSequence);\n });\n sessionReservation.establish();\n activeSession = session;\n commitEvent(event);\n return snapshot;\n };\n try {\n const result = serializedAccess\n ? (assertSerializedAccess(serializedAccess), await switchActiveSession())\n : await enqueueWrite(switchActiveSession);\n return result;\n } catch (error) {\n sessionReservation.release();\n throw error;\n }\n },\n runExternalCommandMutation(request, handler) {\n assertActive();\n const commandId = normalizeRequiredId(request?.commandId, 'commandId');\n normalizeRequiredId(request?.requestId, 'requestId');\n const idempotencyKey = normalizeRequiredId(request?.idempotencyKey, 'idempotencyKey');\n const fingerprint = normalizeRequiredId(request?.fingerprint, 'fingerprint');\n const idempotencyScope = JSON.stringify([commandId, idempotencyKey]);\n if (!Number.isSafeInteger(request?.expectedDocumentRevision) || request.expectedDocumentRevision < 0) {\n throw new Error('External command authoring mutation expectedDocumentRevision must be a non-negative safe integer.');\n }\n const expectedDocumentRevision = request.expectedDocumentRevision;\n if (typeof handler !== 'function') throw new Error('External command authoring mutation handler is required.');\n const existing = externalCommandResults.get(idempotencyScope);\n if (existing) {\n if (existing.fingerprint !== fingerprint\n || existing.expectedDocumentRevision !== expectedDocumentRevision) {\n throw new Error(`External command authoring idempotency conflict: ${idempotencyKey}`);\n }\n return existing.result as Promise<Awaited<ReturnType<typeof handler>>>;\n }\n const admittedSession = activeSession;\n externalOperationCount += 1;\n const result = enqueueWrite(() => {\n let beforeRevision: number | null = null;\n let eventTimestamp: number | null = null;\n let sessionViewActive = true;\n const authorizedSession = createOperationScopedSessionView(\n admittedSession,\n () => {\n if (!sessionViewActive) throw new Error('Browser authoring Session access is expired.');\n },\n handler => runWithEditorSessionWriteAuthority(\n admittedSession,\n sessionAuthorityOwner,\n handler,\n ),\n );\n const finish = (): void => {\n sessionViewActive = false;\n if (beforeRevision !== null && eventTimestamp !== null && activeSession === admittedSession) {\n const next = activeSession.getState({ cloneDocuments: false });\n if (next.documentRevision !== beforeRevision) {\n commitEvent(prepareEvent('document', next, eventTimestamp));\n }\n }\n externalOperationCount -= 1;\n finishDisposal();\n };\n try {\n assertActive();\n if (activeSession !== admittedSession) {\n throw new Error(`Browser authoring document scope changed before execution: ${commandId}`);\n }\n beforeRevision = activeSession.getState({ cloneDocuments: false }).documentRevision;\n if (beforeRevision !== expectedDocumentRevision) {\n throw new Error(\n `Browser authoring revision mismatch for ${commandId}: expected ${expectedDocumentRevision}, received ${beforeRevision}.`,\n );\n }\n eventTimestamp = now();\n const value = callWithEditorSessionWriteAuthority(\n admittedSession,\n sessionAuthorityOwner,\n () => handler(authorizedSession),\n );\n if (value && typeof value === 'object' && 'then' in value\n && typeof value.then === 'function') {\n return Promise.resolve(value).finally(finish);\n }\n finish();\n return value;\n } catch (error) {\n finish();\n throw error;\n }\n }, true);\n externalCommandResults.set(idempotencyScope, {\n fingerprint,\n expectedDocumentRevision,\n result,\n });\n return result;\n },\n tryRunExternalCommandMutationImmediately(request, handler) {\n assertActive();\n const commandId = normalizeRequiredId(request?.commandId, 'commandId');\n normalizeRequiredId(request?.requestId, 'requestId');\n const idempotencyKey = normalizeRequiredId(request?.idempotencyKey, 'idempotencyKey');\n const fingerprint = normalizeRequiredId(request?.fingerprint, 'fingerprint');\n const idempotencyScope = JSON.stringify([commandId, idempotencyKey]);\n if (!Number.isSafeInteger(request?.expectedDocumentRevision) || request.expectedDocumentRevision < 0) {\n throw new Error('External command authoring mutation expectedDocumentRevision must be a non-negative safe integer.');\n }\n const expectedDocumentRevision = request.expectedDocumentRevision;\n if (typeof handler !== 'function') throw new Error('External command authoring mutation handler is required.');\n const existing = externalCommandResults.get(idempotencyScope);\n if (existing) {\n if (existing.fingerprint !== fingerprint\n || existing.expectedDocumentRevision !== expectedDocumentRevision) {\n throw new Error(`External command authoring idempotency conflict: ${idempotencyKey}`);\n }\n if (existing.hasImmediateValue) {\n return { ok: true, value: existing.immediateValue as ReturnType<typeof handler>, reused: true };\n }\n return { ok: false, reason: 'busy' };\n }\n if (writeAdmissionCount > 0) return { ok: false, reason: 'busy' };\n const beforeRevision = activeSession.getState({ cloneDocuments: false }).documentRevision;\n if (beforeRevision !== expectedDocumentRevision) {\n throw new Error(\n `Browser authoring revision mismatch for ${commandId}: expected ${expectedDocumentRevision}, received ${beforeRevision}.`,\n );\n }\n const eventTimestamp = now();\n externalOperationCount += 1;\n const transaction = activeSession.beginTransaction();\n let committed = false;\n try {\n const value = handler(transaction.session);\n if (value && typeof value === 'object' && 'then' in value && typeof value.then === 'function') {\n throw new Error('Immediate Browser authoring mutations must be synchronous.');\n }\n const next = transaction.session.getState({ cloneDocuments: false });\n const event = next.documentRevision !== beforeRevision\n ? prepareEvent('document', next, eventTimestamp)\n : null;\n runWithEditorSessionWriteAuthority(activeSession, sessionAuthorityOwner, () => {\n transaction.commit('document');\n });\n committed = true;\n if (event) commitEvent(event);\n externalCommandResults.set(idempotencyScope, {\n fingerprint,\n expectedDocumentRevision,\n result: Promise.resolve(value),\n immediateValue: value,\n hasImmediateValue: true,\n });\n return { ok: true, value, reused: false };\n } finally {\n if (!committed) transaction.discard();\n externalOperationCount -= 1;\n finishDisposal();\n }\n },\n runSerializedExternalMutation(serializedAccess, expectedDocumentRevision, handler) {\n assertActive();\n assertSerializedAccess(serializedAccess);\n if (!Number.isSafeInteger(expectedDocumentRevision) || expectedDocumentRevision < 0) {\n throw new Error('Serialized external command mutation expectedDocumentRevision must be a non-negative safe integer.');\n }\n const actualRevision = activeSession.getState({ cloneDocuments: false }).documentRevision;\n if (actualRevision !== expectedDocumentRevision) {\n throw new Error(\n `Serialized external command mutation revision mismatch: expected ${expectedDocumentRevision}, received ${actualRevision}.`,\n );\n }\n const transaction = activeSession.beginTransaction();\n let committed = false;\n try {\n const value = handler(transaction.session);\n if (value && typeof value === 'object' && 'then' in value && typeof value.then === 'function') {\n throw new Error('Serialized external command mutations must be synchronous.');\n }\n runWithEditorSessionWriteAuthority(activeSession, sessionAuthorityOwner, () => {\n transaction.commit('document');\n });\n committed = true;\n return value;\n } finally {\n if (!committed) transaction.discard();\n }\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n HOST_EXTERNAL_COMMAND_REGISTRARS.delete(host);\n authorityController.abort();\n for (const operationId of activeExternalOperationIds) commandSystem.cancelOperation(operationId);\n for (const unregister of unregisterBuiltins.splice(0).reverse()) unregister();\n for (const unregister of [...ownedRegistrations].reverse()) unregister();\n finishDisposal();\n },\n drain() {\n if (!disposed) return Promise.resolve();\n return drained;\n },\n };\n\n HOST_EXTERNAL_COMMAND_REGISTRARS.set(host, (registration) => {\n assertActive();\n const unregisterCommand = commandSystem.registerCommand(\n authorizeCommandComposedRegistration({\n ...registration,\n authorityTransaction: 'composed',\n }),\n );\n let active = true;\n const unregister = (): void => {\n if (!active) return;\n active = false;\n ownedRegistrations.delete(unregister);\n unregisterCommand();\n };\n ownedRegistrations.add(unregister);\n return unregister;\n });\n\n try {\n unregisterBuiltins.push(registerCommand(createSnapshotCommand<TDocument, TPatch>(host)));\n unregisterBuiltins.push(registerCommand(createUndoCommand<TDocument, TPatch>()));\n unregisterBuiltins.push(registerCommand(createRedoCommand<TDocument, TPatch>()));\n } catch (error) {\n HOST_EXTERNAL_COMMAND_REGISTRARS.delete(host);\n for (const unregister of unregisterBuiltins.splice(0).reverse()) unregister();\n for (const unregister of [...ownedRegistrations].reverse()) unregister();\n releaseExecutionAuthority();\n releaseSessionAuthorities();\n if (options.disposeCommandSystem !== false) commandSystem.dispose();\n throw error;\n }\n\n return host;\n\n function assertActive(): void {\n if (disposed) throw new Error('Editor Authoring Host is disposed.');\n }\n\n function assertSerializedAccess(access: EditorAuthoringHostSerializedAccess): void {\n if (!access || typeof access !== 'object' || !activeSerializedAccess.has(access)) {\n throw new Error('Editor Authoring Host serialized access is invalid or expired.');\n }\n }\n\n function enqueueWrite<T>(task: () => T | Promise<T>, startIdleSynchronously = false): Promise<T> {\n const startImmediately = startIdleSynchronously && writeAdmissionCount === 0;\n writeAdmissionCount += 1;\n const previous = writeQueue;\n let releaseQueue!: () => void;\n writeQueue = new Promise<void>(resolve => { releaseQueue = resolve; });\n const release = (): void => {\n writeAdmissionCount -= 1;\n releaseQueue();\n finishDisposal();\n };\n const execute = (): Promise<T> => {\n try {\n const value = task();\n if (value && typeof value === 'object' && 'then' in value\n && typeof value.then === 'function') {\n return Promise.resolve(value).finally(release);\n }\n release();\n return Promise.resolve(value);\n } catch (error) {\n release();\n return Promise.reject(error);\n }\n };\n // A synchronous composed UI interaction may start only when the FIFO is\n // idle; every other command retains the established queued turn.\n return startImmediately ? execute() : previous.then(execute);\n }\n\n async function executeWhileHostActive(\n execute: () => Promise<EditorCommandHandlerOutcome<unknown>>,\n commandId: string,\n ): Promise<EditorCommandHandlerOutcome<unknown>> {\n if (authorityController.signal.aborted) return cancelledDiagnostic(commandId);\n return new Promise((resolve, reject) => {\n const onAbort = (): void => resolve(cancelledDiagnostic(commandId));\n authorityController.signal.addEventListener('abort', onAbort, { once: true });\n execute().then(\n outcome => {\n authorityController.signal.removeEventListener('abort', onAbort);\n resolve(outcome);\n },\n error => {\n authorityController.signal.removeEventListener('abort', onAbort);\n reject(error);\n },\n );\n });\n }\n\n function finishDisposal(): void {\n if (!disposed || authorityReleased || externalOperationCount > 0 || writeAdmissionCount > 0) return;\n authorityReleased = true;\n releaseExecutionAuthority();\n releaseSessionAuthorities();\n if (options.disposeCommandSystem !== false) commandSystem.dispose();\n resolveDrained();\n }\n}\n\nfunction createCommandClient(commandSystem: EditorCommandSystem): EditorCommandClient {\n return Object.freeze({\n get catalogRevision() { return commandSystem.catalogRevision; },\n get executionAuthorityInstalled() { return commandSystem.executionAuthorityInstalled; },\n listManifests: () => commandSystem.listManifests(),\n getCatalog: query => commandSystem.getCatalog(query),\n describeCommand: commandId => commandSystem.describeCommand(commandId),\n invoke: invocation => commandSystem.invoke(invocation),\n execute: invocation => commandSystem.execute(invocation),\n getOperation: operationId => commandSystem.getOperation(operationId),\n cancelOperation: operationId => commandSystem.cancelOperation(operationId),\n });\n}\n\nfunction createOperationScopedSessionView<TDocument, TPatch>(\n session: EditorSession<TDocument, TPatch>,\n assertActive: () => void,\n invoke: <TResult>(handler: () => TResult) => TResult,\n): EditorSession<TDocument, TPatch> {\n return new Proxy(Object.create(null) as object, {\n get(_target, property) {\n assertActive();\n if (!EXTERNAL_COMMAND_SESSION_VIEW_METHODS.has(property)) {\n throw new Error(`Browser authoring Session member is unavailable: ${String(property)}.`);\n }\n const value = Reflect.get(session, property, session);\n if (typeof value !== 'function') {\n throw new Error(`Browser authoring Session method is unavailable: ${String(property)}.`);\n }\n return (...args: unknown[]) => {\n assertActive();\n return invoke(() => Reflect.apply(value, session, args));\n };\n },\n set() {\n throw new Error('Browser authoring Session properties are immutable.');\n },\n defineProperty() {\n throw new Error('Browser authoring Session properties are immutable.');\n },\n deleteProperty() {\n throw new Error('Browser authoring Session properties are immutable.');\n },\n }) as EditorSession<TDocument, TPatch>;\n}\n\nfunction validateAuthoringWriteInvocation<TDocument, TPatch>(\n context: EditorCommandHandlerContext,\n session: EditorSession<TDocument, TPatch>,\n handlerValidatesExpectedRevision = false,\n): EditorCommandDiagnostic | null {\n if (!context.idempotencyKey) {\n return diagnostic('command.idempotencyKeyRequired', 'Authoring write commands require an idempotency key.');\n }\n const expected = context.expectedRevision?.document;\n if (expected === undefined) {\n return diagnostic('command.expectedRevisionRequired', 'Authoring write commands require expectedRevision.document.');\n }\n if (handlerValidatesExpectedRevision) return null;\n const actual = session.getState({ cloneDocuments: false }).documentRevision;\n if (expected !== actual) {\n return diagnostic(\n 'command.documentRevisionMismatch',\n `Expected document revision ${expected}, received ${actual}.`,\n { expected, actual },\n );\n }\n return null;\n}\n\nfunction createSnapshotCommand<TDocument, TPatch>(\n host: EditorAuthoringHost<TDocument, TPatch>,\n): EditorAuthoringHostCommandRegistration<TDocument, TPatch, Record<string, never>, EditorAuthoringSnapshot<TDocument>> {\n return {\n manifest: manifest({\n id: 'authoring.snapshot.get',\n title: 'Get Authoring Snapshot',\n target: 'authoring',\n access: 'read',\n persistence: 'none',\n idempotent: true,\n }),\n handler: () => ({ ok: true, output: host.getSnapshot() }),\n };\n}\n\nfunction createUndoCommand<TDocument, TPatch>(): EditorAuthoringHostCommandRegistration<TDocument, TPatch, Record<string, never>, EditorCommandJsonValue> {\n return {\n manifest: manifest({\n id: 'history.undo', title: 'Undo', target: 'authoring', access: 'write',\n persistence: 'authoring', idempotent: false,\n shortcut: 'Mod+Z', menu: { path: ['Edit', 'Undo'] },\n }),\n available: () => true,\n handler: (_input, context) => {\n const result = context.session.undo();\n if (!result) return { ok: false, diagnostics: [diagnostic('history.undoUnavailable', 'There is no command to undo.')] };\n return { ok: true, output: historyOutput(context.session) };\n },\n };\n}\n\nfunction createRedoCommand<TDocument, TPatch>(): EditorAuthoringHostCommandRegistration<TDocument, TPatch, Record<string, never>, EditorCommandJsonValue> {\n return {\n manifest: manifest({\n id: 'history.redo', title: 'Redo', target: 'authoring', access: 'write',\n persistence: 'authoring', idempotent: false,\n shortcut: 'Mod+Shift+Z / Ctrl+Y', menu: { path: ['Edit', 'Redo'] },\n }),\n handler: (_input, context) => {\n const result = context.session.redo();\n if (!result) return { ok: false, diagnostics: [diagnostic('history.redoUnavailable', 'There is no command to redo.')] };\n return { ok: true, output: historyOutput(context.session) };\n },\n };\n}\n\nfunction manifest(input: {\n id: string;\n title: string;\n target: EditorCommandManifest['target'];\n access: EditorCommandManifest['access'];\n persistence: EditorCommandManifest['effects']['persistence'];\n idempotent: boolean;\n shortcut?: string;\n menu?: NonNullable<EditorCommandManifest['presentation']>['menu'];\n}): EditorCommandManifest {\n return {\n schemaVersion: EDITOR_COMMAND_SCHEMA_VERSION,\n id: input.id,\n version: 1,\n title: input.title,\n target: input.target,\n access: input.access,\n stability: 'stable',\n inputSchema: { type: 'object', additionalProperties: false },\n outputSchema: { type: 'object' },\n effects: {\n persistence: input.persistence,\n undoable: input.id === 'history.undo' || input.id === 'history.redo',\n idempotent: input.idempotent,\n },\n presentation: {\n category: 'History',\n inputMode: 'none',\n ...(input.shortcut ? { shortcut: input.shortcut } : {}),\n ...(input.menu ? { menu: input.menu } : {}),\n },\n };\n}\n\nfunction historyOutput<TDocument, TPatch>(session: EditorSession<TDocument, TPatch>): EditorCommandJsonValue {\n const state = session.getState({ cloneDocuments: false });\n return {\n documentRevision: state.documentRevision,\n dirty: state.dirty,\n canUndo: state.canUndo,\n canRedo: state.canRedo,\n };\n}\n\nfunction createSnapshot<TDocument>(\n state: EditorSessionState<TDocument>,\n serviceInstanceId: string,\n eventCursor: number,\n): EditorAuthoringSnapshot<TDocument> {\n return {\n serviceInstanceId,\n documentRevision: state.documentRevision,\n documentStructureRevision: state.documentStructureRevision,\n eventCursor,\n dirty: state.dirty,\n canUndo: state.canUndo,\n canRedo: state.canRedo,\n history: {\n entries: state.history.entries\n .slice(0, DEFAULT_HISTORY_VIEW_LIMIT)\n .map(entry => ({ ...entry })),\n },\n document: state.workingDocument,\n savedDocument: state.persistedDocument,\n };\n}\n\nfunction cancelledDiagnostic(commandId: string): EditorCommandHandlerOutcome<never> {\n return {\n ok: false,\n diagnostics: [diagnostic('command.cancelled', `Editor command was cancelled: ${commandId}`)],\n };\n}\n\nfunction diagnostic(\n code: string,\n message: string,\n details?: Record<string, string | number | boolean | null>,\n): EditorCommandDiagnostic {\n return {\n severity: 'error',\n source: 'command-system',\n code,\n message,\n ...(details ? { details } : {}),\n };\n}\n\nfunction normalizeRequiredId(value: unknown, label: string): string {\n if (typeof value !== 'string' || !value.trim()) throw new Error(`Editor Authoring Host ${label} is required.`);\n return value.trim();\n}\n\nfunction normalizePositiveInteger(value: number | undefined, fallback: number): number {\n return Number.isInteger(value) && value! > 0 ? value! : fallback;\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { EditorCommandCallResult, EditorCommandCapabilityId, EditorCommandCapabilityManifest } from '@fps-games/editor-protocol';
|
|
2
|
+
import { type EditorCommandClient, type EditorCommandSystem } from './editor-command-system.js';
|
|
3
|
+
import { type EditorAuthoringHost } from './editor-authoring-host.js';
|
|
4
|
+
type EditorCommandCapabilityMaybePromise<T> = T | Promise<T>;
|
|
5
|
+
export interface EditorCommandInvocationContext {
|
|
6
|
+
readonly traceId?: string;
|
|
7
|
+
readonly traceStepId?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface EditorCommandCallContext extends EditorCommandInvocationContext {
|
|
10
|
+
readonly capabilityId: EditorCommandCapabilityId;
|
|
11
|
+
/** Opaque Host-issued access valid only while this external command handler owns the FIFO. */
|
|
12
|
+
readonly serializedAuthoringAccess?: unknown;
|
|
13
|
+
}
|
|
14
|
+
export type EditorCommandCapabilityHandler<TInput = unknown, TOutput = unknown> = (input: TInput, context: EditorCommandCallContext) => EditorCommandCapabilityMaybePromise<EditorCommandCallResult<TOutput> | TOutput>;
|
|
15
|
+
export interface EditorCommandCapabilityRegistration<TInput = unknown, TOutput = unknown> {
|
|
16
|
+
manifest: EditorCommandCapabilityManifest;
|
|
17
|
+
available?: () => EditorCommandCapabilityMaybePromise<boolean | string>;
|
|
18
|
+
handler: EditorCommandCapabilityHandler<TInput, TOutput>;
|
|
19
|
+
}
|
|
20
|
+
export interface EditorCommandCapabilityAdapter {
|
|
21
|
+
readonly commandSystem: EditorCommandClient;
|
|
22
|
+
registerCapability<TInput = unknown, TOutput = unknown>(registration: EditorCommandCapabilityRegistration<TInput, TOutput>): () => void;
|
|
23
|
+
listCapabilities(): EditorCommandCapabilityManifest[];
|
|
24
|
+
callCapability<TOutput = unknown>(capabilityId: EditorCommandCapabilityId, input?: unknown, context?: EditorCommandInvocationContext): Promise<EditorCommandCallResult<TOutput>>;
|
|
25
|
+
}
|
|
26
|
+
export interface CreateEditorCommandOptions {
|
|
27
|
+
readonly commandSystem?: EditorCommandSystem;
|
|
28
|
+
readonly resolveAuthoringRevision?: () => number | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function createEditorCommandCapabilityAdapter(options?: CreateEditorCommandOptions): EditorCommandCapabilityAdapter;
|
|
31
|
+
/** Registers a command-backed capability against the Host that owns authoring authority. */
|
|
32
|
+
export declare function registerEditorAuthoringHostCommandCapability<TDocument, TPatch, TInput = unknown, TOutput = unknown>(host: EditorAuthoringHost<TDocument, TPatch>, registration: EditorCommandCapabilityRegistration<TInput, TOutput>): () => void;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=editor-command-capability-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-command-capability-adapter.d.ts","sourceRoot":"","sources":["../src/editor-command-capability-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EACzB,+BAA+B,EAIhC,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAEL,KAAK,mBAAmB,EAExB,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,KAAK,mCAAmC,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7D,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,wBAAyB,SAAQ,8BAA8B;IAC9E,QAAQ,CAAC,YAAY,EAAE,yBAAyB,CAAC;IACjD,8FAA8F;IAC9F,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,CAAC;CAC9C;AAED,MA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jB,IAAI,EAAE,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC,EAC5C,YAAY,EAAE,mCAAmC,CAAC,MAAM,EAAE,OAAO,CAAC,GACjE,MAAM,IAAI,CAKZ"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { EDITOR_COMMAND_BUILT_IN_HOST_IDS, EDITOR_COMMAND_BUILT_IN_PRESENTATION, EDITOR_COMMAND_BUILT_IN_TARGETS, } from '@fps-games/editor-protocol';
|
|
2
|
+
import { createEditorCommandSystem, } from './editor-command-system.js';
|
|
3
|
+
import { callWithEditorAuthoringSerializedAccess, registerEditorAuthoringHostExternalCommand, } from './editor-authoring-host.js';
|
|
4
|
+
export function createEditorCommandCapabilityAdapter(options = {}) {
|
|
5
|
+
const commandSystem = options.commandSystem ?? createEditorCommandSystem();
|
|
6
|
+
let requestSequence = 0;
|
|
7
|
+
const registerCapability = (registration) => {
|
|
8
|
+
return commandSystem.registerCommand(createCapabilityCommandRegistration(registration));
|
|
9
|
+
};
|
|
10
|
+
const adapter = {
|
|
11
|
+
commandSystem: createCapabilityCommandClient(commandSystem),
|
|
12
|
+
registerCapability(registration) {
|
|
13
|
+
return registerCapability(registration);
|
|
14
|
+
},
|
|
15
|
+
listCapabilities() {
|
|
16
|
+
return commandSystem.listManifests().map(toCapabilityManifest);
|
|
17
|
+
},
|
|
18
|
+
async callCapability(capabilityId, input, context) {
|
|
19
|
+
try {
|
|
20
|
+
const requestId = `agent-${++requestSequence}`;
|
|
21
|
+
const manifest = commandSystem.listManifests().find(entry => entry.id === capabilityId);
|
|
22
|
+
const authoringRevision = manifest?.access === 'write'
|
|
23
|
+
&& commandSystem.executionAuthorityInstalled
|
|
24
|
+
? options.resolveAuthoringRevision?.()
|
|
25
|
+
: null;
|
|
26
|
+
if (manifest?.access === 'write'
|
|
27
|
+
&& commandSystem.executionAuthorityInstalled
|
|
28
|
+
&& (authoringRevision === null || authoringRevision === undefined)) {
|
|
29
|
+
return createCapabilityFailure(capabilityId, {
|
|
30
|
+
severity: 'error',
|
|
31
|
+
source: 'command-system',
|
|
32
|
+
code: 'capability.unavailable',
|
|
33
|
+
message: 'Editor authoring authority is unavailable.',
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const result = await commandSystem.execute({
|
|
37
|
+
commandId: capabilityId,
|
|
38
|
+
...(input !== undefined ? { input: input } : {}),
|
|
39
|
+
requestId,
|
|
40
|
+
...(authoringRevision !== null && authoringRevision !== undefined
|
|
41
|
+
? {
|
|
42
|
+
idempotencyKey: requestId,
|
|
43
|
+
expectedRevision: { document: authoringRevision },
|
|
44
|
+
}
|
|
45
|
+
: {}),
|
|
46
|
+
principal: { type: 'agent' },
|
|
47
|
+
source: 'agent-cli',
|
|
48
|
+
...(context?.traceId ? { traceId: context.traceId } : {}),
|
|
49
|
+
...(context?.traceStepId ? { traceStepId: context.traceStepId } : {}),
|
|
50
|
+
});
|
|
51
|
+
if (result.status === 'completed') {
|
|
52
|
+
return {
|
|
53
|
+
ok: true,
|
|
54
|
+
capabilityId,
|
|
55
|
+
output: result.output,
|
|
56
|
+
...(result.diagnostics?.length
|
|
57
|
+
? { diagnostics: result.diagnostics.map(toCapabilityDiagnostic) }
|
|
58
|
+
: {}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
ok: false,
|
|
63
|
+
capabilityId,
|
|
64
|
+
diagnostics: result.diagnostics.map(toCapabilityDiagnostic),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
return createCapabilityFailure(capabilityId, {
|
|
69
|
+
severity: 'error',
|
|
70
|
+
source: 'command-system',
|
|
71
|
+
code: 'capability.exception',
|
|
72
|
+
message: error instanceof Error ? error.message : String(error),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
return adapter;
|
|
78
|
+
}
|
|
79
|
+
function createCapabilityCommandClient(commandSystem) {
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
get catalogRevision() { return commandSystem.catalogRevision; },
|
|
82
|
+
get executionAuthorityInstalled() { return commandSystem.executionAuthorityInstalled; },
|
|
83
|
+
listManifests: () => commandSystem.listManifests(),
|
|
84
|
+
getCatalog: query => commandSystem.getCatalog(query),
|
|
85
|
+
describeCommand: commandId => commandSystem.describeCommand(commandId),
|
|
86
|
+
invoke: invocation => commandSystem.invoke(invocation),
|
|
87
|
+
execute: invocation => commandSystem.execute(invocation),
|
|
88
|
+
getOperation: operationId => commandSystem.getOperation(operationId),
|
|
89
|
+
cancelOperation: operationId => commandSystem.cancelOperation(operationId),
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/** Registers a command-backed capability against the Host that owns authoring authority. */
|
|
93
|
+
export function registerEditorAuthoringHostCommandCapability(host, registration) {
|
|
94
|
+
return registerEditorAuthoringHostExternalCommand(host, createCapabilityCommandRegistration(registration));
|
|
95
|
+
}
|
|
96
|
+
function createCapabilityCommandRegistration(registration) {
|
|
97
|
+
const normalized = normalizeCapabilityRegistration(registration);
|
|
98
|
+
return {
|
|
99
|
+
manifest: createCommandManifest(normalized.manifest),
|
|
100
|
+
...(normalized.available ? { available: normalized.available } : {}),
|
|
101
|
+
// Domain handlers keep their focused runtime validation in addition to the shared manifest.
|
|
102
|
+
validateInput: false,
|
|
103
|
+
validateOutput: false,
|
|
104
|
+
handler: async (input, context) => {
|
|
105
|
+
const invoke = () => normalized.handler(input, {
|
|
106
|
+
capabilityId: normalized.manifest.id,
|
|
107
|
+
...(context.traceId ? { traceId: context.traceId } : {}),
|
|
108
|
+
...(context.traceStepId ? { traceStepId: context.traceStepId } : {}),
|
|
109
|
+
...(context.authorityContext !== undefined
|
|
110
|
+
? { serializedAuthoringAccess: context.authorityContext }
|
|
111
|
+
: {}),
|
|
112
|
+
});
|
|
113
|
+
const result = await (context.authorityContext !== undefined
|
|
114
|
+
? callWithEditorAuthoringSerializedAccess(context.authorityContext, invoke)
|
|
115
|
+
: invoke());
|
|
116
|
+
if (isCapabilityCallResult(result)) {
|
|
117
|
+
return result.ok
|
|
118
|
+
? {
|
|
119
|
+
ok: true,
|
|
120
|
+
output: result.output,
|
|
121
|
+
...(result.diagnostics?.length
|
|
122
|
+
? { diagnostics: result.diagnostics.map(toCommandDiagnostic) }
|
|
123
|
+
: {}),
|
|
124
|
+
}
|
|
125
|
+
: { ok: false, diagnostics: result.diagnostics.map(toCommandDiagnostic) };
|
|
126
|
+
}
|
|
127
|
+
return { ok: true, output: result };
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function createCommandManifest(manifest) {
|
|
132
|
+
const target = inferCommandTarget(manifest);
|
|
133
|
+
const persistence = manifest.access === 'read'
|
|
134
|
+
? 'none'
|
|
135
|
+
: target === 'authoring'
|
|
136
|
+
? 'authoring'
|
|
137
|
+
: target === 'tooling'
|
|
138
|
+
? 'filesystem'
|
|
139
|
+
: 'view';
|
|
140
|
+
const presentation = EDITOR_COMMAND_BUILT_IN_PRESENTATION[manifest.id];
|
|
141
|
+
return {
|
|
142
|
+
schemaVersion: 1,
|
|
143
|
+
id: manifest.id,
|
|
144
|
+
version: 1,
|
|
145
|
+
title: manifest.title,
|
|
146
|
+
...(manifest.description ? { description: manifest.description } : {}),
|
|
147
|
+
target,
|
|
148
|
+
access: manifest.access,
|
|
149
|
+
stability: normalizeCommandStability(manifest.stability),
|
|
150
|
+
inputSchema: cloneJsonObject(manifest.inputSchema ?? {}),
|
|
151
|
+
outputSchema: cloneJsonObject(manifest.outputSchema ?? {}),
|
|
152
|
+
requires: {
|
|
153
|
+
...(manifest.layer === 'editor' ? { editorReady: true } : {}),
|
|
154
|
+
...(target === 'view' ? { viewAttached: true } : {}),
|
|
155
|
+
...(target === 'renderer' ? { rendererAttached: true } : {}),
|
|
156
|
+
},
|
|
157
|
+
effects: {
|
|
158
|
+
persistence,
|
|
159
|
+
undoable: manifest.access === 'write' && target === 'authoring',
|
|
160
|
+
idempotent: manifest.access === 'read',
|
|
161
|
+
},
|
|
162
|
+
...((manifest.category || presentation) ? { presentation: {
|
|
163
|
+
...(manifest.category ? { category: manifest.category } : {}),
|
|
164
|
+
...(presentation?.aliases ? { aliases: presentation.aliases } : {}),
|
|
165
|
+
...(presentation?.keywords ? { keywords: presentation.keywords } : {}),
|
|
166
|
+
...(presentation?.examples ? { examples: presentation.examples } : {}),
|
|
167
|
+
...(presentation?.shortcut ? { shortcut: presentation.shortcut } : {}),
|
|
168
|
+
...(presentation?.menu ? { menu: presentation.menu } : {}),
|
|
169
|
+
} } : {}),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function normalizeCommandStability(stability) {
|
|
173
|
+
if (stability === 'stable')
|
|
174
|
+
return 'stable';
|
|
175
|
+
if (stability === 'deprecated')
|
|
176
|
+
return 'deprecated';
|
|
177
|
+
return 'experimental';
|
|
178
|
+
}
|
|
179
|
+
function inferCommandTarget(manifest) {
|
|
180
|
+
return EDITOR_COMMAND_BUILT_IN_TARGETS[manifest.id] ?? (manifest.layer === 'host' ? 'workspace-service' : 'authoring');
|
|
181
|
+
}
|
|
182
|
+
function toCapabilityManifest(manifest) {
|
|
183
|
+
return {
|
|
184
|
+
schemaVersion: 1,
|
|
185
|
+
id: manifest.id,
|
|
186
|
+
title: manifest.title,
|
|
187
|
+
...(manifest.description ? { description: manifest.description } : {}),
|
|
188
|
+
layer: manifest.target === 'workspace-service'
|
|
189
|
+
|| EDITOR_COMMAND_BUILT_IN_HOST_IDS.has(manifest.id)
|
|
190
|
+
? 'host'
|
|
191
|
+
: 'editor',
|
|
192
|
+
...(manifest.presentation?.category ? { category: manifest.presentation.category } : {}),
|
|
193
|
+
stability: manifest.stability,
|
|
194
|
+
access: manifest.access,
|
|
195
|
+
inputSchema: cloneJsonObject(manifest.inputSchema),
|
|
196
|
+
outputSchema: cloneJsonObject(manifest.outputSchema),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function toCommandDiagnostic(diagnostic) {
|
|
200
|
+
return {
|
|
201
|
+
severity: diagnostic.severity,
|
|
202
|
+
source: diagnostic.source,
|
|
203
|
+
code: diagnostic.code ?? 'capability.failed',
|
|
204
|
+
message: diagnostic.message,
|
|
205
|
+
...(diagnostic.objectId ? { objectId: diagnostic.objectId } : {}),
|
|
206
|
+
...(diagnostic.details ? { details: cloneJsonObject(diagnostic.details) } : {}),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function toCapabilityDiagnostic(diagnostic) {
|
|
210
|
+
return {
|
|
211
|
+
severity: diagnostic.severity,
|
|
212
|
+
source: diagnostic.source,
|
|
213
|
+
code: mapCapabilityDiagnosticCode(diagnostic.code),
|
|
214
|
+
message: diagnostic.message,
|
|
215
|
+
...(diagnostic.objectId ? { objectId: diagnostic.objectId } : {}),
|
|
216
|
+
...(diagnostic.details ? { details: cloneJsonObject(diagnostic.details) } : {}),
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function mapCapabilityDiagnosticCode(code) {
|
|
220
|
+
if (code === 'command.notFound')
|
|
221
|
+
return 'capability.notFound';
|
|
222
|
+
if (code === 'command.unavailable' || code === 'command.availabilityException')
|
|
223
|
+
return 'capability.unavailable';
|
|
224
|
+
if (code === 'command.exception')
|
|
225
|
+
return 'capability.exception';
|
|
226
|
+
return code;
|
|
227
|
+
}
|
|
228
|
+
function normalizeCapabilityRegistration(registration) {
|
|
229
|
+
return {
|
|
230
|
+
...registration,
|
|
231
|
+
manifest: cloneCapabilityManifest(registration.manifest),
|
|
232
|
+
handler: registration.handler,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function cloneCapabilityManifest(manifest) {
|
|
236
|
+
return {
|
|
237
|
+
...manifest,
|
|
238
|
+
inputSchema: cloneJsonObject(manifest.inputSchema),
|
|
239
|
+
outputSchema: cloneJsonObject(manifest.outputSchema),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function cloneJsonObject(value) {
|
|
243
|
+
if (!value)
|
|
244
|
+
return value;
|
|
245
|
+
return JSON.parse(JSON.stringify(value));
|
|
246
|
+
}
|
|
247
|
+
function isCapabilityCallResult(value) {
|
|
248
|
+
if (!value || typeof value !== 'object')
|
|
249
|
+
return false;
|
|
250
|
+
const record = value;
|
|
251
|
+
return typeof record.ok === 'boolean' && typeof record.capabilityId === 'string';
|
|
252
|
+
}
|
|
253
|
+
function createCapabilityFailure(capabilityId, diagnostic) {
|
|
254
|
+
return {
|
|
255
|
+
ok: false,
|
|
256
|
+
capabilityId,
|
|
257
|
+
diagnostics: [diagnostic],
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=editor-command-capability-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-command-capability-adapter.js","sourceRoot":"","sources":["../src/editor-command-capability-adapter.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,gCAAgC,EAChC,oCAAoC,EACpC,+BAA+B,GAChC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,yBAAyB,GAI1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,uCAAuC,EACvC,0CAA0C,GAE3C,MAAM,4BAA4B,CAAC;AAmDpC,MAAM,UAAU,oCAAoC,CAClD,UAAsC,EAAE;IAExC,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,yBAAyB,EAAE,CAAC;IAC3E,IAAI,eAAe,GAAG,CAAC,CAAC;IACxB,MAAM,kBAAkB,GAAG,CACzB,YAAkE,EACpD,EAAE;QAChB,OAAO,aAAa,CAAC,eAAe,CAAC,mCAAmC,CAAC,YAAY,CAAC,CAAC,CAAC;IAC1F,CAAC,CAAC;IACF,MAAM,OAAO,GAAmC;QAC9C,aAAa,EAAE,6BAA6B,CAAC,aAAa,CAAC;QAC3D,kBAAkB,CAChB,YAAkE;YAElE,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;QAC1C,CAAC;QACD,gBAAgB;YACd,OAAO,aAAa,CAAC,aAAa,EA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AC;IAChH,IAAI,IAAI,KAAK,mBAAmB;QAAE,OAAO,sBAAsB,CAAC;IAChE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,+BAA+B,CACtC,YAAkE;IAElE,OAAO;QACL,GAAG,YAAY;QACf,QAAQ,EAAE,uBAAuB,CAAC,YAAY,CAAC,QAAQ,CAAC;QACxD,OAAO,EAAE,YAAY,CAAC,OAA2D;KAClF,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAC9B,QAAyC;IAEzC,OAAO;QACL,GAAG,QAAQ;QACX,WAAW,EAAE,eAAe,CAAC,QAAQ,CAAC,WAAW,CAAC;QAClD,YAAY,EAAE,eAAe,CAAC,QAAQ,CAAC,YAAY,CAAC;KACrD,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAgD,KAAQ;IAC9E,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAM,CAAC;AAChD,CAAC;AAED,SAAS,sBAAsB,CAAU,KAAc;IACrD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,MAAM,GAAG,KAAkD,CAAC;IAClE,OAAO,OAAO,MAAM,CAAC,EAAE,KAAK,SAAS,IAAI,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,CAAC;AACnF,CAAC;AAED,SAAS,uBAAuB,CAC9B,YAAuC,EACvC,UAAmC;IAEnC,OAAO;QACL,EAAE,EAAE,KAAK;QACT,YAAY;QACZ,WAAW,EAAE,CAAC,UAAU,CAAC;KAC1B,CAAC;AACJ,CAAC","sourcesContent":["import type {\n EditorCommandCallResult,\n EditorCommandCapabilityId,\n EditorCommandCapabilityManifest,\n EditorCommandDiagnostic,\n EditorCommandJsonObject,\n EditorCommandManifest,\n} from '@fps-games/editor-protocol';\nimport {\n EDITOR_COMMAND_BUILT_IN_HOST_IDS,\n EDITOR_COMMAND_BUILT_IN_PRESENTATION,\n EDITOR_COMMAND_BUILT_IN_TARGETS,\n} from '@fps-games/editor-protocol';\nimport {\n createEditorCommandSystem,\n type EditorCommandClient,\n type EditorCommandRegistration,\n type EditorCommandSystem,\n} from './editor-command-system.js';\nimport {\n callWithEditorAuthoringSerializedAccess,\n registerEditorAuthoringHostExternalCommand,\n type EditorAuthoringHost,\n} from './editor-authoring-host.js';\n\ntype EditorCommandCapabilityMaybePromise<T> = T | Promise<T>;\n\nexport interface EditorCommandInvocationContext {\n readonly traceId?: string;\n readonly traceStepId?: string;\n}\n\nexport interface EditorCommandCallContext extends EditorCommandInvocationContext {\n readonly capabilityId: EditorCommandCapabilityId;\n /** Opaque Host-issued access valid only while this external command handler owns the FIFO. */\n readonly serializedAuthoringAccess?: unknown;\n}\n\nexport type EditorCommandCapabilityHandler<TInput = unknown, TOutput = unknown> = (\n input: TInput,\n context: EditorCommandCallContext,\n) => EditorCommandCapabilityMaybePromise<EditorCommandCallResult<TOutput> | TOutput>;\n\nexport interface EditorCommandCapabilityRegistration<TInput = unknown, TOutput = unknown> {\n manifest: EditorCommandCapabilityManifest;\n available?: () => EditorCommandCapabilityMaybePromise<boolean | string>;\n handler: EditorCommandCapabilityHandler<TInput, TOutput>;\n}\n\nexport interface EditorCommandCapabilityAdapter {\n readonly commandSystem: EditorCommandClient;\n registerCapability<TInput = unknown, TOutput = unknown>(\n registration: EditorCommandCapabilityRegistration<TInput, TOutput>,\n ): () => void;\n listCapabilities(): EditorCommandCapabilityManifest[];\n callCapability<TOutput = unknown>(\n capabilityId: EditorCommandCapabilityId,\n input?: unknown,\n context?: EditorCommandInvocationContext,\n ): Promise<EditorCommandCallResult<TOutput>>;\n}\n\ntype InternalEditorCommandCapabilityRegistration = Omit<\n EditorCommandCapabilityRegistration<unknown, unknown>,\n 'handler'\n> & {\n handler: EditorCommandCapabilityHandler<unknown, unknown>;\n};\n\nexport interface CreateEditorCommandOptions {\n readonly commandSystem?: EditorCommandSystem;\n readonly resolveAuthoringRevision?: () => number | null;\n}\n\nexport function createEditorCommandCapabilityAdapter(\n options: CreateEditorCommandOptions = {},\n): EditorCommandCapabilityAdapter {\n const commandSystem = options.commandSystem ?? createEditorCommandSystem();\n let requestSequence = 0;\n const registerCapability = <TInput = unknown, TOutput = unknown>(\n registration: EditorCommandCapabilityRegistration<TInput, TOutput>,\n ): (() => void) => {\n return commandSystem.registerCommand(createCapabilityCommandRegistration(registration));\n };\n const adapter: EditorCommandCapabilityAdapter = {\n commandSystem: createCapabilityCommandClient(commandSystem),\n registerCapability<TInput = unknown, TOutput = unknown>(\n registration: EditorCommandCapabilityRegistration<TInput, TOutput>,\n ) {\n return registerCapability(registration);\n },\n listCapabilities() {\n return commandSystem.listManifests().map(toCapabilityManifest);\n },\n async callCapability<TOutput = unknown>(\n capabilityId: EditorCommandCapabilityId,\n input?: unknown,\n context?: EditorCommandInvocationContext,\n ) {\n try {\n const requestId = `agent-${++requestSequence}`;\n const manifest = commandSystem.listManifests().find(entry => entry.id === capabilityId);\n const authoringRevision = manifest?.access === 'write'\n && commandSystem.executionAuthorityInstalled\n ? options.resolveAuthoringRevision?.()\n : null;\n if (manifest?.access === 'write'\n && commandSystem.executionAuthorityInstalled\n && (authoringRevision === null || authoringRevision === undefined)) {\n return createCapabilityFailure(capabilityId, {\n severity: 'error',\n source: 'command-system',\n code: 'capability.unavailable',\n message: 'Editor authoring authority is unavailable.',\n });\n }\n const result = await commandSystem.execute<TOutput>({\n commandId: capabilityId,\n ...(input !== undefined ? { input: input as never } : {}),\n requestId,\n ...(authoringRevision !== null && authoringRevision !== undefined\n ? {\n idempotencyKey: requestId,\n expectedRevision: { document: authoringRevision },\n }\n : {}),\n principal: { type: 'agent' },\n source: 'agent-cli',\n ...(context?.traceId ? { traceId: context.traceId } : {}),\n ...(context?.traceStepId ? { traceStepId: context.traceStepId } : {}),\n });\n if (result.status === 'completed') {\n return {\n ok: true,\n capabilityId,\n output: result.output,\n ...(result.diagnostics?.length\n ? { diagnostics: result.diagnostics.map(toCapabilityDiagnostic) }\n : {}),\n };\n }\n return {\n ok: false,\n capabilityId,\n diagnostics: result.diagnostics.map(toCapabilityDiagnostic),\n };\n } catch (error) {\n return createCapabilityFailure(capabilityId, {\n severity: 'error',\n source: 'command-system',\n code: 'capability.exception',\n message: error instanceof Error ? error.message : String(error),\n });\n }\n },\n };\n return adapter;\n}\n\nfunction createCapabilityCommandClient(commandSystem: EditorCommandSystem): EditorCommandClient {\n return Object.freeze({\n get catalogRevision() { return commandSystem.catalogRevision; },\n get executionAuthorityInstalled() { return commandSystem.executionAuthorityInstalled; },\n listManifests: () => commandSystem.listManifests(),\n getCatalog: query => commandSystem.getCatalog(query),\n describeCommand: commandId => commandSystem.describeCommand(commandId),\n invoke: invocation => commandSystem.invoke(invocation),\n execute: invocation => commandSystem.execute(invocation),\n getOperation: operationId => commandSystem.getOperation(operationId),\n cancelOperation: operationId => commandSystem.cancelOperation(operationId),\n });\n}\n\n/** Registers a command-backed capability against the Host that owns authoring authority. */\nexport function registerEditorAuthoringHostCommandCapability<\n TDocument,\n TPatch,\n TInput = unknown,\n TOutput = unknown,\n>(\n host: EditorAuthoringHost<TDocument, TPatch>,\n registration: EditorCommandCapabilityRegistration<TInput, TOutput>,\n): () => void {\n return registerEditorAuthoringHostExternalCommand(\n host,\n createCapabilityCommandRegistration(registration),\n );\n}\n\nfunction createCapabilityCommandRegistration<TInput = unknown, TOutput = unknown>(\n registration: EditorCommandCapabilityRegistration<TInput, TOutput>,\n): EditorCommandRegistration<TInput, unknown> {\n const normalized = normalizeCapabilityRegistration(registration);\n return {\n manifest: createCommandManifest(normalized.manifest),\n ...(normalized.available ? { available: normalized.available } : {}),\n // Domain handlers keep their focused runtime validation in addition to the shared manifest.\n validateInput: false,\n validateOutput: false,\n handler: async (input, context) => {\n const invoke = () => normalized.handler(input, {\n capabilityId: normalized.manifest.id,\n ...(context.traceId ? { traceId: context.traceId } : {}),\n ...(context.traceStepId ? { traceStepId: context.traceStepId } : {}),\n ...(context.authorityContext !== undefined\n ? { serializedAuthoringAccess: context.authorityContext }\n : {}),\n });\n const result = await (context.authorityContext !== undefined\n ? callWithEditorAuthoringSerializedAccess(context.authorityContext, invoke)\n : invoke());\n if (isCapabilityCallResult(result)) {\n return result.ok\n ? {\n ok: true,\n output: result.output,\n ...(result.diagnostics?.length\n ? { diagnostics: result.diagnostics.map(toCommandDiagnostic) }\n : {}),\n }\n : { ok: false, diagnostics: result.diagnostics.map(toCommandDiagnostic) };\n }\n return { ok: true, output: result };\n },\n };\n}\n\nfunction createCommandManifest(\n manifest: EditorCommandCapabilityManifest,\n): EditorCommandManifest {\n const target = inferCommandTarget(manifest);\n const persistence = manifest.access === 'read'\n ? 'none'\n : target === 'authoring'\n ? 'authoring'\n : target === 'tooling'\n ? 'filesystem'\n : 'view';\n const presentation = EDITOR_COMMAND_BUILT_IN_PRESENTATION[\n manifest.id as keyof typeof EDITOR_COMMAND_BUILT_IN_PRESENTATION\n ];\n return {\n schemaVersion: 1,\n id: manifest.id,\n version: 1,\n title: manifest.title,\n ...(manifest.description ? { description: manifest.description } : {}),\n target,\n access: manifest.access,\n stability: normalizeCommandStability(manifest.stability),\n inputSchema: cloneJsonObject(manifest.inputSchema ?? {}) as EditorCommandJsonObject,\n outputSchema: cloneJsonObject(manifest.outputSchema ?? {}) as EditorCommandJsonObject,\n requires: {\n ...(manifest.layer === 'editor' ? { editorReady: true } : {}),\n ...(target === 'view' ? { viewAttached: true } : {}),\n ...(target === 'renderer' ? { rendererAttached: true } : {}),\n },\n effects: {\n persistence,\n undoable: manifest.access === 'write' && target === 'authoring',\n idempotent: manifest.access === 'read',\n },\n ...((manifest.category || presentation) ? { presentation: {\n ...(manifest.category ? { category: manifest.category } : {}),\n ...(presentation?.aliases ? { aliases: presentation.aliases } : {}),\n ...(presentation?.keywords ? { keywords: presentation.keywords } : {}),\n ...(presentation?.examples ? { examples: presentation.examples } : {}),\n ...(presentation?.shortcut ? { shortcut: presentation.shortcut } : {}),\n ...(presentation?.menu ? { menu: presentation.menu } : {}),\n } } : {}),\n };\n}\n\nfunction normalizeCommandStability(\n stability: EditorCommandCapabilityManifest['stability'],\n): EditorCommandManifest['stability'] {\n if (stability === 'stable') return 'stable';\n if (stability === 'deprecated') return 'deprecated';\n return 'experimental';\n}\n\nfunction inferCommandTarget(\n manifest: EditorCommandCapabilityManifest,\n): EditorCommandManifest['target'] {\n return EDITOR_COMMAND_BUILT_IN_TARGETS[\n manifest.id as keyof typeof EDITOR_COMMAND_BUILT_IN_TARGETS\n ] ?? (manifest.layer === 'host' ? 'workspace-service' : 'authoring');\n}\n\nfunction toCapabilityManifest(manifest: EditorCommandManifest): EditorCommandCapabilityManifest {\n return {\n schemaVersion: 1,\n id: manifest.id,\n title: manifest.title,\n ...(manifest.description ? { description: manifest.description } : {}),\n layer: manifest.target === 'workspace-service'\n || EDITOR_COMMAND_BUILT_IN_HOST_IDS.has(manifest.id as never)\n ? 'host'\n : 'editor',\n ...(manifest.presentation?.category ? { category: manifest.presentation.category } : {}),\n stability: manifest.stability,\n access: manifest.access,\n inputSchema: cloneJsonObject(manifest.inputSchema as EditorCommandJsonObject),\n outputSchema: cloneJsonObject(manifest.outputSchema as EditorCommandJsonObject),\n };\n}\n\nfunction toCommandDiagnostic(diagnostic: EditorCommandDiagnostic): EditorCommandDiagnostic {\n return {\n severity: diagnostic.severity,\n source: diagnostic.source,\n code: diagnostic.code ?? 'capability.failed',\n message: diagnostic.message,\n ...(diagnostic.objectId ? { objectId: diagnostic.objectId } : {}),\n ...(diagnostic.details ? { details: cloneJsonObject(diagnostic.details) as EditorCommandJsonObject } : {}),\n };\n}\n\nfunction toCapabilityDiagnostic(diagnostic: EditorCommandDiagnostic): EditorCommandDiagnostic {\n return {\n severity: diagnostic.severity,\n source: diagnostic.source,\n code: mapCapabilityDiagnosticCode(diagnostic.code),\n message: diagnostic.message,\n ...(diagnostic.objectId ? { objectId: diagnostic.objectId } : {}),\n ...(diagnostic.details ? { details: cloneJsonObject(diagnostic.details as EditorCommandJsonObject) } : {}),\n };\n}\n\nfunction mapCapabilityDiagnosticCode(code: string): string {\n if (code === 'command.notFound') return 'capability.notFound';\n if (code === 'command.unavailable' || code === 'command.availabilityException') return 'capability.unavailable';\n if (code === 'command.exception') return 'capability.exception';\n return code;\n}\n\nfunction normalizeCapabilityRegistration<TInput, TOutput>(\n registration: EditorCommandCapabilityRegistration<TInput, TOutput>,\n): InternalEditorCommandCapabilityRegistration {\n return {\n ...registration,\n manifest: cloneCapabilityManifest(registration.manifest),\n handler: registration.handler as EditorCommandCapabilityHandler<unknown, unknown>,\n };\n}\n\nfunction cloneCapabilityManifest(\n manifest: EditorCommandCapabilityManifest,\n): EditorCommandCapabilityManifest {\n return {\n ...manifest,\n inputSchema: cloneJsonObject(manifest.inputSchema),\n outputSchema: cloneJsonObject(manifest.outputSchema),\n };\n}\n\nfunction cloneJsonObject<T extends EditorCommandJsonObject | undefined>(value: T): T {\n if (!value) return value;\n return JSON.parse(JSON.stringify(value)) as T;\n}\n\nfunction isCapabilityCallResult<TOutput>(value: unknown): value is EditorCommandCallResult<TOutput> {\n if (!value || typeof value !== 'object') return false;\n const record = value as Partial<EditorCommandCallResult<TOutput>>;\n return typeof record.ok === 'boolean' && typeof record.capabilityId === 'string';\n}\n\nfunction createCapabilityFailure(\n capabilityId: EditorCommandCapabilityId,\n diagnostic: EditorCommandDiagnostic,\n): EditorCommandCallResult<never> {\n return {\n ok: false,\n capabilityId,\n diagnostics: [diagnostic],\n };\n}\n"]}
|