@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,51 @@
|
|
|
1
|
+
import { normalizeRuntimeInspectableStatus, normalizeRuntimeNullableString, normalizeRuntimeObjectSnapshot, normalizeRuntimeStringArray, sanitizeRuntimeJson } from "./WorkbenchRuntimeSanitizers.js";
|
|
2
|
+
export function createRuntimeStoreSnapshot(registration) {
|
|
3
|
+
const value = safeReadRuntimeValue(registration.getSnapshot, registration.value);
|
|
4
|
+
return {
|
|
5
|
+
id: registration.id,
|
|
6
|
+
label: registration.label ?? registration.id,
|
|
7
|
+
scope: registration.scope ?? 'runtime',
|
|
8
|
+
status: registration.status ?? 'active',
|
|
9
|
+
value: sanitizeRuntimeJson(value),
|
|
10
|
+
updatedAt: new Date().toISOString(),
|
|
11
|
+
metadata: sanitizeRuntimeJson(registration.metadata ?? {})
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function createRuntimeServiceSnapshot(registration) {
|
|
15
|
+
const snapshot = normalizeRuntimeObjectSnapshot(safeReadRuntimeValue(registration.getSnapshot, {}));
|
|
16
|
+
return {
|
|
17
|
+
id: registration.id,
|
|
18
|
+
label: registration.label ?? registration.id,
|
|
19
|
+
status: normalizeRuntimeInspectableStatus(snapshot.status) ?? registration.status ?? 'unknown',
|
|
20
|
+
capabilities: normalizeRuntimeStringArray(snapshot.capabilities) ?? registration.capabilities ?? [],
|
|
21
|
+
endpoint: normalizeRuntimeNullableString(snapshot.endpoint) ?? registration.endpoint ?? null,
|
|
22
|
+
lastError: normalizeRuntimeNullableString(snapshot.lastError) ?? registration.lastError ?? null,
|
|
23
|
+
updatedAt: new Date().toISOString(),
|
|
24
|
+
metadata: sanitizeRuntimeJson(snapshot.metadata ?? registration.metadata ?? {})
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export function createRuntimeManagerSnapshot(registration) {
|
|
28
|
+
const snapshot = normalizeRuntimeObjectSnapshot(safeReadRuntimeValue(registration.getSnapshot, {}));
|
|
29
|
+
return {
|
|
30
|
+
id: registration.id,
|
|
31
|
+
label: registration.label ?? registration.id,
|
|
32
|
+
status: normalizeRuntimeInspectableStatus(snapshot.status) ?? registration.status ?? 'unknown',
|
|
33
|
+
responsibilities: normalizeRuntimeStringArray(snapshot.responsibilities) ?? registration.responsibilities ?? [],
|
|
34
|
+
lastError: normalizeRuntimeNullableString(snapshot.lastError) ?? registration.lastError ?? null,
|
|
35
|
+
updatedAt: new Date().toISOString(),
|
|
36
|
+
metadata: sanitizeRuntimeJson(snapshot.metadata ?? registration.metadata ?? {})
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function safeReadRuntimeValue(read, fallback) {
|
|
40
|
+
if (!read) {
|
|
41
|
+
return fallback;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
return read();
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return {
|
|
48
|
+
error: error instanceof Error ? error.message : String(error)
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RuntimeManagerSnapshot, RuntimeServiceSnapshot, RuntimeStoreSnapshot } from "../../domain/runtime/model.js";
|
|
2
|
+
export interface RuntimeStoreRegistration {
|
|
3
|
+
id: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
scope?: string;
|
|
6
|
+
status?: RuntimeStoreSnapshot['status'];
|
|
7
|
+
metadata?: unknown;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
getSnapshot?: () => unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface RuntimeServiceRegistration {
|
|
12
|
+
id: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
status?: RuntimeServiceSnapshot['status'];
|
|
15
|
+
capabilities?: string[];
|
|
16
|
+
endpoint?: string | null;
|
|
17
|
+
lastError?: string | null;
|
|
18
|
+
metadata?: unknown;
|
|
19
|
+
getSnapshot?: () => Partial<RuntimeServiceSnapshot> | unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface RuntimeManagerRegistration {
|
|
22
|
+
id: string;
|
|
23
|
+
label?: string;
|
|
24
|
+
status?: RuntimeManagerSnapshot['status'];
|
|
25
|
+
responsibilities?: string[];
|
|
26
|
+
lastError?: string | null;
|
|
27
|
+
metadata?: unknown;
|
|
28
|
+
getSnapshot?: () => Partial<RuntimeManagerSnapshot> | unknown;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { WorkbenchRuntimeSharedStateEntry } from "../../domain/runtime/model.js";
|
|
2
|
+
export declare function upsertSharedStateEntryFromEvent(entries: WorkbenchRuntimeSharedStateEntry[], payload: unknown): WorkbenchRuntimeSharedStateEntry[];
|
|
3
|
+
export declare function upsertSharedStateEntry(entries: WorkbenchRuntimeSharedStateEntry[], nextEntry: WorkbenchRuntimeSharedStateEntry): WorkbenchRuntimeSharedStateEntry[];
|
|
4
|
+
export declare function normalizeSharedStateEntry(value: unknown): WorkbenchRuntimeSharedStateEntry | null;
|
|
5
|
+
export declare function normalizeSharedStateScope(value: unknown): WorkbenchRuntimeSharedStateEntry['scope'] | null;
|
|
6
|
+
export declare function compareSharedStateEntries(left: WorkbenchRuntimeSharedStateEntry, right: WorkbenchRuntimeSharedStateEntry): number;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isJsonValue } from "./WorkbenchRuntimeSanitizers.js";
|
|
2
|
+
export function upsertSharedStateEntryFromEvent(entries, payload) {
|
|
3
|
+
const entry = normalizeSharedStateEntry(payload);
|
|
4
|
+
return entry ? upsertSharedStateEntry(entries, entry) : entries;
|
|
5
|
+
}
|
|
6
|
+
export function upsertSharedStateEntry(entries, nextEntry) {
|
|
7
|
+
return [
|
|
8
|
+
...entries.filter((entry) => entry.key !== nextEntry.key),
|
|
9
|
+
nextEntry
|
|
10
|
+
].sort(compareSharedStateEntries);
|
|
11
|
+
}
|
|
12
|
+
export function normalizeSharedStateEntry(value) {
|
|
13
|
+
if (!value || typeof value !== 'object') {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const payload = value;
|
|
17
|
+
const key = typeof payload.key === 'string' ? payload.key : null;
|
|
18
|
+
const scope = normalizeSharedStateScope(payload.scope);
|
|
19
|
+
const valuePayload = isJsonValue(payload.value) ? payload.value : null;
|
|
20
|
+
const version = typeof payload.version === 'number' && Number.isFinite(payload.version)
|
|
21
|
+
? payload.version
|
|
22
|
+
: 0;
|
|
23
|
+
const updatedAt = typeof payload.updatedAt === 'string' ? payload.updatedAt : '';
|
|
24
|
+
const revision = typeof payload.revision === 'string' && payload.revision
|
|
25
|
+
? payload.revision
|
|
26
|
+
: `${version}:${updatedAt}`;
|
|
27
|
+
const originClientId = typeof payload.originClientId === 'string'
|
|
28
|
+
? payload.originClientId
|
|
29
|
+
: null;
|
|
30
|
+
return key && scope
|
|
31
|
+
? {
|
|
32
|
+
key,
|
|
33
|
+
scope,
|
|
34
|
+
value: valuePayload,
|
|
35
|
+
version,
|
|
36
|
+
revision,
|
|
37
|
+
updatedAt,
|
|
38
|
+
originClientId
|
|
39
|
+
}
|
|
40
|
+
: null;
|
|
41
|
+
}
|
|
42
|
+
export function normalizeSharedStateScope(value) {
|
|
43
|
+
return value === 'product' || value === 'session' || value === 'gesture' ? value : null;
|
|
44
|
+
}
|
|
45
|
+
export function compareSharedStateEntries(left, right) {
|
|
46
|
+
return left.key.localeCompare(right.key);
|
|
47
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { RuntimeLaunchSnapshot, RuntimeDebugEvent, RuntimeDebugEventLevel, RuntimeProjectionMetadata, RuntimeProjectionMode, RuntimeStackTrace, WorkbenchRuntimeBackendPort, WorkbenchRuntimeAppPreviewDescriptor, WorkbenchRuntimeProjectionInvalidationResult, WorkbenchRuntimeSharedStateEntry, WorkbenchRuntimeSharedStatePatch, WorkbenchRuntimeWorkspaceDescriptor, WorkbenchRuntimeSnapshot, WorkbenchRuntimeSubscription } from "../../domain/runtime/model.js";
|
|
2
|
+
import type { LaunchState } from "../../domain/launch/model.js";
|
|
3
|
+
import { type RuntimeLifecycleSnapshot, type RuntimeLifecycleState } from "../../domain/runtime/lifecycle.js";
|
|
4
|
+
import type { RuntimeCrashReportInput, RuntimeEntityLifecycleInput, RuntimeHealthCheckInput, RuntimePerformanceMarkerInput, RuntimeStoreMutationInput, RuntimeStructuredLogInput, RuntimeTelemetryTraceInput } from "../../domain/runtime/observability.js";
|
|
5
|
+
import type { RuntimeManagerRegistration, RuntimeServiceRegistration, RuntimeStoreRegistration } from "./RuntimeRegistryTypes.js";
|
|
6
|
+
export interface WorkbenchRuntimeCoreOptions {
|
|
7
|
+
backend?: WorkbenchRuntimeBackendPort;
|
|
8
|
+
maxEvents?: number;
|
|
9
|
+
maxDebugEvents?: number;
|
|
10
|
+
maxStackTraces?: number;
|
|
11
|
+
maxTelemetryEntries?: number;
|
|
12
|
+
mode?: RuntimeProjectionMode;
|
|
13
|
+
metadata?: Partial<RuntimeProjectionMetadata>;
|
|
14
|
+
}
|
|
15
|
+
export type WorkbenchRuntimeCoreListener = (snapshot: WorkbenchRuntimeSnapshot) => void;
|
|
16
|
+
export type { RuntimeManagerRegistration, RuntimeServiceRegistration, RuntimeStoreRegistration } from "./RuntimeRegistryTypes.js";
|
|
17
|
+
export interface RuntimeDebugEventInput {
|
|
18
|
+
id?: string;
|
|
19
|
+
level?: RuntimeDebugEventLevel;
|
|
20
|
+
type: string;
|
|
21
|
+
message?: string;
|
|
22
|
+
scope?: string | null;
|
|
23
|
+
payload?: unknown;
|
|
24
|
+
timestamp?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class WorkbenchRuntimeCore {
|
|
27
|
+
private readonly backend;
|
|
28
|
+
private readonly backendConnection;
|
|
29
|
+
private readonly maxEvents;
|
|
30
|
+
private readonly maxDebugEvents;
|
|
31
|
+
private readonly maxStackTraces;
|
|
32
|
+
private readonly listeners;
|
|
33
|
+
private readonly observability;
|
|
34
|
+
private readonly backendSubscription;
|
|
35
|
+
private readonly registryOwner;
|
|
36
|
+
private snapshot;
|
|
37
|
+
private launchTransitions;
|
|
38
|
+
private lifecycleSnapshot;
|
|
39
|
+
private sequence;
|
|
40
|
+
constructor(options: WorkbenchRuntimeCoreOptions);
|
|
41
|
+
getSnapshot(): WorkbenchRuntimeSnapshot;
|
|
42
|
+
createSnapshot(metadataPatch?: Partial<RuntimeProjectionMetadata>): WorkbenchRuntimeSnapshot;
|
|
43
|
+
activateSelfProjection(metadataPatch?: Partial<RuntimeProjectionMetadata>): WorkbenchRuntimeSnapshot;
|
|
44
|
+
subscribe(listener: WorkbenchRuntimeCoreListener): WorkbenchRuntimeSubscription;
|
|
45
|
+
connect(): Promise<WorkbenchRuntimeSnapshot>;
|
|
46
|
+
disconnect(): void;
|
|
47
|
+
loadProjection<TProjection = unknown>(kind: string, params?: Record<string, string>): Promise<TProjection>;
|
|
48
|
+
invalidateProjection(kind: string, params?: Record<string, string>): Promise<WorkbenchRuntimeProjectionInvalidationResult>;
|
|
49
|
+
loadProject(root: string): Promise<WorkbenchRuntimeWorkspaceDescriptor>;
|
|
50
|
+
startAppPreview(root?: string): Promise<WorkbenchRuntimeAppPreviewDescriptor>;
|
|
51
|
+
listSharedState(): Promise<WorkbenchRuntimeSharedStateEntry[]>;
|
|
52
|
+
recordTelemetryTrace(input: RuntimeTelemetryTraceInput): void;
|
|
53
|
+
recordStructuredLog(input: RuntimeStructuredLogInput): void;
|
|
54
|
+
recordPerformanceMarker(input: RuntimePerformanceMarkerInput): void;
|
|
55
|
+
recordHealthCheck(input: RuntimeHealthCheckInput): void;
|
|
56
|
+
recordStoreMutation(input: RuntimeStoreMutationInput): void;
|
|
57
|
+
recordEntityLifecycle(input: RuntimeEntityLifecycleInput): void;
|
|
58
|
+
captureCrashReport(error: Error | string, input?: RuntimeCrashReportInput): void;
|
|
59
|
+
registerStore(registration: RuntimeStoreRegistration): WorkbenchRuntimeSubscription;
|
|
60
|
+
registerService(registration: RuntimeServiceRegistration): WorkbenchRuntimeSubscription;
|
|
61
|
+
registerManager(registration: RuntimeManagerRegistration): WorkbenchRuntimeSubscription;
|
|
62
|
+
pushDebugEvent(input: RuntimeDebugEventInput): RuntimeDebugEvent;
|
|
63
|
+
captureStackTrace(error?: Error | string, input?: {
|
|
64
|
+
id?: string;
|
|
65
|
+
message?: string;
|
|
66
|
+
scope?: string | null;
|
|
67
|
+
}): RuntimeStackTrace;
|
|
68
|
+
recordLaunchState(state: LaunchState, input?: {
|
|
69
|
+
message?: string;
|
|
70
|
+
timestamp?: string;
|
|
71
|
+
}): RuntimeLaunchSnapshot;
|
|
72
|
+
transitionLifecycle(state: RuntimeLifecycleState, input?: {
|
|
73
|
+
message?: string;
|
|
74
|
+
timestamp?: string;
|
|
75
|
+
}): RuntimeLifecycleSnapshot;
|
|
76
|
+
patchSharedState(key: string, patch: WorkbenchRuntimeSharedStatePatch): Promise<WorkbenchRuntimeSharedStateEntry>;
|
|
77
|
+
private pushEvent;
|
|
78
|
+
private loadSharedStateFromBackend;
|
|
79
|
+
private setSnapshot;
|
|
80
|
+
private createRuntimeRecordId;
|
|
81
|
+
private refreshObservabilitySnapshot;
|
|
82
|
+
}
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import { createRuntimeLifecycleSnapshot, transitionRuntimeLifecycleSnapshot } from "../../domain/runtime/lifecycle.js";
|
|
2
|
+
import { createRuntimeBackendConnection } from "./RuntimeBackendConnection.js";
|
|
3
|
+
import { createRuntimeBackendSubscriptionOwner } from "./RuntimeBackendSubscription.js";
|
|
4
|
+
import { createRuntimeLaunchPhaseDebugEventInput, createRuntimeLaunchSnapshotFromState, createRuntimeLaunchStoreMutationInput, createRuntimeLaunchTransitionRecord } from "./RuntimeLaunchStateSnapshot.js";
|
|
5
|
+
import { applyRuntimeObservationEvent } from "./RuntimeObservationEvents.js";
|
|
6
|
+
import { normalizeProjectionCatalogFromWorkspace } from "./RuntimeProjectionCatalog.js";
|
|
7
|
+
import { safeReadRuntimeValue } from "./RuntimeRegistrySnapshots.js";
|
|
8
|
+
import { createRuntimeRegistryOwner } from "./RuntimeRegistryOwner.js";
|
|
9
|
+
import { compareSharedStateEntries, normalizeSharedStateEntry, upsertSharedStateEntry } from "./RuntimeSharedState.js";
|
|
10
|
+
import { RuntimeObservabilityHub } from "./RuntimeObservabilityHub.js";
|
|
11
|
+
import { sanitizeRuntimeJson, sanitizeRuntimeText } from "./WorkbenchRuntimeSanitizers.js";
|
|
12
|
+
export class WorkbenchRuntimeCore {
|
|
13
|
+
backend;
|
|
14
|
+
backendConnection;
|
|
15
|
+
maxEvents;
|
|
16
|
+
maxDebugEvents;
|
|
17
|
+
maxStackTraces;
|
|
18
|
+
listeners = new Set();
|
|
19
|
+
observability;
|
|
20
|
+
backendSubscription = createRuntimeBackendSubscriptionOwner();
|
|
21
|
+
registryOwner;
|
|
22
|
+
snapshot;
|
|
23
|
+
launchTransitions = [];
|
|
24
|
+
lifecycleSnapshot;
|
|
25
|
+
sequence = 0;
|
|
26
|
+
constructor(options) {
|
|
27
|
+
this.backend = options.backend ?? null;
|
|
28
|
+
this.backendConnection = createRuntimeBackendConnection(this.backend);
|
|
29
|
+
this.maxEvents = options.maxEvents ?? 50;
|
|
30
|
+
this.maxDebugEvents = options.maxDebugEvents ?? 100;
|
|
31
|
+
this.maxStackTraces = options.maxStackTraces ?? 25;
|
|
32
|
+
this.observability = new RuntimeObservabilityHub({
|
|
33
|
+
maxEntries: options.maxTelemetryEntries ?? Math.max(this.maxEvents, this.maxDebugEvents, this.maxStackTraces)
|
|
34
|
+
});
|
|
35
|
+
this.registryOwner = createRuntimeRegistryOwner({
|
|
36
|
+
onChanged: () => {
|
|
37
|
+
this.createSnapshot();
|
|
38
|
+
},
|
|
39
|
+
onManagerDisposed: (registration) => {
|
|
40
|
+
this.observability.recordEntityLifecycle({
|
|
41
|
+
entityId: registration.id,
|
|
42
|
+
entityType: 'manager',
|
|
43
|
+
kind: 'dispose',
|
|
44
|
+
status: 'idle'
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
onManagerRegistered: (registration) => {
|
|
48
|
+
this.observability.recordEntityLifecycle({
|
|
49
|
+
entityId: registration.id,
|
|
50
|
+
entityType: 'manager',
|
|
51
|
+
kind: 'register',
|
|
52
|
+
status: registration.status ?? 'unknown',
|
|
53
|
+
payload: {
|
|
54
|
+
responsibilities: registration.responsibilities ?? []
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
onServiceDisposed: (registration) => {
|
|
59
|
+
this.observability.recordEntityLifecycle({
|
|
60
|
+
entityId: registration.id,
|
|
61
|
+
entityType: 'service',
|
|
62
|
+
kind: 'dispose',
|
|
63
|
+
status: 'idle'
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
onServiceRegistered: (registration) => {
|
|
67
|
+
this.observability.recordEntityLifecycle({
|
|
68
|
+
entityId: registration.id,
|
|
69
|
+
entityType: 'service',
|
|
70
|
+
kind: 'register',
|
|
71
|
+
status: registration.status ?? 'unknown',
|
|
72
|
+
payload: {
|
|
73
|
+
capabilities: registration.capabilities ?? [],
|
|
74
|
+
endpoint: registration.endpoint ?? null
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
onStoreDisposed: (registration) => {
|
|
79
|
+
this.observability.recordStoreMutation({
|
|
80
|
+
storeId: registration.id,
|
|
81
|
+
kind: 'dispose'
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
onStoreRegistered: (registration) => {
|
|
85
|
+
this.observability.recordStoreMutation({
|
|
86
|
+
storeId: registration.id,
|
|
87
|
+
kind: 'register',
|
|
88
|
+
value: safeReadRuntimeValue(registration.getSnapshot, registration.value)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
this.lifecycleSnapshot = createRuntimeLifecycleSnapshot();
|
|
93
|
+
this.snapshot = {
|
|
94
|
+
status: 'idle',
|
|
95
|
+
backendUrl: this.backend?.baseUrl ?? '',
|
|
96
|
+
projectionMode: options.mode ?? 'self',
|
|
97
|
+
metadata: createRuntimeProjectionMetadata(options.mode ?? 'self', options.metadata),
|
|
98
|
+
health: null,
|
|
99
|
+
workspace: null,
|
|
100
|
+
projectionCatalog: [],
|
|
101
|
+
stores: [],
|
|
102
|
+
services: [],
|
|
103
|
+
managers: [],
|
|
104
|
+
debugEvents: [],
|
|
105
|
+
stackTraces: [],
|
|
106
|
+
launch: null,
|
|
107
|
+
lifecycle: this.lifecycleSnapshot,
|
|
108
|
+
observability: this.observability.createSnapshot(),
|
|
109
|
+
sharedState: [],
|
|
110
|
+
events: [],
|
|
111
|
+
lastError: null
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
getSnapshot() {
|
|
115
|
+
return this.snapshot;
|
|
116
|
+
}
|
|
117
|
+
createSnapshot(metadataPatch = {}) {
|
|
118
|
+
const previousMetadata = this.snapshot.metadata ?? createRuntimeProjectionMetadata(this.snapshot.projectionMode ?? 'self');
|
|
119
|
+
this.setSnapshot({
|
|
120
|
+
metadata: {
|
|
121
|
+
...previousMetadata,
|
|
122
|
+
...metadataPatch,
|
|
123
|
+
mode: metadataPatch.mode ?? previousMetadata.mode,
|
|
124
|
+
source: metadataPatch.source ?? previousMetadata.source,
|
|
125
|
+
version: metadataPatch.version ?? previousMetadata.version,
|
|
126
|
+
generatedAt: metadataPatch.generatedAt ?? new Date().toISOString()
|
|
127
|
+
},
|
|
128
|
+
stores: this.registryOwner.getStoreSnapshots(),
|
|
129
|
+
services: this.registryOwner.getServiceSnapshots(),
|
|
130
|
+
managers: this.registryOwner.getManagerSnapshots(),
|
|
131
|
+
observability: this.observability.createSnapshot()
|
|
132
|
+
});
|
|
133
|
+
return this.snapshot;
|
|
134
|
+
}
|
|
135
|
+
activateSelfProjection(metadataPatch = {}) {
|
|
136
|
+
this.backendSubscription.disconnect();
|
|
137
|
+
this.setSnapshot({
|
|
138
|
+
status: 'online',
|
|
139
|
+
projectionMode: 'self',
|
|
140
|
+
metadata: createRuntimeProjectionMetadata('self', {
|
|
141
|
+
...metadataPatch,
|
|
142
|
+
mode: 'self',
|
|
143
|
+
source: metadataPatch.source ?? 'self'
|
|
144
|
+
}),
|
|
145
|
+
workspace: null,
|
|
146
|
+
projectionCatalog: [],
|
|
147
|
+
sharedState: [],
|
|
148
|
+
events: [],
|
|
149
|
+
lastError: null
|
|
150
|
+
});
|
|
151
|
+
return this.createSnapshot({
|
|
152
|
+
...metadataPatch,
|
|
153
|
+
mode: 'self',
|
|
154
|
+
source: metadataPatch.source ?? 'self'
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
subscribe(listener) {
|
|
158
|
+
this.listeners.add(listener);
|
|
159
|
+
listener(this.snapshot);
|
|
160
|
+
return {
|
|
161
|
+
dispose: () => {
|
|
162
|
+
this.listeners.delete(listener);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async connect() {
|
|
167
|
+
const backend = this.backend;
|
|
168
|
+
if (!backend) {
|
|
169
|
+
return this.createSnapshot({
|
|
170
|
+
mode: this.snapshot.projectionMode ?? 'self',
|
|
171
|
+
source: this.snapshot.metadata?.source || 'self'
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
this.setSnapshot({
|
|
175
|
+
status: 'connecting',
|
|
176
|
+
backendUrl: backend.baseUrl,
|
|
177
|
+
lastError: null
|
|
178
|
+
});
|
|
179
|
+
try {
|
|
180
|
+
const [health, workspace, sharedState] = await Promise.all([
|
|
181
|
+
backend.getHealth(),
|
|
182
|
+
backend.getWorkspace(),
|
|
183
|
+
this.loadSharedStateFromBackend().catch(() => [])
|
|
184
|
+
]);
|
|
185
|
+
this.backendSubscription.replaceWith(() => backend.subscribeToEvents((event) => this.pushEvent(event), (error) => {
|
|
186
|
+
this.setSnapshot({
|
|
187
|
+
status: 'error',
|
|
188
|
+
lastError: error.message
|
|
189
|
+
});
|
|
190
|
+
}));
|
|
191
|
+
this.setSnapshot({
|
|
192
|
+
status: 'online',
|
|
193
|
+
health,
|
|
194
|
+
workspace,
|
|
195
|
+
projectionCatalog: normalizeProjectionCatalogFromWorkspace(workspace),
|
|
196
|
+
sharedState,
|
|
197
|
+
lastError: null
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
this.setSnapshot({
|
|
202
|
+
status: 'offline',
|
|
203
|
+
lastError: error instanceof Error ? error.message : String(error)
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return this.snapshot;
|
|
207
|
+
}
|
|
208
|
+
disconnect() {
|
|
209
|
+
this.backendSubscription.disconnect();
|
|
210
|
+
this.setSnapshot({
|
|
211
|
+
status: 'idle'
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
async loadProjection(kind, params) {
|
|
215
|
+
return this.backendConnection.loadProjection(kind, params);
|
|
216
|
+
}
|
|
217
|
+
async invalidateProjection(kind, params) {
|
|
218
|
+
return this.backendConnection.invalidateProjection(kind, params);
|
|
219
|
+
}
|
|
220
|
+
async loadProject(root) {
|
|
221
|
+
if (!this.backend?.loadProject) {
|
|
222
|
+
throw new Error('Backend project loading is unavailable.');
|
|
223
|
+
}
|
|
224
|
+
this.setSnapshot({
|
|
225
|
+
status: 'connecting',
|
|
226
|
+
lastError: null
|
|
227
|
+
});
|
|
228
|
+
try {
|
|
229
|
+
const workspace = await this.backend.loadProject(root);
|
|
230
|
+
const sharedState = await this.loadSharedStateFromBackend().catch(() => this.snapshot.sharedState);
|
|
231
|
+
this.setSnapshot({
|
|
232
|
+
status: 'online',
|
|
233
|
+
workspace,
|
|
234
|
+
projectionCatalog: normalizeProjectionCatalogFromWorkspace(workspace),
|
|
235
|
+
sharedState,
|
|
236
|
+
lastError: null
|
|
237
|
+
});
|
|
238
|
+
return workspace;
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
this.setSnapshot({
|
|
242
|
+
status: 'error',
|
|
243
|
+
lastError: error instanceof Error ? error.message : String(error)
|
|
244
|
+
});
|
|
245
|
+
throw error;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
async startAppPreview(root) {
|
|
249
|
+
return this.backendConnection.startAppPreview(root);
|
|
250
|
+
}
|
|
251
|
+
async listSharedState() {
|
|
252
|
+
const sharedState = await this.loadSharedStateFromBackend();
|
|
253
|
+
this.setSnapshot({ sharedState });
|
|
254
|
+
return sharedState;
|
|
255
|
+
}
|
|
256
|
+
recordTelemetryTrace(input) {
|
|
257
|
+
this.observability.recordTrace(input);
|
|
258
|
+
this.refreshObservabilitySnapshot();
|
|
259
|
+
}
|
|
260
|
+
recordStructuredLog(input) {
|
|
261
|
+
this.observability.recordLog(input);
|
|
262
|
+
this.refreshObservabilitySnapshot();
|
|
263
|
+
}
|
|
264
|
+
recordPerformanceMarker(input) {
|
|
265
|
+
this.observability.recordPerformanceMarker(input);
|
|
266
|
+
this.refreshObservabilitySnapshot();
|
|
267
|
+
}
|
|
268
|
+
recordHealthCheck(input) {
|
|
269
|
+
this.observability.recordHealthCheck(input);
|
|
270
|
+
this.refreshObservabilitySnapshot();
|
|
271
|
+
}
|
|
272
|
+
recordStoreMutation(input) {
|
|
273
|
+
this.observability.recordStoreMutation(input);
|
|
274
|
+
this.refreshObservabilitySnapshot();
|
|
275
|
+
}
|
|
276
|
+
recordEntityLifecycle(input) {
|
|
277
|
+
this.observability.recordEntityLifecycle(input);
|
|
278
|
+
this.refreshObservabilitySnapshot();
|
|
279
|
+
}
|
|
280
|
+
captureCrashReport(error, input = {}) {
|
|
281
|
+
const report = this.observability.captureCrashReport(error, input);
|
|
282
|
+
this.setSnapshot({
|
|
283
|
+
status: 'error',
|
|
284
|
+
lastError: report.message,
|
|
285
|
+
observability: this.observability.createSnapshot()
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
registerStore(registration) {
|
|
289
|
+
return this.registryOwner.registerStore(registration);
|
|
290
|
+
}
|
|
291
|
+
registerService(registration) {
|
|
292
|
+
return this.registryOwner.registerService(registration);
|
|
293
|
+
}
|
|
294
|
+
registerManager(registration) {
|
|
295
|
+
return this.registryOwner.registerManager(registration);
|
|
296
|
+
}
|
|
297
|
+
pushDebugEvent(input) {
|
|
298
|
+
const event = {
|
|
299
|
+
id: input.id ?? this.createRuntimeRecordId('debug'),
|
|
300
|
+
level: input.level ?? 'info',
|
|
301
|
+
type: sanitizeRuntimeText(input.type, 160),
|
|
302
|
+
message: sanitizeRuntimeText(input.message ?? input.type, 500),
|
|
303
|
+
scope: input.scope ? sanitizeRuntimeText(input.scope, 160) : null,
|
|
304
|
+
timestamp: input.timestamp ?? new Date().toISOString(),
|
|
305
|
+
payload: input.payload === undefined ? undefined : sanitizeRuntimeJson(input.payload)
|
|
306
|
+
};
|
|
307
|
+
this.observability.recordDebugEvent(event);
|
|
308
|
+
this.setSnapshot({
|
|
309
|
+
debugEvents: [event, ...(this.snapshot.debugEvents ?? [])].slice(0, this.maxDebugEvents),
|
|
310
|
+
observability: this.observability.createSnapshot()
|
|
311
|
+
});
|
|
312
|
+
return event;
|
|
313
|
+
}
|
|
314
|
+
captureStackTrace(error, input = {}) {
|
|
315
|
+
const resolvedError = error instanceof Error ? error : null;
|
|
316
|
+
const stackSource = resolvedError?.stack ?? (typeof error === 'string' ? error : new Error(input.message ?? 'Runtime stack trace').stack ?? '');
|
|
317
|
+
const cause = resolvedError && 'cause' in resolvedError ? resolvedError.cause : null;
|
|
318
|
+
const stackTrace = {
|
|
319
|
+
id: input.id ?? this.createRuntimeRecordId('stack'),
|
|
320
|
+
message: sanitizeRuntimeText(input.message ?? resolvedError?.message ?? (typeof error === 'string' ? error : 'Runtime stack trace'), 500),
|
|
321
|
+
scope: input.scope ? sanitizeRuntimeText(input.scope, 160) : null,
|
|
322
|
+
timestamp: new Date().toISOString(),
|
|
323
|
+
frames: stackSource
|
|
324
|
+
.split('\n')
|
|
325
|
+
.map((frame) => sanitizeRuntimeText(frame.trim(), 500))
|
|
326
|
+
.filter(Boolean)
|
|
327
|
+
.slice(0, 24),
|
|
328
|
+
cause: cause instanceof Error ? sanitizeRuntimeText(cause.message, 500) : null
|
|
329
|
+
};
|
|
330
|
+
this.observability.recordStackTrace(stackTrace);
|
|
331
|
+
this.setSnapshot({
|
|
332
|
+
stackTraces: [stackTrace, ...(this.snapshot.stackTraces ?? [])].slice(0, this.maxStackTraces),
|
|
333
|
+
observability: this.observability.createSnapshot()
|
|
334
|
+
});
|
|
335
|
+
return stackTrace;
|
|
336
|
+
}
|
|
337
|
+
recordLaunchState(state, input = {}) {
|
|
338
|
+
const timestamp = input.timestamp ?? new Date().toISOString();
|
|
339
|
+
const previousPhase = this.snapshot.launch?.phase ?? null;
|
|
340
|
+
const phaseChanged = previousPhase !== state.phase;
|
|
341
|
+
const message = sanitizeRuntimeText(input.message ?? `Launch phase ${state.phase}`, 500);
|
|
342
|
+
let transition = null;
|
|
343
|
+
if (phaseChanged) {
|
|
344
|
+
this.transitionLifecycle(state.phase, {
|
|
345
|
+
timestamp,
|
|
346
|
+
message
|
|
347
|
+
});
|
|
348
|
+
transition = createRuntimeLaunchTransitionRecord({
|
|
349
|
+
id: this.createRuntimeRecordId('launch'),
|
|
350
|
+
state,
|
|
351
|
+
previousPhase,
|
|
352
|
+
timestamp,
|
|
353
|
+
message
|
|
354
|
+
});
|
|
355
|
+
this.launchTransitions = [transition, ...this.launchTransitions].slice(0, this.maxDebugEvents);
|
|
356
|
+
}
|
|
357
|
+
const launchSnapshot = createRuntimeLaunchSnapshotFromState({
|
|
358
|
+
state,
|
|
359
|
+
transitions: this.launchTransitions,
|
|
360
|
+
timestamp
|
|
361
|
+
});
|
|
362
|
+
this.observability.recordStoreMutation(createRuntimeLaunchStoreMutationInput({
|
|
363
|
+
id: this.createRuntimeRecordId('launch-state'),
|
|
364
|
+
state,
|
|
365
|
+
previousPhase,
|
|
366
|
+
progress: launchSnapshot.progress,
|
|
367
|
+
timestamp
|
|
368
|
+
}));
|
|
369
|
+
this.setSnapshot({
|
|
370
|
+
launch: launchSnapshot,
|
|
371
|
+
observability: this.observability.createSnapshot()
|
|
372
|
+
});
|
|
373
|
+
if (phaseChanged && transition) {
|
|
374
|
+
this.pushDebugEvent(createRuntimeLaunchPhaseDebugEventInput({
|
|
375
|
+
state,
|
|
376
|
+
previousPhase,
|
|
377
|
+
launchSnapshot,
|
|
378
|
+
timestamp,
|
|
379
|
+
transition
|
|
380
|
+
}));
|
|
381
|
+
}
|
|
382
|
+
return launchSnapshot;
|
|
383
|
+
}
|
|
384
|
+
transitionLifecycle(state, input = {}) {
|
|
385
|
+
const timestamp = input.timestamp ?? new Date().toISOString();
|
|
386
|
+
this.lifecycleSnapshot = transitionRuntimeLifecycleSnapshot(this.lifecycleSnapshot, state, {
|
|
387
|
+
id: this.createRuntimeRecordId('lifecycle'),
|
|
388
|
+
timestamp,
|
|
389
|
+
message: input.message,
|
|
390
|
+
maxTransitions: this.maxDebugEvents,
|
|
391
|
+
maxErrors: Math.max(10, Math.min(this.maxDebugEvents, 25))
|
|
392
|
+
});
|
|
393
|
+
const currentTransition = this.lifecycleSnapshot.transitions[0];
|
|
394
|
+
this.observability.recordTrace({
|
|
395
|
+
id: currentTransition?.id,
|
|
396
|
+
type: 'lifecycle',
|
|
397
|
+
level: currentTransition && !currentTransition.accepted ? 'warning' : 'info',
|
|
398
|
+
scope: 'runtime.lifecycle',
|
|
399
|
+
label: state,
|
|
400
|
+
message: currentTransition?.message ?? input.message ?? `Runtime lifecycle ${state}`,
|
|
401
|
+
timestamp
|
|
402
|
+
});
|
|
403
|
+
this.setSnapshot({
|
|
404
|
+
lifecycle: this.lifecycleSnapshot,
|
|
405
|
+
observability: this.observability.createSnapshot()
|
|
406
|
+
});
|
|
407
|
+
return this.lifecycleSnapshot;
|
|
408
|
+
}
|
|
409
|
+
async patchSharedState(key, patch) {
|
|
410
|
+
const entry = await this.backendConnection.patchSharedState(key, patch);
|
|
411
|
+
const sharedStateEntry = normalizeSharedStateEntry(entry);
|
|
412
|
+
if (!sharedStateEntry) {
|
|
413
|
+
throw new Error(`Backend returned invalid shared state entry for "${key}".`);
|
|
414
|
+
}
|
|
415
|
+
this.setSnapshot({
|
|
416
|
+
sharedState: upsertSharedStateEntry(this.snapshot.sharedState, sharedStateEntry)
|
|
417
|
+
});
|
|
418
|
+
return sharedStateEntry;
|
|
419
|
+
}
|
|
420
|
+
pushEvent(event) {
|
|
421
|
+
this.setSnapshot(applyRuntimeObservationEvent({
|
|
422
|
+
projectionCatalog: this.snapshot.projectionCatalog,
|
|
423
|
+
sharedState: this.snapshot.sharedState,
|
|
424
|
+
events: this.snapshot.events,
|
|
425
|
+
event,
|
|
426
|
+
maxEvents: this.maxEvents
|
|
427
|
+
}));
|
|
428
|
+
}
|
|
429
|
+
async loadSharedStateFromBackend() {
|
|
430
|
+
return (await this.backendConnection.listSharedState())
|
|
431
|
+
.map(normalizeSharedStateEntry)
|
|
432
|
+
.filter((entry) => Boolean(entry))
|
|
433
|
+
.sort(compareSharedStateEntries);
|
|
434
|
+
}
|
|
435
|
+
setSnapshot(patch) {
|
|
436
|
+
this.snapshot = {
|
|
437
|
+
...this.snapshot,
|
|
438
|
+
...patch
|
|
439
|
+
};
|
|
440
|
+
for (const listener of this.listeners) {
|
|
441
|
+
listener(this.snapshot);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
createRuntimeRecordId(prefix) {
|
|
445
|
+
this.sequence += 1;
|
|
446
|
+
return `${prefix}:${this.sequence}`;
|
|
447
|
+
}
|
|
448
|
+
refreshObservabilitySnapshot() {
|
|
449
|
+
this.setSnapshot({
|
|
450
|
+
observability: this.observability.createSnapshot()
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
function createRuntimeProjectionMetadata(mode, metadata = {}) {
|
|
455
|
+
return {
|
|
456
|
+
mode,
|
|
457
|
+
generatedAt: metadata.generatedAt ?? new Date().toISOString(),
|
|
458
|
+
source: metadata.source ?? mode,
|
|
459
|
+
version: metadata.version ?? 'runtime-inspector.v1',
|
|
460
|
+
repo: metadata.repo ?? null,
|
|
461
|
+
build: metadata.build ?? null
|
|
462
|
+
};
|
|
463
|
+
}
|