@konitif/workbench 0.284.1
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/LICENSE.md +21 -0
- package/README.md +54 -0
- package/dist/application/boot/applicationBoot.d.ts +48 -0
- package/dist/application/boot/applicationBoot.js +174 -0
- package/dist/application/experiment/ControlledExperimentCampaign.d.ts +12 -0
- package/dist/application/experiment/ControlledExperimentCampaign.js +159 -0
- package/dist/application/experiment/ControlledExperimentRecorder.d.ts +17 -0
- package/dist/application/experiment/ControlledExperimentRecorder.js +215 -0
- package/dist/application/i18n/WorkbenchTranslationRegistry.d.ts +19 -0
- package/dist/application/i18n/WorkbenchTranslationRegistry.js +179 -0
- package/dist/application/layout/surfaceCommandRouter.d.ts +18 -0
- package/dist/application/layout/surfaceCommandRouter.js +247 -0
- package/dist/application/physics/NoopPhysicsBackend.d.ts +2 -0
- package/dist/application/physics/NoopPhysicsBackend.js +2 -0
- package/dist/application/physics/PhysicsService.d.ts +2 -0
- package/dist/application/physics/PhysicsService.js +2 -0
- package/dist/application/project/ProjectManifest.d.ts +15 -0
- package/dist/application/project/ProjectManifest.js +107 -0
- package/dist/application/repository/RepositoryPreflightEngine.d.ts +6 -0
- package/dist/application/repository/RepositoryPreflightEngine.js +301 -0
- package/dist/application/runtime/RuntimeBackendConnection.d.ts +9 -0
- package/dist/application/runtime/RuntimeBackendConnection.js +34 -0
- package/dist/application/runtime/RuntimeBackendSubscription.d.ts +8 -0
- package/dist/application/runtime/RuntimeBackendSubscription.js +52 -0
- package/dist/application/runtime/RuntimeCheckpointStore.d.ts +20 -0
- package/dist/application/runtime/RuntimeCheckpointStore.js +65 -0
- package/dist/application/runtime/RuntimeLaunchProgress.d.ts +3 -0
- package/dist/application/runtime/RuntimeLaunchProgress.js +38 -0
- package/dist/application/runtime/RuntimeLaunchStateSnapshot.d.ts +48 -0
- package/dist/application/runtime/RuntimeLaunchStateSnapshot.js +73 -0
- package/dist/application/runtime/RuntimeObservabilityHub.d.ts +28 -0
- package/dist/application/runtime/RuntimeObservabilityHub.js +262 -0
- package/dist/application/runtime/RuntimeObservationEvents.d.ts +15 -0
- package/dist/application/runtime/RuntimeObservationEvents.js +18 -0
- package/dist/application/runtime/RuntimeOffloadManager.d.ts +24 -0
- package/dist/application/runtime/RuntimeOffloadManager.js +96 -0
- package/dist/application/runtime/RuntimePlanEngine.d.ts +11 -0
- package/dist/application/runtime/RuntimePlanEngine.js +67 -0
- package/dist/application/runtime/RuntimeProjectionCatalog.d.ts +5 -0
- package/dist/application/runtime/RuntimeProjectionCatalog.js +48 -0
- package/dist/application/runtime/RuntimeProjectionSession.d.ts +5 -0
- package/dist/application/runtime/RuntimeProjectionSession.js +4 -0
- package/dist/application/runtime/RuntimeProjectionSessionKeys.d.ts +5 -0
- package/dist/application/runtime/RuntimeProjectionSessionKeys.js +10 -0
- package/dist/application/runtime/RuntimeProjectionSessionReducers.d.ts +7 -0
- package/dist/application/runtime/RuntimeProjectionSessionReducers.js +101 -0
- package/dist/application/runtime/RuntimeProjectionSessionSerialization.d.ts +5 -0
- package/dist/application/runtime/RuntimeProjectionSessionSerialization.js +89 -0
- package/dist/application/runtime/RuntimeProjectionSessionSharedState.d.ts +3 -0
- package/dist/application/runtime/RuntimeProjectionSessionSharedState.js +53 -0
- package/dist/application/runtime/RuntimeProjectionSessionTypes.d.ts +38 -0
- package/dist/application/runtime/RuntimeProjectionSessionTypes.js +1 -0
- package/dist/application/runtime/RuntimeProjectionViewerSessionSync.d.ts +29 -0
- package/dist/application/runtime/RuntimeProjectionViewerSessionSync.js +39 -0
- package/dist/application/runtime/RuntimeProjectionViewerSessionUpdates.d.ts +27 -0
- package/dist/application/runtime/RuntimeProjectionViewerSessionUpdates.js +38 -0
- package/dist/application/runtime/RuntimeRegistryOwner.d.ts +20 -0
- package/dist/application/runtime/RuntimeRegistryOwner.js +71 -0
- package/dist/application/runtime/RuntimeRegistrySnapshots.d.ts +6 -0
- package/dist/application/runtime/RuntimeRegistrySnapshots.js +51 -0
- package/dist/application/runtime/RuntimeRegistryTypes.d.ts +29 -0
- package/dist/application/runtime/RuntimeRegistryTypes.js +1 -0
- package/dist/application/runtime/RuntimeSharedState.d.ts +6 -0
- package/dist/application/runtime/RuntimeSharedState.js +47 -0
- package/dist/application/runtime/WorkbenchRuntimeCore.d.ts +82 -0
- package/dist/application/runtime/WorkbenchRuntimeCore.js +463 -0
- package/dist/application/runtime/WorkbenchRuntimeSanitizers.d.ts +9 -0
- package/dist/application/runtime/WorkbenchRuntimeSanitizers.js +62 -0
- package/dist/application/shell/state.d.ts +22 -0
- package/dist/application/shell/state.js +308 -0
- package/dist/application/widgets/createWorkbenchWidgetAdapter.d.ts +9 -0
- package/dist/application/widgets/createWorkbenchWidgetAdapter.js +30 -0
- package/dist/application/workspace/canonicalizeLayout.d.ts +2 -0
- package/dist/application/workspace/canonicalizeLayout.js +91 -0
- package/dist/application/workspace/closePanel.d.ts +6 -0
- package/dist/application/workspace/closePanel.js +43 -0
- package/dist/application/workspace/collapseSplit.d.ts +7 -0
- package/dist/application/workspace/collapseSplit.js +45 -0
- package/dist/application/workspace/collapseSplitBoundary.d.ts +8 -0
- package/dist/application/workspace/collapseSplitBoundary.js +106 -0
- package/dist/application/workspace/commands.d.ts +71 -0
- package/dist/application/workspace/commands.js +216 -0
- package/dist/application/workspace/createPeripheralBands.d.ts +14 -0
- package/dist/application/workspace/createPeripheralBands.js +62 -0
- package/dist/application/workspace/createWorkspace.d.ts +7 -0
- package/dist/application/workspace/createWorkspace.js +12 -0
- package/dist/application/workspace/detachPanelToWindow.d.ts +12 -0
- package/dist/application/workspace/detachPanelToWindow.js +57 -0
- package/dist/application/workspace/dockPanel.d.ts +10 -0
- package/dist/application/workspace/dockPanel.js +399 -0
- package/dist/application/workspace/finalizeWorkspace.d.ts +4 -0
- package/dist/application/workspace/finalizeWorkspace.js +23 -0
- package/dist/application/workspace/focusPanel.d.ts +2 -0
- package/dist/application/workspace/focusPanel.js +19 -0
- package/dist/application/workspace/joinPanelArea.d.ts +13 -0
- package/dist/application/workspace/joinPanelArea.js +281 -0
- package/dist/application/workspace/layoutInteraction.d.ts +176 -0
- package/dist/application/workspace/layoutInteraction.js +852 -0
- package/dist/application/workspace/layoutTree.d.ts +34 -0
- package/dist/application/workspace/layoutTree.js +135 -0
- package/dist/application/workspace/openTool.d.ts +15 -0
- package/dist/application/workspace/openTool.js +89 -0
- package/dist/application/workspace/presetArtifacts.d.ts +60 -0
- package/dist/application/workspace/presetArtifacts.js +231 -0
- package/dist/application/workspace/presets.d.ts +5 -0
- package/dist/application/workspace/presets.js +12 -0
- package/dist/application/workspace/reattachWorkspaceWindow.d.ts +7 -0
- package/dist/application/workspace/reattachWorkspaceWindow.js +24 -0
- package/dist/application/workspace/resizeSplit.d.ts +7 -0
- package/dist/application/workspace/resizeSplit.js +12 -0
- package/dist/application/workspace/resizeSplitBoundary.d.ts +10 -0
- package/dist/application/workspace/resizeSplitBoundary.js +115 -0
- package/dist/application/workspace/runToolShellCommand.d.ts +11 -0
- package/dist/application/workspace/runToolShellCommand.js +133 -0
- package/dist/application/workspace/session.d.ts +9 -0
- package/dist/application/workspace/session.js +36 -0
- package/dist/application/workspace/setActiveStackChild.d.ts +7 -0
- package/dist/application/workspace/setActiveStackChild.js +12 -0
- package/dist/application/workspace/setDesignSystemThemeSession.d.ts +3 -0
- package/dist/application/workspace/setDesignSystemThemeSession.js +12 -0
- package/dist/application/workspace/setPanelFullscreenToggleVisibility.d.ts +7 -0
- package/dist/application/workspace/setPanelFullscreenToggleVisibility.js +7 -0
- package/dist/application/workspace/setStackHeaderVisibility.d.ts +7 -0
- package/dist/application/workspace/setStackHeaderVisibility.js +7 -0
- package/dist/application/workspace/setToolPanelTitleOverride.d.ts +9 -0
- package/dist/application/workspace/setToolPanelTitleOverride.js +33 -0
- package/dist/application/workspace/setToolShellStatus.d.ts +8 -0
- package/dist/application/workspace/setToolShellStatus.js +32 -0
- package/dist/application/workspace/setWorkspaceFullscreenPanel.d.ts +3 -0
- package/dist/application/workspace/setWorkspaceFullscreenPanel.js +26 -0
- package/dist/application/workspace/snapshots.d.ts +10 -0
- package/dist/application/workspace/snapshots.js +34 -0
- package/dist/application/workspace/splitPanel.d.ts +10 -0
- package/dist/application/workspace/splitPanel.js +21 -0
- package/dist/application/workspace/subdividePanel.d.ts +39 -0
- package/dist/application/workspace/subdividePanel.js +128 -0
- package/dist/application/workspace/swapPanelArea.d.ts +11 -0
- package/dist/application/workspace/swapPanelArea.js +163 -0
- package/dist/application/workspace/targetWindow.d.ts +4 -0
- package/dist/application/workspace/targetWindow.js +22 -0
- package/dist/application/workspace/toolCapabilities.d.ts +11 -0
- package/dist/application/workspace/toolCapabilities.js +59 -0
- package/dist/application/workspace/toolRuntime.d.ts +32 -0
- package/dist/application/workspace/toolRuntime.js +65 -0
- package/dist/application/workspace/updateToolState.d.ts +8 -0
- package/dist/application/workspace/updateToolState.js +20 -0
- package/dist/boot/applicationBoot.d.ts +1 -0
- package/dist/boot/applicationBoot.js +2 -0
- package/dist/boot/events.d.ts +43 -0
- package/dist/boot/events.js +16 -0
- package/dist/boot/executor.d.ts +13 -0
- package/dist/boot/executor.js +210 -0
- package/dist/boot/graph.d.ts +16 -0
- package/dist/boot/graph.js +126 -0
- package/dist/boot/index.d.ts +2 -0
- package/dist/boot/index.js +3 -0
- package/dist/boot/mechanism.d.ts +5 -0
- package/dist/boot/mechanism.js +6 -0
- package/dist/boot/projection.d.ts +72 -0
- package/dist/boot/projection.js +398 -0
- package/dist/boot/types.d.ts +80 -0
- package/dist/boot/types.js +46 -0
- package/dist/domain/composition/dockArrangement.d.ts +57 -0
- package/dist/domain/composition/dockArrangement.js +304 -0
- package/dist/domain/composition/docking.d.ts +68 -0
- package/dist/domain/composition/docking.js +187 -0
- package/dist/domain/design-system/themeSession.d.ts +12 -0
- package/dist/domain/design-system/themeSession.js +42 -0
- package/dist/domain/experiment/model.d.ts +149 -0
- package/dist/domain/experiment/model.js +1 -0
- package/dist/domain/i18n/languageRegistry.d.ts +57 -0
- package/dist/domain/i18n/languageRegistry.js +1 -0
- package/dist/domain/i18n/model.d.ts +31 -0
- package/dist/domain/i18n/model.js +1 -0
- package/dist/domain/icon/model.d.ts +8 -0
- package/dist/domain/icon/model.js +1 -0
- package/dist/domain/input/interactionBindings.d.ts +2 -0
- package/dist/domain/input/interactionBindings.js +2 -0
- package/dist/domain/launch/model.d.ts +58 -0
- package/dist/domain/launch/model.js +109 -0
- package/dist/domain/layout/interaction.d.ts +90 -0
- package/dist/domain/layout/interaction.js +1 -0
- package/dist/domain/layout/model.d.ts +28 -0
- package/dist/domain/layout/model.js +1 -0
- package/dist/domain/layout/selectors.d.ts +12 -0
- package/dist/domain/layout/selectors.js +84 -0
- package/dist/domain/layout/surfaceProjection.d.ts +56 -0
- package/dist/domain/layout/surfaceProjection.js +249 -0
- package/dist/domain/layout/validation.d.ts +9 -0
- package/dist/domain/layout/validation.js +71 -0
- package/dist/domain/panel/model.d.ts +9 -0
- package/dist/domain/panel/model.js +1 -0
- package/dist/domain/physics/colliderGeometry.d.ts +2 -0
- package/dist/domain/physics/colliderGeometry.js +1 -0
- package/dist/domain/physics/contracts.d.ts +2 -0
- package/dist/domain/physics/contracts.js +1 -0
- package/dist/domain/physics/kinematicBinding.d.ts +22 -0
- package/dist/domain/physics/kinematicBinding.js +1 -0
- package/dist/domain/physics/model.d.ts +4 -0
- package/dist/domain/physics/model.js +1 -0
- package/dist/domain/physics/mujoco.d.ts +5 -0
- package/dist/domain/physics/mujoco.js +1 -0
- package/dist/domain/physics/observationProfile.d.ts +2 -0
- package/dist/domain/physics/observationProfile.js +1 -0
- package/dist/domain/physics/presentationBinding.d.ts +6 -0
- package/dist/domain/physics/presentationBinding.js +1 -0
- package/dist/domain/physics/simulationProfile.d.ts +2 -0
- package/dist/domain/physics/simulationProfile.js +1 -0
- package/dist/domain/physics/visualAlignment.d.ts +17 -0
- package/dist/domain/physics/visualAlignment.js +1 -0
- package/dist/domain/presentation/readingLevel.d.ts +12 -0
- package/dist/domain/presentation/readingLevel.js +29 -0
- package/dist/domain/project/model.d.ts +55 -0
- package/dist/domain/project/model.js +1 -0
- package/dist/domain/repo-quality/model.d.ts +111 -0
- package/dist/domain/repo-quality/model.js +1 -0
- package/dist/domain/repository/model.d.ts +110 -0
- package/dist/domain/repository/model.js +1 -0
- package/dist/domain/runtime/checkpoint.d.ts +37 -0
- package/dist/domain/runtime/checkpoint.js +87 -0
- package/dist/domain/runtime/hydration.d.ts +26 -0
- package/dist/domain/runtime/hydration.js +92 -0
- package/dist/domain/runtime/initialization.d.ts +25 -0
- package/dist/domain/runtime/initialization.js +87 -0
- package/dist/domain/runtime/lifecycle.d.ts +51 -0
- package/dist/domain/runtime/lifecycle.js +118 -0
- package/dist/domain/runtime/model.d.ts +252 -0
- package/dist/domain/runtime/model.js +13 -0
- package/dist/domain/runtime/observability.d.ts +142 -0
- package/dist/domain/runtime/observability.js +1 -0
- package/dist/domain/runtime/offload.d.ts +56 -0
- package/dist/domain/runtime/offload.js +129 -0
- package/dist/domain/runtime/plan.d.ts +26 -0
- package/dist/domain/runtime/plan.js +1 -0
- package/dist/domain/runtime/qualityPolicy.d.ts +28 -0
- package/dist/domain/runtime/qualityPolicy.js +97 -0
- package/dist/domain/runtime/recovery.d.ts +61 -0
- package/dist/domain/runtime/recovery.js +129 -0
- package/dist/domain/runtime/suspension.d.ts +32 -0
- package/dist/domain/runtime/suspension.js +107 -0
- package/dist/domain/runtime/teardown.d.ts +33 -0
- package/dist/domain/runtime/teardown.js +109 -0
- package/dist/domain/shared/id.d.ts +1 -0
- package/dist/domain/shared/id.js +5 -0
- package/dist/domain/shared/json.d.ts +9 -0
- package/dist/domain/shared/json.js +24 -0
- package/dist/domain/shell/model.d.ts +40 -0
- package/dist/domain/shell/model.js +1 -0
- package/dist/domain/shell/runtime.d.ts +76 -0
- package/dist/domain/shell/runtime.js +40 -0
- package/dist/domain/surface/model.d.ts +97 -0
- package/dist/domain/surface/model.js +71 -0
- package/dist/domain/temporal/model.d.ts +95 -0
- package/dist/domain/temporal/model.js +45 -0
- package/dist/domain/tool/internalTab.d.ts +11 -0
- package/dist/domain/tool/internalTab.js +20 -0
- package/dist/domain/tool/model.d.ts +207 -0
- package/dist/domain/tool/model.js +1 -0
- package/dist/domain/tool/runtime.d.ts +122 -0
- package/dist/domain/tool/runtime.js +2 -0
- package/dist/domain/tool/shell.d.ts +38 -0
- package/dist/domain/tool/shell.js +175 -0
- package/dist/domain/widget/composition.d.ts +79 -0
- package/dist/domain/widget/composition.js +250 -0
- package/dist/domain/widget/model.d.ts +35 -0
- package/dist/domain/widget/model.js +8 -0
- package/dist/domain/widget/toolDock.d.ts +30 -0
- package/dist/domain/widget/toolDock.js +52 -0
- package/dist/domain/workbench/model.d.ts +35 -0
- package/dist/domain/workbench/model.js +1 -0
- package/dist/domain/workbench/routing.d.ts +17 -0
- package/dist/domain/workbench/routing.js +72 -0
- package/dist/domain/workspace/factories.d.ts +9 -0
- package/dist/domain/workspace/factories.js +47 -0
- package/dist/domain/workspace/model.d.ts +23 -0
- package/dist/domain/workspace/model.js +1 -0
- package/dist/domain/workspace/persistence.d.ts +5 -0
- package/dist/domain/workspace/persistence.js +1 -0
- package/dist/domain/workspace/selectors.d.ts +19 -0
- package/dist/domain/workspace/selectors.js +90 -0
- package/dist/domain/workspace/session.d.ts +9 -0
- package/dist/domain/workspace/session.js +1 -0
- package/dist/domain/workspace/validation.d.ts +10 -0
- package/dist/domain/workspace/validation.js +231 -0
- package/dist/hosting.d.ts +15 -0
- package/dist/hosting.js +12 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.js +111 -0
- package/dist/infrastructure/audio/WorkbenchAudioManager.d.ts +36 -0
- package/dist/infrastructure/audio/WorkbenchAudioManager.js +100 -0
- package/dist/infrastructure/backend/HttpWorkbenchBackendClient.d.ts +30 -0
- package/dist/infrastructure/backend/HttpWorkbenchBackendClient.js +314 -0
- package/dist/infrastructure/persistence/LocalWorkspacePersistence.d.ts +8 -0
- package/dist/infrastructure/persistence/LocalWorkspacePersistence.js +29 -0
- package/dist/infrastructure/surfaces/InMemorySurfaceViewerRegistry.d.ts +58 -0
- package/dist/infrastructure/surfaces/InMemorySurfaceViewerRegistry.js +121 -0
- package/dist/infrastructure/temporal/InMemoryTemporalDialectRegistry.d.ts +8 -0
- package/dist/infrastructure/temporal/InMemoryTemporalDialectRegistry.js +38 -0
- package/dist/infrastructure/tools/InMemoryToolRegistry.d.ts +46 -0
- package/dist/infrastructure/tools/InMemoryToolRegistry.js +82 -0
- package/dist/infrastructure/widgets/InMemoryShellWidgetRegistry.d.ts +42 -0
- package/dist/infrastructure/widgets/InMemoryShellWidgetRegistry.js +66 -0
- package/dist/infrastructure/widgets/InMemoryWorkbenchWidgetRegistry.d.ts +20 -0
- package/dist/infrastructure/widgets/InMemoryWorkbenchWidgetRegistry.js +35 -0
- package/dist/infrastructure/workbenches/InMemoryWorkbenchRegistry.d.ts +7 -0
- package/dist/infrastructure/workbenches/InMemoryWorkbenchRegistry.js +28 -0
- package/dist/physics-runtime.d.ts +4 -0
- package/dist/physics-runtime.js +2 -0
- package/dist/stage/easing.d.ts +5 -0
- package/dist/stage/easing.js +15 -0
- package/dist/stage/index.d.ts +6 -0
- package/dist/stage/index.js +6 -0
- package/dist/stage/projection.d.ts +4 -0
- package/dist/stage/projection.js +74 -0
- package/dist/stage/stageRuntime.d.ts +2 -0
- package/dist/stage/stageRuntime.js +32 -0
- package/dist/stage/timeline.d.ts +3 -0
- package/dist/stage/timeline.js +69 -0
- package/dist/stage/tween.d.ts +3 -0
- package/dist/stage/tween.js +104 -0
- package/dist/stage/types.d.ts +104 -0
- package/dist/stage/types.js +30 -0
- package/dist/temporal/clock/audioClock.d.ts +1 -0
- package/dist/temporal/clock/audioClock.js +1 -0
- package/dist/temporal/clock/clockGraph.d.ts +1 -0
- package/dist/temporal/clock/clockGraph.js +1 -0
- package/dist/temporal/clock/clockTypes.d.ts +1 -0
- package/dist/temporal/clock/clockTypes.js +1 -0
- package/dist/temporal/clock/fixedStepClock.d.ts +1 -0
- package/dist/temporal/clock/fixedStepClock.js +1 -0
- package/dist/temporal/clock/musicalClock.d.ts +7 -0
- package/dist/temporal/clock/musicalClock.js +35 -0
- package/dist/temporal/clock/rootClock.d.ts +1 -0
- package/dist/temporal/clock/rootClock.js +1 -0
- package/dist/temporal/clock/videoClock.d.ts +1 -0
- package/dist/temporal/clock/videoClock.js +1 -0
- package/dist/temporal/easing/easingFunctions.d.ts +2 -0
- package/dist/temporal/easing/easingFunctions.js +19 -0
- package/dist/temporal/easing/easingRegistry.d.ts +10 -0
- package/dist/temporal/easing/easingRegistry.js +32 -0
- package/dist/temporal/easing/easingShaderSource.d.ts +2 -0
- package/dist/temporal/easing/easingShaderSource.js +16 -0
- package/dist/temporal/easing/easingTypes.d.ts +9 -0
- package/dist/temporal/easing/easingTypes.js +1 -0
- package/dist/temporal/history/runtimeHistory.d.ts +77 -0
- package/dist/temporal/history/runtimeHistory.js +5 -0
- package/dist/temporal/history/temporalHistoryCore.d.ts +1 -0
- package/dist/temporal/history/temporalHistoryCore.js +1 -0
- package/dist/temporal/index.d.ts +20 -0
- package/dist/temporal/index.js +20 -0
- package/dist/temporal/invalidation/invalidationController.d.ts +1 -0
- package/dist/temporal/invalidation/invalidationController.js +1 -0
- package/dist/temporal/scheduler/browserSchedulerHost.d.ts +3 -0
- package/dist/temporal/scheduler/browserSchedulerHost.js +19 -0
- package/dist/temporal/scheduler/frameBudget.d.ts +1 -0
- package/dist/temporal/scheduler/frameBudget.js +1 -0
- package/dist/temporal/scheduler/temporalScheduler.d.ts +4 -0
- package/dist/temporal/scheduler/temporalScheduler.js +6 -0
- package/dist/temporal/scheduler/temporalSchedulerCore.d.ts +1 -0
- package/dist/temporal/scheduler/temporalSchedulerCore.js +1 -0
- package/dist/temporal/scheduler/visibilityPolicy.d.ts +2 -0
- package/dist/temporal/scheduler/visibilityPolicy.js +1 -0
- package/dist/temporal/transport/temporalTransport.d.ts +1 -0
- package/dist/temporal/transport/temporalTransport.js +1 -0
- package/dist/temporal/transport/transportScope.d.ts +7 -0
- package/dist/temporal/transport/transportScope.js +3 -0
- package/dist/temporal/transport/transportTimeline.d.ts +22 -0
- package/dist/temporal/transport/transportTimeline.js +36 -0
- package/dist/temporal/transport/transportTypes.d.ts +1 -0
- package/dist/temporal/transport/transportTypes.js +1 -0
- package/dist/workspace-contracts.d.ts +36 -0
- package/dist/workspace-contracts.js +28 -0
- package/package.json +57 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { cloneJsonObject } from "../../domain/shared/json.js";
|
|
2
|
+
export class ControlledExperimentRecorder {
|
|
3
|
+
definition;
|
|
4
|
+
conditionIds;
|
|
5
|
+
metricIds;
|
|
6
|
+
metricIdSet;
|
|
7
|
+
phaseIds;
|
|
8
|
+
activeRun = null;
|
|
9
|
+
constructor(definition) {
|
|
10
|
+
this.definition = definition;
|
|
11
|
+
assertDefinition(definition);
|
|
12
|
+
this.conditionIds = new Set(definition.conditions.map((condition) => condition.id));
|
|
13
|
+
this.metricIds = definition.metrics.map((metric) => metric.id);
|
|
14
|
+
this.metricIdSet = new Set(this.metricIds);
|
|
15
|
+
this.phaseIds = new Set(definition.phases.map((phase) => phase.id));
|
|
16
|
+
}
|
|
17
|
+
start(input) {
|
|
18
|
+
if (this.activeRun) {
|
|
19
|
+
throw new Error(`Experiment ${this.definition.id} is already recording ${this.activeRun.input.runId}.`);
|
|
20
|
+
}
|
|
21
|
+
if (!this.conditionIds.has(input.conditionId)) {
|
|
22
|
+
throw new Error(`Unknown experiment condition: ${input.conditionId}`);
|
|
23
|
+
}
|
|
24
|
+
if (!input.runId.trim() || !Number.isFinite(input.startedAtMs)) {
|
|
25
|
+
throw new Error('A controlled experiment run requires a stable id and finite start timestamp.');
|
|
26
|
+
}
|
|
27
|
+
this.activeRun = {
|
|
28
|
+
input: {
|
|
29
|
+
...input,
|
|
30
|
+
runId: input.runId.trim(),
|
|
31
|
+
environment: cloneJsonObject(input.environment)
|
|
32
|
+
},
|
|
33
|
+
phaseId: null,
|
|
34
|
+
sequence: 0,
|
|
35
|
+
observations: [],
|
|
36
|
+
phaseMarkers: [],
|
|
37
|
+
droppedObservationCount: 0
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
markPhase(phaseId, observedAtMs, provenance = {}) {
|
|
41
|
+
const run = this.activeRun;
|
|
42
|
+
if (!run || !this.phaseIds.has(phaseId) || !Number.isFinite(observedAtMs)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
run.phaseId = phaseId;
|
|
46
|
+
run.phaseMarkers.push({
|
|
47
|
+
sequence: run.sequence++,
|
|
48
|
+
phaseId,
|
|
49
|
+
observedAtMs,
|
|
50
|
+
provenance: cloneJsonObject(provenance)
|
|
51
|
+
});
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
record(input) {
|
|
55
|
+
const run = this.activeRun;
|
|
56
|
+
if (!run || !Number.isFinite(input.observedAtMs)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (run.observations.length >= this.definition.maxObservations) {
|
|
60
|
+
run.droppedObservationCount += 1;
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
run.observations.push({
|
|
64
|
+
sequence: run.sequence++,
|
|
65
|
+
observedAtMs: input.observedAtMs,
|
|
66
|
+
phaseId: run.phaseId,
|
|
67
|
+
metrics: Object.fromEntries(Object.entries(input.metrics)
|
|
68
|
+
.filter(([metricId]) => this.metricIdSet.has(metricId))
|
|
69
|
+
.map(([metricId, value]) => [metricId, normalizeMetricValue(value)])),
|
|
70
|
+
provenance: cloneJsonObject(input.provenance ?? {})
|
|
71
|
+
});
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
stop(input) {
|
|
75
|
+
const run = this.activeRun;
|
|
76
|
+
if (!run) {
|
|
77
|
+
throw new Error(`Experiment ${this.definition.id} is not recording.`);
|
|
78
|
+
}
|
|
79
|
+
if (!Number.isFinite(input.endedAtMs)) {
|
|
80
|
+
throw new Error('A controlled experiment run requires a finite end timestamp.');
|
|
81
|
+
}
|
|
82
|
+
const condition = this.definition.conditions.find((candidate) => candidate.id === run.input.conditionId);
|
|
83
|
+
if (!condition) {
|
|
84
|
+
throw new Error(`Unknown experiment condition: ${run.input.conditionId}`);
|
|
85
|
+
}
|
|
86
|
+
const observations = run.observations.map(cloneObservation);
|
|
87
|
+
const retentionInvalid = run.droppedObservationCount > 0;
|
|
88
|
+
const status = input.status === 'cancelled'
|
|
89
|
+
? 'cancelled'
|
|
90
|
+
: retentionInvalid
|
|
91
|
+
? 'invalid'
|
|
92
|
+
: input.status ?? 'completed';
|
|
93
|
+
const artifact = {
|
|
94
|
+
schemaVersion: 1,
|
|
95
|
+
experiment: {
|
|
96
|
+
id: this.definition.id,
|
|
97
|
+
version: this.definition.version,
|
|
98
|
+
title: this.definition.title,
|
|
99
|
+
hypothesis: this.definition.hypothesis,
|
|
100
|
+
independentVariable: this.definition.independentVariable,
|
|
101
|
+
conditions: this.definition.conditions.map(cloneCondition),
|
|
102
|
+
condition: {
|
|
103
|
+
...condition,
|
|
104
|
+
parameters: cloneJsonObject(condition.parameters)
|
|
105
|
+
},
|
|
106
|
+
metrics: this.definition.metrics.map((metric) => ({ ...metric })),
|
|
107
|
+
phases: this.definition.phases.map((phase) => ({ ...phase })),
|
|
108
|
+
controlledVariables: [...this.definition.controlledVariables]
|
|
109
|
+
},
|
|
110
|
+
run: {
|
|
111
|
+
id: run.input.runId,
|
|
112
|
+
status,
|
|
113
|
+
reason: input.reason?.trim() || (retentionInvalid ? 'observation_limit_reached' : null),
|
|
114
|
+
startedAtMs: run.input.startedAtMs,
|
|
115
|
+
endedAtMs: input.endedAtMs,
|
|
116
|
+
durationMs: Math.max(0, input.endedAtMs - run.input.startedAtMs),
|
|
117
|
+
environment: cloneJsonObject(run.input.environment)
|
|
118
|
+
},
|
|
119
|
+
observations,
|
|
120
|
+
phaseMarkers: run.phaseMarkers.map((marker) => ({
|
|
121
|
+
...marker,
|
|
122
|
+
provenance: cloneJsonObject(marker.provenance)
|
|
123
|
+
})),
|
|
124
|
+
metricSummaries: summarizeMetrics(this.metricIds, observations),
|
|
125
|
+
retention: {
|
|
126
|
+
maxObservations: this.definition.maxObservations,
|
|
127
|
+
recordedObservations: observations.length,
|
|
128
|
+
droppedObservations: run.droppedObservationCount,
|
|
129
|
+
truncated: run.droppedObservationCount > 0
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
this.activeRun = null;
|
|
133
|
+
return artifact;
|
|
134
|
+
}
|
|
135
|
+
isRecording() {
|
|
136
|
+
return this.activeRun !== null;
|
|
137
|
+
}
|
|
138
|
+
snapshot() {
|
|
139
|
+
const run = this.activeRun;
|
|
140
|
+
return {
|
|
141
|
+
recording: run !== null,
|
|
142
|
+
runId: run?.input.runId ?? null,
|
|
143
|
+
conditionId: run?.input.conditionId ?? null,
|
|
144
|
+
phaseId: run?.phaseId ?? null,
|
|
145
|
+
observationCount: run?.observations.length ?? 0,
|
|
146
|
+
droppedObservationCount: run?.droppedObservationCount ?? 0
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function cloneCondition(condition) {
|
|
151
|
+
return {
|
|
152
|
+
...condition,
|
|
153
|
+
parameters: cloneJsonObject(condition.parameters)
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function assertDefinition(definition) {
|
|
157
|
+
if (!definition.id.trim() || !Number.isInteger(definition.version) || definition.version < 1) {
|
|
158
|
+
throw new Error('A controlled experiment definition requires a stable id and positive integer version.');
|
|
159
|
+
}
|
|
160
|
+
assertUniqueIds('condition', definition.conditions.map((condition) => condition.id));
|
|
161
|
+
assertUniqueIds('metric', definition.metrics.map((metric) => metric.id));
|
|
162
|
+
assertUniqueIds('phase', definition.phases.map((phase) => phase.id));
|
|
163
|
+
if (definition.conditions.length < 2) {
|
|
164
|
+
throw new Error('A controlled comparison requires at least two conditions.');
|
|
165
|
+
}
|
|
166
|
+
if (!Number.isInteger(definition.maxObservations) || definition.maxObservations < 1) {
|
|
167
|
+
throw new Error('A controlled experiment requires a positive observation retention bound.');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function assertUniqueIds(kind, ids) {
|
|
171
|
+
if (ids.some((id) => !id.trim()) || new Set(ids).size !== ids.length) {
|
|
172
|
+
throw new Error(`Controlled experiment ${kind} ids must be non-empty and unique.`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function normalizeMetricValue(value) {
|
|
176
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
177
|
+
}
|
|
178
|
+
function cloneObservation(observation) {
|
|
179
|
+
return {
|
|
180
|
+
...observation,
|
|
181
|
+
metrics: { ...observation.metrics },
|
|
182
|
+
provenance: cloneJsonObject(observation.provenance)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function summarizeMetrics(metricIds, observations) {
|
|
186
|
+
return Object.fromEntries(metricIds.map((metricId) => {
|
|
187
|
+
const values = observations
|
|
188
|
+
.map((observation) => observation.metrics[metricId])
|
|
189
|
+
.filter((value) => typeof value === 'number' && Number.isFinite(value));
|
|
190
|
+
return [metricId, summarizeMetric(values)];
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
function summarizeMetric(values) {
|
|
194
|
+
if (values.length === 0) {
|
|
195
|
+
return { count: 0, minimum: null, maximum: null, mean: null, p01: null, p50: null, p95: null, p99: null };
|
|
196
|
+
}
|
|
197
|
+
const sorted = [...values].sort((left, right) => left - right);
|
|
198
|
+
return {
|
|
199
|
+
count: sorted.length,
|
|
200
|
+
minimum: sorted[0] ?? null,
|
|
201
|
+
maximum: sorted[sorted.length - 1] ?? null,
|
|
202
|
+
mean: sorted.reduce((total, value) => total + value, 0) / sorted.length,
|
|
203
|
+
p01: percentile(sorted, 0.01),
|
|
204
|
+
p50: percentile(sorted, 0.5),
|
|
205
|
+
p95: percentile(sorted, 0.95),
|
|
206
|
+
p99: percentile(sorted, 0.99)
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function percentile(sorted, quantile) {
|
|
210
|
+
if (sorted.length === 0) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
const index = Math.ceil(Math.min(1, Math.max(0, quantile)) * sorted.length) - 1;
|
|
214
|
+
return sorted[Math.max(0, index)] ?? null;
|
|
215
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TranslationBundle, TranslationLookupOptions, TranslationMatch, TranslationRegistryOptions, WorkbenchLocale } from "../../domain/i18n/model.js";
|
|
2
|
+
export declare class WorkbenchTranslationRegistry {
|
|
3
|
+
readonly fallbackLocale: WorkbenchLocale;
|
|
4
|
+
private bundles;
|
|
5
|
+
private bundleIndexes;
|
|
6
|
+
private messageIndexes;
|
|
7
|
+
private resolutionCache;
|
|
8
|
+
private nextOrder;
|
|
9
|
+
constructor(options?: TranslationRegistryOptions);
|
|
10
|
+
registerBundle(bundle: TranslationBundle): boolean;
|
|
11
|
+
registerBundles(bundles: TranslationBundle[]): boolean;
|
|
12
|
+
private upsertBundle;
|
|
13
|
+
listBundles(): TranslationBundle[];
|
|
14
|
+
resolve(key: string, options?: TranslationLookupOptions): TranslationMatch | null;
|
|
15
|
+
translate(key: string, options?: TranslationLookupOptions): string;
|
|
16
|
+
private resolveForLocale;
|
|
17
|
+
private rebuildMessageIndex;
|
|
18
|
+
}
|
|
19
|
+
export declare function createWorkbenchTranslationRegistry(options?: TranslationRegistryOptions): WorkbenchTranslationRegistry;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
function normalizeLocale(locale) {
|
|
2
|
+
return (locale?.trim() || 'en').toLowerCase();
|
|
3
|
+
}
|
|
4
|
+
function buildLocaleFallbacks(locale, fallbackLocale) {
|
|
5
|
+
const normalizedLocale = normalizeLocale(locale);
|
|
6
|
+
const normalizedFallback = normalizeLocale(fallbackLocale);
|
|
7
|
+
const baseLocale = normalizedLocale.split('-')[0] ?? normalizedLocale;
|
|
8
|
+
const fallbacks = [normalizedLocale];
|
|
9
|
+
if (baseLocale && baseLocale !== normalizedLocale) {
|
|
10
|
+
fallbacks.push(baseLocale);
|
|
11
|
+
}
|
|
12
|
+
if (!fallbacks.includes(normalizedFallback)) {
|
|
13
|
+
fallbacks.push(normalizedFallback);
|
|
14
|
+
}
|
|
15
|
+
return fallbacks;
|
|
16
|
+
}
|
|
17
|
+
function interpolateMessage(message, values) {
|
|
18
|
+
if (!values) {
|
|
19
|
+
return message;
|
|
20
|
+
}
|
|
21
|
+
return message.replace(/\{\{\s*([A-Za-z0-9_.-]+)\s*\}\}/g, (placeholder, name) => {
|
|
22
|
+
const value = values[name];
|
|
23
|
+
return value === null || value === undefined ? placeholder : String(value);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export class WorkbenchTranslationRegistry {
|
|
27
|
+
fallbackLocale;
|
|
28
|
+
bundles = [];
|
|
29
|
+
bundleIndexes = new Map();
|
|
30
|
+
messageIndexes = new Map();
|
|
31
|
+
resolutionCache = new Map();
|
|
32
|
+
nextOrder = 0;
|
|
33
|
+
constructor(options = {}) {
|
|
34
|
+
this.fallbackLocale = normalizeLocale(options.fallbackLocale);
|
|
35
|
+
}
|
|
36
|
+
registerBundle(bundle) {
|
|
37
|
+
const changedLocale = this.upsertBundle(bundle);
|
|
38
|
+
if (!changedLocale) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
this.rebuildMessageIndex(changedLocale);
|
|
42
|
+
this.resolutionCache.clear();
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
registerBundles(bundles) {
|
|
46
|
+
const changedLocales = new Set();
|
|
47
|
+
for (const bundle of bundles) {
|
|
48
|
+
const changedLocale = this.upsertBundle(bundle);
|
|
49
|
+
if (changedLocale) {
|
|
50
|
+
changedLocales.add(changedLocale);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (changedLocales.size === 0) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
for (const locale of changedLocales) {
|
|
57
|
+
this.rebuildMessageIndex(locale);
|
|
58
|
+
}
|
|
59
|
+
this.resolutionCache.clear();
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
upsertBundle(bundle) {
|
|
63
|
+
const normalizedBundle = {
|
|
64
|
+
...bundle,
|
|
65
|
+
locale: normalizeLocale(bundle.locale),
|
|
66
|
+
namespace: bundle.namespace.trim(),
|
|
67
|
+
priority: bundle.priority ?? 0,
|
|
68
|
+
order: this.nextOrder++
|
|
69
|
+
};
|
|
70
|
+
const identity = translationBundleIdentity(normalizedBundle);
|
|
71
|
+
const existingIndex = this.bundleIndexes.get(identity);
|
|
72
|
+
if (existingIndex !== undefined) {
|
|
73
|
+
const existing = this.bundles[existingIndex];
|
|
74
|
+
if (sameTranslationBundle(existing, normalizedBundle)) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
this.bundles[existingIndex] = normalizedBundle;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this.bundleIndexes.set(identity, this.bundles.length);
|
|
81
|
+
this.bundles.push(normalizedBundle);
|
|
82
|
+
}
|
|
83
|
+
return normalizedBundle.locale;
|
|
84
|
+
}
|
|
85
|
+
listBundles() {
|
|
86
|
+
return this.bundles.map(({ order: _order, ...bundle }) => bundle);
|
|
87
|
+
}
|
|
88
|
+
resolve(key, options = {}) {
|
|
89
|
+
const trimmedKey = key.trim();
|
|
90
|
+
if (!trimmedKey) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
for (const locale of buildLocaleFallbacks(options.locale, this.fallbackLocale)) {
|
|
94
|
+
const match = this.resolveForLocale(trimmedKey, locale);
|
|
95
|
+
if (match) {
|
|
96
|
+
return match;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
translate(key, options = {}) {
|
|
102
|
+
const match = this.resolve(key, options);
|
|
103
|
+
const message = match?.value ?? options.default ?? key;
|
|
104
|
+
return interpolateMessage(message, options.values);
|
|
105
|
+
}
|
|
106
|
+
resolveForLocale(key, locale) {
|
|
107
|
+
const cacheKey = `${locale}\u0000${key}`;
|
|
108
|
+
if (this.resolutionCache.has(cacheKey)) {
|
|
109
|
+
return this.resolutionCache.get(cacheKey) ?? null;
|
|
110
|
+
}
|
|
111
|
+
const match = this.messageIndexes.get(locale)?.get(key) ?? null;
|
|
112
|
+
this.resolutionCache.set(cacheKey, match);
|
|
113
|
+
return match;
|
|
114
|
+
}
|
|
115
|
+
rebuildMessageIndex(locale) {
|
|
116
|
+
const candidates = new Map();
|
|
117
|
+
for (const bundle of this.bundles) {
|
|
118
|
+
if (bundle.locale !== locale) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
for (const messageKey of Object.keys(bundle.messages)) {
|
|
122
|
+
const key = bundle.namespace
|
|
123
|
+
? messageKey
|
|
124
|
+
? `${bundle.namespace}.${messageKey}`
|
|
125
|
+
: bundle.namespace
|
|
126
|
+
: messageKey;
|
|
127
|
+
const current = candidates.get(key);
|
|
128
|
+
if (!current || isHigherPriorityBundle(bundle, current.bundle)) {
|
|
129
|
+
candidates.set(key, { bundle, messageKey });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const index = new Map();
|
|
134
|
+
for (const [key, candidate] of candidates) {
|
|
135
|
+
index.set(key, {
|
|
136
|
+
key,
|
|
137
|
+
locale,
|
|
138
|
+
namespace: candidate.bundle.namespace,
|
|
139
|
+
messageKey: candidate.messageKey,
|
|
140
|
+
value: candidate.bundle.messages[candidate.messageKey] ?? key,
|
|
141
|
+
source: candidate.bundle.source
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
this.messageIndexes.set(locale, index);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function isHigherPriorityBundle(candidate, current) {
|
|
148
|
+
return (candidate.priority > current.priority ||
|
|
149
|
+
(candidate.priority === current.priority &&
|
|
150
|
+
candidate.namespace.length > current.namespace.length) ||
|
|
151
|
+
(candidate.priority === current.priority &&
|
|
152
|
+
candidate.namespace.length === current.namespace.length &&
|
|
153
|
+
candidate.order > current.order));
|
|
154
|
+
}
|
|
155
|
+
function translationBundleIdentity(bundle) {
|
|
156
|
+
return [
|
|
157
|
+
bundle.locale,
|
|
158
|
+
bundle.namespace,
|
|
159
|
+
String(bundle.priority),
|
|
160
|
+
bundle.layer ?? '',
|
|
161
|
+
bundle.source ?? ''
|
|
162
|
+
].join('\u0000');
|
|
163
|
+
}
|
|
164
|
+
function sameTranslationBundle(left, right) {
|
|
165
|
+
if (left.locale !== right.locale ||
|
|
166
|
+
left.namespace !== right.namespace ||
|
|
167
|
+
left.priority !== right.priority ||
|
|
168
|
+
left.layer !== right.layer ||
|
|
169
|
+
left.source !== right.source) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
const leftEntries = Object.entries(left.messages);
|
|
173
|
+
const rightEntries = Object.entries(right.messages);
|
|
174
|
+
return (leftEntries.length === rightEntries.length &&
|
|
175
|
+
leftEntries.every(([key, value]) => right.messages[key] === value));
|
|
176
|
+
}
|
|
177
|
+
export function createWorkbenchTranslationRegistry(options) {
|
|
178
|
+
return new WorkbenchTranslationRegistry(options);
|
|
179
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { LayoutSurfaceProjection, LayoutUserActionIntent } from "../../domain/layout/surfaceProjection.js";
|
|
2
|
+
import type { ShellState } from "../../domain/shell/model.js";
|
|
3
|
+
import { type WorkspaceSessionState } from "../workspace/session.js";
|
|
4
|
+
export interface LayoutSurfaceCommandState {
|
|
5
|
+
shellState?: ShellState;
|
|
6
|
+
workspaceSession?: WorkspaceSessionState;
|
|
7
|
+
}
|
|
8
|
+
export interface DispatchLayoutSurfaceIntentInput {
|
|
9
|
+
state: LayoutSurfaceCommandState;
|
|
10
|
+
intent: LayoutUserActionIntent;
|
|
11
|
+
projection?: LayoutSurfaceProjection;
|
|
12
|
+
}
|
|
13
|
+
export interface DispatchLayoutSurfaceIntentResult {
|
|
14
|
+
state: LayoutSurfaceCommandState;
|
|
15
|
+
handled: boolean;
|
|
16
|
+
reason?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function dispatchLayoutSurfaceIntent(input: DispatchLayoutSurfaceIntentInput): DispatchLayoutSurfaceIntentResult;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { findPanelInWorkspace, findStackInWorkspace } from "../../domain/workspace/selectors.js";
|
|
2
|
+
import { activateShellWidget, setShellRegionOpen, setShellRegionSize, setShellRegionVisible } from "../shell/state.js";
|
|
3
|
+
import { closePanel } from "../workspace/closePanel.js";
|
|
4
|
+
import { collapseSplitBoundary } from "../workspace/collapseSplitBoundary.js";
|
|
5
|
+
import { createWorkspaceSessionState } from "../workspace/session.js";
|
|
6
|
+
import { dockPanel } from "../workspace/dockPanel.js";
|
|
7
|
+
import { resizeSplitBoundary } from "../workspace/resizeSplitBoundary.js";
|
|
8
|
+
import { focusPanel } from "../workspace/focusPanel.js";
|
|
9
|
+
import { selectWorkspaceTargetWindow } from "../workspace/targetWindow.js";
|
|
10
|
+
import { splitPanel } from "../workspace/splitPanel.js";
|
|
11
|
+
export function dispatchLayoutSurfaceIntent(input) {
|
|
12
|
+
if (input.intent.surfaceId.startsWith('shell:')) {
|
|
13
|
+
return dispatchShellLayoutSurfaceIntent(input);
|
|
14
|
+
}
|
|
15
|
+
if (input.intent.surfaceId.startsWith('workspace:')) {
|
|
16
|
+
return dispatchWorkspaceLayoutSurfaceIntent(input);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
state: input.state,
|
|
20
|
+
handled: false,
|
|
21
|
+
reason: `Unsupported layout surface "${input.intent.surfaceId}"`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function dispatchShellLayoutSurfaceIntent(input) {
|
|
25
|
+
const shellState = input.state.shellState;
|
|
26
|
+
if (!shellState) {
|
|
27
|
+
return createUnhandledResult(input.state, 'Missing shell state');
|
|
28
|
+
}
|
|
29
|
+
const regionId = resolveShellRegionId(input.intent, input.projection);
|
|
30
|
+
if (!regionId || !shellState.regions[regionId]) {
|
|
31
|
+
return createUnhandledResult(input.state, 'Unknown shell region');
|
|
32
|
+
}
|
|
33
|
+
const region = shellState.regions[regionId];
|
|
34
|
+
let nextShellState = shellState;
|
|
35
|
+
switch (input.intent.kind) {
|
|
36
|
+
case 'activate': {
|
|
37
|
+
const widgetId = readString(input.intent.metadata, 'widgetId') ?? region.activeWidgetId;
|
|
38
|
+
nextShellState = widgetId ? activateShellWidget(shellState, regionId, widgetId) : shellState;
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
case 'resize': {
|
|
42
|
+
const nextSize = resolveNextShellRegionSize(region.size, input.intent.metadata);
|
|
43
|
+
nextShellState = nextSize === null ? shellState : setShellRegionSize(shellState, regionId, nextSize);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case 'toggle-open':
|
|
47
|
+
nextShellState = setShellRegionOpen(shellState, regionId, !region.isOpen);
|
|
48
|
+
break;
|
|
49
|
+
case 'toggle-visibility':
|
|
50
|
+
nextShellState = setShellRegionVisible(shellState, regionId, !region.isVisible);
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
return createUnhandledResult(input.state, `Unsupported shell intent "${input.intent.kind}"`);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
state: {
|
|
57
|
+
...input.state,
|
|
58
|
+
shellState: nextShellState
|
|
59
|
+
},
|
|
60
|
+
handled: true
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function dispatchWorkspaceLayoutSurfaceIntent(input) {
|
|
64
|
+
let workspaceSession = input.state.workspaceSession;
|
|
65
|
+
if (!workspaceSession) {
|
|
66
|
+
return createUnhandledResult(input.state, 'Missing workspace session');
|
|
67
|
+
}
|
|
68
|
+
const sourceId = resolveWorkspaceSourceId(input.intent, input.projection);
|
|
69
|
+
if (!sourceId) {
|
|
70
|
+
return createUnhandledResult(input.state, 'Unknown workspace target');
|
|
71
|
+
}
|
|
72
|
+
const workspace = selectWorkspaceTargetWindow(workspaceSession.workspace, sourceId);
|
|
73
|
+
workspaceSession = createWorkspaceSessionState(workspace, workspaceSession.focus);
|
|
74
|
+
let nextSession = workspaceSession;
|
|
75
|
+
switch (input.intent.kind) {
|
|
76
|
+
case 'activate':
|
|
77
|
+
nextSession = activateWorkspaceTarget(workspaceSession, sourceId);
|
|
78
|
+
break;
|
|
79
|
+
case 'close':
|
|
80
|
+
nextSession = updateWorkspaceSession(workspaceSession, closePanel(workspace, { panelId: sourceId }), sourceId);
|
|
81
|
+
break;
|
|
82
|
+
case 'collapse':
|
|
83
|
+
nextSession = updateWorkspaceSession(workspaceSession, collapseSplitBoundary(workspace, {
|
|
84
|
+
rootSplitId: sourceId,
|
|
85
|
+
boundaryIndex: readNumber(input.intent.metadata, 'boundaryIndex') ?? 0,
|
|
86
|
+
removeSide: readRemoveSide(input.intent.metadata) ?? 'end'
|
|
87
|
+
}));
|
|
88
|
+
break;
|
|
89
|
+
case 'dock':
|
|
90
|
+
case 'move':
|
|
91
|
+
nextSession = dockWorkspacePanel(workspaceSession, sourceId, input.intent);
|
|
92
|
+
break;
|
|
93
|
+
case 'resize': {
|
|
94
|
+
const deltaRatio = readNumber(input.intent.metadata, 'deltaRatio');
|
|
95
|
+
if (deltaRatio === null) {
|
|
96
|
+
return createUnhandledResult(input.state, 'Missing workspace resize deltaRatio');
|
|
97
|
+
}
|
|
98
|
+
nextSession = updateWorkspaceSession(workspaceSession, resizeSplitBoundary(workspace, {
|
|
99
|
+
rootSplitId: sourceId,
|
|
100
|
+
boundaryIndex: readNumber(input.intent.metadata, 'boundaryIndex') ?? 0,
|
|
101
|
+
deltaRatio,
|
|
102
|
+
mode: readResizeMode(input.intent.metadata) ?? 'local'
|
|
103
|
+
}));
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case 'split':
|
|
107
|
+
nextSession = splitWorkspaceTarget(workspaceSession, sourceId, input.intent);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
return createUnhandledResult(input.state, `Unsupported workspace intent "${input.intent.kind}"`);
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
state: {
|
|
114
|
+
...input.state,
|
|
115
|
+
workspaceSession: nextSession
|
|
116
|
+
},
|
|
117
|
+
handled: true
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function activateWorkspaceTarget(state, sourceId) {
|
|
121
|
+
const panel = findPanelInWorkspace(state.workspace, sourceId);
|
|
122
|
+
if (!panel) {
|
|
123
|
+
const stack = findStackInWorkspace(state.workspace, sourceId);
|
|
124
|
+
return stack ? focusPanel(state, stack.activeChildId) : state;
|
|
125
|
+
}
|
|
126
|
+
return focusPanel(state, panel.id);
|
|
127
|
+
}
|
|
128
|
+
function splitWorkspaceTarget(state, sourceId, intent) {
|
|
129
|
+
const targetPanelId = resolveWorkspacePanelId(state.workspace, sourceId);
|
|
130
|
+
if (!targetPanelId) {
|
|
131
|
+
return state;
|
|
132
|
+
}
|
|
133
|
+
const orientation = intent.orientation ?? readSplitOrientation(intent.metadata) ?? 'horizontal';
|
|
134
|
+
const nextWorkspace = splitPanel(state.workspace, {
|
|
135
|
+
panelId: targetPanelId,
|
|
136
|
+
orientation,
|
|
137
|
+
side: intent.side
|
|
138
|
+
});
|
|
139
|
+
return updateWorkspaceSession(state, nextWorkspace, targetPanelId);
|
|
140
|
+
}
|
|
141
|
+
function dockWorkspacePanel(state, sourceId, intent) {
|
|
142
|
+
const panelId = readString(intent.metadata, 'panelId') ?? state.focus.activePanelId;
|
|
143
|
+
const targetStack = findStackInWorkspace(state.workspace, sourceId);
|
|
144
|
+
const placement = intent.side ?? readDockSide(intent.metadata) ?? 'center';
|
|
145
|
+
if (!panelId || !targetStack) {
|
|
146
|
+
return state;
|
|
147
|
+
}
|
|
148
|
+
const nextWorkspace = dockPanel(state.workspace, {
|
|
149
|
+
panelId,
|
|
150
|
+
target: {
|
|
151
|
+
kind: 'stack',
|
|
152
|
+
stackId: targetStack.id,
|
|
153
|
+
placement
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
return updateWorkspaceSession(state, nextWorkspace, panelId);
|
|
157
|
+
}
|
|
158
|
+
function updateWorkspaceSession(state, workspace, preferredPanelId = state.focus.activePanelId) {
|
|
159
|
+
return createWorkspaceSessionState(workspace, { activePanelId: preferredPanelId ?? undefined });
|
|
160
|
+
}
|
|
161
|
+
function resolveWorkspacePanelId(workspace, sourceId) {
|
|
162
|
+
const panel = findPanelInWorkspace(workspace, sourceId);
|
|
163
|
+
if (panel) {
|
|
164
|
+
return panel.id;
|
|
165
|
+
}
|
|
166
|
+
const stack = findStackInWorkspace(workspace, sourceId);
|
|
167
|
+
return stack?.activeChildId ?? null;
|
|
168
|
+
}
|
|
169
|
+
function resolveShellRegionId(intent, projection) {
|
|
170
|
+
const projectedRegionId = resolveProjectedMetadataString(intent.targetId, projection, 'regionId');
|
|
171
|
+
if (isShellRegionId(projectedRegionId)) {
|
|
172
|
+
return projectedRegionId;
|
|
173
|
+
}
|
|
174
|
+
const marker = intent.targetId.includes(':boundary:') ? ':boundary:' : ':region:';
|
|
175
|
+
const value = readSuffixAfterMarker(intent.targetId, marker);
|
|
176
|
+
return isShellRegionId(value) ? value : null;
|
|
177
|
+
}
|
|
178
|
+
function resolveWorkspaceSourceId(intent, projection) {
|
|
179
|
+
const projectedArea = projection?.areas[intent.targetId];
|
|
180
|
+
if (projectedArea) {
|
|
181
|
+
return projectedArea.sourceId;
|
|
182
|
+
}
|
|
183
|
+
const projectedBoundary = projection?.boundaries[intent.targetId];
|
|
184
|
+
if (projectedBoundary) {
|
|
185
|
+
return projectedBoundary.sourceId;
|
|
186
|
+
}
|
|
187
|
+
return readSuffixAfterMarker(intent.targetId, ':area:') ?? readSuffixAfterMarker(intent.targetId, ':boundary:');
|
|
188
|
+
}
|
|
189
|
+
function resolveProjectedMetadataString(targetId, projection, key) {
|
|
190
|
+
const areaValue = readString(projection?.areas[targetId]?.metadata, key);
|
|
191
|
+
if (areaValue !== null) {
|
|
192
|
+
return areaValue;
|
|
193
|
+
}
|
|
194
|
+
return readString(projection?.boundaries[targetId]?.metadata, key);
|
|
195
|
+
}
|
|
196
|
+
function resolveNextShellRegionSize(currentSize, metadata) {
|
|
197
|
+
const size = readNumber(metadata, 'size');
|
|
198
|
+
if (size !== null) {
|
|
199
|
+
return size;
|
|
200
|
+
}
|
|
201
|
+
const delta = readNumber(metadata, 'delta');
|
|
202
|
+
return delta === null ? null : currentSize + delta;
|
|
203
|
+
}
|
|
204
|
+
function readString(metadata, key) {
|
|
205
|
+
const value = readMetadataValue(metadata, key);
|
|
206
|
+
return typeof value === 'string' ? value : null;
|
|
207
|
+
}
|
|
208
|
+
function readNumber(metadata, key) {
|
|
209
|
+
const value = readMetadataValue(metadata, key);
|
|
210
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
211
|
+
}
|
|
212
|
+
function readSplitOrientation(metadata) {
|
|
213
|
+
const value = readString(metadata, 'orientation');
|
|
214
|
+
return value === 'horizontal' || value === 'vertical' ? value : null;
|
|
215
|
+
}
|
|
216
|
+
function readDockSide(metadata) {
|
|
217
|
+
const value = readString(metadata, 'side');
|
|
218
|
+
return isDockSide(value) ? value : null;
|
|
219
|
+
}
|
|
220
|
+
function readRemoveSide(metadata) {
|
|
221
|
+
const value = readString(metadata, 'removeSide');
|
|
222
|
+
return value === 'start' || value === 'end' ? value : null;
|
|
223
|
+
}
|
|
224
|
+
function readResizeMode(metadata) {
|
|
225
|
+
const value = readString(metadata, 'mode');
|
|
226
|
+
return value === 'local' || value === 'proportional' ? value : null;
|
|
227
|
+
}
|
|
228
|
+
function readMetadataValue(metadata, key) {
|
|
229
|
+
return metadata ? metadata[key] : undefined;
|
|
230
|
+
}
|
|
231
|
+
function readSuffixAfterMarker(value, marker) {
|
|
232
|
+
const markerIndex = value.indexOf(marker);
|
|
233
|
+
return markerIndex === -1 ? null : value.slice(markerIndex + marker.length) || null;
|
|
234
|
+
}
|
|
235
|
+
function isShellRegionId(value) {
|
|
236
|
+
return value === 'left' || value === 'right' || value === 'bottom';
|
|
237
|
+
}
|
|
238
|
+
function isDockSide(value) {
|
|
239
|
+
return value === 'top' || value === 'right' || value === 'bottom' || value === 'left';
|
|
240
|
+
}
|
|
241
|
+
function createUnhandledResult(state, reason) {
|
|
242
|
+
return {
|
|
243
|
+
state,
|
|
244
|
+
handled: false,
|
|
245
|
+
reason
|
|
246
|
+
};
|
|
247
|
+
}
|