@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,34 @@
|
|
|
1
|
+
import type { LayoutNode, SplitNode, StackNode } from "../../domain/layout/model.js";
|
|
2
|
+
import type { PanelNode } from "../../domain/panel/model.js";
|
|
3
|
+
import type { Workspace } from "../../domain/workspace/model.js";
|
|
4
|
+
export interface LayoutNodePathEntry {
|
|
5
|
+
split: SplitNode;
|
|
6
|
+
childIndex: 0 | 1;
|
|
7
|
+
}
|
|
8
|
+
export interface StackPanelPath {
|
|
9
|
+
stack: StackNode;
|
|
10
|
+
trail: LayoutNodePathEntry[];
|
|
11
|
+
}
|
|
12
|
+
export interface LayoutNodePath {
|
|
13
|
+
node: LayoutNode;
|
|
14
|
+
trail: LayoutNodePathEntry[];
|
|
15
|
+
}
|
|
16
|
+
export interface PanelPath {
|
|
17
|
+
panel: PanelNode;
|
|
18
|
+
stack: StackNode;
|
|
19
|
+
panelIndex: number;
|
|
20
|
+
trail: LayoutNodePathEntry[];
|
|
21
|
+
}
|
|
22
|
+
export declare function updateActiveWindowRoot(workspace: Workspace, updater: (root: LayoutNode) => LayoutNode): Workspace;
|
|
23
|
+
export declare function containsPanel(node: LayoutNode, panelId: string): boolean;
|
|
24
|
+
export declare function updateStackById(node: LayoutNode, stackId: string, updater: (stack: StackNode) => StackNode): LayoutNode;
|
|
25
|
+
export declare function updateSplitById(node: LayoutNode, splitId: string, updater: (split: SplitNode) => SplitNode): LayoutNode;
|
|
26
|
+
export declare function updatePanelById(node: LayoutNode, panelId: string, updater: (panel: PanelNode) => PanelNode): LayoutNode;
|
|
27
|
+
export declare function replaceStackContainingPanel(node: LayoutNode, panelId: string, updater: (stack: StackNode) => LayoutNode): LayoutNode;
|
|
28
|
+
export declare function findStackPathContainingPanel(node: LayoutNode, panelId: string, trail?: LayoutNodePathEntry[]): StackPanelPath | null;
|
|
29
|
+
export declare function findLayoutNodePathById(node: LayoutNode, nodeId: string, trail?: LayoutNodePathEntry[]): LayoutNodePath | null;
|
|
30
|
+
export declare function findStackPathById(node: LayoutNode, stackId: string): LayoutNodePath | null;
|
|
31
|
+
export declare function findSplitPathById(node: LayoutNode, splitId: string): LayoutNodePath | null;
|
|
32
|
+
export declare function findPanelPathById(node: LayoutNode, panelId: string, trail?: LayoutNodePathEntry[]): PanelPath | null;
|
|
33
|
+
export declare function replaceNodeAtPath(root: LayoutNode, trail: LayoutNodePathEntry[], replacement: LayoutNode): LayoutNode;
|
|
34
|
+
export declare function replaceNodeAtPathAllowingRemoval(root: LayoutNode, trail: LayoutNodePathEntry[], replacement: LayoutNode | null): LayoutNode | null;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { containsPanel as layoutContainsPanel } from "../../domain/layout/selectors.js";
|
|
2
|
+
import { getActiveWindow } from "../../domain/workspace/selectors.js";
|
|
3
|
+
export function updateActiveWindowRoot(workspace, updater) {
|
|
4
|
+
const activeWindow = getActiveWindow(workspace);
|
|
5
|
+
if (!activeWindow) {
|
|
6
|
+
return workspace;
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
...workspace,
|
|
10
|
+
windows: workspace.windows.map((window) => window.id === activeWindow.id ? { ...window, root: updater(window.root) } : window)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function containsPanel(node, panelId) {
|
|
14
|
+
return layoutContainsPanel(node, panelId);
|
|
15
|
+
}
|
|
16
|
+
export function updateStackById(node, stackId, updater) {
|
|
17
|
+
const stackPath = findStackPathById(node, stackId);
|
|
18
|
+
if (!stackPath || stackPath.node.kind !== 'stack') {
|
|
19
|
+
return node;
|
|
20
|
+
}
|
|
21
|
+
return replaceNodeAtPath(node, stackPath.trail, updater(stackPath.node));
|
|
22
|
+
}
|
|
23
|
+
export function updateSplitById(node, splitId, updater) {
|
|
24
|
+
const splitPath = findSplitPathById(node, splitId);
|
|
25
|
+
if (!splitPath || splitPath.node.kind !== 'split') {
|
|
26
|
+
return node;
|
|
27
|
+
}
|
|
28
|
+
return replaceNodeAtPath(node, splitPath.trail, updater(splitPath.node));
|
|
29
|
+
}
|
|
30
|
+
export function updatePanelById(node, panelId, updater) {
|
|
31
|
+
const panelPath = findPanelPathById(node, panelId);
|
|
32
|
+
if (!panelPath) {
|
|
33
|
+
return node;
|
|
34
|
+
}
|
|
35
|
+
const nextChildren = [...panelPath.stack.children];
|
|
36
|
+
nextChildren[panelPath.panelIndex] = updater(panelPath.panel);
|
|
37
|
+
return replaceNodeAtPath(node, panelPath.trail, {
|
|
38
|
+
...panelPath.stack,
|
|
39
|
+
children: nextChildren
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function replaceStackContainingPanel(node, panelId, updater) {
|
|
43
|
+
const stackPath = findStackPathContainingPanel(node, panelId);
|
|
44
|
+
if (!stackPath) {
|
|
45
|
+
return node;
|
|
46
|
+
}
|
|
47
|
+
return replaceNodeAtPath(node, stackPath.trail, updater(stackPath.stack));
|
|
48
|
+
}
|
|
49
|
+
export function findStackPathContainingPanel(node, panelId, trail = []) {
|
|
50
|
+
if (node.kind === 'stack') {
|
|
51
|
+
return node.children.some((panel) => panel.id === panelId)
|
|
52
|
+
? {
|
|
53
|
+
stack: node,
|
|
54
|
+
trail
|
|
55
|
+
}
|
|
56
|
+
: null;
|
|
57
|
+
}
|
|
58
|
+
for (let childIndex = 0; childIndex < node.children.length; childIndex = (childIndex + 1)) {
|
|
59
|
+
const child = node.children[childIndex];
|
|
60
|
+
const path = findStackPathContainingPanel(child, panelId, [...trail, { split: node, childIndex }]);
|
|
61
|
+
if (path) {
|
|
62
|
+
return path;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
export function findLayoutNodePathById(node, nodeId, trail = []) {
|
|
68
|
+
if (node.id === nodeId) {
|
|
69
|
+
return {
|
|
70
|
+
node,
|
|
71
|
+
trail
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (node.kind === 'stack') {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
for (let childIndex = 0; childIndex < node.children.length; childIndex = (childIndex + 1)) {
|
|
78
|
+
const child = node.children[childIndex];
|
|
79
|
+
const path = findLayoutNodePathById(child, nodeId, [...trail, { split: node, childIndex }]);
|
|
80
|
+
if (path) {
|
|
81
|
+
return path;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
export function findStackPathById(node, stackId) {
|
|
87
|
+
const path = findLayoutNodePathById(node, stackId);
|
|
88
|
+
return path?.node.kind === 'stack' ? path : null;
|
|
89
|
+
}
|
|
90
|
+
export function findSplitPathById(node, splitId) {
|
|
91
|
+
const path = findLayoutNodePathById(node, splitId);
|
|
92
|
+
return path?.node.kind === 'split' ? path : null;
|
|
93
|
+
}
|
|
94
|
+
export function findPanelPathById(node, panelId, trail = []) {
|
|
95
|
+
if (node.kind === 'stack') {
|
|
96
|
+
const panelIndex = node.children.findIndex((panel) => panel.id === panelId);
|
|
97
|
+
return panelIndex === -1
|
|
98
|
+
? null
|
|
99
|
+
: {
|
|
100
|
+
panel: node.children[panelIndex],
|
|
101
|
+
stack: node,
|
|
102
|
+
panelIndex,
|
|
103
|
+
trail
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
for (let childIndex = 0; childIndex < node.children.length; childIndex = (childIndex + 1)) {
|
|
107
|
+
const child = node.children[childIndex];
|
|
108
|
+
const path = findPanelPathById(child, panelId, [...trail, { split: node, childIndex }]);
|
|
109
|
+
if (path) {
|
|
110
|
+
return path;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
export function replaceNodeAtPath(root, trail, replacement) {
|
|
116
|
+
return replaceNodeAtPathAllowingRemoval(root, trail, replacement) ?? root;
|
|
117
|
+
}
|
|
118
|
+
export function replaceNodeAtPathAllowingRemoval(root, trail, replacement) {
|
|
119
|
+
let nextNode = replacement;
|
|
120
|
+
for (let index = trail.length - 1; index >= 0; index -= 1) {
|
|
121
|
+
const { split, childIndex } = trail[index];
|
|
122
|
+
const siblingIndex = childIndex === 0 ? 1 : 0;
|
|
123
|
+
const sibling = split.children[siblingIndex];
|
|
124
|
+
if (!nextNode) {
|
|
125
|
+
nextNode = sibling;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const nextChildren = childIndex === 0 ? [nextNode, sibling] : [sibling, nextNode];
|
|
129
|
+
nextNode = {
|
|
130
|
+
...split,
|
|
131
|
+
children: nextChildren
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return nextNode;
|
|
135
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ToolCatalogPort } from "../../domain/tool/model.js";
|
|
2
|
+
import type { Workspace } from "../../domain/workspace/model.js";
|
|
3
|
+
interface OpenToolInput {
|
|
4
|
+
panelId: string;
|
|
5
|
+
toolId: string;
|
|
6
|
+
singletonPlacement?: 'focus-existing' | 'move-to-panel';
|
|
7
|
+
}
|
|
8
|
+
export interface OpenToolResult {
|
|
9
|
+
workspace: Workspace;
|
|
10
|
+
panelId: string | null;
|
|
11
|
+
toolInstanceId: string | null;
|
|
12
|
+
reusedExisting: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function openTool(workspace: Workspace, input: OpenToolInput, toolCatalog: ToolCatalogPort): OpenToolResult;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { createInitialToolShellState, resolvePanelTitle } from "../../domain/tool/shell.js";
|
|
2
|
+
import { createId } from "../../domain/shared/id.js";
|
|
3
|
+
import { cloneJsonObject } from "../../domain/shared/json.js";
|
|
4
|
+
import { containsPanel } from "../../domain/layout/selectors.js";
|
|
5
|
+
import { findToolPlacementByToolId, getActiveWindow } from "../../domain/workspace/selectors.js";
|
|
6
|
+
import { pruneUnusedToolInstances } from "./finalizeWorkspace.js";
|
|
7
|
+
import { updateActiveWindowRoot, updatePanelById } from "./layoutTree.js";
|
|
8
|
+
export function openTool(workspace, input, toolCatalog) {
|
|
9
|
+
const toolDefinition = toolCatalog.getDefinition(input.toolId);
|
|
10
|
+
const activeWindow = getActiveWindow(workspace);
|
|
11
|
+
if (!toolDefinition || !activeWindow || !containsPanel(activeWindow.root, input.panelId)) {
|
|
12
|
+
return {
|
|
13
|
+
workspace,
|
|
14
|
+
panelId: null,
|
|
15
|
+
toolInstanceId: null,
|
|
16
|
+
reusedExisting: false
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const existingPlacement = findToolPlacementByToolId(workspace, input.toolId);
|
|
20
|
+
if (toolDefinition.openingPolicy.mode === 'singleton-global' &&
|
|
21
|
+
existingPlacement &&
|
|
22
|
+
input.singletonPlacement !== 'move-to-panel') {
|
|
23
|
+
return {
|
|
24
|
+
workspace,
|
|
25
|
+
panelId: existingPlacement.panelId,
|
|
26
|
+
toolInstanceId: existingPlacement.toolInstanceId,
|
|
27
|
+
reusedExisting: true
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (toolDefinition.openingPolicy.mode === 'singleton-global' &&
|
|
31
|
+
existingPlacement &&
|
|
32
|
+
input.singletonPlacement === 'move-to-panel') {
|
|
33
|
+
const nextWorkspace = moveExistingToolInstanceToPanel(workspace, {
|
|
34
|
+
sourcePanelId: existingPlacement.panelId,
|
|
35
|
+
targetPanelId: input.panelId,
|
|
36
|
+
toolInstanceId: existingPlacement.toolInstanceId,
|
|
37
|
+
panelTitle: resolvePanelTitle(toolDefinition, existingPlacement.toolInstance)
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
workspace: pruneUnusedToolInstances(nextWorkspace),
|
|
41
|
+
panelId: input.panelId,
|
|
42
|
+
toolInstanceId: existingPlacement.toolInstanceId,
|
|
43
|
+
reusedExisting: true
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const toolInstance = {
|
|
47
|
+
id: createId('tool-instance'),
|
|
48
|
+
toolId: toolDefinition.id,
|
|
49
|
+
state: cloneJsonObject(toolDefinition.initialState),
|
|
50
|
+
panelTitleOverride: null,
|
|
51
|
+
shellState: createInitialToolShellState(toolDefinition)
|
|
52
|
+
};
|
|
53
|
+
const nextWorkspace = updateActiveWindowRoot({
|
|
54
|
+
...workspace,
|
|
55
|
+
toolInstances: {
|
|
56
|
+
...workspace.toolInstances,
|
|
57
|
+
[toolInstance.id]: toolInstance
|
|
58
|
+
}
|
|
59
|
+
}, (root) => updatePanelById(root, input.panelId, (panel) => ({
|
|
60
|
+
...panel,
|
|
61
|
+
title: resolvePanelTitle(toolDefinition, toolInstance),
|
|
62
|
+
toolInstanceId: toolInstance.id
|
|
63
|
+
})));
|
|
64
|
+
return {
|
|
65
|
+
workspace: pruneUnusedToolInstances(nextWorkspace),
|
|
66
|
+
panelId: input.panelId,
|
|
67
|
+
toolInstanceId: toolInstance.id,
|
|
68
|
+
reusedExisting: false
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function moveExistingToolInstanceToPanel(workspace, input) {
|
|
72
|
+
return {
|
|
73
|
+
...workspace,
|
|
74
|
+
windows: workspace.windows.map((window) => ({
|
|
75
|
+
...window,
|
|
76
|
+
root: updatePanelById(updatePanelById(window.root, input.sourcePanelId, (panel) => panel.id === input.targetPanelId
|
|
77
|
+
? panel
|
|
78
|
+
: {
|
|
79
|
+
...panel,
|
|
80
|
+
title: 'New panel',
|
|
81
|
+
toolInstanceId: null
|
|
82
|
+
}), input.targetPanelId, (panel) => ({
|
|
83
|
+
...panel,
|
|
84
|
+
title: input.panelTitle,
|
|
85
|
+
toolInstanceId: input.toolInstanceId
|
|
86
|
+
}))
|
|
87
|
+
}))
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ShellState } from "../../domain/shell/model.js";
|
|
2
|
+
import type { WorkspaceSessionState } from "../../domain/workspace/session.js";
|
|
3
|
+
export declare const WORKSPACE_PRESET_ARTIFACT_SCHEMA: "konitif.workspace-preset";
|
|
4
|
+
export declare const WORKSPACE_PRESET_ARTIFACT_SCHEMA_VERSION: 1;
|
|
5
|
+
export interface WorkspacePresetCompatibility {
|
|
6
|
+
fixtureSchemaVersions: string[];
|
|
7
|
+
projectSchemaVersions: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface WorkspacePresetCatalogMetadata {
|
|
10
|
+
label: string;
|
|
11
|
+
description: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
}
|
|
14
|
+
export interface WorkspacePresetArtifact {
|
|
15
|
+
schema: typeof WORKSPACE_PRESET_ARTIFACT_SCHEMA;
|
|
16
|
+
schemaVersion: typeof WORKSPACE_PRESET_ARTIFACT_SCHEMA_VERSION;
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
version: string;
|
|
20
|
+
catalog: WorkspacePresetCatalogMetadata;
|
|
21
|
+
compatibility: WorkspacePresetCompatibility;
|
|
22
|
+
workspaceSession: WorkspaceSessionState;
|
|
23
|
+
shellState: ShellState;
|
|
24
|
+
}
|
|
25
|
+
export type WorkspacePresetDiagnosticCode = 'workspace-preset.invalid-json' | 'workspace-preset.invalid-schema' | 'workspace-preset.invalid-id' | 'workspace-preset.invalid-name' | 'workspace-preset.invalid-version' | 'workspace-preset.invalid-catalog' | 'workspace-preset.invalid-compatibility' | 'workspace-preset.invalid-workspace' | 'workspace-preset.invalid-focus' | 'workspace-preset.invalid-shell' | 'workspace-preset.fixture-schema-incompatible' | 'workspace-preset.project-schema-incompatible';
|
|
26
|
+
export interface WorkspacePresetDiagnostic {
|
|
27
|
+
code: WorkspacePresetDiagnosticCode;
|
|
28
|
+
path: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
export interface AuthorWorkspacePresetInput {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
version: string;
|
|
35
|
+
catalog?: Partial<WorkspacePresetCatalogMetadata>;
|
|
36
|
+
compatibility: WorkspacePresetCompatibility;
|
|
37
|
+
workspaceSession: WorkspaceSessionState;
|
|
38
|
+
shellState: ShellState;
|
|
39
|
+
}
|
|
40
|
+
export type WorkspacePresetResult = {
|
|
41
|
+
ok: true;
|
|
42
|
+
artifact: WorkspacePresetArtifact;
|
|
43
|
+
diagnostics: [];
|
|
44
|
+
} | {
|
|
45
|
+
ok: false;
|
|
46
|
+
artifact?: undefined;
|
|
47
|
+
diagnostics: WorkspacePresetDiagnostic[];
|
|
48
|
+
};
|
|
49
|
+
export interface WorkspacePresetCompatibilityRequest {
|
|
50
|
+
fixtureSchemaVersion?: string | null;
|
|
51
|
+
projectSchemaVersion?: string | null;
|
|
52
|
+
}
|
|
53
|
+
export declare function authorWorkspacePreset(input: AuthorWorkspacePresetInput): WorkspacePresetResult;
|
|
54
|
+
export declare function serializeWorkspacePresetArtifact(artifact: WorkspacePresetArtifact): string;
|
|
55
|
+
export declare function importWorkspacePresetArtifact(source: string, compatibilityRequest?: WorkspacePresetCompatibilityRequest): WorkspacePresetResult;
|
|
56
|
+
export declare function evaluateWorkspacePresetCompatibility(artifact: WorkspacePresetArtifact, request: WorkspacePresetCompatibilityRequest): WorkspacePresetDiagnostic[];
|
|
57
|
+
export declare function validateWorkspacePresetArtifact(value: unknown): WorkspacePresetDiagnostic[];
|
|
58
|
+
export declare function projectWorkspacePresetCatalogMetadata(artifact: WorkspacePresetArtifact): WorkspacePresetCatalogMetadata & {
|
|
59
|
+
id: string;
|
|
60
|
+
};
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { validateWorkspaceSnapshot } from "../../domain/workspace/validation.js";
|
|
2
|
+
import { createWorkspaceSessionState } from "./session.js";
|
|
3
|
+
export const WORKSPACE_PRESET_ARTIFACT_SCHEMA = 'konitif.workspace-preset';
|
|
4
|
+
export const WORKSPACE_PRESET_ARTIFACT_SCHEMA_VERSION = 1;
|
|
5
|
+
const PRESET_ID_PATTERN = /^[a-z0-9]+(?:[.-][a-z0-9]+)*$/;
|
|
6
|
+
const PRESET_VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
7
|
+
const SHELL_REGION_IDS = ['left', 'right', 'bottom'];
|
|
8
|
+
export function authorWorkspacePreset(input) {
|
|
9
|
+
const artifact = {
|
|
10
|
+
schema: WORKSPACE_PRESET_ARTIFACT_SCHEMA,
|
|
11
|
+
schemaVersion: WORKSPACE_PRESET_ARTIFACT_SCHEMA_VERSION,
|
|
12
|
+
id: input.id.trim(),
|
|
13
|
+
name: input.name.trim(),
|
|
14
|
+
version: input.version.trim(),
|
|
15
|
+
catalog: normalizeCatalogMetadata(input.name, input.catalog),
|
|
16
|
+
compatibility: normalizeCompatibility(input.compatibility),
|
|
17
|
+
workspaceSession: createWorkspaceSessionState(input.workspaceSession.workspace, input.workspaceSession.focus),
|
|
18
|
+
shellState: input.shellState
|
|
19
|
+
};
|
|
20
|
+
const diagnostics = validateWorkspacePresetArtifact(artifact);
|
|
21
|
+
return diagnostics.length > 0
|
|
22
|
+
? { ok: false, diagnostics }
|
|
23
|
+
: { ok: true, artifact: cloneCanonicalValue(artifact), diagnostics: [] };
|
|
24
|
+
}
|
|
25
|
+
export function serializeWorkspacePresetArtifact(artifact) {
|
|
26
|
+
const diagnostics = validateWorkspacePresetArtifact(artifact);
|
|
27
|
+
if (diagnostics.length > 0) {
|
|
28
|
+
throw new Error(diagnostics[0]?.message ?? 'Workspace preset artifact is invalid.');
|
|
29
|
+
}
|
|
30
|
+
return `${JSON.stringify(sortCanonicalValue(artifact), null, 2)}\n`;
|
|
31
|
+
}
|
|
32
|
+
export function importWorkspacePresetArtifact(source, compatibilityRequest = {}) {
|
|
33
|
+
let parsed;
|
|
34
|
+
try {
|
|
35
|
+
parsed = JSON.parse(source);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return {
|
|
39
|
+
ok: false,
|
|
40
|
+
diagnostics: [diagnostic('workspace-preset.invalid-json', '$', 'Workspace preset must be valid JSON.')]
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const migrated = migrateWorkspacePresetArtifact(parsed);
|
|
44
|
+
const diagnostics = validateWorkspacePresetArtifact(migrated);
|
|
45
|
+
if (diagnostics.length > 0) {
|
|
46
|
+
return { ok: false, diagnostics };
|
|
47
|
+
}
|
|
48
|
+
const artifact = cloneCanonicalValue(migrated);
|
|
49
|
+
const compatibilityDiagnostics = evaluateWorkspacePresetCompatibility(artifact, compatibilityRequest);
|
|
50
|
+
return compatibilityDiagnostics.length > 0
|
|
51
|
+
? { ok: false, diagnostics: compatibilityDiagnostics }
|
|
52
|
+
: { ok: true, artifact, diagnostics: [] };
|
|
53
|
+
}
|
|
54
|
+
export function evaluateWorkspacePresetCompatibility(artifact, request) {
|
|
55
|
+
const diagnostics = [];
|
|
56
|
+
const fixtureSchemaVersion = request.fixtureSchemaVersion?.trim();
|
|
57
|
+
const projectSchemaVersion = request.projectSchemaVersion?.trim();
|
|
58
|
+
if (fixtureSchemaVersion && !artifact.compatibility.fixtureSchemaVersions.includes(fixtureSchemaVersion)) {
|
|
59
|
+
diagnostics.push(diagnostic('workspace-preset.fixture-schema-incompatible', '$.compatibility.fixtureSchemaVersions', `Preset ${artifact.id}@${artifact.version} does not support fixture schema ${fixtureSchemaVersion}. Supported versions: ${formatSupportedVersions(artifact.compatibility.fixtureSchemaVersions)}.`));
|
|
60
|
+
}
|
|
61
|
+
if (projectSchemaVersion && !artifact.compatibility.projectSchemaVersions.includes(projectSchemaVersion)) {
|
|
62
|
+
diagnostics.push(diagnostic('workspace-preset.project-schema-incompatible', '$.compatibility.projectSchemaVersions', `Preset ${artifact.id}@${artifact.version} does not support project schema ${projectSchemaVersion}. Supported versions: ${formatSupportedVersions(artifact.compatibility.projectSchemaVersions)}.`));
|
|
63
|
+
}
|
|
64
|
+
return diagnostics;
|
|
65
|
+
}
|
|
66
|
+
export function validateWorkspacePresetArtifact(value) {
|
|
67
|
+
if (!isRecord(value)) {
|
|
68
|
+
return [diagnostic('workspace-preset.invalid-schema', '$', 'Workspace preset must be an object.')];
|
|
69
|
+
}
|
|
70
|
+
const diagnostics = [];
|
|
71
|
+
if (value.schema !== WORKSPACE_PRESET_ARTIFACT_SCHEMA ||
|
|
72
|
+
value.schemaVersion !== WORKSPACE_PRESET_ARTIFACT_SCHEMA_VERSION) {
|
|
73
|
+
diagnostics.push(diagnostic('workspace-preset.invalid-schema', '$.schema', `Workspace preset must use ${WORKSPACE_PRESET_ARTIFACT_SCHEMA} schema version ${WORKSPACE_PRESET_ARTIFACT_SCHEMA_VERSION}.`));
|
|
74
|
+
}
|
|
75
|
+
if (typeof value.id !== 'string' || !PRESET_ID_PATTERN.test(value.id)) {
|
|
76
|
+
diagnostics.push(diagnostic('workspace-preset.invalid-id', '$.id', 'Workspace preset id must be a lowercase dot-or-dash identifier.'));
|
|
77
|
+
}
|
|
78
|
+
if (typeof value.name !== 'string' || value.name.trim().length < 2 || value.name.trim().length > 80) {
|
|
79
|
+
diagnostics.push(diagnostic('workspace-preset.invalid-name', '$.name', 'Workspace preset name must contain 2 to 80 characters.'));
|
|
80
|
+
}
|
|
81
|
+
if (typeof value.version !== 'string' || !PRESET_VERSION_PATTERN.test(value.version)) {
|
|
82
|
+
diagnostics.push(diagnostic('workspace-preset.invalid-version', '$.version', 'Workspace preset version must use semantic versioning.'));
|
|
83
|
+
}
|
|
84
|
+
diagnostics.push(...validateCatalogMetadata(value.catalog));
|
|
85
|
+
diagnostics.push(...validateCompatibility(value.compatibility));
|
|
86
|
+
diagnostics.push(...validateWorkspaceSession(value.workspaceSession));
|
|
87
|
+
diagnostics.push(...validateShellState(value.shellState));
|
|
88
|
+
return diagnostics;
|
|
89
|
+
}
|
|
90
|
+
export function projectWorkspacePresetCatalogMetadata(artifact) {
|
|
91
|
+
return {
|
|
92
|
+
id: artifact.id,
|
|
93
|
+
...cloneCanonicalValue(artifact.catalog)
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function validateCatalogMetadata(value) {
|
|
97
|
+
if (!isRecord(value) ||
|
|
98
|
+
typeof value.label !== 'string' ||
|
|
99
|
+
value.label.trim().length < 2 ||
|
|
100
|
+
value.label.trim().length > 80 ||
|
|
101
|
+
typeof value.description !== 'string' ||
|
|
102
|
+
value.description.trim().length < 2 ||
|
|
103
|
+
value.description.trim().length > 240 ||
|
|
104
|
+
typeof value.icon !== 'string' ||
|
|
105
|
+
value.icon.trim().length < 2 ||
|
|
106
|
+
value.icon.trim().length > 80) {
|
|
107
|
+
return [
|
|
108
|
+
diagnostic('workspace-preset.invalid-catalog', '$.catalog', 'Workspace preset catalog metadata must provide a label, description, and icon.')
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
function normalizeCatalogMetadata(name, value) {
|
|
114
|
+
const normalizedName = name.trim();
|
|
115
|
+
return {
|
|
116
|
+
label: value?.label?.trim() || normalizedName,
|
|
117
|
+
description: value?.description?.trim() || `${normalizedName} workspace preset.`,
|
|
118
|
+
icon: value?.icon?.trim() || 'layout.workspace'
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function migrateWorkspacePresetArtifact(value) {
|
|
122
|
+
if (!isRecord(value) || value.catalog !== undefined) {
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
const name = typeof value.name === 'string' ? value.name : '';
|
|
126
|
+
return {
|
|
127
|
+
...value,
|
|
128
|
+
catalog: normalizeCatalogMetadata(name, undefined)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function validateCompatibility(value) {
|
|
132
|
+
if (!isRecord(value)) {
|
|
133
|
+
return [
|
|
134
|
+
diagnostic('workspace-preset.invalid-compatibility', '$.compatibility', 'Workspace preset compatibility must be an object.')
|
|
135
|
+
];
|
|
136
|
+
}
|
|
137
|
+
const fixtureVersions = validateVersionList(value.fixtureSchemaVersions);
|
|
138
|
+
const projectVersions = validateVersionList(value.projectSchemaVersions);
|
|
139
|
+
return fixtureVersions && projectVersions
|
|
140
|
+
? []
|
|
141
|
+
: [
|
|
142
|
+
diagnostic('workspace-preset.invalid-compatibility', '$.compatibility', 'Workspace preset compatibility must declare non-empty unique fixture and project schema version lists.')
|
|
143
|
+
];
|
|
144
|
+
}
|
|
145
|
+
function validateWorkspaceSession(value) {
|
|
146
|
+
if (!isRecord(value) || !isRecord(value.focus)) {
|
|
147
|
+
return [
|
|
148
|
+
diagnostic('workspace-preset.invalid-workspace', '$.workspaceSession', 'Workspace preset must contain a workspace session and focus state.')
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
const workspaceIssues = validateWorkspaceSnapshot(value.workspace);
|
|
152
|
+
if (workspaceIssues.length > 0) {
|
|
153
|
+
return workspaceIssues.map((issue) => diagnostic('workspace-preset.invalid-workspace', `$.workspaceSession.${issue.path}`, issue.message));
|
|
154
|
+
}
|
|
155
|
+
const normalized = createWorkspaceSessionState(value.workspace, value.focus);
|
|
156
|
+
if (value.focus.activePanelId !== normalized.focus.activePanelId ||
|
|
157
|
+
value.focus.activeToolInstanceId !== normalized.focus.activeToolInstanceId) {
|
|
158
|
+
return [
|
|
159
|
+
diagnostic('workspace-preset.invalid-focus', '$.workspaceSession.focus', 'Workspace preset focus must reference the focused panel and its tool instance.')
|
|
160
|
+
];
|
|
161
|
+
}
|
|
162
|
+
return [];
|
|
163
|
+
}
|
|
164
|
+
function validateShellState(value) {
|
|
165
|
+
if (!isRecord(value) || !isRecord(value.regions)) {
|
|
166
|
+
return [
|
|
167
|
+
diagnostic('workspace-preset.invalid-shell', '$.shellState', 'Workspace preset must contain shell regions.')
|
|
168
|
+
];
|
|
169
|
+
}
|
|
170
|
+
for (const regionId of SHELL_REGION_IDS) {
|
|
171
|
+
const region = value.regions[regionId];
|
|
172
|
+
if (!isRecord(region) ||
|
|
173
|
+
region.id !== regionId ||
|
|
174
|
+
typeof region.isVisible !== 'boolean' ||
|
|
175
|
+
typeof region.isOpen !== 'boolean' ||
|
|
176
|
+
typeof region.size !== 'number' ||
|
|
177
|
+
!Number.isFinite(region.size) ||
|
|
178
|
+
!Array.isArray(region.widgetIds) ||
|
|
179
|
+
!region.widgetIds.every((widgetId) => typeof widgetId === 'string') ||
|
|
180
|
+
(region.activeWidgetId !== null && typeof region.activeWidgetId !== 'string')) {
|
|
181
|
+
return [
|
|
182
|
+
diagnostic('workspace-preset.invalid-shell', `$.shellState.regions.${regionId}`, `Workspace preset shell region ${regionId} is incomplete or invalid.`)
|
|
183
|
+
];
|
|
184
|
+
}
|
|
185
|
+
if (region.activeWidgetId && !region.widgetIds.includes(region.activeWidgetId)) {
|
|
186
|
+
return [
|
|
187
|
+
diagnostic('workspace-preset.invalid-shell', `$.shellState.regions.${regionId}.activeWidgetId`, `Workspace preset shell region ${regionId} must activate one of its declared widgets.`)
|
|
188
|
+
];
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
193
|
+
function validateVersionList(value) {
|
|
194
|
+
return (Array.isArray(value) &&
|
|
195
|
+
value.length > 0 &&
|
|
196
|
+
value.every((entry) => typeof entry === 'string' && entry.trim().length > 0) &&
|
|
197
|
+
new Set(value).size === value.length);
|
|
198
|
+
}
|
|
199
|
+
function normalizeCompatibility(value) {
|
|
200
|
+
return {
|
|
201
|
+
fixtureSchemaVersions: normalizeVersionList(value.fixtureSchemaVersions),
|
|
202
|
+
projectSchemaVersions: normalizeVersionList(value.projectSchemaVersions)
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function normalizeVersionList(values) {
|
|
206
|
+
return [...new Set(values.map((value) => value.trim()).filter(Boolean))].sort((left, right) => left.localeCompare(right, 'en'));
|
|
207
|
+
}
|
|
208
|
+
function formatSupportedVersions(values) {
|
|
209
|
+
return values.length > 0 ? values.join(', ') : 'none';
|
|
210
|
+
}
|
|
211
|
+
function diagnostic(code, path, message) {
|
|
212
|
+
return { code, path, message };
|
|
213
|
+
}
|
|
214
|
+
function isRecord(value) {
|
|
215
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
216
|
+
}
|
|
217
|
+
function cloneCanonicalValue(value) {
|
|
218
|
+
return JSON.parse(JSON.stringify(sortCanonicalValue(value)));
|
|
219
|
+
}
|
|
220
|
+
function sortCanonicalValue(value) {
|
|
221
|
+
if (Array.isArray(value)) {
|
|
222
|
+
return value.map(sortCanonicalValue);
|
|
223
|
+
}
|
|
224
|
+
if (!isRecord(value)) {
|
|
225
|
+
return value;
|
|
226
|
+
}
|
|
227
|
+
return Object.fromEntries(Object.keys(value)
|
|
228
|
+
.sort((left, right) => left.localeCompare(right, 'en'))
|
|
229
|
+
.filter((key) => value[key] !== undefined)
|
|
230
|
+
.map((key) => [key, sortCanonicalValue(value[key])]));
|
|
231
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ToolCatalogPort } from "../../domain/tool/model.js";
|
|
2
|
+
import { type WorkspaceSessionState } from "./session.js";
|
|
3
|
+
export type WorkspacePresetId = 'default';
|
|
4
|
+
export declare function createWorkspaceFromPreset(toolCatalog: ToolCatalogPort, presetId?: WorkspacePresetId): import("../../index.js").Workspace;
|
|
5
|
+
export declare function createWorkspaceSessionFromPreset(toolCatalog: ToolCatalogPort, presetId?: WorkspacePresetId): WorkspaceSessionState;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createWorkspaceSessionState } from "./session.js";
|
|
2
|
+
import { createWorkspace } from "./createWorkspace.js";
|
|
3
|
+
const DEFAULT_WORKSPACE_INITIAL_TOOL_ID = 'example.welcome';
|
|
4
|
+
export function createWorkspaceFromPreset(toolCatalog, presetId = 'default') {
|
|
5
|
+
switch (presetId) {
|
|
6
|
+
case 'default':
|
|
7
|
+
return createWorkspace(toolCatalog, { initialToolId: DEFAULT_WORKSPACE_INITIAL_TOOL_ID });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function createWorkspaceSessionFromPreset(toolCatalog, presetId = 'default') {
|
|
11
|
+
return createWorkspaceSessionState(createWorkspaceFromPreset(toolCatalog, presetId));
|
|
12
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Workspace } from "../../domain/workspace/model.js";
|
|
2
|
+
/** Recover the current detached layout, never a snapshot captured before detaching. */
|
|
3
|
+
export declare function reattachWorkspaceWindow(workspace: Workspace, input: {
|
|
4
|
+
windowId: string;
|
|
5
|
+
sourceWindowId: string;
|
|
6
|
+
sourceStackId: string;
|
|
7
|
+
}): Workspace;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createSplit } from "../../domain/workspace/factories.js";
|
|
2
|
+
import { findStackPathById, updateStackById } from "./layoutTree.js";
|
|
3
|
+
/** Recover the current detached layout, never a snapshot captured before detaching. */
|
|
4
|
+
export function reattachWorkspaceWindow(workspace, input) {
|
|
5
|
+
const detached = workspace.windows.find((entry) => entry.id === input.windowId);
|
|
6
|
+
const source = workspace.windows.find((entry) => entry.id === input.sourceWindowId);
|
|
7
|
+
if (!detached || !source || detached.id === source.id)
|
|
8
|
+
return workspace;
|
|
9
|
+
const detachedRoot = detached.root;
|
|
10
|
+
const stackExists = findStackPathById(source.root, input.sourceStackId);
|
|
11
|
+
const root = detachedRoot.kind === 'stack' && stackExists
|
|
12
|
+
? updateStackById(source.root, input.sourceStackId, (stack) => ({
|
|
13
|
+
...stack,
|
|
14
|
+
children: [...stack.children, ...detachedRoot.children],
|
|
15
|
+
activeChildId: detachedRoot.activeChildId
|
|
16
|
+
}))
|
|
17
|
+
: createSplit('horizontal', [source.root, detachedRoot]);
|
|
18
|
+
return {
|
|
19
|
+
...workspace,
|
|
20
|
+
activeWindowId: source.id,
|
|
21
|
+
windows: workspace.windows.filter((entry) => entry.id !== detached.id)
|
|
22
|
+
.map((entry) => entry.id === source.id ? { ...entry, root } : entry)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { normalizeSplitSizes } from "../../domain/layout/validation.js";
|
|
2
|
+
import { updateActiveWindowRoot, updateSplitById } from "./layoutTree.js";
|
|
3
|
+
import { updateWorkspaceTargetWindow } from "./targetWindow.js";
|
|
4
|
+
export function resizeSplit(workspace, input) {
|
|
5
|
+
return updateWorkspaceTargetWindow(workspace, input.splitId, (selected) => resizeSplitInActiveWindow(selected, input));
|
|
6
|
+
}
|
|
7
|
+
function resizeSplitInActiveWindow(workspace, input) {
|
|
8
|
+
return updateActiveWindowRoot(workspace, (root) => updateSplitById(root, input.splitId, (split) => ({
|
|
9
|
+
...split,
|
|
10
|
+
sizes: normalizeSplitSizes(input.sizes)
|
|
11
|
+
})));
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Workspace } from "../../domain/workspace/model.js";
|
|
2
|
+
export type ResizeSplitBoundaryMode = 'local' | 'proportional';
|
|
3
|
+
interface ResizeSplitBoundaryInput {
|
|
4
|
+
rootSplitId: string;
|
|
5
|
+
boundaryIndex: number;
|
|
6
|
+
deltaRatio: number;
|
|
7
|
+
mode?: ResizeSplitBoundaryMode;
|
|
8
|
+
}
|
|
9
|
+
export declare function resizeSplitBoundary(workspace: Workspace, input: ResizeSplitBoundaryInput): Workspace;
|
|
10
|
+
export {};
|