@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.
Files changed (373) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +54 -0
  3. package/dist/application/boot/applicationBoot.d.ts +48 -0
  4. package/dist/application/boot/applicationBoot.js +174 -0
  5. package/dist/application/experiment/ControlledExperimentCampaign.d.ts +12 -0
  6. package/dist/application/experiment/ControlledExperimentCampaign.js +159 -0
  7. package/dist/application/experiment/ControlledExperimentRecorder.d.ts +17 -0
  8. package/dist/application/experiment/ControlledExperimentRecorder.js +215 -0
  9. package/dist/application/i18n/WorkbenchTranslationRegistry.d.ts +19 -0
  10. package/dist/application/i18n/WorkbenchTranslationRegistry.js +179 -0
  11. package/dist/application/layout/surfaceCommandRouter.d.ts +18 -0
  12. package/dist/application/layout/surfaceCommandRouter.js +247 -0
  13. package/dist/application/physics/NoopPhysicsBackend.d.ts +2 -0
  14. package/dist/application/physics/NoopPhysicsBackend.js +2 -0
  15. package/dist/application/physics/PhysicsService.d.ts +2 -0
  16. package/dist/application/physics/PhysicsService.js +2 -0
  17. package/dist/application/project/ProjectManifest.d.ts +15 -0
  18. package/dist/application/project/ProjectManifest.js +107 -0
  19. package/dist/application/repository/RepositoryPreflightEngine.d.ts +6 -0
  20. package/dist/application/repository/RepositoryPreflightEngine.js +301 -0
  21. package/dist/application/runtime/RuntimeBackendConnection.d.ts +9 -0
  22. package/dist/application/runtime/RuntimeBackendConnection.js +34 -0
  23. package/dist/application/runtime/RuntimeBackendSubscription.d.ts +8 -0
  24. package/dist/application/runtime/RuntimeBackendSubscription.js +52 -0
  25. package/dist/application/runtime/RuntimeCheckpointStore.d.ts +20 -0
  26. package/dist/application/runtime/RuntimeCheckpointStore.js +65 -0
  27. package/dist/application/runtime/RuntimeLaunchProgress.d.ts +3 -0
  28. package/dist/application/runtime/RuntimeLaunchProgress.js +38 -0
  29. package/dist/application/runtime/RuntimeLaunchStateSnapshot.d.ts +48 -0
  30. package/dist/application/runtime/RuntimeLaunchStateSnapshot.js +73 -0
  31. package/dist/application/runtime/RuntimeObservabilityHub.d.ts +28 -0
  32. package/dist/application/runtime/RuntimeObservabilityHub.js +262 -0
  33. package/dist/application/runtime/RuntimeObservationEvents.d.ts +15 -0
  34. package/dist/application/runtime/RuntimeObservationEvents.js +18 -0
  35. package/dist/application/runtime/RuntimeOffloadManager.d.ts +24 -0
  36. package/dist/application/runtime/RuntimeOffloadManager.js +96 -0
  37. package/dist/application/runtime/RuntimePlanEngine.d.ts +11 -0
  38. package/dist/application/runtime/RuntimePlanEngine.js +67 -0
  39. package/dist/application/runtime/RuntimeProjectionCatalog.d.ts +5 -0
  40. package/dist/application/runtime/RuntimeProjectionCatalog.js +48 -0
  41. package/dist/application/runtime/RuntimeProjectionSession.d.ts +5 -0
  42. package/dist/application/runtime/RuntimeProjectionSession.js +4 -0
  43. package/dist/application/runtime/RuntimeProjectionSessionKeys.d.ts +5 -0
  44. package/dist/application/runtime/RuntimeProjectionSessionKeys.js +10 -0
  45. package/dist/application/runtime/RuntimeProjectionSessionReducers.d.ts +7 -0
  46. package/dist/application/runtime/RuntimeProjectionSessionReducers.js +101 -0
  47. package/dist/application/runtime/RuntimeProjectionSessionSerialization.d.ts +5 -0
  48. package/dist/application/runtime/RuntimeProjectionSessionSerialization.js +89 -0
  49. package/dist/application/runtime/RuntimeProjectionSessionSharedState.d.ts +3 -0
  50. package/dist/application/runtime/RuntimeProjectionSessionSharedState.js +53 -0
  51. package/dist/application/runtime/RuntimeProjectionSessionTypes.d.ts +38 -0
  52. package/dist/application/runtime/RuntimeProjectionSessionTypes.js +1 -0
  53. package/dist/application/runtime/RuntimeProjectionViewerSessionSync.d.ts +29 -0
  54. package/dist/application/runtime/RuntimeProjectionViewerSessionSync.js +39 -0
  55. package/dist/application/runtime/RuntimeProjectionViewerSessionUpdates.d.ts +27 -0
  56. package/dist/application/runtime/RuntimeProjectionViewerSessionUpdates.js +38 -0
  57. package/dist/application/runtime/RuntimeRegistryOwner.d.ts +20 -0
  58. package/dist/application/runtime/RuntimeRegistryOwner.js +71 -0
  59. package/dist/application/runtime/RuntimeRegistrySnapshots.d.ts +6 -0
  60. package/dist/application/runtime/RuntimeRegistrySnapshots.js +51 -0
  61. package/dist/application/runtime/RuntimeRegistryTypes.d.ts +29 -0
  62. package/dist/application/runtime/RuntimeRegistryTypes.js +1 -0
  63. package/dist/application/runtime/RuntimeSharedState.d.ts +6 -0
  64. package/dist/application/runtime/RuntimeSharedState.js +47 -0
  65. package/dist/application/runtime/WorkbenchRuntimeCore.d.ts +82 -0
  66. package/dist/application/runtime/WorkbenchRuntimeCore.js +463 -0
  67. package/dist/application/runtime/WorkbenchRuntimeSanitizers.d.ts +9 -0
  68. package/dist/application/runtime/WorkbenchRuntimeSanitizers.js +62 -0
  69. package/dist/application/shell/state.d.ts +22 -0
  70. package/dist/application/shell/state.js +308 -0
  71. package/dist/application/widgets/createWorkbenchWidgetAdapter.d.ts +9 -0
  72. package/dist/application/widgets/createWorkbenchWidgetAdapter.js +30 -0
  73. package/dist/application/workspace/canonicalizeLayout.d.ts +2 -0
  74. package/dist/application/workspace/canonicalizeLayout.js +91 -0
  75. package/dist/application/workspace/closePanel.d.ts +6 -0
  76. package/dist/application/workspace/closePanel.js +43 -0
  77. package/dist/application/workspace/collapseSplit.d.ts +7 -0
  78. package/dist/application/workspace/collapseSplit.js +45 -0
  79. package/dist/application/workspace/collapseSplitBoundary.d.ts +8 -0
  80. package/dist/application/workspace/collapseSplitBoundary.js +106 -0
  81. package/dist/application/workspace/commands.d.ts +71 -0
  82. package/dist/application/workspace/commands.js +216 -0
  83. package/dist/application/workspace/createPeripheralBands.d.ts +14 -0
  84. package/dist/application/workspace/createPeripheralBands.js +62 -0
  85. package/dist/application/workspace/createWorkspace.d.ts +7 -0
  86. package/dist/application/workspace/createWorkspace.js +12 -0
  87. package/dist/application/workspace/detachPanelToWindow.d.ts +12 -0
  88. package/dist/application/workspace/detachPanelToWindow.js +57 -0
  89. package/dist/application/workspace/dockPanel.d.ts +10 -0
  90. package/dist/application/workspace/dockPanel.js +399 -0
  91. package/dist/application/workspace/finalizeWorkspace.d.ts +4 -0
  92. package/dist/application/workspace/finalizeWorkspace.js +23 -0
  93. package/dist/application/workspace/focusPanel.d.ts +2 -0
  94. package/dist/application/workspace/focusPanel.js +19 -0
  95. package/dist/application/workspace/joinPanelArea.d.ts +13 -0
  96. package/dist/application/workspace/joinPanelArea.js +281 -0
  97. package/dist/application/workspace/layoutInteraction.d.ts +176 -0
  98. package/dist/application/workspace/layoutInteraction.js +852 -0
  99. package/dist/application/workspace/layoutTree.d.ts +34 -0
  100. package/dist/application/workspace/layoutTree.js +135 -0
  101. package/dist/application/workspace/openTool.d.ts +15 -0
  102. package/dist/application/workspace/openTool.js +89 -0
  103. package/dist/application/workspace/presetArtifacts.d.ts +60 -0
  104. package/dist/application/workspace/presetArtifacts.js +231 -0
  105. package/dist/application/workspace/presets.d.ts +5 -0
  106. package/dist/application/workspace/presets.js +12 -0
  107. package/dist/application/workspace/reattachWorkspaceWindow.d.ts +7 -0
  108. package/dist/application/workspace/reattachWorkspaceWindow.js +24 -0
  109. package/dist/application/workspace/resizeSplit.d.ts +7 -0
  110. package/dist/application/workspace/resizeSplit.js +12 -0
  111. package/dist/application/workspace/resizeSplitBoundary.d.ts +10 -0
  112. package/dist/application/workspace/resizeSplitBoundary.js +115 -0
  113. package/dist/application/workspace/runToolShellCommand.d.ts +11 -0
  114. package/dist/application/workspace/runToolShellCommand.js +133 -0
  115. package/dist/application/workspace/session.d.ts +9 -0
  116. package/dist/application/workspace/session.js +36 -0
  117. package/dist/application/workspace/setActiveStackChild.d.ts +7 -0
  118. package/dist/application/workspace/setActiveStackChild.js +12 -0
  119. package/dist/application/workspace/setDesignSystemThemeSession.d.ts +3 -0
  120. package/dist/application/workspace/setDesignSystemThemeSession.js +12 -0
  121. package/dist/application/workspace/setPanelFullscreenToggleVisibility.d.ts +7 -0
  122. package/dist/application/workspace/setPanelFullscreenToggleVisibility.js +7 -0
  123. package/dist/application/workspace/setStackHeaderVisibility.d.ts +7 -0
  124. package/dist/application/workspace/setStackHeaderVisibility.js +7 -0
  125. package/dist/application/workspace/setToolPanelTitleOverride.d.ts +9 -0
  126. package/dist/application/workspace/setToolPanelTitleOverride.js +33 -0
  127. package/dist/application/workspace/setToolShellStatus.d.ts +8 -0
  128. package/dist/application/workspace/setToolShellStatus.js +32 -0
  129. package/dist/application/workspace/setWorkspaceFullscreenPanel.d.ts +3 -0
  130. package/dist/application/workspace/setWorkspaceFullscreenPanel.js +26 -0
  131. package/dist/application/workspace/snapshots.d.ts +10 -0
  132. package/dist/application/workspace/snapshots.js +34 -0
  133. package/dist/application/workspace/splitPanel.d.ts +10 -0
  134. package/dist/application/workspace/splitPanel.js +21 -0
  135. package/dist/application/workspace/subdividePanel.d.ts +39 -0
  136. package/dist/application/workspace/subdividePanel.js +128 -0
  137. package/dist/application/workspace/swapPanelArea.d.ts +11 -0
  138. package/dist/application/workspace/swapPanelArea.js +163 -0
  139. package/dist/application/workspace/targetWindow.d.ts +4 -0
  140. package/dist/application/workspace/targetWindow.js +22 -0
  141. package/dist/application/workspace/toolCapabilities.d.ts +11 -0
  142. package/dist/application/workspace/toolCapabilities.js +59 -0
  143. package/dist/application/workspace/toolRuntime.d.ts +32 -0
  144. package/dist/application/workspace/toolRuntime.js +65 -0
  145. package/dist/application/workspace/updateToolState.d.ts +8 -0
  146. package/dist/application/workspace/updateToolState.js +20 -0
  147. package/dist/boot/applicationBoot.d.ts +1 -0
  148. package/dist/boot/applicationBoot.js +2 -0
  149. package/dist/boot/events.d.ts +43 -0
  150. package/dist/boot/events.js +16 -0
  151. package/dist/boot/executor.d.ts +13 -0
  152. package/dist/boot/executor.js +210 -0
  153. package/dist/boot/graph.d.ts +16 -0
  154. package/dist/boot/graph.js +126 -0
  155. package/dist/boot/index.d.ts +2 -0
  156. package/dist/boot/index.js +3 -0
  157. package/dist/boot/mechanism.d.ts +5 -0
  158. package/dist/boot/mechanism.js +6 -0
  159. package/dist/boot/projection.d.ts +72 -0
  160. package/dist/boot/projection.js +398 -0
  161. package/dist/boot/types.d.ts +80 -0
  162. package/dist/boot/types.js +46 -0
  163. package/dist/domain/composition/dockArrangement.d.ts +57 -0
  164. package/dist/domain/composition/dockArrangement.js +304 -0
  165. package/dist/domain/composition/docking.d.ts +68 -0
  166. package/dist/domain/composition/docking.js +187 -0
  167. package/dist/domain/design-system/themeSession.d.ts +12 -0
  168. package/dist/domain/design-system/themeSession.js +42 -0
  169. package/dist/domain/experiment/model.d.ts +149 -0
  170. package/dist/domain/experiment/model.js +1 -0
  171. package/dist/domain/i18n/languageRegistry.d.ts +57 -0
  172. package/dist/domain/i18n/languageRegistry.js +1 -0
  173. package/dist/domain/i18n/model.d.ts +31 -0
  174. package/dist/domain/i18n/model.js +1 -0
  175. package/dist/domain/icon/model.d.ts +8 -0
  176. package/dist/domain/icon/model.js +1 -0
  177. package/dist/domain/input/interactionBindings.d.ts +2 -0
  178. package/dist/domain/input/interactionBindings.js +2 -0
  179. package/dist/domain/launch/model.d.ts +58 -0
  180. package/dist/domain/launch/model.js +109 -0
  181. package/dist/domain/layout/interaction.d.ts +90 -0
  182. package/dist/domain/layout/interaction.js +1 -0
  183. package/dist/domain/layout/model.d.ts +28 -0
  184. package/dist/domain/layout/model.js +1 -0
  185. package/dist/domain/layout/selectors.d.ts +12 -0
  186. package/dist/domain/layout/selectors.js +84 -0
  187. package/dist/domain/layout/surfaceProjection.d.ts +56 -0
  188. package/dist/domain/layout/surfaceProjection.js +249 -0
  189. package/dist/domain/layout/validation.d.ts +9 -0
  190. package/dist/domain/layout/validation.js +71 -0
  191. package/dist/domain/panel/model.d.ts +9 -0
  192. package/dist/domain/panel/model.js +1 -0
  193. package/dist/domain/physics/colliderGeometry.d.ts +2 -0
  194. package/dist/domain/physics/colliderGeometry.js +1 -0
  195. package/dist/domain/physics/contracts.d.ts +2 -0
  196. package/dist/domain/physics/contracts.js +1 -0
  197. package/dist/domain/physics/kinematicBinding.d.ts +22 -0
  198. package/dist/domain/physics/kinematicBinding.js +1 -0
  199. package/dist/domain/physics/model.d.ts +4 -0
  200. package/dist/domain/physics/model.js +1 -0
  201. package/dist/domain/physics/mujoco.d.ts +5 -0
  202. package/dist/domain/physics/mujoco.js +1 -0
  203. package/dist/domain/physics/observationProfile.d.ts +2 -0
  204. package/dist/domain/physics/observationProfile.js +1 -0
  205. package/dist/domain/physics/presentationBinding.d.ts +6 -0
  206. package/dist/domain/physics/presentationBinding.js +1 -0
  207. package/dist/domain/physics/simulationProfile.d.ts +2 -0
  208. package/dist/domain/physics/simulationProfile.js +1 -0
  209. package/dist/domain/physics/visualAlignment.d.ts +17 -0
  210. package/dist/domain/physics/visualAlignment.js +1 -0
  211. package/dist/domain/presentation/readingLevel.d.ts +12 -0
  212. package/dist/domain/presentation/readingLevel.js +29 -0
  213. package/dist/domain/project/model.d.ts +55 -0
  214. package/dist/domain/project/model.js +1 -0
  215. package/dist/domain/repo-quality/model.d.ts +111 -0
  216. package/dist/domain/repo-quality/model.js +1 -0
  217. package/dist/domain/repository/model.d.ts +110 -0
  218. package/dist/domain/repository/model.js +1 -0
  219. package/dist/domain/runtime/checkpoint.d.ts +37 -0
  220. package/dist/domain/runtime/checkpoint.js +87 -0
  221. package/dist/domain/runtime/hydration.d.ts +26 -0
  222. package/dist/domain/runtime/hydration.js +92 -0
  223. package/dist/domain/runtime/initialization.d.ts +25 -0
  224. package/dist/domain/runtime/initialization.js +87 -0
  225. package/dist/domain/runtime/lifecycle.d.ts +51 -0
  226. package/dist/domain/runtime/lifecycle.js +118 -0
  227. package/dist/domain/runtime/model.d.ts +252 -0
  228. package/dist/domain/runtime/model.js +13 -0
  229. package/dist/domain/runtime/observability.d.ts +142 -0
  230. package/dist/domain/runtime/observability.js +1 -0
  231. package/dist/domain/runtime/offload.d.ts +56 -0
  232. package/dist/domain/runtime/offload.js +129 -0
  233. package/dist/domain/runtime/plan.d.ts +26 -0
  234. package/dist/domain/runtime/plan.js +1 -0
  235. package/dist/domain/runtime/qualityPolicy.d.ts +28 -0
  236. package/dist/domain/runtime/qualityPolicy.js +97 -0
  237. package/dist/domain/runtime/recovery.d.ts +61 -0
  238. package/dist/domain/runtime/recovery.js +129 -0
  239. package/dist/domain/runtime/suspension.d.ts +32 -0
  240. package/dist/domain/runtime/suspension.js +107 -0
  241. package/dist/domain/runtime/teardown.d.ts +33 -0
  242. package/dist/domain/runtime/teardown.js +109 -0
  243. package/dist/domain/shared/id.d.ts +1 -0
  244. package/dist/domain/shared/id.js +5 -0
  245. package/dist/domain/shared/json.d.ts +9 -0
  246. package/dist/domain/shared/json.js +24 -0
  247. package/dist/domain/shell/model.d.ts +40 -0
  248. package/dist/domain/shell/model.js +1 -0
  249. package/dist/domain/shell/runtime.d.ts +76 -0
  250. package/dist/domain/shell/runtime.js +40 -0
  251. package/dist/domain/surface/model.d.ts +97 -0
  252. package/dist/domain/surface/model.js +71 -0
  253. package/dist/domain/temporal/model.d.ts +95 -0
  254. package/dist/domain/temporal/model.js +45 -0
  255. package/dist/domain/tool/internalTab.d.ts +11 -0
  256. package/dist/domain/tool/internalTab.js +20 -0
  257. package/dist/domain/tool/model.d.ts +207 -0
  258. package/dist/domain/tool/model.js +1 -0
  259. package/dist/domain/tool/runtime.d.ts +122 -0
  260. package/dist/domain/tool/runtime.js +2 -0
  261. package/dist/domain/tool/shell.d.ts +38 -0
  262. package/dist/domain/tool/shell.js +175 -0
  263. package/dist/domain/widget/composition.d.ts +79 -0
  264. package/dist/domain/widget/composition.js +250 -0
  265. package/dist/domain/widget/model.d.ts +35 -0
  266. package/dist/domain/widget/model.js +8 -0
  267. package/dist/domain/widget/toolDock.d.ts +30 -0
  268. package/dist/domain/widget/toolDock.js +52 -0
  269. package/dist/domain/workbench/model.d.ts +35 -0
  270. package/dist/domain/workbench/model.js +1 -0
  271. package/dist/domain/workbench/routing.d.ts +17 -0
  272. package/dist/domain/workbench/routing.js +72 -0
  273. package/dist/domain/workspace/factories.d.ts +9 -0
  274. package/dist/domain/workspace/factories.js +47 -0
  275. package/dist/domain/workspace/model.d.ts +23 -0
  276. package/dist/domain/workspace/model.js +1 -0
  277. package/dist/domain/workspace/persistence.d.ts +5 -0
  278. package/dist/domain/workspace/persistence.js +1 -0
  279. package/dist/domain/workspace/selectors.d.ts +19 -0
  280. package/dist/domain/workspace/selectors.js +90 -0
  281. package/dist/domain/workspace/session.d.ts +9 -0
  282. package/dist/domain/workspace/session.js +1 -0
  283. package/dist/domain/workspace/validation.d.ts +10 -0
  284. package/dist/domain/workspace/validation.js +231 -0
  285. package/dist/hosting.d.ts +15 -0
  286. package/dist/hosting.js +12 -0
  287. package/dist/index.d.ts +111 -0
  288. package/dist/index.js +111 -0
  289. package/dist/infrastructure/audio/WorkbenchAudioManager.d.ts +36 -0
  290. package/dist/infrastructure/audio/WorkbenchAudioManager.js +100 -0
  291. package/dist/infrastructure/backend/HttpWorkbenchBackendClient.d.ts +30 -0
  292. package/dist/infrastructure/backend/HttpWorkbenchBackendClient.js +314 -0
  293. package/dist/infrastructure/persistence/LocalWorkspacePersistence.d.ts +8 -0
  294. package/dist/infrastructure/persistence/LocalWorkspacePersistence.js +29 -0
  295. package/dist/infrastructure/surfaces/InMemorySurfaceViewerRegistry.d.ts +58 -0
  296. package/dist/infrastructure/surfaces/InMemorySurfaceViewerRegistry.js +121 -0
  297. package/dist/infrastructure/temporal/InMemoryTemporalDialectRegistry.d.ts +8 -0
  298. package/dist/infrastructure/temporal/InMemoryTemporalDialectRegistry.js +38 -0
  299. package/dist/infrastructure/tools/InMemoryToolRegistry.d.ts +46 -0
  300. package/dist/infrastructure/tools/InMemoryToolRegistry.js +82 -0
  301. package/dist/infrastructure/widgets/InMemoryShellWidgetRegistry.d.ts +42 -0
  302. package/dist/infrastructure/widgets/InMemoryShellWidgetRegistry.js +66 -0
  303. package/dist/infrastructure/widgets/InMemoryWorkbenchWidgetRegistry.d.ts +20 -0
  304. package/dist/infrastructure/widgets/InMemoryWorkbenchWidgetRegistry.js +35 -0
  305. package/dist/infrastructure/workbenches/InMemoryWorkbenchRegistry.d.ts +7 -0
  306. package/dist/infrastructure/workbenches/InMemoryWorkbenchRegistry.js +28 -0
  307. package/dist/physics-runtime.d.ts +4 -0
  308. package/dist/physics-runtime.js +2 -0
  309. package/dist/stage/easing.d.ts +5 -0
  310. package/dist/stage/easing.js +15 -0
  311. package/dist/stage/index.d.ts +6 -0
  312. package/dist/stage/index.js +6 -0
  313. package/dist/stage/projection.d.ts +4 -0
  314. package/dist/stage/projection.js +74 -0
  315. package/dist/stage/stageRuntime.d.ts +2 -0
  316. package/dist/stage/stageRuntime.js +32 -0
  317. package/dist/stage/timeline.d.ts +3 -0
  318. package/dist/stage/timeline.js +69 -0
  319. package/dist/stage/tween.d.ts +3 -0
  320. package/dist/stage/tween.js +104 -0
  321. package/dist/stage/types.d.ts +104 -0
  322. package/dist/stage/types.js +30 -0
  323. package/dist/temporal/clock/audioClock.d.ts +1 -0
  324. package/dist/temporal/clock/audioClock.js +1 -0
  325. package/dist/temporal/clock/clockGraph.d.ts +1 -0
  326. package/dist/temporal/clock/clockGraph.js +1 -0
  327. package/dist/temporal/clock/clockTypes.d.ts +1 -0
  328. package/dist/temporal/clock/clockTypes.js +1 -0
  329. package/dist/temporal/clock/fixedStepClock.d.ts +1 -0
  330. package/dist/temporal/clock/fixedStepClock.js +1 -0
  331. package/dist/temporal/clock/musicalClock.d.ts +7 -0
  332. package/dist/temporal/clock/musicalClock.js +35 -0
  333. package/dist/temporal/clock/rootClock.d.ts +1 -0
  334. package/dist/temporal/clock/rootClock.js +1 -0
  335. package/dist/temporal/clock/videoClock.d.ts +1 -0
  336. package/dist/temporal/clock/videoClock.js +1 -0
  337. package/dist/temporal/easing/easingFunctions.d.ts +2 -0
  338. package/dist/temporal/easing/easingFunctions.js +19 -0
  339. package/dist/temporal/easing/easingRegistry.d.ts +10 -0
  340. package/dist/temporal/easing/easingRegistry.js +32 -0
  341. package/dist/temporal/easing/easingShaderSource.d.ts +2 -0
  342. package/dist/temporal/easing/easingShaderSource.js +16 -0
  343. package/dist/temporal/easing/easingTypes.d.ts +9 -0
  344. package/dist/temporal/easing/easingTypes.js +1 -0
  345. package/dist/temporal/history/runtimeHistory.d.ts +77 -0
  346. package/dist/temporal/history/runtimeHistory.js +5 -0
  347. package/dist/temporal/history/temporalHistoryCore.d.ts +1 -0
  348. package/dist/temporal/history/temporalHistoryCore.js +1 -0
  349. package/dist/temporal/index.d.ts +20 -0
  350. package/dist/temporal/index.js +20 -0
  351. package/dist/temporal/invalidation/invalidationController.d.ts +1 -0
  352. package/dist/temporal/invalidation/invalidationController.js +1 -0
  353. package/dist/temporal/scheduler/browserSchedulerHost.d.ts +3 -0
  354. package/dist/temporal/scheduler/browserSchedulerHost.js +19 -0
  355. package/dist/temporal/scheduler/frameBudget.d.ts +1 -0
  356. package/dist/temporal/scheduler/frameBudget.js +1 -0
  357. package/dist/temporal/scheduler/temporalScheduler.d.ts +4 -0
  358. package/dist/temporal/scheduler/temporalScheduler.js +6 -0
  359. package/dist/temporal/scheduler/temporalSchedulerCore.d.ts +1 -0
  360. package/dist/temporal/scheduler/temporalSchedulerCore.js +1 -0
  361. package/dist/temporal/scheduler/visibilityPolicy.d.ts +2 -0
  362. package/dist/temporal/scheduler/visibilityPolicy.js +1 -0
  363. package/dist/temporal/transport/temporalTransport.d.ts +1 -0
  364. package/dist/temporal/transport/temporalTransport.js +1 -0
  365. package/dist/temporal/transport/transportScope.d.ts +7 -0
  366. package/dist/temporal/transport/transportScope.js +3 -0
  367. package/dist/temporal/transport/transportTimeline.d.ts +22 -0
  368. package/dist/temporal/transport/transportTimeline.js +36 -0
  369. package/dist/temporal/transport/transportTypes.d.ts +1 -0
  370. package/dist/temporal/transport/transportTypes.js +1 -0
  371. package/dist/workspace-contracts.d.ts +36 -0
  372. package/dist/workspace-contracts.js +28 -0
  373. package/package.json +57 -0
@@ -0,0 +1,304 @@
1
+ export const DOCK_ARRANGEMENT_SCHEMA_VERSION = 1;
2
+ export function createDockArrangement(input) {
3
+ const children = (input.entities ?? [])
4
+ .map(createDockArrangementEntityNode)
5
+ .filter((node) => node !== null);
6
+ const activeChild = children.find((child) => child.entity.id === input.activeEntityId) ?? children[0] ?? null;
7
+ return {
8
+ schemaVersion: DOCK_ARRANGEMENT_SCHEMA_VERSION,
9
+ root: {
10
+ nodeType: 'group',
11
+ nodeId: normalizeId(input.id) || 'dock-root',
12
+ presentation: input.presentation ?? 'tabs',
13
+ axis: normalizeGroupAxis(input.presentation ?? 'tabs', input.axis),
14
+ children,
15
+ activeChildId: activeChild?.nodeId ?? null
16
+ }
17
+ };
18
+ }
19
+ export function createDockArrangementEntityNode(entity) {
20
+ const normalizedEntity = normalizeDockableEntity(entity);
21
+ if (!normalizedEntity) {
22
+ return null;
23
+ }
24
+ return {
25
+ nodeType: 'entity',
26
+ nodeId: `entity:${getDockableEntityKey(normalizedEntity)}`,
27
+ entity: normalizedEntity
28
+ };
29
+ }
30
+ export function createDockArrangementGroup(input) {
31
+ const children = input.children ?? [];
32
+ return {
33
+ nodeType: 'group',
34
+ nodeId: normalizeId(input.id) || 'dock-group',
35
+ presentation: input.presentation,
36
+ axis: normalizeGroupAxis(input.presentation, input.axis),
37
+ children,
38
+ activeChildId: normalizeActiveChildId(input.activeChildId, children),
39
+ ...(input.presentation === 'split' && input.sizes
40
+ ? { sizes: normalizeSizes(input.sizes, children.length) }
41
+ : {})
42
+ };
43
+ }
44
+ export function getDockableEntityKey(entity) {
45
+ return `${entity.kind}:${normalizeId(entity.id)}`;
46
+ }
47
+ export function listDockArrangementEntities(arrangement) {
48
+ const entities = [];
49
+ visitDockArrangement(arrangement.root, (node) => {
50
+ if (node.nodeType === 'entity') {
51
+ entities.push(node.entity);
52
+ }
53
+ });
54
+ return entities;
55
+ }
56
+ export function findDockArrangementGroup(arrangement, groupId) {
57
+ const normalizedGroupId = normalizeId(groupId);
58
+ let match = null;
59
+ visitDockArrangement(arrangement.root, (node) => {
60
+ if (!match && node.nodeType === 'group' && node.nodeId === normalizedGroupId) {
61
+ match = node;
62
+ }
63
+ });
64
+ return match;
65
+ }
66
+ export function upsertDockArrangementEntity(arrangement, entity, placement = {}) {
67
+ const entityNode = createDockArrangementEntityNode(entity);
68
+ if (!entityNode) {
69
+ return arrangement;
70
+ }
71
+ const entityKey = getDockableEntityKey(entityNode.entity);
72
+ const withoutEntity = removeEntityNode(arrangement.root, entityKey);
73
+ const targetGroupId = normalizeId(placement.targetGroupId ?? '') || withoutEntity.nodeId;
74
+ const nextRoot = insertEntityNode(withoutEntity, targetGroupId, entityNode, placement);
75
+ if (nextRoot === withoutEntity) {
76
+ return arrangement;
77
+ }
78
+ return {
79
+ ...arrangement,
80
+ root: nextRoot
81
+ };
82
+ }
83
+ export function removeDockArrangementEntity(arrangement, entity) {
84
+ const entityKey = getDockableEntityKey(entity);
85
+ const root = removeEntityNode(arrangement.root, entityKey);
86
+ return root === arrangement.root ? arrangement : { ...arrangement, root };
87
+ }
88
+ export function setDockArrangementActiveEntity(arrangement, entity) {
89
+ const entityKey = getDockableEntityKey(entity);
90
+ const root = activateEntityNode(arrangement.root, entityKey).node;
91
+ return root === arrangement.root ? arrangement : { ...arrangement, root };
92
+ }
93
+ export function createDockArrangementFromContainerRuntimeState(state, entityKind, presentation = 'tabs') {
94
+ return createDockArrangement({
95
+ id: state.id,
96
+ presentation,
97
+ axis: presentation === 'tabs' ? 'tabs' : 'vertical',
98
+ entities: state.entityIds.map((id) => ({ id, kind: entityKind })),
99
+ activeEntityId: state.activeEntityId
100
+ });
101
+ }
102
+ export function projectDockArrangementToContainerRuntimeState(arrangement, fallback) {
103
+ const entities = listDockArrangementEntities(arrangement);
104
+ const activeEntity = resolveActiveDockArrangementEntity(arrangement.root);
105
+ return {
106
+ id: fallback.id,
107
+ kind: fallback.kind,
108
+ isVisible: fallback.isVisible,
109
+ activeEntityId: activeEntity?.id ?? entities[0]?.id ?? null,
110
+ entityIds: entities.map((entity) => entity.id)
111
+ };
112
+ }
113
+ export function validateDockArrangement(arrangement) {
114
+ const issues = [];
115
+ const nodeIds = new Set();
116
+ const entityKeys = new Set();
117
+ visitDockArrangement(arrangement.root, (node) => {
118
+ if (!normalizeId(node.nodeId)) {
119
+ issues.push({ code: 'empty-node-id', nodeId: node.nodeId });
120
+ }
121
+ else if (nodeIds.has(node.nodeId)) {
122
+ issues.push({ code: 'duplicate-node-id', nodeId: node.nodeId });
123
+ }
124
+ else {
125
+ nodeIds.add(node.nodeId);
126
+ }
127
+ if (node.nodeType === 'entity') {
128
+ const entityKey = getDockableEntityKey(node.entity);
129
+ if (!normalizeId(node.entity.id)) {
130
+ issues.push({ code: 'empty-entity-id', nodeId: node.nodeId, entityKey });
131
+ }
132
+ else if (entityKeys.has(entityKey)) {
133
+ issues.push({ code: 'duplicate-entity', nodeId: node.nodeId, entityKey });
134
+ }
135
+ else {
136
+ entityKeys.add(entityKey);
137
+ }
138
+ return;
139
+ }
140
+ if (node.activeChildId !== null && !node.children.some((child) => child.nodeId === node.activeChildId)) {
141
+ issues.push({ code: 'invalid-active-child', nodeId: node.nodeId });
142
+ }
143
+ if (!isAxisCompatible(node.presentation, node.axis)) {
144
+ issues.push({ code: 'invalid-axis', nodeId: node.nodeId });
145
+ }
146
+ if (node.sizes && node.sizes.length !== node.children.length) {
147
+ issues.push({ code: 'invalid-size-count', nodeId: node.nodeId });
148
+ }
149
+ });
150
+ return issues;
151
+ }
152
+ function removeEntityNode(group, entityKey) {
153
+ let changed = false;
154
+ const children = group.children.flatMap((child) => {
155
+ if (child.nodeType === 'entity') {
156
+ if (getDockableEntityKey(child.entity) === entityKey) {
157
+ changed = true;
158
+ return [];
159
+ }
160
+ return [child];
161
+ }
162
+ const nextChild = removeEntityNode(child, entityKey);
163
+ changed ||= nextChild !== child;
164
+ return [nextChild];
165
+ });
166
+ if (!changed) {
167
+ return group;
168
+ }
169
+ return {
170
+ ...group,
171
+ children,
172
+ activeChildId: normalizeActiveChildId(group.activeChildId, children),
173
+ ...(group.sizes ? { sizes: normalizeSizes(group.sizes, children.length) } : {})
174
+ };
175
+ }
176
+ function insertEntityNode(group, targetGroupId, entityNode, placement) {
177
+ if (group.nodeId === targetGroupId) {
178
+ const children = insertNode(group.children, entityNode, placement);
179
+ return {
180
+ ...group,
181
+ children,
182
+ activeChildId: placement.activate === false
183
+ ? normalizeActiveChildId(group.activeChildId, children)
184
+ : entityNode.nodeId,
185
+ ...(group.sizes ? { sizes: normalizeSizes(group.sizes, children.length) } : {})
186
+ };
187
+ }
188
+ let changed = false;
189
+ const children = group.children.map((child) => {
190
+ if (child.nodeType === 'entity') {
191
+ return child;
192
+ }
193
+ const nextChild = insertEntityNode(child, targetGroupId, entityNode, placement);
194
+ changed ||= nextChild !== child;
195
+ return nextChild;
196
+ });
197
+ return changed ? { ...group, children } : group;
198
+ }
199
+ function insertNode(children, node, placement) {
200
+ const beforeId = normalizeId(placement.beforeEntityId ?? '');
201
+ const afterId = normalizeId(placement.afterEntityId ?? '');
202
+ const beforeIndex = beforeId ? children.findIndex((child) => matchesEntityId(child, beforeId)) : -1;
203
+ const afterIndex = afterId ? children.findIndex((child) => matchesEntityId(child, afterId)) : -1;
204
+ if (beforeIndex >= 0) {
205
+ return [...children.slice(0, beforeIndex), node, ...children.slice(beforeIndex)];
206
+ }
207
+ if (afterIndex >= 0) {
208
+ return [...children.slice(0, afterIndex + 1), node, ...children.slice(afterIndex + 1)];
209
+ }
210
+ return [...children, node];
211
+ }
212
+ function activateEntityNode(group, entityKey) {
213
+ for (const child of group.children) {
214
+ if (child.nodeType === 'entity') {
215
+ if (getDockableEntityKey(child.entity) === entityKey) {
216
+ if (group.activeChildId === child.nodeId) {
217
+ return { node: group, found: true };
218
+ }
219
+ return { node: { ...group, activeChildId: child.nodeId }, found: true };
220
+ }
221
+ continue;
222
+ }
223
+ const result = activateEntityNode(child, entityKey);
224
+ if (result.found) {
225
+ const children = group.children.map((candidate) => candidate === child ? result.node : candidate);
226
+ return {
227
+ node: {
228
+ ...group,
229
+ children,
230
+ activeChildId: child.nodeId
231
+ },
232
+ found: true
233
+ };
234
+ }
235
+ }
236
+ return { node: group, found: false };
237
+ }
238
+ function resolveActiveDockArrangementEntity(node) {
239
+ if (node.nodeType === 'entity') {
240
+ return node.entity;
241
+ }
242
+ const activeChild = node.children.find((child) => child.nodeId === node.activeChildId) ?? node.children[0];
243
+ return activeChild ? resolveActiveDockArrangementEntity(activeChild) : null;
244
+ }
245
+ function normalizeDockableEntity(entity) {
246
+ const id = normalizeId(entity.id);
247
+ if (!id) {
248
+ return null;
249
+ }
250
+ return {
251
+ ...entity,
252
+ id,
253
+ capabilityId: normalizeOptionalId(entity.capabilityId),
254
+ sourceContainerId: normalizeOptionalId(entity.sourceContainerId),
255
+ contextToolIds: normalizeIds(entity.contextToolIds ?? [])
256
+ };
257
+ }
258
+ function normalizeActiveChildId(activeChildId, children) {
259
+ const normalizedId = normalizeId(activeChildId ?? '');
260
+ return children.some((child) => child.nodeId === normalizedId) ? normalizedId : children[0]?.nodeId ?? null;
261
+ }
262
+ function normalizeSizes(sizes, childCount) {
263
+ if (childCount === 0) {
264
+ return [];
265
+ }
266
+ const positiveSizes = Array.from({ length: childCount }, (_, index) => {
267
+ const value = sizes[index];
268
+ return Number.isFinite(value) && value > 0 ? value : 1;
269
+ });
270
+ const total = positiveSizes.reduce((sum, value) => sum + value, 0);
271
+ return positiveSizes.map((value) => value / total);
272
+ }
273
+ function normalizeGroupAxis(presentation, axis) {
274
+ if (presentation === 'tabs') {
275
+ return 'tabs';
276
+ }
277
+ if (axis === 'horizontal' || axis === 'vertical') {
278
+ return axis;
279
+ }
280
+ return 'vertical';
281
+ }
282
+ function isAxisCompatible(presentation, axis) {
283
+ return presentation === 'tabs'
284
+ ? axis === 'tabs'
285
+ : axis === 'horizontal' || axis === 'vertical';
286
+ }
287
+ function matchesEntityId(node, entityId) {
288
+ return node.nodeType === 'entity' && node.entity.id === entityId;
289
+ }
290
+ function normalizeIds(values) {
291
+ return [...new Set(values.map(normalizeId).filter(Boolean))];
292
+ }
293
+ function normalizeOptionalId(value) {
294
+ return normalizeId(value ?? '') || null;
295
+ }
296
+ function normalizeId(value) {
297
+ return value.trim();
298
+ }
299
+ function visitDockArrangement(node, visitor) {
300
+ visitor(node);
301
+ if (node.nodeType === 'group') {
302
+ node.children.forEach((child) => visitDockArrangement(child, visitor));
303
+ }
304
+ }
@@ -0,0 +1,68 @@
1
+ export type DockableEntityKind = 'panel' | 'tool-instance' | 'shell-widget' | 'tool-widget' | 'widget-placement';
2
+ export type DockContainerKind = 'workspace-panel-stack' | 'workspace-split' | 'shell-region' | 'tool-side' | 'widget-zone';
3
+ export type DockAxis = 'horizontal' | 'vertical' | 'grid' | 'tabs';
4
+ export type DockMode = 'append' | 'reorder' | 'tab' | 'split' | 'stack' | 'replace';
5
+ export type DockPlanRejectionReason = 'invalid-entity' | 'invalid-container' | 'unsupported-kind' | 'unsupported-mode' | 'missing-context' | 'already-connected';
6
+ export interface DockableEntity {
7
+ id: string;
8
+ kind: DockableEntityKind;
9
+ capabilityId?: string | null;
10
+ sourceContainerId?: string | null;
11
+ contextToolIds?: string[];
12
+ }
13
+ export interface DockContainer {
14
+ id: string;
15
+ kind: DockContainerKind;
16
+ acceptedEntityKinds: DockableEntityKind[];
17
+ axis: DockAxis;
18
+ supportedModes: DockMode[];
19
+ contextToolIds?: string[];
20
+ }
21
+ export interface DockContainerRuntimeState {
22
+ id: string;
23
+ kind?: DockContainerKind;
24
+ isVisible: boolean;
25
+ activeEntityId: string | null;
26
+ entityIds: string[];
27
+ }
28
+ export type DockContainerRuntimeStateById = Record<string, DockContainerRuntimeState | undefined>;
29
+ export interface DockContext {
30
+ availableToolIds?: Iterable<string>;
31
+ connectedCapabilityIds?: Iterable<string>;
32
+ connectedEntityIds?: Iterable<string>;
33
+ }
34
+ export interface DockPlacement {
35
+ beforeEntityId?: string | null;
36
+ afterEntityId?: string | null;
37
+ }
38
+ export interface DockPlan {
39
+ accepted: boolean;
40
+ entityId: string;
41
+ containerId: string;
42
+ mode: DockMode;
43
+ placement: DockPlacement;
44
+ reason?: DockPlanRejectionReason;
45
+ }
46
+ export interface CreateDockPlanInput {
47
+ entity: DockableEntity;
48
+ container: DockContainer;
49
+ mode: DockMode;
50
+ placement?: DockPlacement | null;
51
+ context?: DockContext;
52
+ allowConnectedCapability?: boolean;
53
+ allowConnectedEntity?: boolean;
54
+ }
55
+ export declare function createDockContainerRuntimeState(input: {
56
+ id: string;
57
+ kind?: DockContainerKind;
58
+ isVisible?: boolean;
59
+ entityIds?: string[];
60
+ activeEntityId?: string | null;
61
+ }): DockContainerRuntimeState;
62
+ export declare function normalizeDockContainerRuntimeState(value: unknown, fallback: DockContainerRuntimeState): DockContainerRuntimeState;
63
+ export declare function setDockContainerVisible(stateById: DockContainerRuntimeStateById, containerId: string, isVisible: boolean): DockContainerRuntimeStateById;
64
+ export declare function dockEntityInContainerRuntimeState(state: DockContainerRuntimeState, entityId: string, placement?: DockPlacement | null | undefined): DockContainerRuntimeState;
65
+ export declare function normalizeDockPlacement(placement: DockPlacement | null | undefined): DockPlacement;
66
+ export declare function hasDockPlacement(placement: DockPlacement | null | undefined): boolean;
67
+ export declare function insertDockableEntityId(entityIds: string[], entityId: string, placement?: DockPlacement | null | undefined): string[];
68
+ export declare function createDockPlan(input: CreateDockPlanInput): DockPlan;
@@ -0,0 +1,187 @@
1
+ export function createDockContainerRuntimeState(input) {
2
+ const entityIds = normalizeEntityIds(input.entityIds ?? []);
3
+ const activeEntityId = normalizeActiveEntityId(input.activeEntityId, entityIds);
4
+ return {
5
+ id: input.id.trim(),
6
+ kind: input.kind,
7
+ isVisible: input.isVisible ?? entityIds.length > 0,
8
+ activeEntityId,
9
+ entityIds
10
+ };
11
+ }
12
+ export function normalizeDockContainerRuntimeState(value, fallback) {
13
+ if (!isRecord(value)) {
14
+ return fallback;
15
+ }
16
+ const entityIds = Array.isArray(value.entityIds)
17
+ ? normalizeEntityIds(value.entityIds.filter((entityId) => typeof entityId === 'string'))
18
+ : fallback.entityIds;
19
+ const activeEntityId = normalizeActiveEntityId(typeof value.activeEntityId === 'string' ? value.activeEntityId : fallback.activeEntityId, entityIds);
20
+ return {
21
+ id: typeof value.id === 'string' && value.id.trim() ? value.id.trim() : fallback.id,
22
+ kind: isDockContainerKind(value.kind) ? value.kind : fallback.kind,
23
+ isVisible: typeof value.isVisible === 'boolean' ? value.isVisible : fallback.isVisible,
24
+ activeEntityId,
25
+ entityIds
26
+ };
27
+ }
28
+ export function setDockContainerVisible(stateById, containerId, isVisible) {
29
+ const normalizedContainerId = containerId.trim();
30
+ const state = stateById[normalizedContainerId];
31
+ if (!state || state.isVisible === isVisible) {
32
+ return stateById;
33
+ }
34
+ return {
35
+ ...stateById,
36
+ [normalizedContainerId]: {
37
+ ...state,
38
+ isVisible
39
+ }
40
+ };
41
+ }
42
+ export function dockEntityInContainerRuntimeState(state, entityId, placement = {}) {
43
+ const entityIds = insertDockableEntityId(state.entityIds, entityId, placement);
44
+ return {
45
+ ...state,
46
+ isVisible: true,
47
+ activeEntityId: entityId.trim() || state.activeEntityId,
48
+ entityIds
49
+ };
50
+ }
51
+ export function normalizeDockPlacement(placement) {
52
+ return {
53
+ beforeEntityId: normalizeOptionalId(placement?.beforeEntityId),
54
+ afterEntityId: normalizeOptionalId(placement?.afterEntityId)
55
+ };
56
+ }
57
+ export function hasDockPlacement(placement) {
58
+ const normalizedPlacement = normalizeDockPlacement(placement);
59
+ return Boolean(normalizedPlacement.beforeEntityId || normalizedPlacement.afterEntityId);
60
+ }
61
+ export function insertDockableEntityId(entityIds, entityId, placement = {}) {
62
+ const normalizedEntityId = entityId.trim();
63
+ if (!normalizedEntityId) {
64
+ return entityIds;
65
+ }
66
+ const baseEntityIds = entityIds.filter((currentEntityId) => currentEntityId !== normalizedEntityId);
67
+ const normalizedPlacement = normalizeDockPlacement(placement);
68
+ if (normalizedPlacement.beforeEntityId) {
69
+ const beforeIndex = baseEntityIds.indexOf(normalizedPlacement.beforeEntityId);
70
+ if (beforeIndex >= 0) {
71
+ return [
72
+ ...baseEntityIds.slice(0, beforeIndex),
73
+ normalizedEntityId,
74
+ ...baseEntityIds.slice(beforeIndex)
75
+ ];
76
+ }
77
+ }
78
+ if (normalizedPlacement.afterEntityId) {
79
+ const afterIndex = baseEntityIds.indexOf(normalizedPlacement.afterEntityId);
80
+ if (afterIndex >= 0) {
81
+ return [
82
+ ...baseEntityIds.slice(0, afterIndex + 1),
83
+ normalizedEntityId,
84
+ ...baseEntityIds.slice(afterIndex + 1)
85
+ ];
86
+ }
87
+ }
88
+ return [...baseEntityIds, normalizedEntityId];
89
+ }
90
+ export function createDockPlan(input) {
91
+ const entityId = input.entity.id.trim();
92
+ const containerId = input.container.id.trim();
93
+ const placement = normalizeDockPlacement(input.placement);
94
+ if (!entityId) {
95
+ return rejectDockPlan(entityId, containerId, input.mode, placement, 'invalid-entity');
96
+ }
97
+ if (!containerId) {
98
+ return rejectDockPlan(entityId, containerId, input.mode, placement, 'invalid-container');
99
+ }
100
+ if (!input.container.acceptedEntityKinds.includes(input.entity.kind)) {
101
+ return rejectDockPlan(entityId, containerId, input.mode, placement, 'unsupported-kind');
102
+ }
103
+ if (!input.container.supportedModes.includes(input.mode)) {
104
+ return rejectDockPlan(entityId, containerId, input.mode, placement, 'unsupported-mode');
105
+ }
106
+ if (!hasRequiredContext(input.entity.contextToolIds, input.context?.availableToolIds)) {
107
+ return rejectDockPlan(entityId, containerId, input.mode, placement, 'missing-context');
108
+ }
109
+ if (!hasRequiredContext(input.container.contextToolIds, input.context?.availableToolIds)) {
110
+ return rejectDockPlan(entityId, containerId, input.mode, placement, 'missing-context');
111
+ }
112
+ const connectedEntityIds = toSet(input.context?.connectedEntityIds);
113
+ const connectedCapabilityIds = toSet(input.context?.connectedCapabilityIds);
114
+ const capabilityId = input.entity.capabilityId?.trim() || null;
115
+ if (!input.allowConnectedEntity && connectedEntityIds.has(entityId)) {
116
+ return rejectDockPlan(entityId, containerId, input.mode, placement, 'already-connected');
117
+ }
118
+ if (!input.allowConnectedCapability && capabilityId && connectedCapabilityIds.has(capabilityId)) {
119
+ return rejectDockPlan(entityId, containerId, input.mode, placement, 'already-connected');
120
+ }
121
+ return {
122
+ accepted: true,
123
+ entityId,
124
+ containerId,
125
+ mode: input.mode,
126
+ placement
127
+ };
128
+ }
129
+ function rejectDockPlan(entityId, containerId, mode, placement, reason) {
130
+ return {
131
+ accepted: false,
132
+ entityId,
133
+ containerId,
134
+ mode,
135
+ placement,
136
+ reason
137
+ };
138
+ }
139
+ function normalizeOptionalId(value) {
140
+ const normalizedValue = value?.trim();
141
+ return normalizedValue ? normalizedValue : null;
142
+ }
143
+ function hasRequiredContext(requiredToolIds, availableToolIds) {
144
+ const requiredIds = requiredToolIds?.map((toolId) => toolId.trim()).filter(Boolean) ?? [];
145
+ if (requiredIds.length === 0) {
146
+ return true;
147
+ }
148
+ const availableIds = toSet(availableToolIds);
149
+ return requiredIds.some((toolId) => availableIds.has(toolId));
150
+ }
151
+ function toSet(values) {
152
+ const normalizedValues = new Set();
153
+ for (const value of values ?? []) {
154
+ const normalizedValue = value.trim();
155
+ if (normalizedValue) {
156
+ normalizedValues.add(normalizedValue);
157
+ }
158
+ }
159
+ return normalizedValues;
160
+ }
161
+ function normalizeEntityIds(entityIds) {
162
+ const normalizedEntityIds = [];
163
+ for (const entityId of entityIds) {
164
+ const normalizedEntityId = entityId.trim();
165
+ if (normalizedEntityId && !normalizedEntityIds.includes(normalizedEntityId)) {
166
+ normalizedEntityIds.push(normalizedEntityId);
167
+ }
168
+ }
169
+ return normalizedEntityIds;
170
+ }
171
+ function normalizeActiveEntityId(activeEntityId, entityIds) {
172
+ const normalizedActiveEntityId = activeEntityId?.trim();
173
+ if (normalizedActiveEntityId && entityIds.includes(normalizedActiveEntityId)) {
174
+ return normalizedActiveEntityId;
175
+ }
176
+ return entityIds[0] ?? null;
177
+ }
178
+ function isDockContainerKind(value) {
179
+ return (value === 'workspace-panel-stack' ||
180
+ value === 'workspace-split' ||
181
+ value === 'shell-region' ||
182
+ value === 'tool-side' ||
183
+ value === 'widget-zone');
184
+ }
185
+ function isRecord(value) {
186
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
187
+ }
@@ -0,0 +1,12 @@
1
+ export declare const DESIGN_SYSTEM_THEME_SESSION_VERSION = 1;
2
+ export type DesignSystemThemeMode = 'dark' | 'light';
3
+ export interface DesignSystemThemeSession {
4
+ version: typeof DESIGN_SYSTEM_THEME_SESSION_VERSION;
5
+ mode: DesignSystemThemeMode;
6
+ draftValues: Record<string, string>;
7
+ draftPast: Array<Record<string, string>>;
8
+ draftFuture: Array<Record<string, string>>;
9
+ }
10
+ export declare function createDesignSystemThemeSession(input?: Partial<DesignSystemThemeSession>): DesignSystemThemeSession;
11
+ export declare function normalizeDesignSystemThemeSession(input: unknown): DesignSystemThemeSession | null;
12
+ export declare function normalizeDesignSystemThemeMode(input: unknown): DesignSystemThemeMode;
@@ -0,0 +1,42 @@
1
+ export const DESIGN_SYSTEM_THEME_SESSION_VERSION = 1;
2
+ export function createDesignSystemThemeSession(input = {}) {
3
+ return {
4
+ version: DESIGN_SYSTEM_THEME_SESSION_VERSION,
5
+ mode: normalizeDesignSystemThemeMode(input.mode),
6
+ draftValues: cloneDraftValues(input.draftValues),
7
+ draftPast: cloneDraftHistory(input.draftPast),
8
+ draftFuture: cloneDraftHistory(input.draftFuture)
9
+ };
10
+ }
11
+ export function normalizeDesignSystemThemeSession(input) {
12
+ if (!isRecord(input)) {
13
+ return null;
14
+ }
15
+ return createDesignSystemThemeSession({
16
+ mode: normalizeDesignSystemThemeMode(input.mode),
17
+ draftValues: normalizeDraftValues(input.draftValues),
18
+ draftPast: normalizeDraftHistory(input.draftPast),
19
+ draftFuture: normalizeDraftHistory(input.draftFuture)
20
+ });
21
+ }
22
+ export function normalizeDesignSystemThemeMode(input) {
23
+ return input === 'light' ? 'light' : 'dark';
24
+ }
25
+ function normalizeDraftHistory(input) {
26
+ return Array.isArray(input) ? input.map(normalizeDraftValues) : [];
27
+ }
28
+ function cloneDraftHistory(input) {
29
+ return input?.map(cloneDraftValues) ?? [];
30
+ }
31
+ function normalizeDraftValues(input) {
32
+ if (!isRecord(input)) {
33
+ return {};
34
+ }
35
+ return Object.fromEntries(Object.entries(input).filter((entry) => typeof entry[1] === 'string'));
36
+ }
37
+ function cloneDraftValues(input) {
38
+ return input ? { ...input } : {};
39
+ }
40
+ function isRecord(input) {
41
+ return Boolean(input) && typeof input === 'object' && !Array.isArray(input);
42
+ }