4runr-os 2.1.2 → 2.1.5
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/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/tui_mk1/kernel.d.ts.map +1 -1
- package/dist/tui_mk1/kernel.js +107 -4
- package/dist/tui_mk1/kernel.js.map +1 -1
- package/dist/tui_mk1/layout/layoutEngine.d.ts +38 -19
- package/dist/tui_mk1/layout/layoutEngine.d.ts.map +1 -1
- package/dist/tui_mk1/layout/layoutEngine.js +521 -228
- package/dist/tui_mk1/layout/layoutEngine.js.map +1 -1
- package/dist/tui_mk1/log.d.ts +23 -0
- package/dist/tui_mk1/log.d.ts.map +1 -0
- package/dist/tui_mk1/log.js +125 -0
- package/dist/tui_mk1/log.js.map +1 -0
- package/dist/tui_mk1/logger.d.ts.map +1 -1
- package/dist/tui_mk1/logger.js +20 -10
- package/dist/tui_mk1/logger.js.map +1 -1
- package/dist/tui_mk1/mk1App.d.ts +13 -18
- package/dist/tui_mk1/mk1App.d.ts.map +1 -1
- package/dist/tui_mk1/mk1App.js +334 -157
- package/dist/tui_mk1/mk1App.js.map +1 -1
- package/dist/tui_mk1/resizeController.d.ts.map +1 -1
- package/dist/tui_mk1/resizeController.js +15 -1
- package/dist/tui_mk1/resizeController.js.map +1 -1
- package/dist/tui_mk1/stdoutGuard.d.ts.map +1 -1
- package/dist/tui_mk1/stdoutGuard.js +7 -0
- package/dist/tui_mk1/stdoutGuard.js.map +1 -1
- package/dist/tui_mk1/terminalRestore.d.ts.map +1 -1
- package/dist/tui_mk1/terminalRestore.js +19 -1
- package/dist/tui_mk1/terminalRestore.js.map +1 -1
- package/dist/tui_mk1/ui/offenderScanner.d.ts +31 -0
- package/dist/tui_mk1/ui/offenderScanner.d.ts.map +1 -0
- package/dist/tui_mk1/ui/offenderScanner.js +80 -0
- package/dist/tui_mk1/ui/offenderScanner.js.map +1 -0
- package/dist/tui_mk1/ui/safe.d.ts +9 -0
- package/dist/tui_mk1/ui/safe.d.ts.map +1 -0
- package/dist/tui_mk1/ui/safe.js +29 -0
- package/dist/tui_mk1/ui/safe.js.map +1 -0
- package/dist/tui_mk1/ui/safeText.d.ts +22 -0
- package/dist/tui_mk1/ui/safeText.d.ts.map +1 -0
- package/dist/tui_mk1/ui/safeText.js +50 -0
- package/dist/tui_mk1/ui/safeText.js.map +1 -0
- package/dist/tui_mk1/ui/uiBuilder.d.ts +44 -0
- package/dist/tui_mk1/ui/uiBuilder.d.ts.map +1 -0
- package/dist/tui_mk1/ui/uiBuilder.js +467 -0
- package/dist/tui_mk1/ui/uiBuilder.js.map +1 -0
- package/dist/tui_mk1/viewport/safeViewport.d.ts +10 -1
- package/dist/tui_mk1/viewport/safeViewport.d.ts.map +1 -1
- package/dist/tui_mk1/viewport/safeViewport.js +47 -15
- package/dist/tui_mk1/viewport/safeViewport.js.map +1 -1
- package/dist/tui_mk2/kernel.d.ts +28 -0
- package/dist/tui_mk2/kernel.d.ts.map +1 -0
- package/dist/tui_mk2/kernel.js +86 -0
- package/dist/tui_mk2/kernel.js.map +1 -0
- package/dist/tui_mk2/mk2App.d.ts +33 -0
- package/dist/tui_mk2/mk2App.d.ts.map +1 -0
- package/dist/tui_mk2/mk2App.js +93 -0
- package/dist/tui_mk2/mk2App.js.map +1 -0
- package/package.json +8 -7
- package/dist/tui_mk1/ui/panels/createSection.d.ts +0 -18
- package/dist/tui_mk1/ui/panels/createSection.d.ts.map +0 -1
- package/dist/tui_mk1/ui/panels/createSection.js +0 -42
- package/dist/tui_mk1/ui/panels/createSection.js.map +0 -1
- package/dist/tui_mk1/ui/panels.d.ts +0 -23
- package/dist/tui_mk1/ui/panels.d.ts.map +0 -1
- package/dist/tui_mk1/ui/panels.js +0 -108
- package/dist/tui_mk1/ui/panels.js.map +0 -1
- package/dist/tui_mk1/ui/render/sectionRenderer.d.ts +0 -21
- package/dist/tui_mk1/ui/render/sectionRenderer.d.ts.map +0 -1
- package/dist/tui_mk1/ui/render/sectionRenderer.js +0 -32
- package/dist/tui_mk1/ui/render/sectionRenderer.js.map +0 -1
- package/dist/tui_mk1/ui/widgetManager.d.ts +0 -58
- package/dist/tui_mk1/ui/widgetManager.d.ts.map +0 -1
- package/dist/tui_mk1/ui/widgetManager.js +0 -197
- package/dist/tui_mk1/ui/widgetManager.js.map +0 -1
- package/dist/ui/boot/sequence.d.ts +0 -10
- package/dist/ui/boot/sequence.d.ts.map +0 -1
- package/dist/ui/boot/sequence.js +0 -171
- package/dist/ui/boot/sequence.js.map +0 -1
- package/dist/ui/constraints/layoutSpec.d.ts +0 -47
- package/dist/ui/constraints/layoutSpec.d.ts.map +0 -1
- package/dist/ui/constraints/layoutSpec.js +0 -60
- package/dist/ui/constraints/layoutSpec.js.map +0 -1
- package/dist/ui/constraints/unknownHandling.d.ts +0 -29
- package/dist/ui/constraints/unknownHandling.d.ts.map +0 -1
- package/dist/ui/constraints/unknownHandling.js +0 -60
- package/dist/ui/constraints/unknownHandling.js.map +0 -1
- package/dist/ui/drilldowns/feed.d.ts +0 -11
- package/dist/ui/drilldowns/feed.d.ts.map +0 -1
- package/dist/ui/drilldowns/feed.js +0 -68
- package/dist/ui/drilldowns/feed.js.map +0 -1
- package/dist/ui/drilldowns/index.d.ts +0 -7
- package/dist/ui/drilldowns/index.d.ts.map +0 -1
- package/dist/ui/drilldowns/index.js +0 -8
- package/dist/ui/drilldowns/index.js.map +0 -1
- package/dist/ui/drilldowns/posture.d.ts +0 -11
- package/dist/ui/drilldowns/posture.d.ts.map +0 -1
- package/dist/ui/drilldowns/posture.js +0 -74
- package/dist/ui/drilldowns/posture.js.map +0 -1
- package/dist/ui/intelligence-posture-view.d.ts +0 -22
- package/dist/ui/intelligence-posture-view.d.ts.map +0 -1
- package/dist/ui/intelligence-posture-view.js +0 -169
- package/dist/ui/intelligence-posture-view.js.map +0 -1
- package/dist/ui/navigation/keymaps.d.ts +0 -26
- package/dist/ui/navigation/keymaps.d.ts.map +0 -1
- package/dist/ui/navigation/keymaps.js +0 -135
- package/dist/ui/navigation/keymaps.js.map +0 -1
- package/dist/ui/navigation/palette.d.ts +0 -10
- package/dist/ui/navigation/palette.d.ts.map +0 -1
- package/dist/ui/navigation/palette.js +0 -133
- package/dist/ui/navigation/palette.js.map +0 -1
- package/dist/ui/navigation/state.d.ts +0 -47
- package/dist/ui/navigation/state.d.ts.map +0 -1
- package/dist/ui/navigation/state.js +0 -84
- package/dist/ui/navigation/state.js.map +0 -1
- package/dist/ui/navigation/types.d.ts +0 -38
- package/dist/ui/navigation/types.d.ts.map +0 -1
- package/dist/ui/navigation/types.js +0 -36
- package/dist/ui/navigation/types.js.map +0 -1
- package/dist/ui/panels/active-assets.d.ts +0 -12
- package/dist/ui/panels/active-assets.d.ts.map +0 -1
- package/dist/ui/panels/active-assets.js +0 -83
- package/dist/ui/panels/active-assets.js.map +0 -1
- package/dist/ui/panels/capability-flags.d.ts +0 -12
- package/dist/ui/panels/capability-flags.d.ts.map +0 -1
- package/dist/ui/panels/capability-flags.js +0 -59
- package/dist/ui/panels/capability-flags.js.map +0 -1
- package/dist/ui/panels/command-surface.d.ts +0 -12
- package/dist/ui/panels/command-surface.d.ts.map +0 -1
- package/dist/ui/panels/command-surface.js +0 -55
- package/dist/ui/panels/command-surface.js.map +0 -1
- package/dist/ui/panels/network-origin.d.ts +0 -12
- package/dist/ui/panels/network-origin.d.ts.map +0 -1
- package/dist/ui/panels/network-origin.js +0 -79
- package/dist/ui/panels/network-origin.js.map +0 -1
- package/dist/ui/panels/operations-feed.d.ts +0 -12
- package/dist/ui/panels/operations-feed.d.ts.map +0 -1
- package/dist/ui/panels/operations-feed.js +0 -90
- package/dist/ui/panels/operations-feed.js.map +0 -1
- package/dist/ui/panels/posture.d.ts +0 -12
- package/dist/ui/panels/posture.d.ts.map +0 -1
- package/dist/ui/panels/posture.js +0 -84
- package/dist/ui/panels/posture.js.map +0 -1
- package/dist/ui/panels/resources.d.ts +0 -11
- package/dist/ui/panels/resources.d.ts.map +0 -1
- package/dist/ui/panels/resources.js +0 -88
- package/dist/ui/panels/resources.js.map +0 -1
- package/dist/ui/primitives/Panel.d.ts +0 -25
- package/dist/ui/primitives/Panel.d.ts.map +0 -1
- package/dist/ui/primitives/Panel.js +0 -59
- package/dist/ui/primitives/Panel.js.map +0 -1
- package/dist/ui/rendering/metricRenderer.d.ts +0 -24
- package/dist/ui/rendering/metricRenderer.d.ts.map +0 -1
- package/dist/ui/rendering/metricRenderer.js +0 -86
- package/dist/ui/rendering/metricRenderer.js.map +0 -1
- package/dist/ui/runtime/hub.d.ts +0 -12
- package/dist/ui/runtime/hub.d.ts.map +0 -1
- package/dist/ui/runtime/hub.js +0 -486
- package/dist/ui/runtime/hub.js.map +0 -1
- package/dist/ui/runtime/hubValidation.d.ts +0 -23
- package/dist/ui/runtime/hubValidation.d.ts.map +0 -1
- package/dist/ui/runtime/hubValidation.js +0 -90
- package/dist/ui/runtime/hubValidation.js.map +0 -1
- package/dist/ui/runtime/index.d.ts +0 -29
- package/dist/ui/runtime/index.d.ts.map +0 -1
- package/dist/ui/runtime/index.js +0 -297
- package/dist/ui/runtime/index.js.map +0 -1
- package/dist/ui/runtime/no-tui.d.ts +0 -12
- package/dist/ui/runtime/no-tui.d.ts.map +0 -1
- package/dist/ui/runtime/no-tui.js +0 -77
- package/dist/ui/runtime/no-tui.js.map +0 -1
- package/dist/ui/runtime/state-builder.d.ts +0 -13
- package/dist/ui/runtime/state-builder.d.ts.map +0 -1
- package/dist/ui/runtime/state-builder.js +0 -114
- package/dist/ui/runtime/state-builder.js.map +0 -1
- package/dist/ui/runtime/terminalSizeCheck.d.ts +0 -10
- package/dist/ui/runtime/terminalSizeCheck.d.ts.map +0 -1
- package/dist/ui/runtime/terminalSizeCheck.js +0 -51
- package/dist/ui/runtime/terminalSizeCheck.js.map +0 -1
- package/dist/ui/runtime/tuiLogGate.d.ts +0 -22
- package/dist/ui/runtime/tuiLogGate.d.ts.map +0 -1
- package/dist/ui/runtime/tuiLogGate.js +0 -68
- package/dist/ui/runtime/tuiLogGate.js.map +0 -1
- package/dist/ui/state/types.d.ts +0 -72
- package/dist/ui/state/types.d.ts.map +0 -1
- package/dist/ui/state/types.js +0 -6
- package/dist/ui/state/types.js.map +0 -1
- package/dist/ui/theme/borders.d.ts +0 -20
- package/dist/ui/theme/borders.d.ts.map +0 -1
- package/dist/ui/theme/borders.js +0 -55
- package/dist/ui/theme/borders.js.map +0 -1
- package/dist/ui/theme/tokens.d.ts +0 -28
- package/dist/ui/theme/tokens.d.ts.map +0 -1
- package/dist/ui/theme/tokens.js +0 -50
- package/dist/ui/theme/tokens.js.map +0 -1
- package/dist/ui/theme/typography.d.ts +0 -14
- package/dist/ui/theme/typography.d.ts.map +0 -1
- package/dist/ui/theme/typography.js +0 -30
- package/dist/ui/theme/typography.js.map +0 -1
- package/dist/ui/v3/collectors/assets.collector.d.ts +0 -20
- package/dist/ui/v3/collectors/assets.collector.d.ts.map +0 -1
- package/dist/ui/v3/collectors/assets.collector.js +0 -80
- package/dist/ui/v3/collectors/assets.collector.js.map +0 -1
- package/dist/ui/v3/collectors/capabilities.collector.d.ts +0 -18
- package/dist/ui/v3/collectors/capabilities.collector.d.ts.map +0 -1
- package/dist/ui/v3/collectors/capabilities.collector.js +0 -113
- package/dist/ui/v3/collectors/capabilities.collector.js.map +0 -1
- package/dist/ui/v3/collectors/network.collector.d.ts +0 -18
- package/dist/ui/v3/collectors/network.collector.d.ts.map +0 -1
- package/dist/ui/v3/collectors/network.collector.js +0 -37
- package/dist/ui/v3/collectors/network.collector.js.map +0 -1
- package/dist/ui/v3/collectors/posture.derive.d.ts +0 -24
- package/dist/ui/v3/collectors/posture.derive.d.ts.map +0 -1
- package/dist/ui/v3/collectors/posture.derive.js +0 -57
- package/dist/ui/v3/collectors/posture.derive.js.map +0 -1
- package/dist/ui/v3/collectors/resources.d.ts +0 -23
- package/dist/ui/v3/collectors/resources.d.ts.map +0 -1
- package/dist/ui/v3/collectors/resources.js +0 -136
- package/dist/ui/v3/collectors/resources.js.map +0 -1
- package/dist/ui/v3/commands/commandEngine.d.ts +0 -77
- package/dist/ui/v3/commands/commandEngine.d.ts.map +0 -1
- package/dist/ui/v3/commands/commandEngine.js +0 -3289
- package/dist/ui/v3/commands/commandEngine.js.map +0 -1
- package/dist/ui/v3/commands/commandResult.d.ts +0 -25
- package/dist/ui/v3/commands/commandResult.d.ts.map +0 -1
- package/dist/ui/v3/commands/commandResult.js +0 -19
- package/dist/ui/v3/commands/commandResult.js.map +0 -1
- package/dist/ui/v3/commands/diagnose.d.ts +0 -17
- package/dist/ui/v3/commands/diagnose.d.ts.map +0 -1
- package/dist/ui/v3/commands/diagnose.js +0 -62
- package/dist/ui/v3/commands/diagnose.js.map +0 -1
- package/dist/ui/v3/commands/errorClassifier.d.ts +0 -23
- package/dist/ui/v3/commands/errorClassifier.d.ts.map +0 -1
- package/dist/ui/v3/commands/errorClassifier.js +0 -63
- package/dist/ui/v3/commands/errorClassifier.js.map +0 -1
- package/dist/ui/v3/commands/parser.d.ts +0 -14
- package/dist/ui/v3/commands/parser.d.ts.map +0 -1
- package/dist/ui/v3/commands/parser.js +0 -29
- package/dist/ui/v3/commands/parser.js.map +0 -1
- package/dist/ui/v3/commands/router.d.ts +0 -13
- package/dist/ui/v3/commands/router.d.ts.map +0 -1
- package/dist/ui/v3/commands/router.js +0 -150
- package/dist/ui/v3/commands/router.js.map +0 -1
- package/dist/ui/v3/config/gateway.d.ts +0 -40
- package/dist/ui/v3/config/gateway.d.ts.map +0 -1
- package/dist/ui/v3/config/gateway.js +0 -113
- package/dist/ui/v3/config/gateway.js.map +0 -1
- package/dist/ui/v3/core/event.d.ts +0 -19
- package/dist/ui/v3/core/event.d.ts.map +0 -1
- package/dist/ui/v3/core/event.js +0 -7
- package/dist/ui/v3/core/event.js.map +0 -1
- package/dist/ui/v3/core/eventBus.d.ts +0 -39
- package/dist/ui/v3/core/eventBus.d.ts.map +0 -1
- package/dist/ui/v3/core/eventBus.js +0 -79
- package/dist/ui/v3/core/eventBus.js.map +0 -1
- package/dist/ui/v3/core/feedStore.d.ts +0 -34
- package/dist/ui/v3/core/feedStore.d.ts.map +0 -1
- package/dist/ui/v3/core/feedStore.js +0 -46
- package/dist/ui/v3/core/feedStore.js.map +0 -1
- package/dist/ui/v3/core/logger.d.ts +0 -40
- package/dist/ui/v3/core/logger.d.ts.map +0 -1
- package/dist/ui/v3/core/logger.js +0 -191
- package/dist/ui/v3/core/logger.js.map +0 -1
- package/dist/ui/v3/core/opEvent.d.ts +0 -15
- package/dist/ui/v3/core/opEvent.d.ts.map +0 -1
- package/dist/ui/v3/core/opEvent.js +0 -7
- package/dist/ui/v3/core/opEvent.js.map +0 -1
- package/dist/ui/v3/index.d.ts +0 -8
- package/dist/ui/v3/index.d.ts.map +0 -1
- package/dist/ui/v3/index.js +0 -51
- package/dist/ui/v3/index.js.map +0 -1
- package/dist/ui/v3/runtime/moduleConfig.d.ts +0 -21
- package/dist/ui/v3/runtime/moduleConfig.d.ts.map +0 -1
- package/dist/ui/v3/runtime/moduleConfig.js +0 -41
- package/dist/ui/v3/runtime/moduleConfig.js.map +0 -1
- package/dist/ui/v3/section0/index.d.ts +0 -22
- package/dist/ui/v3/section0/index.d.ts.map +0 -1
- package/dist/ui/v3/section0/index.js +0 -88
- package/dist/ui/v3/section0/index.js.map +0 -1
- package/dist/ui/v3/section0/runtime/createScreen.d.ts +0 -27
- package/dist/ui/v3/section0/runtime/createScreen.d.ts.map +0 -1
- package/dist/ui/v3/section0/runtime/createScreen.js +0 -55
- package/dist/ui/v3/section0/runtime/createScreen.js.map +0 -1
- package/dist/ui/v3/section0/runtime/lifecycle.d.ts +0 -53
- package/dist/ui/v3/section0/runtime/lifecycle.d.ts.map +0 -1
- package/dist/ui/v3/section0/runtime/lifecycle.js +0 -172
- package/dist/ui/v3/section0/runtime/lifecycle.js.map +0 -1
- package/dist/ui/v3/section1/index.d.ts +0 -19
- package/dist/ui/v3/section1/index.d.ts.map +0 -1
- package/dist/ui/v3/section1/index.js +0 -413
- package/dist/ui/v3/section1/index.js.map +0 -1
- package/dist/ui/v3/section1/runtime/commandLine.d.ts +0 -49
- package/dist/ui/v3/section1/runtime/commandLine.d.ts.map +0 -1
- package/dist/ui/v3/section1/runtime/commandLine.js +0 -183
- package/dist/ui/v3/section1/runtime/commandLine.js.map +0 -1
- package/dist/ui/v3/section1/runtime/focusLock.d.ts +0 -24
- package/dist/ui/v3/section1/runtime/focusLock.d.ts.map +0 -1
- package/dist/ui/v3/section1/runtime/focusLock.js +0 -44
- package/dist/ui/v3/section1/runtime/focusLock.js.map +0 -1
- package/dist/ui/v3/state/assertUiState.d.ts +0 -27
- package/dist/ui/v3/state/assertUiState.d.ts.map +0 -1
- package/dist/ui/v3/state/assertUiState.js +0 -89
- package/dist/ui/v3/state/assertUiState.js.map +0 -1
- package/dist/ui/v3/state/capabilitiesStore.d.ts +0 -54
- package/dist/ui/v3/state/capabilitiesStore.d.ts.map +0 -1
- package/dist/ui/v3/state/capabilitiesStore.js +0 -76
- package/dist/ui/v3/state/capabilitiesStore.js.map +0 -1
- package/dist/ui/v3/state/defaultState.d.ts +0 -19
- package/dist/ui/v3/state/defaultState.d.ts.map +0 -1
- package/dist/ui/v3/state/defaultState.js +0 -28
- package/dist/ui/v3/state/defaultState.js.map +0 -1
- package/dist/ui/v3/state/gatewayConnectionStore.d.ts +0 -72
- package/dist/ui/v3/state/gatewayConnectionStore.d.ts.map +0 -1
- package/dist/ui/v3/state/gatewayConnectionStore.js +0 -108
- package/dist/ui/v3/state/gatewayConnectionStore.js.map +0 -1
- package/dist/ui/v3/state/initializePostureState.d.ts +0 -23
- package/dist/ui/v3/state/initializePostureState.d.ts.map +0 -1
- package/dist/ui/v3/state/initializePostureState.js +0 -41
- package/dist/ui/v3/state/initializePostureState.js.map +0 -1
- package/dist/ui/v3/state/panelStore.d.ts +0 -80
- package/dist/ui/v3/state/panelStore.d.ts.map +0 -1
- package/dist/ui/v3/state/panelStore.js +0 -131
- package/dist/ui/v3/state/panelStore.js.map +0 -1
- package/dist/ui/v3/state/resourcesData.d.ts +0 -15
- package/dist/ui/v3/state/resourcesData.d.ts.map +0 -1
- package/dist/ui/v3/state/resourcesData.js +0 -7
- package/dist/ui/v3/state/resourcesData.js.map +0 -1
- package/dist/ui/v3/state/uiState.d.ts +0 -22
- package/dist/ui/v3/state/uiState.d.ts.map +0 -1
- package/dist/ui/v3/state/uiState.js +0 -13
- package/dist/ui/v3/state/uiState.js.map +0 -1
- package/dist/ui/v3/state/uiStateBuilder.d.ts +0 -32
- package/dist/ui/v3/state/uiStateBuilder.d.ts.map +0 -1
- package/dist/ui/v3/state/uiStateBuilder.js +0 -73
- package/dist/ui/v3/state/uiStateBuilder.js.map +0 -1
- package/dist/ui/v3/state/uiStateTypes.d.ts +0 -59
- package/dist/ui/v3/state/uiStateTypes.d.ts.map +0 -1
- package/dist/ui/v3/state/uiStateTypes.js +0 -8
- package/dist/ui/v3/state/uiStateTypes.js.map +0 -1
- package/dist/ui/v3/state/value.d.ts +0 -80
- package/dist/ui/v3/state/value.d.ts.map +0 -1
- package/dist/ui/v3/state/value.js +0 -96
- package/dist/ui/v3/state/value.js.map +0 -1
- package/dist/ui/v3/tui/geometry.d.ts +0 -83
- package/dist/ui/v3/tui/geometry.d.ts.map +0 -1
- package/dist/ui/v3/tui/geometry.js +0 -201
- package/dist/ui/v3/tui/geometry.js.map +0 -1
- package/dist/ui/v3/tui/startTui.d.ts +0 -37
- package/dist/ui/v3/tui/startTui.d.ts.map +0 -1
- package/dist/ui/v3/tui/startTui.js +0 -61
- package/dist/ui/v3/tui/startTui.js.map +0 -1
- package/dist/ui/v3/tui/terminalMode.d.ts +0 -31
- package/dist/ui/v3/tui/terminalMode.d.ts.map +0 -1
- package/dist/ui/v3/tui/terminalMode.js +0 -76
- package/dist/ui/v3/tui/terminalMode.js.map +0 -1
- package/dist/ui/v3/ui/debugUtils.d.ts +0 -67
- package/dist/ui/v3/ui/debugUtils.d.ts.map +0 -1
- package/dist/ui/v3/ui/debugUtils.js +0 -238
- package/dist/ui/v3/ui/debugUtils.js.map +0 -1
- package/dist/ui/v3/ui/focus.d.ts +0 -28
- package/dist/ui/v3/ui/focus.d.ts.map +0 -1
- package/dist/ui/v3/ui/focus.js +0 -38
- package/dist/ui/v3/ui/focus.js.map +0 -1
- package/dist/ui/v3/ui/layout/hubLayout.d.ts +0 -43
- package/dist/ui/v3/ui/layout/hubLayout.d.ts.map +0 -1
- package/dist/ui/v3/ui/layout/hubLayout.js +0 -170
- package/dist/ui/v3/ui/layout/hubLayout.js.map +0 -1
- package/dist/ui/v3/ui/layout/phase1Layout.d.ts +0 -63
- package/dist/ui/v3/ui/layout/phase1Layout.d.ts.map +0 -1
- package/dist/ui/v3/ui/layout/phase1Layout.js +0 -274
- package/dist/ui/v3/ui/layout/phase1Layout.js.map +0 -1
- package/dist/ui/v3/ui/layout/phase1Layout.test.d.ts +0 -5
- package/dist/ui/v3/ui/layout/phase1Layout.test.d.ts.map +0 -1
- package/dist/ui/v3/ui/layout/phase1Layout.test.js +0 -120
- package/dist/ui/v3/ui/layout/phase1Layout.test.js.map +0 -1
- package/dist/ui/v3/ui/minimalRuntime.d.ts +0 -14
- package/dist/ui/v3/ui/minimalRuntime.d.ts.map +0 -1
- package/dist/ui/v3/ui/minimalRuntime.js +0 -111
- package/dist/ui/v3/ui/minimalRuntime.js.map +0 -1
- package/dist/ui/v3/ui/panels/AssetsPanel.d.ts +0 -17
- package/dist/ui/v3/ui/panels/AssetsPanel.d.ts.map +0 -1
- package/dist/ui/v3/ui/panels/AssetsPanel.js +0 -53
- package/dist/ui/v3/ui/panels/AssetsPanel.js.map +0 -1
- package/dist/ui/v3/ui/panels/CapabilitiesPanel.d.ts +0 -20
- package/dist/ui/v3/ui/panels/CapabilitiesPanel.d.ts.map +0 -1
- package/dist/ui/v3/ui/panels/CapabilitiesPanel.js +0 -67
- package/dist/ui/v3/ui/panels/CapabilitiesPanel.js.map +0 -1
- package/dist/ui/v3/ui/panels/NetworkPanel.d.ts +0 -31
- package/dist/ui/v3/ui/panels/NetworkPanel.d.ts.map +0 -1
- package/dist/ui/v3/ui/panels/NetworkPanel.js +0 -153
- package/dist/ui/v3/ui/panels/NetworkPanel.js.map +0 -1
- package/dist/ui/v3/ui/panels/PosturePanel.d.ts +0 -16
- package/dist/ui/v3/ui/panels/PosturePanel.d.ts.map +0 -1
- package/dist/ui/v3/ui/panels/PosturePanel.js +0 -60
- package/dist/ui/v3/ui/panels/PosturePanel.js.map +0 -1
- package/dist/ui/v3/ui/panels/ResourcesPanel.d.ts +0 -20
- package/dist/ui/v3/ui/panels/ResourcesPanel.d.ts.map +0 -1
- package/dist/ui/v3/ui/panels/ResourcesPanel.js +0 -66
- package/dist/ui/v3/ui/panels/ResourcesPanel.js.map +0 -1
- package/dist/ui/v3/ui/phase1Runtime.d.ts +0 -29
- package/dist/ui/v3/ui/phase1Runtime.d.ts.map +0 -1
- package/dist/ui/v3/ui/phase1Runtime.js +0 -1648
- package/dist/ui/v3/ui/phase1Runtime.js.map +0 -1
- package/dist/ui/v3/ui/phase1RuntimeClean.d.ts +0 -34
- package/dist/ui/v3/ui/phase1RuntimeClean.d.ts.map +0 -1
- package/dist/ui/v3/ui/phase1RuntimeClean.js +0 -1841
- package/dist/ui/v3/ui/phase1RuntimeClean.js.map +0 -1
- package/dist/ui/v3/ui/primitives/Panel.d.ts +0 -39
- package/dist/ui/v3/ui/primitives/Panel.d.ts.map +0 -1
- package/dist/ui/v3/ui/primitives/Panel.js +0 -105
- package/dist/ui/v3/ui/primitives/Panel.js.map +0 -1
- package/dist/ui/v3/ui/theme.d.ts +0 -37
- package/dist/ui/v3/ui/theme.d.ts.map +0 -1
- package/dist/ui/v3/ui/theme.js +0 -40
- package/dist/ui/v3/ui/theme.js.map +0 -1
- package/dist/ui/v3/ui/uiRuntime.d.ts +0 -40
- package/dist/ui/v3/ui/uiRuntime.d.ts.map +0 -1
- package/dist/ui/v3/ui/uiRuntime.js +0 -60
- package/dist/ui/v3/ui/uiRuntime.js.map +0 -1
- package/dist/ui/v3/ui/widgets/CommandLine.d.ts +0 -26
- package/dist/ui/v3/ui/widgets/CommandLine.d.ts.map +0 -1
- package/dist/ui/v3/ui/widgets/CommandLine.js +0 -67
- package/dist/ui/v3/ui/widgets/CommandLine.js.map +0 -1
- package/dist/ui/v3/v1Adapters/agents.d.ts +0 -72
- package/dist/ui/v3/v1Adapters/agents.d.ts.map +0 -1
- package/dist/ui/v3/v1Adapters/agents.js +0 -182
- package/dist/ui/v3/v1Adapters/agents.js.map +0 -1
- package/dist/ui/v3/v1Adapters/config.d.ts +0 -67
- package/dist/ui/v3/v1Adapters/config.d.ts.map +0 -1
- package/dist/ui/v3/v1Adapters/config.js +0 -78
- package/dist/ui/v3/v1Adapters/config.js.map +0 -1
- package/dist/ui/v3/v1Adapters/connect.d.ts +0 -77
- package/dist/ui/v3/v1Adapters/connect.d.ts.map +0 -1
- package/dist/ui/v3/v1Adapters/connect.js +0 -576
- package/dist/ui/v3/v1Adapters/connect.js.map +0 -1
- package/dist/ui/v3/v1Adapters/httpDebug.d.ts +0 -19
- package/dist/ui/v3/v1Adapters/httpDebug.d.ts.map +0 -1
- package/dist/ui/v3/v1Adapters/httpDebug.js +0 -60
- package/dist/ui/v3/v1Adapters/httpDebug.js.map +0 -1
- package/dist/ui/v3/v1Adapters/runs.d.ts +0 -77
- package/dist/ui/v3/v1Adapters/runs.d.ts.map +0 -1
- package/dist/ui/v3/v1Adapters/runs.js +0 -339
- package/dist/ui/v3/v1Adapters/runs.js.map +0 -1
- package/dist/ui/v4/engine/renderFrame.d.ts +0 -47
- package/dist/ui/v4/engine/renderFrame.d.ts.map +0 -1
- package/dist/ui/v4/engine/renderFrame.js +0 -653
- package/dist/ui/v4/engine/renderFrame.js.map +0 -1
- package/dist/ui/v4/engine/resizeController.d.ts +0 -48
- package/dist/ui/v4/engine/resizeController.d.ts.map +0 -1
- package/dist/ui/v4/engine/resizeController.js +0 -285
- package/dist/ui/v4/engine/resizeController.js.map +0 -1
- package/dist/ui/v4/engine/safeViewport.d.ts +0 -47
- package/dist/ui/v4/engine/safeViewport.d.ts.map +0 -1
- package/dist/ui/v4/engine/safeViewport.js +0 -123
- package/dist/ui/v4/engine/safeViewport.js.map +0 -1
- package/dist/ui/v4/engine/terminalProfile.d.ts +0 -56
- package/dist/ui/v4/engine/terminalProfile.d.ts.map +0 -1
- package/dist/ui/v4/engine/terminalProfile.js +0 -115
- package/dist/ui/v4/engine/terminalProfile.js.map +0 -1
- package/dist/ui/v4/index.d.ts +0 -28
- package/dist/ui/v4/index.d.ts.map +0 -1
- package/dist/ui/v4/index.js +0 -993
- package/dist/ui/v4/index.js.map +0 -1
- package/dist/ui/v4/layout/layoutEngine.d.ts +0 -62
- package/dist/ui/v4/layout/layoutEngine.d.ts.map +0 -1
- package/dist/ui/v4/layout/layoutEngine.js +0 -294
- package/dist/ui/v4/layout/layoutEngine.js.map +0 -1
- package/dist/ui/v4/runtime/keepAlive.d.ts +0 -21
- package/dist/ui/v4/runtime/keepAlive.d.ts.map +0 -1
- package/dist/ui/v4/runtime/keepAlive.js +0 -149
- package/dist/ui/v4/runtime/keepAlive.js.map +0 -1
- package/dist/ui/v4/runtime/logger.d.ts +0 -35
- package/dist/ui/v4/runtime/logger.d.ts.map +0 -1
- package/dist/ui/v4/runtime/logger.js +0 -109
- package/dist/ui/v4/runtime/logger.js.map +0 -1
- package/dist/ui/v5/debug/assertNoOverflow.d.ts +0 -28
- package/dist/ui/v5/debug/assertNoOverflow.d.ts.map +0 -1
- package/dist/ui/v5/debug/assertNoOverflow.js +0 -63
- package/dist/ui/v5/debug/assertNoOverflow.js.map +0 -1
- package/dist/ui/v5/debug/debugCommands.d.ts +0 -20
- package/dist/ui/v5/debug/debugCommands.d.ts.map +0 -1
- package/dist/ui/v5/debug/debugCommands.js +0 -461
- package/dist/ui/v5/debug/debugCommands.js.map +0 -1
- package/dist/ui/v5/debugCommands.d.ts +0 -20
- package/dist/ui/v5/debugCommands.d.ts.map +0 -1
- package/dist/ui/v5/debugCommands.js +0 -81
- package/dist/ui/v5/debugCommands.js.map +0 -1
- package/dist/ui/v5/guardrails/stdoutGuard.d.ts +0 -23
- package/dist/ui/v5/guardrails/stdoutGuard.d.ts.map +0 -1
- package/dist/ui/v5/guardrails/stdoutGuard.js +0 -94
- package/dist/ui/v5/guardrails/stdoutGuard.js.map +0 -1
- package/dist/ui/v5/guardrails/terminalRestore.d.ts +0 -17
- package/dist/ui/v5/guardrails/terminalRestore.d.ts.map +0 -1
- package/dist/ui/v5/guardrails/terminalRestore.js +0 -47
- package/dist/ui/v5/guardrails/terminalRestore.js.map +0 -1
- package/dist/ui/v5/index.d.ts +0 -30
- package/dist/ui/v5/index.d.ts.map +0 -1
- package/dist/ui/v5/index.js +0 -243
- package/dist/ui/v5/index.js.map +0 -1
- package/dist/ui/v5/kernel/kernel.d.ts +0 -81
- package/dist/ui/v5/kernel/kernel.d.ts.map +0 -1
- package/dist/ui/v5/kernel/kernel.js +0 -339
- package/dist/ui/v5/kernel/kernel.js.map +0 -1
- package/dist/ui/v5/kernel.d.ts +0 -75
- package/dist/ui/v5/kernel.d.ts.map +0 -1
- package/dist/ui/v5/kernel.js +0 -289
- package/dist/ui/v5/kernel.js.map +0 -1
- package/dist/ui/v5/layout/clampRect.d.ts +0 -28
- package/dist/ui/v5/layout/clampRect.d.ts.map +0 -1
- package/dist/ui/v5/layout/clampRect.js +0 -45
- package/dist/ui/v5/layout/clampRect.js.map +0 -1
- package/dist/ui/v5/layout/layoutEngine.d.ts +0 -16
- package/dist/ui/v5/layout/layoutEngine.d.ts.map +0 -1
- package/dist/ui/v5/layout/layoutEngine.js +0 -99
- package/dist/ui/v5/layout/layoutEngine.js.map +0 -1
- package/dist/ui/v5/renderGate.d.ts +0 -19
- package/dist/ui/v5/renderGate.d.ts.map +0 -1
- package/dist/ui/v5/renderGate.js +0 -36
- package/dist/ui/v5/renderGate.js.map +0 -1
- package/dist/ui/v5/resize/resizeController.d.ts +0 -62
- package/dist/ui/v5/resize/resizeController.d.ts.map +0 -1
- package/dist/ui/v5/resize/resizeController.js +0 -141
- package/dist/ui/v5/resize/resizeController.js.map +0 -1
- package/dist/ui/v5/resizeController.d.ts +0 -55
- package/dist/ui/v5/resizeController.d.ts.map +0 -1
- package/dist/ui/v5/resizeController.js +0 -124
- package/dist/ui/v5/resizeController.js.map +0 -1
- package/dist/ui/v5/runtime/keepAlive.d.ts +0 -37
- package/dist/ui/v5/runtime/keepAlive.d.ts.map +0 -1
- package/dist/ui/v5/runtime/keepAlive.js +0 -122
- package/dist/ui/v5/runtime/keepAlive.js.map +0 -1
- package/dist/ui/v5/runtime/restoreTerminal.d.ts +0 -34
- package/dist/ui/v5/runtime/restoreTerminal.d.ts.map +0 -1
- package/dist/ui/v5/runtime/restoreTerminal.js +0 -100
- package/dist/ui/v5/runtime/restoreTerminal.js.map +0 -1
- package/dist/ui/v5/runtime/stdoutGuard.d.ts +0 -42
- package/dist/ui/v5/runtime/stdoutGuard.d.ts.map +0 -1
- package/dist/ui/v5/runtime/stdoutGuard.js +0 -156
- package/dist/ui/v5/runtime/stdoutGuard.js.map +0 -1
- package/dist/ui/v5/viewport/getViewport.d.ts +0 -23
- package/dist/ui/v5/viewport/getViewport.d.ts.map +0 -1
- package/dist/ui/v5/viewport/getViewport.js +0 -117
- package/dist/ui/v5/viewport/getViewport.js.map +0 -1
- package/dist/ui/v5/viewport.d.ts +0 -41
- package/dist/ui/v5/viewport.d.ts.map +0 -1
- package/dist/ui/v5/viewport.js +0 -90
- package/dist/ui/v5/viewport.js.map +0 -1
- package/dist/ui/widgets/flagRow.d.ts +0 -25
- package/dist/ui/widgets/flagRow.d.ts.map +0 -1
- package/dist/ui/widgets/flagRow.js +0 -57
- package/dist/ui/widgets/flagRow.js.map +0 -1
- package/dist/ui/widgets/index.d.ts +0 -9
- package/dist/ui/widgets/index.d.ts.map +0 -1
- package/dist/ui/widgets/index.js +0 -9
- package/dist/ui/widgets/index.js.map +0 -1
- package/dist/ui/widgets/meter.d.ts +0 -18
- package/dist/ui/widgets/meter.d.ts.map +0 -1
- package/dist/ui/widgets/meter.js +0 -38
- package/dist/ui/widgets/meter.js.map +0 -1
- package/dist/ui/widgets/miniMap.d.ts +0 -26
- package/dist/ui/widgets/miniMap.d.ts.map +0 -1
- package/dist/ui/widgets/miniMap.js +0 -94
- package/dist/ui/widgets/miniMap.js.map +0 -1
- package/dist/ui/widgets/sparkline.d.ts +0 -17
- package/dist/ui/widgets/sparkline.d.ts.map +0 -1
- package/dist/ui/widgets/sparkline.js +0 -65
- package/dist/ui/widgets/sparkline.js.map +0 -1
|
@@ -1,258 +1,551 @@
|
|
|
1
|
-
const MIN_COLS_NORMAL = 140; // Increased threshold
|
|
2
|
-
const MIN_ROWS_NORMAL = 35; // Increased threshold
|
|
3
|
-
const MIN_WIDTH = 10;
|
|
4
|
-
const MIN_HEIGHT = 3;
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
2
|
+
* MK1 Layout Engine - Pure math, no blessed imports
|
|
3
|
+
*
|
|
4
|
+
* Computes panel rectangles based on canvas size and layout mode.
|
|
5
|
+
* All rectangles are clamped to prevent overflow.
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Clamp rectangle to canvas bounds
|
|
9
|
+
* Returns null if clamped size would be invalid
|
|
10
|
+
* - Header/command: minimum w >= 1, h >= 1
|
|
11
|
+
* - Other panels: minimum w >= 3, h >= 3
|
|
12
|
+
*/
|
|
13
|
+
export function clampRect(rect, canvasCols, canvasRows, isThin = false) {
|
|
14
|
+
let { x, y, w, h } = rect;
|
|
15
|
+
// Clamp position
|
|
16
|
+
x = Math.max(0, Math.min(x, canvasCols - 1));
|
|
17
|
+
y = Math.max(0, Math.min(y, canvasRows - 1));
|
|
18
|
+
// Clamp width
|
|
19
|
+
const maxW = canvasCols - x;
|
|
20
|
+
w = Math.min(w, maxW);
|
|
21
|
+
// Clamp height
|
|
22
|
+
const maxH = canvasRows - y;
|
|
23
|
+
h = Math.min(h, maxH);
|
|
24
|
+
// Check minimums
|
|
25
|
+
// Header and command line are thin (1 line), allow h >= 1
|
|
26
|
+
const minSize = isThin ? 1 : 3;
|
|
27
|
+
if (w < minSize || h < minSize) {
|
|
28
|
+
return null; // Invalid after clamping
|
|
19
29
|
}
|
|
30
|
+
return { x, y, w, h };
|
|
20
31
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (hasOverflow(normalLayout, safeCols, safeRows)) {
|
|
32
|
-
const narrowLayout = computeNarrowLayout(safeCols, safeRows);
|
|
33
|
-
console.log(`[LAYOUT] mode=narrow reason=overflow safeCols=${safeCols} safeRows=${safeRows}`);
|
|
34
|
-
return narrowLayout;
|
|
35
|
-
}
|
|
36
|
-
// Assert all rects are within viewport (dev mode)
|
|
37
|
-
if (process.env.TUI_DEBUG === '1') {
|
|
38
|
-
for (const [key, rect] of Object.entries(normalLayout.rects)) {
|
|
39
|
-
if (key !== 'WATERMARK') { // Skip watermark
|
|
40
|
-
assertRectWithinViewport(rect, safeCols, safeRows, key);
|
|
41
|
-
}
|
|
32
|
+
/**
|
|
33
|
+
* Assert no overflow - throws if any rect exceeds canvas
|
|
34
|
+
*/
|
|
35
|
+
export function assertNoOverflow(spec, canvas) {
|
|
36
|
+
for (const [name, rect] of Object.entries(spec.rects)) {
|
|
37
|
+
const rightEdge = rect.x + rect.w;
|
|
38
|
+
const bottomEdge = rect.y + rect.h;
|
|
39
|
+
if (rect.x < 0 || rect.y < 0 || rightEdge > canvas.cols || bottomEdge > canvas.rows) {
|
|
40
|
+
throw new Error(`Layout overflow: ${name} at (${rect.x},${rect.y}) size ${rect.w}x${rect.h} ` +
|
|
41
|
+
`exceeds canvas ${canvas.cols}x${canvas.rows}`);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
console.log(`[LAYOUT] mode=normal safeCols=${safeCols} safeRows=${safeRows}`);
|
|
45
|
-
return normalLayout;
|
|
46
44
|
}
|
|
47
45
|
/**
|
|
48
|
-
*
|
|
49
|
-
* Left stack: POSTURE, RESOURCES, ASSETS
|
|
50
|
-
* Center: OPERATIONS (big)
|
|
51
|
-
* Right stack: NETWORK, CAPABILITIES
|
|
52
|
-
* Bottom: COMMAND_LINE (full width)
|
|
46
|
+
* Compute wide layout (3-column grid)
|
|
53
47
|
*
|
|
54
|
-
*
|
|
48
|
+
* Rule: sum of widths + gutters <= safeCols
|
|
49
|
+
* Rule: nothing ends at x == safeCols (1-col air gap)
|
|
50
|
+
* Rule: borders consume 2 cols (left + right) and 2 rows (top + bottom)
|
|
51
|
+
* So we need to account for border space when computing panel sizes
|
|
55
52
|
*/
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
//
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
53
|
+
function computeWideLayout(canvas) {
|
|
54
|
+
// Phase A: Use safeCols/safeRows from canvas (already computed by getSafeViewport)
|
|
55
|
+
// Phase A: No more RIGHT_GAP here - getSafeViewport already applied it
|
|
56
|
+
// canvas.cols is already safeCols (after RIGHT_GAP), canvas.rows is already safeRows (after BOTTOM_GAP)
|
|
57
|
+
const safeCols = canvas.cols; // Already has RIGHT_GAP applied
|
|
58
|
+
const safeRows = canvas.rows; // Already has BOTTOM_GAP applied
|
|
59
|
+
const GUTTER = 1; // Gap between columns
|
|
60
|
+
const COMMAND_HEIGHT = 3;
|
|
61
|
+
const HEADER_HEIGHT = 1;
|
|
62
|
+
const MIN_MAIN_H = 20;
|
|
63
|
+
const MIN_ROWS = 24;
|
|
64
|
+
// Step 1: SAFE_COLS = screen.cols - 1 (or use canvas.cols which already has RIGHT_GAP applied)
|
|
65
|
+
// canvas.cols is already safeCols (from getSafeViewport with RIGHT_GAP applied)
|
|
66
|
+
const SAFE_COLS = safeCols; // Already has RIGHT_GAP applied in getSafeViewport
|
|
67
|
+
// Step 2: Use fixed widths for left/right, cap OPS width
|
|
68
|
+
// Rule: LEFT_W + GUTTER + OPS_W + GUTTER + RIGHT_W <= SAFE_COLS - 5 (5 unit safety margin)
|
|
69
|
+
// Use outer widths (border included) - all calculations use outer width
|
|
70
|
+
const MIN_LEFT_W = 28; // Minimum outer width for left column
|
|
71
|
+
const MAX_LEFT_W = 50; // Maximum outer width for left column (increased to use space freed from operations)
|
|
72
|
+
const MIN_RIGHT_W = 28; // Minimum outer width for right column
|
|
73
|
+
const MAX_RIGHT_W = 50; // Maximum outer width for right column (increased to use space freed from operations)
|
|
74
|
+
// Step 2: Cap OPS width - user: "operations section smaller its too big"
|
|
75
|
+
const OPS_MAX_W = 140; // Maximum outer width for operations (reduced from 180 to make it smaller)
|
|
76
|
+
const OPS_MIN_W = 60; // Minimum outer width for operations (must be readable)
|
|
77
|
+
// Step 2: Calculate available space for OPS first (operations is capped at OPS_MAX_W)
|
|
78
|
+
// Leave 5 unit safety margin: RIGHT_EDGE <= SAFE_COLS - 5
|
|
79
|
+
// So: LEFT_W + GUTTER + OPS_W + GUTTER + RIGHT_W <= SAFE_COLS - 5
|
|
80
|
+
// Rearranging: LEFT_W + RIGHT_W <= SAFE_COLS - OPS_W - (GUTTER * 2) - 5
|
|
81
|
+
const SAFE_GAP = 5; // 5 unit safety margin for wiggle room
|
|
82
|
+
const maxAvailableForLeftRight = SAFE_COLS - OPS_MAX_W - (GUTTER * 2) - SAFE_GAP;
|
|
83
|
+
// Step 2: Distribute available space to left and right columns (user: "other sections should be bigger")
|
|
84
|
+
// Split the available space 50/50 between left and right
|
|
85
|
+
let leftW = Math.round(maxAvailableForLeftRight / 2);
|
|
86
|
+
let rightW = Math.round(maxAvailableForLeftRight / 2);
|
|
87
|
+
// Step 2: Clamp to min/max bounds
|
|
88
|
+
leftW = Math.max(MIN_LEFT_W, Math.min(MAX_LEFT_W, leftW));
|
|
89
|
+
rightW = Math.max(MIN_RIGHT_W, Math.min(MAX_RIGHT_W, rightW));
|
|
90
|
+
// Step 2: Use these as fixed widths
|
|
91
|
+
const LEFT_W = leftW;
|
|
92
|
+
const RIGHT_W = rightW;
|
|
93
|
+
// Phase A: Validate canvas size (use safeRows directly)
|
|
94
|
+
if (safeRows < MIN_ROWS) {
|
|
95
|
+
throw new Error(`Canvas too small for wide layout: safeRows=${safeRows} < ${MIN_ROWS}`);
|
|
96
|
+
}
|
|
97
|
+
const mainHeight = safeRows - HEADER_HEIGHT - COMMAND_HEIGHT;
|
|
98
|
+
if (mainHeight < MIN_MAIN_H) {
|
|
99
|
+
throw new Error(`Main area too small: height=${mainHeight} < ${MIN_MAIN_H}`);
|
|
100
|
+
}
|
|
101
|
+
// Step 2: Calculate OPS width - operations stays at perfect size (180)
|
|
102
|
+
// Remaining space after left+right+gutters
|
|
103
|
+
const availableForOps = SAFE_COLS - LEFT_W - RIGHT_W - (GUTTER * 2);
|
|
104
|
+
// OPS width is the smaller of available space and OPS_MAX_W
|
|
105
|
+
// User: "operation section is perfect sized" - keep at 180
|
|
106
|
+
let opsW = Math.max(OPS_MIN_W, Math.min(OPS_MAX_W, availableForOps));
|
|
107
|
+
// Step 3: Recompute positions using capped OPS width
|
|
108
|
+
// Step 1: Use explicit x positions, not right: 0 anchoring
|
|
109
|
+
const LEFT_X = 0;
|
|
110
|
+
let OPS_X = LEFT_X + LEFT_W + GUTTER;
|
|
111
|
+
let RIGHT_X = OPS_X + opsW + GUTTER;
|
|
112
|
+
// Step 3: Assert no overflow with 5 unit safety margin
|
|
113
|
+
// RIGHT_EDGE must be <= SAFE_COLS - SAFE_GAP (5 unit safety margin for wiggle room)
|
|
114
|
+
const maxRightEdge = SAFE_COLS - SAFE_GAP;
|
|
115
|
+
if (RIGHT_X + RIGHT_W > maxRightEdge) {
|
|
116
|
+
// Emergency clamp: reduce OPS width to fit with 5 unit gap
|
|
117
|
+
const maxOpsW = maxRightEdge - LEFT_W - RIGHT_W - (GUTTER * 2);
|
|
118
|
+
if (maxOpsW < OPS_MIN_W) {
|
|
119
|
+
throw new Error(`Cannot fit panels with 5 unit safety margin: maxOpsW=${maxOpsW} < OPS_MIN_W=${OPS_MIN_W} ` +
|
|
120
|
+
`(SAFE_COLS=${SAFE_COLS} SAFE_GAP=${SAFE_GAP} LEFT_W=${LEFT_W} RIGHT_W=${RIGHT_W} GUTTER=${GUTTER})`);
|
|
121
|
+
}
|
|
122
|
+
opsW = Math.max(OPS_MIN_W, maxOpsW);
|
|
123
|
+
// Recalculate positions with clamped opsW
|
|
124
|
+
OPS_X = LEFT_X + LEFT_W + GUTTER;
|
|
125
|
+
RIGHT_X = OPS_X + opsW + GUTTER;
|
|
126
|
+
// Verify emergency clamp worked (with 5 unit safety margin)
|
|
127
|
+
if (RIGHT_X + RIGHT_W > maxRightEdge) {
|
|
128
|
+
throw new Error(`Emergency clamp failed: RIGHT_X=${RIGHT_X} RIGHT_W=${RIGHT_W} RIGHT_EDGE=${RIGHT_X + RIGHT_W} > maxRightEdge=${maxRightEdge} (SAFE_COLS=${SAFE_COLS} - SAFE_GAP=${SAFE_GAP})`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Use fixed widths (already set above) - these are outer widths including borders
|
|
132
|
+
// leftW and rightW already declared above, just use them
|
|
133
|
+
const centerW = opsW; // Use the capped OPS width (outer width including borders)
|
|
134
|
+
// Step 3: Final positions (already calculated and verified above)
|
|
135
|
+
const leftX = LEFT_X; // 0
|
|
136
|
+
const centerX = OPS_X;
|
|
137
|
+
const rightX = RIGHT_X;
|
|
138
|
+
// Final verification - ensure right edge has 5 unit safety margin
|
|
139
|
+
// maxRightEdge already declared above, reuse it
|
|
140
|
+
const rightEdge = rightX + rightW;
|
|
141
|
+
if (rightEdge > maxRightEdge) {
|
|
142
|
+
throw new Error(`[LAYOUT ERROR] rightEdge=${rightEdge} > maxRightEdge=${maxRightEdge} (SAFE_COLS=${SAFE_COLS} - SAFE_GAP=${SAFE_GAP}) ` +
|
|
143
|
+
`(LEFT_W=${leftW} OPS_W=${centerW} RIGHT_W=${rightW} GUTTER=${GUTTER} ` +
|
|
144
|
+
`LEFT_X=${leftX} OPS_X=${centerX} RIGHT_X=${rightX})`);
|
|
145
|
+
}
|
|
146
|
+
// Verify we have the 5 unit gap
|
|
147
|
+
const gapCheck = SAFE_COLS - rightEdge;
|
|
148
|
+
if (gapCheck < SAFE_GAP) {
|
|
149
|
+
throw new Error(`[LAYOUT ERROR] Gap too small: gap=${gapCheck} < SAFE_GAP=${SAFE_GAP} ` +
|
|
150
|
+
`(rightEdge=${rightEdge} SAFE_COLS=${SAFE_COLS})`);
|
|
151
|
+
}
|
|
152
|
+
// Build layout spec with final widths (normal or emergency-clamped)
|
|
153
|
+
// Left column panels (split vertically with gaps to prevent double borders)
|
|
154
|
+
const VERTICAL_GAP = 1; // Gap between vertically stacked panels to prevent double borders
|
|
155
|
+
const availableHeightForLeft = mainHeight - (VERTICAL_GAP * 2); // Account for 2 gaps between 3 panels
|
|
156
|
+
const leftPanelH = Math.floor(availableHeightForLeft / 3);
|
|
157
|
+
const leftRemainder = availableHeightForLeft - (leftPanelH * 3);
|
|
158
|
+
// Right column panels (split vertically with gap)
|
|
159
|
+
const availableHeightForRight = mainHeight - VERTICAL_GAP; // Account for 1 gap between 2 panels
|
|
160
|
+
const rightPanelH = Math.floor(availableHeightForRight / 2);
|
|
161
|
+
const rightRemainder = availableHeightForRight - (rightPanelH * 2);
|
|
162
|
+
const headerY = 0;
|
|
163
|
+
const mainY = HEADER_HEIGHT;
|
|
164
|
+
const commandY = canvas.rows - COMMAND_HEIGHT; // Use canvas.rows to position at very bottom
|
|
165
|
+
// Phase E: Header and command span full safeCols width (not beyond)
|
|
166
|
+
const headerW = safeCols; // Use full safeCols (already has RIGHT_GAP applied in getSafeViewport)
|
|
167
|
+
const commandW = safeCols;
|
|
168
|
+
const spec = {
|
|
169
|
+
mode: 'wide',
|
|
170
|
+
reason: 'wide',
|
|
171
|
+
rects: {
|
|
172
|
+
header: {
|
|
173
|
+
x: 0,
|
|
174
|
+
y: headerY,
|
|
175
|
+
w: headerW,
|
|
176
|
+
h: HEADER_HEIGHT,
|
|
177
|
+
},
|
|
178
|
+
posture: {
|
|
179
|
+
x: leftX,
|
|
180
|
+
y: mainY,
|
|
181
|
+
w: leftW,
|
|
182
|
+
h: leftPanelH + (leftRemainder > 0 ? 1 : 0),
|
|
183
|
+
},
|
|
184
|
+
resources: {
|
|
185
|
+
x: leftX,
|
|
186
|
+
y: mainY + leftPanelH + (leftRemainder > 0 ? 1 : 0) + VERTICAL_GAP,
|
|
187
|
+
w: leftW,
|
|
188
|
+
h: leftPanelH + (leftRemainder > 1 ? 1 : 0),
|
|
189
|
+
},
|
|
190
|
+
assets: {
|
|
191
|
+
x: leftX,
|
|
192
|
+
y: mainY + (leftPanelH * 2) + Math.min(leftRemainder, 2) + (VERTICAL_GAP * 2),
|
|
193
|
+
w: leftW,
|
|
194
|
+
h: leftPanelH + (leftRemainder > 2 ? 1 : 0),
|
|
195
|
+
},
|
|
196
|
+
operations: {
|
|
197
|
+
x: centerX,
|
|
198
|
+
y: mainY,
|
|
199
|
+
w: centerW,
|
|
200
|
+
h: mainHeight,
|
|
201
|
+
},
|
|
202
|
+
network: {
|
|
203
|
+
x: rightX,
|
|
204
|
+
y: mainY,
|
|
205
|
+
w: rightW,
|
|
206
|
+
h: rightPanelH + (rightRemainder > 0 ? 1 : 0),
|
|
207
|
+
},
|
|
208
|
+
capabilities: {
|
|
209
|
+
x: rightX,
|
|
210
|
+
y: mainY + rightPanelH + (rightRemainder > 0 ? 1 : 0) + VERTICAL_GAP,
|
|
211
|
+
w: rightW,
|
|
212
|
+
h: rightPanelH + (rightRemainder > 1 ? 1 : 0),
|
|
213
|
+
},
|
|
214
|
+
command: {
|
|
215
|
+
x: 0,
|
|
216
|
+
y: commandY,
|
|
217
|
+
w: commandW, // Use commandW (usableCols), not canvas.cols
|
|
218
|
+
h: COMMAND_HEIGHT,
|
|
219
|
+
},
|
|
220
|
+
},
|
|
147
221
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
222
|
+
// Step 5: Acceptance test data - store debug info for logging
|
|
223
|
+
const totalUsedWidth = leftW + GUTTER + centerW + GUTTER + rightW;
|
|
224
|
+
const safetyMargin = SAFE_COLS - rightEdge; // Actual safety margin from right edge (should be >= SAFE_GAP)
|
|
225
|
+
// Phase A/B: Store debug info for logging and offender scanner
|
|
226
|
+
// Step 5: All values for acceptance test verification
|
|
227
|
+
spec._debug = {
|
|
228
|
+
cols: canvas.cols, // This is safeCols (already has RIGHT_GAP)
|
|
229
|
+
rows: canvas.rows, // This is safeRows (already has BOTTOM_GAP)
|
|
230
|
+
safeCols: SAFE_COLS,
|
|
231
|
+
safeRows,
|
|
232
|
+
GUTTER,
|
|
233
|
+
SAFE_GAP,
|
|
234
|
+
LEFT_W,
|
|
235
|
+
RIGHT_W,
|
|
236
|
+
OPS_MAX_W,
|
|
237
|
+
OPS_MIN_W,
|
|
238
|
+
availableForOps,
|
|
239
|
+
leftX,
|
|
240
|
+
leftW,
|
|
241
|
+
centerX,
|
|
242
|
+
centerW,
|
|
243
|
+
rightX,
|
|
244
|
+
rightW,
|
|
245
|
+
rightEdge: rightEdge,
|
|
246
|
+
gap: safetyMargin, // Safety margin from right edge (should be >= SAFE_GAP)
|
|
247
|
+
status: rightEdge <= (SAFE_COLS - SAFE_GAP) ? 'OK' : 'ERROR',
|
|
153
248
|
};
|
|
249
|
+
// Final safety check already done above - rightEdge verified <= SAFE_COLS
|
|
250
|
+
// Phase E: Clamp all rects to ensure no element exceeds safe bounds
|
|
251
|
+
// Use safeCols/safeRows (already has gaps applied from getSafeViewport)
|
|
252
|
+
for (const [name, rect] of Object.entries(spec.rects)) {
|
|
253
|
+
const isThin = name === 'header' || name === 'command';
|
|
254
|
+
const clamped = clampRect(rect, safeCols, safeRows, isThin);
|
|
255
|
+
if (!clamped) {
|
|
256
|
+
throw new Error(`Panel ${name} invalid after clamping (rect=${rect.x},${rect.y} ${rect.w}x${rect.h} safeCols=${safeCols} safeRows=${safeRows})`);
|
|
257
|
+
}
|
|
258
|
+
// Phase E: Critical anti-scroll rule - verify clamped rect
|
|
259
|
+
if (clamped.x + clamped.w > safeCols || clamped.y + clamped.h > safeRows) {
|
|
260
|
+
throw new Error(`Panel ${name} still exceeds bounds after clamping: ` +
|
|
261
|
+
`rightEdge=${clamped.x + clamped.w} > safeCols=${safeCols} OR ` +
|
|
262
|
+
`bottomEdge=${clamped.y + clamped.h} > safeRows=${safeRows}`);
|
|
263
|
+
}
|
|
264
|
+
spec.rects[name] = clamped;
|
|
265
|
+
}
|
|
266
|
+
// Phase E: Final overflow assertion
|
|
267
|
+
assertNoOverflow(spec, { cols: safeCols, rows: safeRows });
|
|
268
|
+
return spec;
|
|
154
269
|
}
|
|
155
270
|
/**
|
|
156
|
-
*
|
|
157
|
-
* Uses safeCols/safeRows
|
|
271
|
+
* Compute standard layout (same as wide but with adjusted widths)
|
|
158
272
|
*/
|
|
159
|
-
function
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
const
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const rects = {};
|
|
176
|
-
// Status line - within safeCols
|
|
177
|
-
rects['STATUS'] = {
|
|
178
|
-
left: 0,
|
|
179
|
-
top: 0,
|
|
180
|
-
width: safeCols,
|
|
181
|
-
height: statusLineHeight,
|
|
182
|
-
};
|
|
183
|
-
let currentTop = usableTop;
|
|
184
|
-
const panels = ['POSTURE', 'RESOURCES', 'ASSETS', 'OPERATIONS', 'NETWORK', 'CAPABILITIES'];
|
|
185
|
-
for (let i = 0; i < panels.length; i++) {
|
|
186
|
-
const extraRow = i < remainder ? 1 : 0;
|
|
187
|
-
rects[panels[i]] = {
|
|
188
|
-
left: finalMarginX,
|
|
189
|
-
top: currentTop,
|
|
190
|
-
width: finalContentWidth,
|
|
191
|
-
height: panelHeight + extraRow,
|
|
192
|
-
};
|
|
193
|
-
currentTop += panelHeight + extraRow;
|
|
273
|
+
function computeStandardLayout(canvas) {
|
|
274
|
+
const GAP = 1;
|
|
275
|
+
const COMMAND_HEIGHT = 3;
|
|
276
|
+
const HEADER_HEIGHT = 1;
|
|
277
|
+
const AIR_GAP = 1; // 1-col air gap on right and bottom
|
|
278
|
+
const MIN_CENTER_W = 60;
|
|
279
|
+
const MIN_RIGHT_W = 26;
|
|
280
|
+
const MIN_LEFT_W = 26;
|
|
281
|
+
const MIN_MAIN_H = 20;
|
|
282
|
+
const MIN_ROWS = 24;
|
|
283
|
+
// Use safeCols/safeRows (already accounts for padding)
|
|
284
|
+
// Subtract AIR_GAP to ensure nothing ends at safeCols
|
|
285
|
+
const usableCols = canvas.cols - AIR_GAP;
|
|
286
|
+
const usableRows = canvas.rows - AIR_GAP;
|
|
287
|
+
if (usableRows < MIN_ROWS) {
|
|
288
|
+
throw new Error(`Canvas too small for standard layout: rows=${usableRows} < ${MIN_ROWS}`);
|
|
194
289
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
290
|
+
const mainHeight = usableRows - HEADER_HEIGHT - COMMAND_HEIGHT;
|
|
291
|
+
if (mainHeight < MIN_MAIN_H) {
|
|
292
|
+
throw new Error(`Main area too small: height=${mainHeight} < ${MIN_MAIN_H}`);
|
|
293
|
+
}
|
|
294
|
+
// Calculate column widths with priority: center >= 60, right >= 26, left >= 26
|
|
295
|
+
const availableW = usableCols - (GAP * 2);
|
|
296
|
+
const centerW = Math.max(MIN_CENTER_W, Math.floor(availableW * 0.5));
|
|
297
|
+
const rightW = Math.max(MIN_RIGHT_W, Math.floor((availableW - centerW) * 0.4));
|
|
298
|
+
const leftW = availableW - centerW - rightW;
|
|
299
|
+
if (leftW < MIN_LEFT_W) {
|
|
300
|
+
// Adjust: reduce right first, then center if needed
|
|
301
|
+
const needed = MIN_LEFT_W - leftW;
|
|
302
|
+
if (rightW - needed >= MIN_RIGHT_W) {
|
|
303
|
+
const newRightW = rightW - needed;
|
|
304
|
+
const newLeftW = availableW - centerW - newRightW;
|
|
305
|
+
return computeStandardLayoutWithWidths(canvas, newLeftW, centerW, newRightW, GAP, HEADER_HEIGHT, COMMAND_HEIGHT, mainHeight, AIR_GAP);
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
// Must reduce center
|
|
309
|
+
const newCenterW = Math.max(MIN_CENTER_W, centerW - (MIN_LEFT_W - leftW));
|
|
310
|
+
const newRightW = Math.max(MIN_RIGHT_W, rightW);
|
|
311
|
+
const newLeftW = availableW - newCenterW - newRightW;
|
|
312
|
+
return computeStandardLayoutWithWidths(canvas, newLeftW, newCenterW, newRightW, GAP, HEADER_HEIGHT, COMMAND_HEIGHT, mainHeight, AIR_GAP);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return computeStandardLayoutWithWidths(canvas, leftW, centerW, rightW, GAP, HEADER_HEIGHT, COMMAND_HEIGHT, mainHeight, AIR_GAP);
|
|
316
|
+
}
|
|
317
|
+
function computeStandardLayoutWithWidths(canvas, leftW, centerW, rightW, gap, headerHeight, commandHeight, mainHeight, airGap) {
|
|
318
|
+
const usableCols = canvas.cols - airGap;
|
|
319
|
+
const usableRows = canvas.rows - airGap;
|
|
320
|
+
// Left column panels (split vertically)
|
|
321
|
+
const leftPanelH = Math.floor(mainHeight / 3);
|
|
322
|
+
const leftRemainder = mainHeight - (leftPanelH * 3);
|
|
323
|
+
// Right column panels (split vertically)
|
|
324
|
+
const rightPanelH = Math.floor(mainHeight / 2);
|
|
325
|
+
const rightRemainder = mainHeight - (rightPanelH * 2);
|
|
326
|
+
const headerY = 0;
|
|
327
|
+
const mainY = headerHeight;
|
|
328
|
+
const commandY = canvas.rows - commandHeight; // Use canvas.rows to position at very bottom
|
|
329
|
+
// Compute explicit positions (never use right: 0 or bottom: 0)
|
|
330
|
+
const headerW = usableCols;
|
|
331
|
+
const commandW = usableCols;
|
|
332
|
+
const spec = {
|
|
333
|
+
mode: 'standard',
|
|
334
|
+
reason: 'standard',
|
|
335
|
+
rects: {
|
|
336
|
+
header: {
|
|
337
|
+
x: 0,
|
|
338
|
+
y: headerY,
|
|
339
|
+
w: headerW,
|
|
340
|
+
h: headerHeight,
|
|
341
|
+
},
|
|
342
|
+
posture: {
|
|
343
|
+
x: 0,
|
|
344
|
+
y: mainY,
|
|
345
|
+
w: leftW,
|
|
346
|
+
h: leftPanelH + (leftRemainder > 0 ? 1 : 0),
|
|
347
|
+
},
|
|
348
|
+
resources: {
|
|
349
|
+
x: 0,
|
|
350
|
+
y: mainY + leftPanelH + (leftRemainder > 0 ? 1 : 0),
|
|
351
|
+
w: leftW,
|
|
352
|
+
h: leftPanelH + (leftRemainder > 1 ? 1 : 0),
|
|
353
|
+
},
|
|
354
|
+
assets: {
|
|
355
|
+
x: 0,
|
|
356
|
+
y: mainY + (leftPanelH * 2) + Math.min(leftRemainder, 2),
|
|
357
|
+
w: leftW,
|
|
358
|
+
h: leftPanelH + (leftRemainder > 2 ? 1 : 0),
|
|
359
|
+
},
|
|
360
|
+
operations: {
|
|
361
|
+
x: leftW + gap,
|
|
362
|
+
y: mainY,
|
|
363
|
+
w: centerW,
|
|
364
|
+
h: mainHeight,
|
|
365
|
+
},
|
|
366
|
+
network: {
|
|
367
|
+
x: leftW + gap + centerW + gap,
|
|
368
|
+
y: mainY,
|
|
369
|
+
w: rightW,
|
|
370
|
+
h: rightPanelH + (rightRemainder > 0 ? 1 : 0),
|
|
371
|
+
},
|
|
372
|
+
capabilities: {
|
|
373
|
+
x: leftW + gap + centerW + gap,
|
|
374
|
+
y: mainY + rightPanelH + (rightRemainder > 0 ? 1 : 0),
|
|
375
|
+
w: rightW,
|
|
376
|
+
h: rightPanelH + (rightRemainder > 1 ? 1 : 0),
|
|
377
|
+
},
|
|
378
|
+
command: {
|
|
379
|
+
x: 0,
|
|
380
|
+
y: commandY,
|
|
381
|
+
w: commandW,
|
|
382
|
+
h: commandHeight,
|
|
383
|
+
},
|
|
384
|
+
},
|
|
215
385
|
};
|
|
386
|
+
// Clamp all rects (header and command are thin, allow h=1)
|
|
387
|
+
// Use usableCols/usableRows for clamping
|
|
388
|
+
for (const [name, rect] of Object.entries(spec.rects)) {
|
|
389
|
+
const isThin = name === 'header' || name === 'command';
|
|
390
|
+
const clamped = clampRect(rect, usableCols, usableRows, isThin);
|
|
391
|
+
if (!clamped) {
|
|
392
|
+
throw new Error(`Panel ${name} invalid after clamping`);
|
|
393
|
+
}
|
|
394
|
+
spec.rects[name] = clamped;
|
|
395
|
+
}
|
|
396
|
+
assertNoOverflow(spec, { cols: usableCols, rows: usableRows });
|
|
397
|
+
return spec;
|
|
216
398
|
}
|
|
217
399
|
/**
|
|
218
|
-
*
|
|
219
|
-
* Uses safeCols/safeRows
|
|
400
|
+
* Compute stack layout (everything stacked vertically)
|
|
220
401
|
*/
|
|
221
|
-
function
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
402
|
+
function computeStackLayout(canvas) {
|
|
403
|
+
const HEADER_HEIGHT = 1;
|
|
404
|
+
const COMMAND_HEIGHT = 3;
|
|
405
|
+
const GAP = 1;
|
|
406
|
+
const AIR_GAP = 1; // 1-col air gap on right and bottom
|
|
407
|
+
// Use safeCols/safeRows (already accounts for padding)
|
|
408
|
+
// Subtract AIR_GAP to ensure nothing ends at safeCols
|
|
409
|
+
const usableCols = canvas.cols - AIR_GAP;
|
|
410
|
+
const usableRows = canvas.rows - AIR_GAP;
|
|
411
|
+
const usableHeight = usableRows - HEADER_HEIGHT - COMMAND_HEIGHT;
|
|
412
|
+
const panelCount = 6; // posture, resources, assets, operations, network, capabilities
|
|
413
|
+
const panelHeight = Math.max(3, Math.floor(usableHeight / panelCount));
|
|
414
|
+
const remainder = usableHeight - (panelHeight * panelCount);
|
|
415
|
+
const headerY = 0;
|
|
416
|
+
const commandY = canvas.rows - COMMAND_HEIGHT; // Use canvas.rows to position at very bottom
|
|
417
|
+
// Compute explicit positions (never use right: 0 or bottom: 0)
|
|
418
|
+
const headerW = usableCols;
|
|
419
|
+
const commandW = usableCols;
|
|
420
|
+
let currentY = HEADER_HEIGHT;
|
|
421
|
+
const spec = {
|
|
422
|
+
mode: 'stack',
|
|
423
|
+
reason: 'stack',
|
|
424
|
+
rects: {
|
|
425
|
+
header: {
|
|
426
|
+
x: 0,
|
|
427
|
+
y: headerY,
|
|
428
|
+
w: headerW, // Use headerW (usableCols), not canvas.cols
|
|
429
|
+
h: HEADER_HEIGHT,
|
|
430
|
+
},
|
|
431
|
+
posture: {
|
|
432
|
+
x: 0,
|
|
433
|
+
y: currentY,
|
|
434
|
+
w: usableCols, // Use usableCols, not canvas.cols
|
|
435
|
+
h: panelHeight + (remainder > 0 ? 1 : 0),
|
|
436
|
+
},
|
|
437
|
+
resources: {
|
|
438
|
+
x: 0,
|
|
439
|
+
y: currentY += panelHeight + (remainder > 0 ? 1 : 0),
|
|
440
|
+
w: usableCols, // Use usableCols, not canvas.cols
|
|
441
|
+
h: panelHeight + (remainder > 1 ? 1 : 0),
|
|
442
|
+
},
|
|
443
|
+
assets: {
|
|
444
|
+
x: 0,
|
|
445
|
+
y: currentY += panelHeight + (remainder > 1 ? 1 : 0),
|
|
446
|
+
w: usableCols, // Use usableCols, not canvas.cols
|
|
447
|
+
h: panelHeight + (remainder > 2 ? 1 : 0),
|
|
448
|
+
},
|
|
449
|
+
operations: {
|
|
450
|
+
x: 0,
|
|
451
|
+
y: currentY += panelHeight + (remainder > 2 ? 1 : 0),
|
|
452
|
+
w: usableCols, // Use usableCols, not canvas.cols
|
|
453
|
+
h: panelHeight + (remainder > 3 ? 1 : 0),
|
|
454
|
+
},
|
|
455
|
+
network: {
|
|
456
|
+
x: 0,
|
|
457
|
+
y: currentY += panelHeight + (remainder > 3 ? 1 : 0),
|
|
458
|
+
w: usableCols, // Use usableCols, not canvas.cols
|
|
459
|
+
h: panelHeight + (remainder > 4 ? 1 : 0),
|
|
460
|
+
},
|
|
461
|
+
capabilities: {
|
|
462
|
+
x: 0,
|
|
463
|
+
y: currentY += panelHeight + (remainder > 4 ? 1 : 0),
|
|
464
|
+
w: usableCols, // Use usableCols, not canvas.cols
|
|
465
|
+
h: panelHeight + (remainder > 5 ? 1 : 0),
|
|
466
|
+
},
|
|
467
|
+
command: {
|
|
468
|
+
x: 0,
|
|
469
|
+
y: commandY,
|
|
470
|
+
w: commandW, // Use commandW (usableCols), not canvas.cols
|
|
471
|
+
h: COMMAND_HEIGHT,
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
// Clamp all rects (header and command are thin, allow h=1)
|
|
476
|
+
// Use usableCols/usableRows for clamping (already accounts for air gap)
|
|
477
|
+
for (const [name, rect] of Object.entries(spec.rects)) {
|
|
478
|
+
const isThin = name === 'header' || name === 'command';
|
|
479
|
+
const clamped = clampRect(rect, usableCols, usableRows, isThin);
|
|
480
|
+
if (!clamped) {
|
|
481
|
+
throw new Error(`Panel ${name} invalid after clamping`);
|
|
230
482
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
483
|
+
spec.rects[name] = clamped;
|
|
484
|
+
}
|
|
485
|
+
assertNoOverflow(spec, canvas);
|
|
486
|
+
return spec;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Get layout mode from environment or auto-detect
|
|
490
|
+
*/
|
|
491
|
+
function getLayoutMode(canvas) {
|
|
492
|
+
const envMode = process.env.TUI_LAYOUT;
|
|
493
|
+
if (envMode === 'wide') {
|
|
494
|
+
return { mode: 'wide', reason: 'env=wide' };
|
|
495
|
+
}
|
|
496
|
+
if (envMode === 'standard') {
|
|
497
|
+
return { mode: 'standard', reason: 'env=standard' };
|
|
498
|
+
}
|
|
499
|
+
if (envMode === 'stack') {
|
|
500
|
+
return { mode: 'stack', reason: 'env=stack' };
|
|
501
|
+
}
|
|
502
|
+
// Auto-detect: try wide first, then standard, then stack
|
|
503
|
+
try {
|
|
504
|
+
computeWideLayout(canvas);
|
|
505
|
+
return { mode: 'wide', reason: 'auto' };
|
|
506
|
+
}
|
|
507
|
+
catch {
|
|
508
|
+
// Wide failed, try standard
|
|
509
|
+
try {
|
|
510
|
+
computeStandardLayout(canvas);
|
|
511
|
+
return { mode: 'standard', reason: 'auto' };
|
|
237
512
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return
|
|
513
|
+
catch {
|
|
514
|
+
// Both failed, use stack
|
|
515
|
+
return { mode: 'stack', reason: 'auto-fallback' };
|
|
241
516
|
}
|
|
242
517
|
}
|
|
243
|
-
return false;
|
|
244
518
|
}
|
|
245
519
|
/**
|
|
246
|
-
*
|
|
247
|
-
* Uses safeCols/safeRows from layout
|
|
520
|
+
* Compute layout - main entry point
|
|
248
521
|
*/
|
|
249
|
-
export function
|
|
250
|
-
const {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
522
|
+
export function computeLayout(canvas) {
|
|
523
|
+
const { mode, reason } = getLayoutMode(canvas);
|
|
524
|
+
try {
|
|
525
|
+
if (mode === 'wide') {
|
|
526
|
+
const spec = computeWideLayout(canvas);
|
|
527
|
+
spec.reason = reason;
|
|
528
|
+
return spec;
|
|
529
|
+
}
|
|
530
|
+
else if (mode === 'standard') {
|
|
531
|
+
const spec = computeStandardLayout(canvas);
|
|
532
|
+
spec.reason = reason;
|
|
533
|
+
return spec;
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
const spec = computeStackLayout(canvas);
|
|
537
|
+
spec.reason = reason;
|
|
538
|
+
return spec;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
catch (error) {
|
|
542
|
+
// If requested mode fails, fallback to stack
|
|
543
|
+
if (mode !== 'stack') {
|
|
544
|
+
const spec = computeStackLayout(canvas);
|
|
545
|
+
spec.reason = `${reason}→fallback-stack`;
|
|
546
|
+
return spec;
|
|
547
|
+
}
|
|
548
|
+
throw error;
|
|
255
549
|
}
|
|
256
|
-
return layout;
|
|
257
550
|
}
|
|
258
551
|
//# sourceMappingURL=layoutEngine.js.map
|