@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,129 @@
|
|
|
1
|
+
export function createRuntimeOffloadTask(input, timestamp = new Date().toISOString()) {
|
|
2
|
+
return {
|
|
3
|
+
id: input.id ?? `offload:${input.kind}:${timestamp}`,
|
|
4
|
+
kind: input.kind,
|
|
5
|
+
label: sanitizeText(input.label, 160),
|
|
6
|
+
priority: input.priority ?? 'normal',
|
|
7
|
+
status: 'queued',
|
|
8
|
+
progress: 0,
|
|
9
|
+
cancellable: input.cancellable ?? true,
|
|
10
|
+
createdAt: timestamp,
|
|
11
|
+
startedAt: null,
|
|
12
|
+
completedAt: null,
|
|
13
|
+
error: null,
|
|
14
|
+
payload: input.payload === undefined ? undefined : sanitizeJson(input.payload)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function startRuntimeOffloadTask(task, timestamp = new Date().toISOString()) {
|
|
18
|
+
if (task.status !== 'queued') {
|
|
19
|
+
return task;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
...task,
|
|
23
|
+
status: 'running',
|
|
24
|
+
startedAt: timestamp,
|
|
25
|
+
error: null
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function updateRuntimeOffloadTaskProgress(task, progress, _timestamp = new Date().toISOString()) {
|
|
29
|
+
if (task.status !== 'running') {
|
|
30
|
+
return task;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...task,
|
|
34
|
+
progress: clampProgress(progress)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function completeRuntimeOffloadTask(task, result = undefined, timestamp = new Date().toISOString()) {
|
|
38
|
+
if (task.status !== 'running') {
|
|
39
|
+
return task;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
...task,
|
|
43
|
+
status: 'completed',
|
|
44
|
+
progress: 100,
|
|
45
|
+
completedAt: timestamp,
|
|
46
|
+
error: null,
|
|
47
|
+
result: result === undefined ? task.result : sanitizeJson(result)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function failRuntimeOffloadTask(task, error, timestamp = new Date().toISOString()) {
|
|
51
|
+
if (task.status !== 'running' && task.status !== 'queued') {
|
|
52
|
+
return task;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
...task,
|
|
56
|
+
status: 'failed',
|
|
57
|
+
completedAt: timestamp,
|
|
58
|
+
error: sanitizeText(error, 500)
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export function cancelRuntimeOffloadTask(task, timestamp = new Date().toISOString()) {
|
|
62
|
+
if (!task.cancellable || task.status === 'completed' || task.status === 'failed' || task.status === 'cancelled') {
|
|
63
|
+
return task;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
...task,
|
|
67
|
+
status: 'cancelled',
|
|
68
|
+
completedAt: timestamp,
|
|
69
|
+
error: null
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function createRuntimeOffloadSnapshot(tasks, timestamp = new Date().toISOString()) {
|
|
73
|
+
const sortedTasks = [...tasks].sort(compareRuntimeOffloadTasks);
|
|
74
|
+
return {
|
|
75
|
+
generatedAt: timestamp,
|
|
76
|
+
activeTaskIds: sortedTasks.filter((task) => task.status === 'running').map((task) => task.id),
|
|
77
|
+
queue: sortedTasks.filter((task) => task.status === 'queued').map((task) => task.id),
|
|
78
|
+
tasks: sortedTasks,
|
|
79
|
+
totals: {
|
|
80
|
+
queued: sortedTasks.filter((task) => task.status === 'queued').length,
|
|
81
|
+
running: sortedTasks.filter((task) => task.status === 'running').length,
|
|
82
|
+
completed: sortedTasks.filter((task) => task.status === 'completed').length,
|
|
83
|
+
failed: sortedTasks.filter((task) => task.status === 'failed').length,
|
|
84
|
+
cancelled: sortedTasks.filter((task) => task.status === 'cancelled').length
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export function compareRuntimeOffloadTasks(a, b) {
|
|
89
|
+
const priorityDelta = priorityWeight[b.priority] - priorityWeight[a.priority];
|
|
90
|
+
if (priorityDelta !== 0 && a.status === b.status && a.status === 'queued') {
|
|
91
|
+
return priorityDelta;
|
|
92
|
+
}
|
|
93
|
+
return a.createdAt.localeCompare(b.createdAt);
|
|
94
|
+
}
|
|
95
|
+
const priorityWeight = {
|
|
96
|
+
low: 0,
|
|
97
|
+
normal: 1,
|
|
98
|
+
high: 2,
|
|
99
|
+
urgent: 3
|
|
100
|
+
};
|
|
101
|
+
function clampProgress(progress) {
|
|
102
|
+
return Math.max(0, Math.min(100, Math.round(Number.isFinite(progress) ? progress : 0)));
|
|
103
|
+
}
|
|
104
|
+
function sanitizeText(value, maxLength = 2000) {
|
|
105
|
+
return value.length <= maxLength ? value : `${value.slice(0, maxLength - 1)}...`;
|
|
106
|
+
}
|
|
107
|
+
function sanitizeJson(value, depth = 0) {
|
|
108
|
+
if (value === null || typeof value === 'boolean') {
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
if (typeof value === 'string') {
|
|
112
|
+
return sanitizeText(value);
|
|
113
|
+
}
|
|
114
|
+
if (typeof value === 'number') {
|
|
115
|
+
return Number.isFinite(value) ? value : null;
|
|
116
|
+
}
|
|
117
|
+
if (Array.isArray(value)) {
|
|
118
|
+
return depth >= 4 ? `[Array(${value.length})]` : value.slice(0, 50).map((entry) => sanitizeJson(entry, depth + 1));
|
|
119
|
+
}
|
|
120
|
+
if (value && typeof value === 'object') {
|
|
121
|
+
if (depth >= 4) {
|
|
122
|
+
return '[Object]';
|
|
123
|
+
}
|
|
124
|
+
return Object.fromEntries(Object.entries(value)
|
|
125
|
+
.slice(0, 50)
|
|
126
|
+
.map(([key, entry]) => [sanitizeText(key, 120), sanitizeJson(entry, depth + 1)]));
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { LaunchPreflightSummary, LaunchProfile, LaunchTarget } from "../launch/model.js";
|
|
2
|
+
export type RuntimePlanStepKind = 'mount-store' | 'start-service' | 'initialize-manager' | 'register-tool' | 'activate-watcher' | 'launch-worker' | 'observability-hook' | 'teardown-hook' | 'rollback-hook';
|
|
3
|
+
export type RuntimePlanStepStatus = 'planned' | 'skipped' | 'blocked';
|
|
4
|
+
export interface RuntimePlanStep {
|
|
5
|
+
id: string;
|
|
6
|
+
kind: RuntimePlanStepKind;
|
|
7
|
+
label: string;
|
|
8
|
+
status: RuntimePlanStepStatus;
|
|
9
|
+
critical: boolean;
|
|
10
|
+
reason: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface RuntimePlanWarning {
|
|
13
|
+
id: string;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
export interface RuntimePlan {
|
|
17
|
+
id: string;
|
|
18
|
+
target: LaunchTarget;
|
|
19
|
+
profile: LaunchProfile;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
dryRun: boolean;
|
|
22
|
+
canExecute: boolean;
|
|
23
|
+
steps: RuntimePlanStep[];
|
|
24
|
+
warnings: RuntimePlanWarning[];
|
|
25
|
+
preflight: LaunchPreflightSummary | null;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type RuntimeQualityMode = 'off' | 'low' | 'medium' | 'high';
|
|
2
|
+
export type RuntimeQualityReason = 'requested' | 'hidden-tab' | 'reduced-motion' | 'battery-saver' | 'low-fps' | 'busy-offload' | 'low-concurrency' | 'recovery';
|
|
3
|
+
export interface RuntimeQualityPolicyInput {
|
|
4
|
+
requestedQuality?: RuntimeQualityMode;
|
|
5
|
+
reducedMotion?: boolean;
|
|
6
|
+
batterySaver?: boolean;
|
|
7
|
+
hidden?: boolean;
|
|
8
|
+
fps?: number | null;
|
|
9
|
+
hardwareConcurrency?: number | null;
|
|
10
|
+
activeOffloadTasks?: number;
|
|
11
|
+
recovering?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface RuntimeQualityPolicy {
|
|
14
|
+
requestedQuality: RuntimeQualityMode;
|
|
15
|
+
effectiveQuality: RuntimeQualityMode;
|
|
16
|
+
shouldAnimate: boolean;
|
|
17
|
+
reducedMotion: boolean;
|
|
18
|
+
budgets: {
|
|
19
|
+
particleCount: number;
|
|
20
|
+
blurPx: number;
|
|
21
|
+
ambientFps: number;
|
|
22
|
+
maxConcurrentOffloadTasks: number;
|
|
23
|
+
telemetrySampleRate: number;
|
|
24
|
+
};
|
|
25
|
+
reasons: RuntimeQualityReason[];
|
|
26
|
+
}
|
|
27
|
+
export declare function createRuntimeQualityPolicy(input?: RuntimeQualityPolicyInput): RuntimeQualityPolicy;
|
|
28
|
+
export declare function shouldThrottleRuntimeQuality(policy: RuntimeQualityPolicy): boolean;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export function createRuntimeQualityPolicy(input = {}) {
|
|
2
|
+
const requestedQuality = input.requestedQuality ?? 'medium';
|
|
3
|
+
const reasons = ['requested'];
|
|
4
|
+
let effectiveQuality = requestedQuality;
|
|
5
|
+
if (input.hidden) {
|
|
6
|
+
effectiveQuality = minQuality(effectiveQuality, 'low');
|
|
7
|
+
reasons.push('hidden-tab');
|
|
8
|
+
}
|
|
9
|
+
if (input.reducedMotion) {
|
|
10
|
+
effectiveQuality = minQuality(effectiveQuality, 'low');
|
|
11
|
+
reasons.push('reduced-motion');
|
|
12
|
+
}
|
|
13
|
+
if (input.batterySaver) {
|
|
14
|
+
effectiveQuality = minQuality(effectiveQuality, 'low');
|
|
15
|
+
reasons.push('battery-saver');
|
|
16
|
+
}
|
|
17
|
+
if (typeof input.fps === 'number' && Number.isFinite(input.fps) && input.fps > 0 && input.fps < 28) {
|
|
18
|
+
effectiveQuality = downshiftQuality(effectiveQuality);
|
|
19
|
+
reasons.push('low-fps');
|
|
20
|
+
}
|
|
21
|
+
if ((input.activeOffloadTasks ?? 0) >= 3) {
|
|
22
|
+
effectiveQuality = minQuality(effectiveQuality, 'medium');
|
|
23
|
+
reasons.push('busy-offload');
|
|
24
|
+
}
|
|
25
|
+
if (typeof input.hardwareConcurrency === 'number' && Number.isFinite(input.hardwareConcurrency) && input.hardwareConcurrency > 0 && input.hardwareConcurrency <= 2) {
|
|
26
|
+
effectiveQuality = minQuality(effectiveQuality, 'low');
|
|
27
|
+
reasons.push('low-concurrency');
|
|
28
|
+
}
|
|
29
|
+
if (input.recovering) {
|
|
30
|
+
effectiveQuality = minQuality(effectiveQuality, 'low');
|
|
31
|
+
reasons.push('recovery');
|
|
32
|
+
}
|
|
33
|
+
const budgets = createBudgets(effectiveQuality);
|
|
34
|
+
const shouldAnimate = effectiveQuality !== 'off' && !input.reducedMotion && !input.hidden;
|
|
35
|
+
return {
|
|
36
|
+
requestedQuality,
|
|
37
|
+
effectiveQuality,
|
|
38
|
+
shouldAnimate,
|
|
39
|
+
reducedMotion: input.reducedMotion ?? false,
|
|
40
|
+
budgets: {
|
|
41
|
+
...budgets,
|
|
42
|
+
maxConcurrentOffloadTasks: Math.max(1, Math.min(budgets.maxConcurrentOffloadTasks, Math.max(1, Math.floor(input.hardwareConcurrency ?? budgets.maxConcurrentOffloadTasks))))
|
|
43
|
+
},
|
|
44
|
+
reasons: uniqueReasons(reasons)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function shouldThrottleRuntimeQuality(policy) {
|
|
48
|
+
return policy.effectiveQuality === 'off' || policy.effectiveQuality === 'low' || policy.reasons.some((reason) => reason !== 'requested');
|
|
49
|
+
}
|
|
50
|
+
const qualityOrder = ['off', 'low', 'medium', 'high'];
|
|
51
|
+
function minQuality(current, cap) {
|
|
52
|
+
return qualityOrder[Math.min(qualityOrder.indexOf(current), qualityOrder.indexOf(cap))] ?? 'medium';
|
|
53
|
+
}
|
|
54
|
+
function downshiftQuality(current) {
|
|
55
|
+
const index = qualityOrder.indexOf(current);
|
|
56
|
+
return qualityOrder[Math.max(0, index - 1)] ?? 'low';
|
|
57
|
+
}
|
|
58
|
+
function createBudgets(quality) {
|
|
59
|
+
switch (quality) {
|
|
60
|
+
case 'off':
|
|
61
|
+
return {
|
|
62
|
+
particleCount: 0,
|
|
63
|
+
blurPx: 0,
|
|
64
|
+
ambientFps: 0,
|
|
65
|
+
maxConcurrentOffloadTasks: 1,
|
|
66
|
+
telemetrySampleRate: 0.25
|
|
67
|
+
};
|
|
68
|
+
case 'low':
|
|
69
|
+
return {
|
|
70
|
+
particleCount: 18,
|
|
71
|
+
blurPx: 8,
|
|
72
|
+
ambientFps: 12,
|
|
73
|
+
maxConcurrentOffloadTasks: 1,
|
|
74
|
+
telemetrySampleRate: 0.5
|
|
75
|
+
};
|
|
76
|
+
case 'high':
|
|
77
|
+
return {
|
|
78
|
+
particleCount: 96,
|
|
79
|
+
blurPx: 24,
|
|
80
|
+
ambientFps: 60,
|
|
81
|
+
maxConcurrentOffloadTasks: 4,
|
|
82
|
+
telemetrySampleRate: 1
|
|
83
|
+
};
|
|
84
|
+
case 'medium':
|
|
85
|
+
default:
|
|
86
|
+
return {
|
|
87
|
+
particleCount: 48,
|
|
88
|
+
blurPx: 16,
|
|
89
|
+
ambientFps: 30,
|
|
90
|
+
maxConcurrentOffloadTasks: 2,
|
|
91
|
+
telemetrySampleRate: 0.75
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function uniqueReasons(reasons) {
|
|
96
|
+
return [...new Set(reasons)];
|
|
97
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { LaunchPhase, LaunchTarget } from "../launch/model.js";
|
|
2
|
+
export type RuntimeRecoveryCause = 'launch-failed' | 'initialization-failed' | 'hydration-failed' | 'suspension-failed' | 'resume-failed' | 'teardown-failed' | 'crash' | 'manual';
|
|
3
|
+
export type RuntimeRecoveryActionKind = 'capture-failed-launch-report' | 'load-last-known-good' | 'disable-tools' | 'disable-plugins' | 'boot-core-only' | 'export-diagnostic-bundle' | 'retry-preflight' | 'retry-safe-mode' | 'return-launch-gate';
|
|
4
|
+
export type RuntimeRecoveryActionStatus = 'pending' | 'running' | 'completed' | 'failed';
|
|
5
|
+
export interface RuntimeFailedLaunchReport {
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
phase: LaunchPhase;
|
|
9
|
+
cause: RuntimeRecoveryCause;
|
|
10
|
+
target: LaunchTarget | null;
|
|
11
|
+
error: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RuntimeDiagnosticBundle {
|
|
14
|
+
id: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
failedLaunchReportId: string;
|
|
17
|
+
includedSections: string[];
|
|
18
|
+
sanitized: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface RuntimeRecoveryAction {
|
|
21
|
+
id: string;
|
|
22
|
+
kind: RuntimeRecoveryActionKind;
|
|
23
|
+
label: string;
|
|
24
|
+
status: RuntimeRecoveryActionStatus;
|
|
25
|
+
startedAt: string | null;
|
|
26
|
+
completedAt: string | null;
|
|
27
|
+
message: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface RuntimeRecoverySnapshot {
|
|
30
|
+
status: 'idle' | 'running' | 'completed' | 'failed';
|
|
31
|
+
cause: RuntimeRecoveryCause;
|
|
32
|
+
activeActionId: string | null;
|
|
33
|
+
progress: number;
|
|
34
|
+
report: RuntimeFailedLaunchReport;
|
|
35
|
+
diagnosticBundle: RuntimeDiagnosticBundle | null;
|
|
36
|
+
actions: RuntimeRecoveryAction[];
|
|
37
|
+
startedAt: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
completedAt: string | null;
|
|
40
|
+
error: string | null;
|
|
41
|
+
}
|
|
42
|
+
export interface RuntimeSafeModeSnapshot {
|
|
43
|
+
active: boolean;
|
|
44
|
+
reason: string;
|
|
45
|
+
enteredAt: string;
|
|
46
|
+
profile: 'core-only';
|
|
47
|
+
disabledTools: string[];
|
|
48
|
+
disabledPlugins: string[];
|
|
49
|
+
failedLaunchReportId: string | null;
|
|
50
|
+
diagnosticBundleId: string | null;
|
|
51
|
+
}
|
|
52
|
+
export declare function createRuntimeRecoverySnapshot(input: {
|
|
53
|
+
phase: LaunchPhase;
|
|
54
|
+
cause: RuntimeRecoveryCause;
|
|
55
|
+
target: LaunchTarget | null;
|
|
56
|
+
error: string;
|
|
57
|
+
}, timestamp?: string): RuntimeRecoverySnapshot;
|
|
58
|
+
export declare function completeRuntimeRecoveryAction(snapshot: RuntimeRecoverySnapshot, actionId: string, timestamp?: string, message?: string | null): RuntimeRecoverySnapshot;
|
|
59
|
+
export declare function failRuntimeRecoveryAction(snapshot: RuntimeRecoverySnapshot, actionId: string, error: string, timestamp?: string): RuntimeRecoverySnapshot;
|
|
60
|
+
export declare function createRuntimeSafeModeSnapshot(recovery: RuntimeRecoverySnapshot | null, timestamp?: string, reason?: string): RuntimeSafeModeSnapshot;
|
|
61
|
+
export declare function createRuntimeDiagnosticBundle(failedLaunchReportId: string, timestamp?: string): RuntimeDiagnosticBundle;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
const RECOVERY_ACTIONS = [
|
|
2
|
+
{ kind: 'capture-failed-launch-report', label: 'Capture failed launch report' },
|
|
3
|
+
{ kind: 'load-last-known-good', label: 'Load last known good config' },
|
|
4
|
+
{ kind: 'disable-tools', label: 'Disable non-critical tools' },
|
|
5
|
+
{ kind: 'disable-plugins', label: 'Disable plugins' },
|
|
6
|
+
{ kind: 'boot-core-only', label: 'Boot core-only runtime' },
|
|
7
|
+
{ kind: 'export-diagnostic-bundle', label: 'Export diagnostic bundle' },
|
|
8
|
+
{ kind: 'retry-preflight', label: 'Retry from preflight' },
|
|
9
|
+
{ kind: 'retry-safe-mode', label: 'Retry from safe mode' },
|
|
10
|
+
{ kind: 'return-launch-gate', label: 'Return to launch gate' }
|
|
11
|
+
];
|
|
12
|
+
export function createRuntimeRecoverySnapshot(input, timestamp = new Date().toISOString()) {
|
|
13
|
+
const actions = RECOVERY_ACTIONS.map((action) => ({
|
|
14
|
+
id: `recovery:${action.kind}`,
|
|
15
|
+
kind: action.kind,
|
|
16
|
+
label: action.label,
|
|
17
|
+
status: 'pending',
|
|
18
|
+
startedAt: null,
|
|
19
|
+
completedAt: null,
|
|
20
|
+
message: null
|
|
21
|
+
}));
|
|
22
|
+
const firstAction = actions[0] ?? null;
|
|
23
|
+
return {
|
|
24
|
+
status: 'running',
|
|
25
|
+
cause: input.cause,
|
|
26
|
+
activeActionId: firstAction?.id ?? null,
|
|
27
|
+
progress: 0,
|
|
28
|
+
report: {
|
|
29
|
+
id: `failed-launch:${timestamp}`,
|
|
30
|
+
createdAt: timestamp,
|
|
31
|
+
phase: input.phase,
|
|
32
|
+
cause: input.cause,
|
|
33
|
+
target: input.target,
|
|
34
|
+
error: input.error
|
|
35
|
+
},
|
|
36
|
+
diagnosticBundle: null,
|
|
37
|
+
actions: firstAction
|
|
38
|
+
? actions.map((action) => action.id === firstAction.id ? { ...action, status: 'running', startedAt: timestamp } : action)
|
|
39
|
+
: actions,
|
|
40
|
+
startedAt: timestamp,
|
|
41
|
+
updatedAt: timestamp,
|
|
42
|
+
completedAt: null,
|
|
43
|
+
error: input.error
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export function completeRuntimeRecoveryAction(snapshot, actionId, timestamp = new Date().toISOString(), message = null) {
|
|
47
|
+
const actions = snapshot.actions.map((action) => action.id === actionId
|
|
48
|
+
? {
|
|
49
|
+
...action,
|
|
50
|
+
status: 'completed',
|
|
51
|
+
completedAt: timestamp,
|
|
52
|
+
message
|
|
53
|
+
}
|
|
54
|
+
: action);
|
|
55
|
+
const diagnosticBundle = actions.find((action) => action.id === actionId)?.kind === 'export-diagnostic-bundle'
|
|
56
|
+
? createRuntimeDiagnosticBundle(snapshot.report.id, timestamp)
|
|
57
|
+
: snapshot.diagnosticBundle;
|
|
58
|
+
const nextPendingAction = actions.find((action) => action.status === 'pending') ?? null;
|
|
59
|
+
const nextActions = nextPendingAction
|
|
60
|
+
? actions.map((action) => action.id === nextPendingAction.id
|
|
61
|
+
? {
|
|
62
|
+
...action,
|
|
63
|
+
status: 'running',
|
|
64
|
+
startedAt: timestamp
|
|
65
|
+
}
|
|
66
|
+
: action)
|
|
67
|
+
: actions;
|
|
68
|
+
const progress = calculateRecoveryProgress(nextActions);
|
|
69
|
+
const completed = progress >= 100;
|
|
70
|
+
return {
|
|
71
|
+
...snapshot,
|
|
72
|
+
status: completed ? 'completed' : 'running',
|
|
73
|
+
activeActionId: completed ? null : nextPendingAction?.id ?? null,
|
|
74
|
+
progress,
|
|
75
|
+
diagnosticBundle,
|
|
76
|
+
actions: nextActions,
|
|
77
|
+
updatedAt: timestamp,
|
|
78
|
+
completedAt: completed ? timestamp : null,
|
|
79
|
+
error: null
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function failRuntimeRecoveryAction(snapshot, actionId, error, timestamp = new Date().toISOString()) {
|
|
83
|
+
const actions = snapshot.actions.map((action) => action.id === actionId
|
|
84
|
+
? {
|
|
85
|
+
...action,
|
|
86
|
+
status: 'failed',
|
|
87
|
+
completedAt: timestamp,
|
|
88
|
+
message: error
|
|
89
|
+
}
|
|
90
|
+
: action);
|
|
91
|
+
return {
|
|
92
|
+
...snapshot,
|
|
93
|
+
status: 'failed',
|
|
94
|
+
activeActionId: null,
|
|
95
|
+
progress: calculateRecoveryProgress(actions),
|
|
96
|
+
actions,
|
|
97
|
+
updatedAt: timestamp,
|
|
98
|
+
completedAt: timestamp,
|
|
99
|
+
error
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function createRuntimeSafeModeSnapshot(recovery, timestamp = new Date().toISOString(), reason = 'Recovery switched to core-only safe mode.') {
|
|
103
|
+
return {
|
|
104
|
+
active: true,
|
|
105
|
+
reason,
|
|
106
|
+
enteredAt: timestamp,
|
|
107
|
+
profile: 'core-only',
|
|
108
|
+
disabledTools: ['non-critical-tools'],
|
|
109
|
+
disabledPlugins: ['external-plugins'],
|
|
110
|
+
failedLaunchReportId: recovery?.report.id ?? null,
|
|
111
|
+
diagnosticBundleId: recovery?.diagnosticBundle?.id ?? null
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export function createRuntimeDiagnosticBundle(failedLaunchReportId, timestamp = new Date().toISOString()) {
|
|
115
|
+
return {
|
|
116
|
+
id: `diagnostic-bundle:${timestamp}`,
|
|
117
|
+
createdAt: timestamp,
|
|
118
|
+
failedLaunchReportId,
|
|
119
|
+
includedSections: ['launch-state', 'runtime-plan', 'lifecycle', 'debug-events', 'stack-traces'],
|
|
120
|
+
sanitized: true
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function calculateRecoveryProgress(actions) {
|
|
124
|
+
if (actions.length === 0) {
|
|
125
|
+
return 100;
|
|
126
|
+
}
|
|
127
|
+
const resolvedActions = actions.filter((action) => action.status === 'completed').length;
|
|
128
|
+
return Math.round((resolvedActions / actions.length) * 100);
|
|
129
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type RuntimeSuspensionOperation = 'suspend' | 'resume';
|
|
2
|
+
export type RuntimeSuspensionStepStatus = 'pending' | 'running' | 'completed' | 'failed';
|
|
3
|
+
export type RuntimeSuspensionStepKind = 'pause-watchers' | 'pause-workers' | 'freeze-sessions' | 'flush-writes' | 'checkpoint' | 'validate-checkpoint' | 'reconnect-services' | 'resume-watchers' | 'resume-workers' | 'rehydrate-state';
|
|
4
|
+
export interface RuntimeSuspensionStep {
|
|
5
|
+
id: string;
|
|
6
|
+
kind: RuntimeSuspensionStepKind;
|
|
7
|
+
label: string;
|
|
8
|
+
status: RuntimeSuspensionStepStatus;
|
|
9
|
+
startedAt: string | null;
|
|
10
|
+
completedAt: string | null;
|
|
11
|
+
message: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface RuntimeSuspensionCheckpoint {
|
|
14
|
+
id: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
reason: string;
|
|
17
|
+
}
|
|
18
|
+
export interface RuntimeSuspensionSnapshot {
|
|
19
|
+
operation: RuntimeSuspensionOperation;
|
|
20
|
+
status: 'idle' | 'running' | 'completed' | 'failed';
|
|
21
|
+
activeStepId: string | null;
|
|
22
|
+
progress: number;
|
|
23
|
+
checkpoint: RuntimeSuspensionCheckpoint | null;
|
|
24
|
+
steps: RuntimeSuspensionStep[];
|
|
25
|
+
startedAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
completedAt: string | null;
|
|
28
|
+
error: string | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function createRuntimeSuspensionSnapshot(operation: RuntimeSuspensionOperation, timestamp?: string, _reason?: string, checkpoint?: RuntimeSuspensionCheckpoint | null): RuntimeSuspensionSnapshot;
|
|
31
|
+
export declare function completeRuntimeSuspensionStep(snapshot: RuntimeSuspensionSnapshot, stepId: string, timestamp?: string, message?: string | null): RuntimeSuspensionSnapshot;
|
|
32
|
+
export declare function failRuntimeSuspensionStep(snapshot: RuntimeSuspensionSnapshot, stepId: string, error: string, timestamp?: string): RuntimeSuspensionSnapshot;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const SUSPEND_STEPS = [
|
|
2
|
+
{ kind: 'pause-watchers', label: 'Pause watchers' },
|
|
3
|
+
{ kind: 'pause-workers', label: 'Pause workers' },
|
|
4
|
+
{ kind: 'freeze-sessions', label: 'Freeze sessions' },
|
|
5
|
+
{ kind: 'flush-writes', label: 'Flush writes' },
|
|
6
|
+
{ kind: 'checkpoint', label: 'Create checkpoint' }
|
|
7
|
+
];
|
|
8
|
+
const RESUME_STEPS = [
|
|
9
|
+
{ kind: 'validate-checkpoint', label: 'Validate checkpoint' },
|
|
10
|
+
{ kind: 'reconnect-services', label: 'Reconnect services' },
|
|
11
|
+
{ kind: 'rehydrate-state', label: 'Rehydrate state' },
|
|
12
|
+
{ kind: 'resume-watchers', label: 'Resume watchers' },
|
|
13
|
+
{ kind: 'resume-workers', label: 'Resume workers' }
|
|
14
|
+
];
|
|
15
|
+
export function createRuntimeSuspensionSnapshot(operation, timestamp = new Date().toISOString(), _reason = operation === 'suspend' ? 'User requested suspension.' : 'User requested resume.', checkpoint = null) {
|
|
16
|
+
const steps = (operation === 'suspend' ? SUSPEND_STEPS : RESUME_STEPS).map((step) => ({
|
|
17
|
+
id: `${operation}:${step.kind}`,
|
|
18
|
+
kind: step.kind,
|
|
19
|
+
label: step.label,
|
|
20
|
+
status: 'pending',
|
|
21
|
+
startedAt: null,
|
|
22
|
+
completedAt: null,
|
|
23
|
+
message: null
|
|
24
|
+
}));
|
|
25
|
+
const firstStep = steps[0] ?? null;
|
|
26
|
+
return {
|
|
27
|
+
operation,
|
|
28
|
+
status: 'running',
|
|
29
|
+
activeStepId: firstStep?.id ?? null,
|
|
30
|
+
progress: 0,
|
|
31
|
+
checkpoint,
|
|
32
|
+
steps: firstStep
|
|
33
|
+
? steps.map((step) => step.id === firstStep.id ? { ...step, status: 'running', startedAt: timestamp } : step)
|
|
34
|
+
: steps,
|
|
35
|
+
startedAt: timestamp,
|
|
36
|
+
updatedAt: timestamp,
|
|
37
|
+
completedAt: null,
|
|
38
|
+
error: null
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function completeRuntimeSuspensionStep(snapshot, stepId, timestamp = new Date().toISOString(), message = null) {
|
|
42
|
+
const steps = snapshot.steps.map((step) => step.id === stepId
|
|
43
|
+
? {
|
|
44
|
+
...step,
|
|
45
|
+
status: 'completed',
|
|
46
|
+
completedAt: timestamp,
|
|
47
|
+
message
|
|
48
|
+
}
|
|
49
|
+
: step);
|
|
50
|
+
const nextPendingStep = steps.find((step) => step.status === 'pending') ?? null;
|
|
51
|
+
const nextSteps = nextPendingStep
|
|
52
|
+
? steps.map((step) => step.id === nextPendingStep.id
|
|
53
|
+
? {
|
|
54
|
+
...step,
|
|
55
|
+
status: 'running',
|
|
56
|
+
startedAt: timestamp
|
|
57
|
+
}
|
|
58
|
+
: step)
|
|
59
|
+
: steps;
|
|
60
|
+
const progress = calculateSuspensionProgress(nextSteps);
|
|
61
|
+
const completed = progress >= 100;
|
|
62
|
+
const checkpoint = completed && snapshot.operation === 'suspend'
|
|
63
|
+
? {
|
|
64
|
+
id: `checkpoint:${timestamp}`,
|
|
65
|
+
createdAt: timestamp,
|
|
66
|
+
reason: snapshot.checkpoint?.reason ?? 'Runtime suspended.'
|
|
67
|
+
}
|
|
68
|
+
: snapshot.checkpoint;
|
|
69
|
+
return {
|
|
70
|
+
...snapshot,
|
|
71
|
+
status: completed ? 'completed' : 'running',
|
|
72
|
+
activeStepId: completed ? null : nextPendingStep?.id ?? null,
|
|
73
|
+
progress,
|
|
74
|
+
checkpoint,
|
|
75
|
+
steps: nextSteps,
|
|
76
|
+
updatedAt: timestamp,
|
|
77
|
+
completedAt: completed ? timestamp : null,
|
|
78
|
+
error: null
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export function failRuntimeSuspensionStep(snapshot, stepId, error, timestamp = new Date().toISOString()) {
|
|
82
|
+
const steps = snapshot.steps.map((step) => step.id === stepId
|
|
83
|
+
? {
|
|
84
|
+
...step,
|
|
85
|
+
status: 'failed',
|
|
86
|
+
completedAt: timestamp,
|
|
87
|
+
message: error
|
|
88
|
+
}
|
|
89
|
+
: step);
|
|
90
|
+
return {
|
|
91
|
+
...snapshot,
|
|
92
|
+
status: 'failed',
|
|
93
|
+
activeStepId: null,
|
|
94
|
+
progress: calculateSuspensionProgress(steps),
|
|
95
|
+
steps,
|
|
96
|
+
updatedAt: timestamp,
|
|
97
|
+
completedAt: timestamp,
|
|
98
|
+
error
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function calculateSuspensionProgress(steps) {
|
|
102
|
+
if (steps.length === 0) {
|
|
103
|
+
return 100;
|
|
104
|
+
}
|
|
105
|
+
const resolvedSteps = steps.filter((step) => step.status === 'completed').length;
|
|
106
|
+
return Math.round((resolvedSteps / steps.length) * 100);
|
|
107
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type RuntimeTeardownStepStatus = 'pending' | 'running' | 'completed' | 'failed';
|
|
2
|
+
export type RuntimeTeardownStepKind = 'stop-services' | 'dispose-managers' | 'terminate-workers' | 'unsubscribe-stores' | 'flush-logs' | 'persist-final-checkpoint' | 'close-repo-handles' | 'return-launch-gate';
|
|
3
|
+
export interface RuntimeTeardownStep {
|
|
4
|
+
id: string;
|
|
5
|
+
kind: RuntimeTeardownStepKind;
|
|
6
|
+
label: string;
|
|
7
|
+
status: RuntimeTeardownStepStatus;
|
|
8
|
+
startedAt: string | null;
|
|
9
|
+
completedAt: string | null;
|
|
10
|
+
message: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface RuntimeTeardownReport {
|
|
13
|
+
id: string;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
completedSteps: number;
|
|
17
|
+
failedStepId: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface RuntimeTeardownSnapshot {
|
|
20
|
+
status: 'idle' | 'running' | 'completed' | 'failed';
|
|
21
|
+
activeStepId: string | null;
|
|
22
|
+
progress: number;
|
|
23
|
+
reason: string;
|
|
24
|
+
report: RuntimeTeardownReport | null;
|
|
25
|
+
steps: RuntimeTeardownStep[];
|
|
26
|
+
startedAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
completedAt: string | null;
|
|
29
|
+
error: string | null;
|
|
30
|
+
}
|
|
31
|
+
export declare function createRuntimeTeardownSnapshot(timestamp?: string, reason?: string): RuntimeTeardownSnapshot;
|
|
32
|
+
export declare function completeRuntimeTeardownStep(snapshot: RuntimeTeardownSnapshot, stepId: string, timestamp?: string, message?: string | null): RuntimeTeardownSnapshot;
|
|
33
|
+
export declare function failRuntimeTeardownStep(snapshot: RuntimeTeardownSnapshot, stepId: string, error: string, timestamp?: string): RuntimeTeardownSnapshot;
|