@timurproko/a1 0.1.0 → 0.1.1-dev.10
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/README.md +10 -43
- package/bin/{addone.js → cli.js} +2 -2
- package/bin/guardian.js +22 -0
- package/bin/ui.js +20 -0
- package/dist/native/darwin-arm64/manifest.json +20 -0
- package/dist/native/darwin-arm64/process-guardian +0 -0
- package/dist/native/linux-x64/manifest.json +20 -0
- package/dist/native/linux-x64/process-guardian +0 -0
- package/dist/native/win32-x64/manifest.json +20 -0
- package/dist/native/win32-x64/process-guardian.exe +0 -0
- package/dist/src/cli/dispatch.d.ts +4 -5
- package/dist/src/cli/dispatch.js +11 -11
- package/dist/src/cli/index.d.ts +0 -1
- package/dist/src/cli/index.js +0 -1
- package/dist/src/cli/version-stats.d.ts +0 -1
- package/dist/src/cli/version-stats.js +27 -23
- package/dist/src/cli/version.d.ts +1 -2
- package/dist/src/cli/version.js +4 -4
- package/dist/src/composition/index.d.ts +48 -0
- package/dist/src/composition/index.js +258 -0
- package/dist/src/features/launch/development-launch.d.ts +0 -1
- package/dist/src/features/launch/development-launch.js +12 -11
- package/dist/src/features/launch/index.d.ts +0 -1
- package/dist/src/features/launch/index.js +0 -1
- package/dist/src/features/launch/initialize-profile.d.ts +1 -2
- package/dist/src/features/launch/initialize-profile.js +24 -4
- package/dist/src/features/launch/intent.d.ts +0 -1
- package/dist/src/features/launch/intent.js +0 -1
- package/dist/src/features/launch/prepare-launch.d.ts +2 -3
- package/dist/src/features/launch/prepare-launch.js +3 -4
- package/dist/src/features/launch/profile-paths.d.ts +2 -3
- package/dist/src/features/launch/profile-paths.js +9 -8
- package/dist/src/features/launch/profiles.d.ts +3 -4
- package/dist/src/features/launch/profiles.js +7 -8
- package/dist/src/features/launch/runtime-selection.d.ts +13 -9
- package/dist/src/features/launch/runtime-selection.js +6 -7
- package/dist/src/features/owned-ui/customization.d.ts +5 -3
- package/dist/src/features/owned-ui/customization.js +2 -4
- package/dist/src/features/owned-ui/diagnostics.d.ts +0 -1
- package/dist/src/features/owned-ui/diagnostics.js +0 -1
- package/dist/src/features/owned-ui/index.d.ts +1 -2
- package/dist/src/features/owned-ui/index.js +1 -2
- package/dist/src/features/owned-ui/run.d.ts +9 -7
- package/dist/src/features/owned-ui/run.js +9 -15
- package/dist/src/features/owned-ui/settings-app.d.ts +22 -0
- package/dist/src/features/owned-ui/settings-app.js +633 -0
- package/dist/src/features/workspace/capabilities.d.ts +0 -1
- package/dist/src/features/workspace/capabilities.js +0 -1
- package/dist/src/features/workspace/index.d.ts +0 -1
- package/dist/src/features/workspace/index.js +0 -1
- package/dist/src/features/workspace/presentation.d.ts +1 -2
- package/dist/src/features/workspace/presentation.js +5 -4
- package/dist/src/features/workspace/reconciliation.d.ts +0 -1
- package/dist/src/features/workspace/reconciliation.js +0 -1
- package/dist/src/features/workspace/reducer.d.ts +0 -1
- package/dist/src/features/workspace/reducer.js +0 -1
- package/dist/src/features/workspace/router.d.ts +0 -1
- package/dist/src/features/workspace/router.js +0 -1
- package/dist/src/features/workspace/store.d.ts +0 -1
- package/dist/src/features/workspace/store.js +0 -1
- package/dist/src/foundation/agent-engine-contracts/capability-ports.d.ts +95 -0
- package/dist/src/foundation/agent-engine-contracts/capability-ports.js +35 -0
- package/dist/src/foundation/agent-engine-contracts/domain-validation.d.ts +12 -0
- package/dist/src/foundation/agent-engine-contracts/domain-validation.js +89 -0
- package/dist/src/foundation/agent-engine-contracts/domain.d.ts +116 -0
- package/dist/src/foundation/agent-engine-contracts/domain.js +1 -0
- package/dist/src/foundation/agent-engine-contracts/index.d.ts +7 -0
- package/dist/src/foundation/agent-engine-contracts/index.js +7 -0
- package/dist/src/foundation/agent-engine-contracts/model.d.ts +78 -0
- package/dist/src/foundation/agent-engine-contracts/model.js +1 -0
- package/dist/src/foundation/agent-engine-contracts/ports.d.ts +18 -0
- package/dist/src/foundation/agent-engine-contracts/ports.js +1 -0
- package/dist/src/foundation/agent-engine-contracts/serialization.d.ts +7 -0
- package/dist/src/foundation/agent-engine-contracts/serialization.js +58 -0
- package/dist/src/foundation/agent-engine-contracts/validation.d.ts +5 -0
- package/dist/src/foundation/agent-engine-contracts/validation.js +128 -0
- package/dist/src/foundation/launch-guardian/index.d.ts +1 -0
- package/dist/src/foundation/launch-guardian/index.js +1 -0
- package/dist/src/foundation/launch-guardian/main.d.ts +31 -0
- package/dist/src/foundation/launch-guardian/main.js +165 -0
- package/dist/src/foundation/lifecycle/commands.d.ts +40 -0
- package/dist/src/foundation/lifecycle/commands.js +1 -0
- package/dist/src/foundation/lifecycle/index.d.ts +2 -1
- package/dist/src/foundation/lifecycle/index.js +2 -1
- package/dist/src/foundation/lifecycle/launch-instance.d.ts +46 -0
- package/dist/src/foundation/lifecycle/launch-instance.js +134 -0
- package/dist/src/foundation/lifecycle/model.d.ts +7 -44
- package/dist/src/foundation/lifecycle/model.js +3 -3
- package/dist/src/foundation/lifecycle/paths.d.ts +2 -3
- package/dist/src/foundation/lifecycle/paths.js +32 -16
- package/dist/src/foundation/native-host-protocol/codec.d.ts +0 -1
- package/dist/src/foundation/native-host-protocol/codec.js +0 -1
- package/dist/src/foundation/native-host-protocol/evidence.d.ts +2 -3
- package/dist/src/foundation/native-host-protocol/evidence.js +4 -4
- package/dist/src/foundation/native-host-protocol/index.d.ts +0 -1
- package/dist/src/foundation/native-host-protocol/index.js +0 -1
- package/dist/src/foundation/native-host-protocol/messages.d.ts +1 -2
- package/dist/src/foundation/native-host-protocol/messages.js +2 -2
- package/dist/src/foundation/native-host-protocol/proof-gate.d.ts +0 -1
- package/dist/src/foundation/native-host-protocol/proof-gate.js +0 -1
- package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts +0 -1
- package/dist/src/foundation/owned-ui-contracts/extension-ui.js +0 -1
- package/dist/src/foundation/owned-ui-contracts/index.d.ts +0 -1
- package/dist/src/foundation/owned-ui-contracts/index.js +0 -1
- package/dist/src/foundation/owned-ui-contracts/model.d.ts +0 -1
- package/dist/src/foundation/owned-ui-contracts/model.js +0 -1
- package/dist/src/foundation/owned-ui-contracts/validation.d.ts +0 -1
- package/dist/src/foundation/owned-ui-contracts/validation.js +0 -1
- package/dist/src/foundation/owned-ui-settings/declarations.d.ts +13 -0
- package/dist/src/foundation/owned-ui-settings/declarations.js +39 -0
- package/dist/src/foundation/owned-ui-settings/index.d.ts +6 -0
- package/dist/src/foundation/owned-ui-settings/index.js +6 -0
- package/dist/src/foundation/owned-ui-settings/migrations.d.ts +13 -0
- package/dist/src/foundation/owned-ui-settings/migrations.js +28 -0
- package/dist/src/foundation/owned-ui-settings/resolution.d.ts +45 -0
- package/dist/src/foundation/owned-ui-settings/resolution.js +147 -0
- package/dist/src/foundation/owned-ui-settings/sections.d.ts +70 -0
- package/dist/src/foundation/owned-ui-settings/sections.js +93 -0
- package/dist/src/foundation/owned-ui-settings/session.d.ts +44 -0
- package/dist/src/foundation/owned-ui-settings/session.js +145 -0
- package/dist/src/foundation/owned-ui-settings/store.d.ts +28 -0
- package/dist/src/foundation/owned-ui-settings/store.js +90 -0
- package/dist/src/foundation/pi-component-adapter/components.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/components.js +0 -1
- package/dist/src/foundation/pi-component-adapter/conformance.d.ts +1 -1
- package/dist/src/foundation/pi-component-adapter/conformance.js +10 -4
- package/dist/src/foundation/pi-component-adapter/index.d.ts +1 -1
- package/dist/src/foundation/pi-component-adapter/index.js +1 -1
- package/dist/src/foundation/pi-component-adapter/resources/builtin-themes.d.ts +165 -0
- package/dist/src/foundation/pi-component-adapter/resources/builtin-themes.js +166 -0
- package/dist/src/foundation/pi-component-adapter/shell-components.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-components.js +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js +10 -13
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.js +5 -62
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts +9 -2
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js +10 -9
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js +0 -1
- package/dist/src/foundation/pi-component-adapter/theme.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/theme.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js +3 -27
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.d.ts +18 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/owned-editor.js +55 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-footer.d.ts +10 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-footer.js +120 -0
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts +1 -2
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js +1 -2
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.js +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js +1 -2
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts +8 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js +30 -15
- package/dist/src/foundation/pi-engine-adapter/adapter.d.ts +19 -205
- package/dist/src/foundation/pi-engine-adapter/adapter.js +156 -181
- package/dist/src/foundation/pi-engine-adapter/conformance.d.ts +24 -1
- package/dist/src/foundation/pi-engine-adapter/conformance.js +60 -15
- package/dist/src/foundation/pi-engine-adapter/index.d.ts +6 -1
- package/dist/src/foundation/pi-engine-adapter/index.js +6 -1
- package/dist/src/foundation/pi-engine-adapter/model-auth-integration.d.ts +30 -0
- package/dist/src/foundation/pi-engine-adapter/model-auth-integration.js +61 -0
- package/dist/src/foundation/pi-engine-adapter/pi-settings-metadata.json +374 -0
- package/dist/src/foundation/pi-engine-adapter/public-main-entry.d.ts +5 -0
- package/dist/src/foundation/pi-engine-adapter/public-main-entry.js +27 -0
- package/dist/src/foundation/pi-engine-adapter/resource-extension-integration.d.ts +31 -0
- package/dist/src/foundation/pi-engine-adapter/resource-extension-integration.js +80 -0
- package/dist/src/foundation/pi-engine-adapter/runtime-integration.d.ts +18 -0
- package/dist/src/foundation/pi-engine-adapter/runtime-integration.js +32 -0
- package/dist/src/foundation/pi-engine-adapter/session-integration.d.ts +43 -0
- package/dist/src/foundation/pi-engine-adapter/session-integration.js +97 -0
- package/dist/src/foundation/pi-engine-adapter/settings-integration.d.ts +55 -0
- package/dist/src/foundation/pi-engine-adapter/settings-integration.js +233 -0
- package/dist/src/foundation/pi-engine-adapter/workflow-controllers.d.ts +20 -0
- package/dist/src/foundation/pi-engine-adapter/workflow-controllers.js +48 -0
- package/dist/src/foundation/pi-engine-adapter/workflows.d.ts +9 -1
- package/dist/src/foundation/pi-engine-adapter/workflows.js +0 -1
- package/dist/src/foundation/pi-owned-ui-integration/index.d.ts +2 -0
- package/dist/src/foundation/pi-owned-ui-integration/index.js +2 -0
- package/dist/src/foundation/pi-owned-ui-integration/route-host.d.ts +29 -0
- package/dist/src/foundation/pi-owned-ui-integration/route-host.js +1 -0
- package/dist/src/{features/owned-ui/pi-session-shell.d.ts → foundation/pi-owned-ui-integration/session-shell.d.ts} +23 -14
- package/dist/src/{features/owned-ui/pi-session-shell.js → foundation/pi-owned-ui-integration/session-shell.js} +130 -61
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts +6 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js +9 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts +8 -4
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js +22 -9
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts +0 -2
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.js +1 -2
- package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts +1 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/index.js +1 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/presentation-adapter.d.ts +4 -0
- package/dist/src/foundation/pi-tui-runtime-adapter/presentation-adapter.js +48 -0
- package/dist/src/foundation/presentation-contracts/index.d.ts +96 -0
- package/dist/src/foundation/presentation-contracts/index.js +38 -0
- package/dist/src/foundation/process-containment/artifact.d.ts +1 -0
- package/dist/src/foundation/process-containment/artifact.js +34 -0
- package/dist/src/foundation/process-containment/contracts.d.ts +31 -0
- package/dist/src/foundation/process-containment/contracts.js +35 -0
- package/dist/src/foundation/process-containment/index.d.ts +5 -0
- package/dist/src/foundation/process-containment/index.js +5 -0
- package/dist/src/foundation/process-containment/linux-process-inspector.d.ts +6 -0
- package/dist/src/foundation/process-containment/linux-process-inspector.js +26 -0
- package/dist/src/foundation/process-containment/native-guardian-containment.d.ts +16 -0
- package/dist/src/foundation/process-containment/native-guardian-containment.js +139 -0
- package/dist/src/foundation/process-containment/windows-process-inspector.d.ts +17 -0
- package/dist/src/foundation/process-containment/windows-process-inspector.js +53 -0
- package/dist/src/foundation/protocol/client.d.ts +2 -2
- package/dist/src/foundation/protocol/client.js +3 -1
- package/dist/src/foundation/protocol/index.d.ts +0 -1
- package/dist/src/foundation/protocol/index.js +0 -1
- package/dist/src/foundation/protocol/messages.d.ts +6 -7
- package/dist/src/foundation/protocol/messages.js +3 -3
- package/dist/src/foundation/release/bootstrap.d.ts +2 -3
- package/dist/src/foundation/release/bootstrap.js +85 -33
- package/dist/src/foundation/release/cohort-selection.d.ts +0 -1
- package/dist/src/foundation/release/cohort-selection.js +3 -4
- package/dist/src/foundation/release/cohort-state.d.ts +6 -4
- package/dist/src/foundation/release/cohort-state.js +5 -4
- package/dist/src/foundation/release/concurrency.d.ts +1 -0
- package/dist/src/foundation/release/concurrency.js +17 -0
- package/dist/src/foundation/release/development-preview-release.d.ts +2 -2
- package/dist/src/foundation/release/development-preview-release.js +3 -2
- package/dist/src/foundation/release/index.d.ts +0 -1
- package/dist/src/foundation/release/index.js +0 -1
- package/dist/src/foundation/release/process-cleanup.d.ts +1 -2
- package/dist/src/foundation/release/process-cleanup.js +2 -3
- package/dist/src/foundation/release/release-gc.d.ts +0 -1
- package/dist/src/foundation/release/release-gc.js +0 -1
- package/dist/src/foundation/release/release-store.d.ts +38 -6
- package/dist/src/foundation/release/release-store.js +103 -43
- package/dist/src/foundation/release/release.d.ts +20 -6
- package/dist/src/foundation/release/release.js +77 -48
- package/dist/src/foundation/release/stable-release.d.ts +2 -2
- package/dist/src/foundation/release/stable-release.js +6 -5
- package/dist/src/foundation/release/update-transaction.d.ts +2 -2
- package/dist/src/foundation/release/update-transaction.js +8 -7
- package/dist/src/foundation/release/update.d.ts +20 -4
- package/dist/src/foundation/release/update.js +152 -36
- package/dist/src/foundation/storage/control-store.d.ts +8 -8
- package/dist/src/foundation/storage/control-store.js +132 -61
- package/dist/src/foundation/storage/index.d.ts +0 -1
- package/dist/src/foundation/storage/index.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/backpressure.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/commands.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/commands.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/handshake.d.ts +2 -3
- package/dist/src/foundation/structured-agent-runtime/handshake.js +13 -13
- package/dist/src/foundation/structured-agent-runtime/index.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/index.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/reconnection.js +0 -1
- package/dist/src/foundation/structured-agent-runtime/state.d.ts +0 -1
- package/dist/src/foundation/structured-agent-runtime/state.js +0 -1
- package/dist/src/foundation/supervision/index.d.ts +1 -2
- package/dist/src/foundation/supervision/index.js +1 -2
- package/dist/src/foundation/supervision/main.d.ts +0 -1
- package/dist/src/foundation/supervision/main.js +11 -10
- package/dist/src/foundation/supervision/paths.d.ts +1 -2
- package/dist/src/foundation/supervision/paths.js +1 -2
- package/dist/src/foundation/supervision/server.d.ts +6 -5
- package/dist/src/foundation/supervision/server.js +259 -91
- package/dist/src/foundation/ui-apps/contracts.d.ts +42 -0
- package/dist/src/foundation/ui-apps/contracts.js +12 -0
- package/dist/src/foundation/ui-apps/host.d.ts +42 -0
- package/dist/src/foundation/ui-apps/host.js +152 -0
- package/dist/src/foundation/ui-apps/index.d.ts +3 -0
- package/dist/src/foundation/ui-apps/index.js +3 -0
- package/dist/src/foundation/ui-apps/registry.d.ts +11 -0
- package/dist/src/foundation/ui-apps/registry.js +32 -0
- package/dist/src/foundation/ui-components/dialog-panel.d.ts +36 -0
- package/dist/src/foundation/ui-components/dialog-panel.js +47 -0
- package/dist/src/foundation/ui-components/frame.d.ts +21 -0
- package/dist/src/foundation/ui-components/frame.js +54 -0
- package/dist/src/foundation/ui-components/index.d.ts +18 -0
- package/dist/src/foundation/ui-components/index.js +18 -0
- package/dist/src/foundation/ui-components/label.d.ts +8 -0
- package/dist/src/foundation/ui-components/label.js +36 -0
- package/dist/src/foundation/ui-components/line-input.d.ts +74 -0
- package/dist/src/foundation/ui-components/line-input.js +245 -0
- package/dist/src/foundation/ui-components/list-block.d.ts +66 -0
- package/dist/src/foundation/ui-components/list-block.js +176 -0
- package/dist/src/foundation/ui-components/list-view.d.ts +66 -0
- package/dist/src/foundation/ui-components/list-view.js +76 -0
- package/dist/src/foundation/ui-components/mouse.d.ts +15 -0
- package/dist/src/foundation/ui-components/mouse.js +46 -0
- package/dist/src/foundation/ui-components/pane.d.ts +33 -0
- package/dist/src/foundation/ui-components/pane.js +7 -0
- package/dist/src/foundation/ui-components/revision.d.ts +35 -0
- package/dist/src/foundation/ui-components/revision.js +79 -0
- package/dist/src/foundation/ui-components/scrollbar.d.ts +62 -0
- package/dist/src/foundation/ui-components/scrollbar.js +102 -0
- package/dist/src/foundation/ui-components/shortcuts.d.ts +57 -0
- package/dist/src/foundation/ui-components/shortcuts.js +81 -0
- package/dist/src/foundation/ui-components/spans.d.ts +7 -0
- package/dist/src/foundation/ui-components/spans.js +59 -0
- package/dist/src/foundation/ui-components/status-line.d.ts +16 -0
- package/dist/src/foundation/ui-components/status-line.js +14 -0
- package/dist/src/foundation/ui-components/stepper.d.ts +24 -0
- package/dist/src/foundation/ui-components/stepper.js +33 -0
- package/dist/src/foundation/ui-components/surface.d.ts +20 -0
- package/dist/src/foundation/ui-components/surface.js +38 -0
- package/dist/src/foundation/ui-components/text.d.ts +24 -0
- package/dist/src/foundation/ui-components/text.js +123 -0
- package/dist/src/foundation/ui-components/theme.d.ts +23 -0
- package/dist/src/foundation/ui-components/theme.js +13 -0
- package/dist/src/foundation/ui-components/value-menu.d.ts +41 -0
- package/dist/src/foundation/ui-components/value-menu.js +33 -0
- package/dist/src/foundation/workspace-contracts/index.d.ts +0 -1
- package/dist/src/foundation/workspace-contracts/index.js +0 -1
- package/dist/src/foundation/workspace-contracts/model.d.ts +0 -1
- package/dist/src/foundation/workspace-contracts/model.js +0 -1
- package/dist/src/foundation/workspace-contracts/validation.d.ts +0 -1
- package/dist/src/foundation/workspace-contracts/validation.js +0 -1
- package/dist/src/product-identity.d.ts +37 -0
- package/dist/src/product-identity.js +150 -0
- package/dist/src/product-identity.json +99 -0
- package/docs/architecture/boundaries.md +32 -14
- package/docs/architecture/process-guardian-provenance.md +26 -0
- package/docs/architecture/project-structure.md +2 -2
- package/docs/architecture/resource-and-data-policy.md +1 -1
- package/docs/architecture/terminal-host-proof-gate.md +2 -2
- package/docs/architecture/terminal-host-provenance.md +3 -3
- package/docs/architecture/terminal-host-spike-evidence.md +1 -1
- package/docs/architecture/toolchain.md +40 -8
- package/docs/architecture/ui-reference-provenance.md +50 -0
- package/docs/ci-release-runbook.md +67 -0
- package/docs/features/launch-profiles.md +12 -6
- package/docs/manual-launch-instance-acceptance.md +66 -0
- package/docs/manual-pi-boundary-candidate.md +33 -0
- package/docs/manual-terminal-colour-check.md +55 -0
- package/docs/manual-transparent-checkpoint.md +11 -11
- package/package.json +27 -14
- package/bin/addone-ui.js +0 -20
- package/dist/src/cli/dispatch.d.ts.map +0 -1
- package/dist/src/cli/dispatch.js.map +0 -1
- package/dist/src/cli/index.d.ts.map +0 -1
- package/dist/src/cli/index.js.map +0 -1
- package/dist/src/cli/version-stats.d.ts.map +0 -1
- package/dist/src/cli/version-stats.js.map +0 -1
- package/dist/src/cli/version.d.ts.map +0 -1
- package/dist/src/cli/version.js.map +0 -1
- package/dist/src/features/launch/development-launch.d.ts.map +0 -1
- package/dist/src/features/launch/development-launch.js.map +0 -1
- package/dist/src/features/launch/index.d.ts.map +0 -1
- package/dist/src/features/launch/index.js.map +0 -1
- package/dist/src/features/launch/initialize-profile.d.ts.map +0 -1
- package/dist/src/features/launch/initialize-profile.js.map +0 -1
- package/dist/src/features/launch/intent.d.ts.map +0 -1
- package/dist/src/features/launch/intent.js.map +0 -1
- package/dist/src/features/launch/prepare-launch.d.ts.map +0 -1
- package/dist/src/features/launch/prepare-launch.js.map +0 -1
- package/dist/src/features/launch/profile-paths.d.ts.map +0 -1
- package/dist/src/features/launch/profile-paths.js.map +0 -1
- package/dist/src/features/launch/profiles.d.ts.map +0 -1
- package/dist/src/features/launch/profiles.js.map +0 -1
- package/dist/src/features/launch/runtime-selection.d.ts.map +0 -1
- package/dist/src/features/launch/runtime-selection.js.map +0 -1
- package/dist/src/features/owned-ui/customization.d.ts.map +0 -1
- package/dist/src/features/owned-ui/customization.js.map +0 -1
- package/dist/src/features/owned-ui/diagnostics.d.ts.map +0 -1
- package/dist/src/features/owned-ui/diagnostics.js.map +0 -1
- package/dist/src/features/owned-ui/index.d.ts.map +0 -1
- package/dist/src/features/owned-ui/index.js.map +0 -1
- package/dist/src/features/owned-ui/pi-session-shell.d.ts.map +0 -1
- package/dist/src/features/owned-ui/pi-session-shell.js.map +0 -1
- package/dist/src/features/owned-ui/run.d.ts.map +0 -1
- package/dist/src/features/owned-ui/run.js.map +0 -1
- package/dist/src/features/workspace/capabilities.d.ts.map +0 -1
- package/dist/src/features/workspace/capabilities.js.map +0 -1
- package/dist/src/features/workspace/index.d.ts.map +0 -1
- package/dist/src/features/workspace/index.js.map +0 -1
- package/dist/src/features/workspace/presentation.d.ts.map +0 -1
- package/dist/src/features/workspace/presentation.js.map +0 -1
- package/dist/src/features/workspace/reconciliation.d.ts.map +0 -1
- package/dist/src/features/workspace/reconciliation.js.map +0 -1
- package/dist/src/features/workspace/reducer.d.ts.map +0 -1
- package/dist/src/features/workspace/reducer.js.map +0 -1
- package/dist/src/features/workspace/router.d.ts.map +0 -1
- package/dist/src/features/workspace/router.js.map +0 -1
- package/dist/src/features/workspace/store.d.ts.map +0 -1
- package/dist/src/features/workspace/store.js.map +0 -1
- package/dist/src/foundation/lifecycle/index.d.ts.map +0 -1
- package/dist/src/foundation/lifecycle/index.js.map +0 -1
- package/dist/src/foundation/lifecycle/model.d.ts.map +0 -1
- package/dist/src/foundation/lifecycle/model.js.map +0 -1
- package/dist/src/foundation/lifecycle/paths.d.ts.map +0 -1
- package/dist/src/foundation/lifecycle/paths.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/codec.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/codec.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/evidence.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/evidence.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/index.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/index.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/messages.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/messages.js.map +0 -1
- package/dist/src/foundation/native-host-protocol/proof-gate.d.ts.map +0 -1
- package/dist/src/foundation/native-host-protocol/proof-gate.js.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/extension-ui.d.ts.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/extension-ui.js.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/index.d.ts.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/index.js.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/model.d.ts.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/model.js.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/validation.d.ts.map +0 -1
- package/dist/src/foundation/owned-ui-contracts/validation.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/components.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/components.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/conformance.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/conformance.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/index.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/index.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-components.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-components.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-editor-autocomplete.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-extension-ui.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-footer-status.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-presenters-transcript.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-selectors-dialogs.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/shell-shared-facade.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/theme.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/theme.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/adjacent/core/keybindings.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/countdown-timer.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/custom-entry.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/daxnuts.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/earendil-announcement.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/extension-editor.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/first-time-setup.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/markdown-transform.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/mermaid.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/scoped-models-selector.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector-search.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/session-selector.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/skill-invocation-message.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/status-indicator.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/tree-selector.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/components/trust-selector.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/external-editor.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/model-search.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme-controller.js.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.d.ts.map +0 -1
- package/dist/src/foundation/pi-component-adapter/upstream/theme/theme.js.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/adapter.d.ts.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/adapter.js.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/conformance.d.ts.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/conformance.js.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/index.d.ts.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/index.js.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/workflows.d.ts.map +0 -1
- package/dist/src/foundation/pi-engine-adapter/workflows.js.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.d.ts.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/adapter.js.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.d.ts.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/conformance.js.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.d.ts.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/contracts.js.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/index.d.ts.map +0 -1
- package/dist/src/foundation/pi-tui-runtime-adapter/index.js.map +0 -1
- package/dist/src/foundation/protocol/client.d.ts.map +0 -1
- package/dist/src/foundation/protocol/client.js.map +0 -1
- package/dist/src/foundation/protocol/index.d.ts.map +0 -1
- package/dist/src/foundation/protocol/index.js.map +0 -1
- package/dist/src/foundation/protocol/messages.d.ts.map +0 -1
- package/dist/src/foundation/protocol/messages.js.map +0 -1
- package/dist/src/foundation/release/bootstrap.d.ts.map +0 -1
- package/dist/src/foundation/release/bootstrap.js.map +0 -1
- package/dist/src/foundation/release/cohort-selection.d.ts.map +0 -1
- package/dist/src/foundation/release/cohort-selection.js.map +0 -1
- package/dist/src/foundation/release/cohort-state.d.ts.map +0 -1
- package/dist/src/foundation/release/cohort-state.js.map +0 -1
- package/dist/src/foundation/release/development-preview-release.d.ts.map +0 -1
- package/dist/src/foundation/release/development-preview-release.js.map +0 -1
- package/dist/src/foundation/release/index.d.ts.map +0 -1
- package/dist/src/foundation/release/index.js.map +0 -1
- package/dist/src/foundation/release/process-cleanup.d.ts.map +0 -1
- package/dist/src/foundation/release/process-cleanup.js.map +0 -1
- package/dist/src/foundation/release/release-gc.d.ts.map +0 -1
- package/dist/src/foundation/release/release-gc.js.map +0 -1
- package/dist/src/foundation/release/release-store.d.ts.map +0 -1
- package/dist/src/foundation/release/release-store.js.map +0 -1
- package/dist/src/foundation/release/release.d.ts.map +0 -1
- package/dist/src/foundation/release/release.js.map +0 -1
- package/dist/src/foundation/release/stable-release.d.ts.map +0 -1
- package/dist/src/foundation/release/stable-release.js.map +0 -1
- package/dist/src/foundation/release/update-transaction.d.ts.map +0 -1
- package/dist/src/foundation/release/update-transaction.js.map +0 -1
- package/dist/src/foundation/release/update.d.ts.map +0 -1
- package/dist/src/foundation/release/update.js.map +0 -1
- package/dist/src/foundation/storage/control-store.d.ts.map +0 -1
- package/dist/src/foundation/storage/control-store.js.map +0 -1
- package/dist/src/foundation/storage/index.d.ts.map +0 -1
- package/dist/src/foundation/storage/index.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/backpressure.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/backpressure.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/commands.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/commands.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/handshake.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/handshake.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/index.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/index.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/reconnection.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/reconnection.js.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/state.d.ts.map +0 -1
- package/dist/src/foundation/structured-agent-runtime/state.js.map +0 -1
- package/dist/src/foundation/supervision/index.d.ts.map +0 -1
- package/dist/src/foundation/supervision/index.js.map +0 -1
- package/dist/src/foundation/supervision/main.d.ts.map +0 -1
- package/dist/src/foundation/supervision/main.js.map +0 -1
- package/dist/src/foundation/supervision/paths.d.ts.map +0 -1
- package/dist/src/foundation/supervision/paths.js.map +0 -1
- package/dist/src/foundation/supervision/server.d.ts.map +0 -1
- package/dist/src/foundation/supervision/server.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/command-resolution.d.ts +0 -14
- package/dist/src/foundation/transparent-terminal/command-resolution.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/command-resolution.js +0 -70
- package/dist/src/foundation/transparent-terminal/command-resolution.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/foreground-broker.d.ts +0 -33
- package/dist/src/foundation/transparent-terminal/foreground-broker.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/foreground-broker.js +0 -88
- package/dist/src/foundation/transparent-terminal/foreground-broker.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/index.d.ts +0 -4
- package/dist/src/foundation/transparent-terminal/index.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/index.js +0 -4
- package/dist/src/foundation/transparent-terminal/index.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/main.d.ts +0 -10
- package/dist/src/foundation/transparent-terminal/main.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/main.js +0 -107
- package/dist/src/foundation/transparent-terminal/main.js.map +0 -1
- package/dist/src/foundation/transparent-terminal/native-launcher.d.ts +0 -26
- package/dist/src/foundation/transparent-terminal/native-launcher.d.ts.map +0 -1
- package/dist/src/foundation/transparent-terminal/native-launcher.js +0 -147
- package/dist/src/foundation/transparent-terminal/native-launcher.js.map +0 -1
- package/dist/src/foundation/workspace-contracts/index.d.ts.map +0 -1
- package/dist/src/foundation/workspace-contracts/index.js.map +0 -1
- package/dist/src/foundation/workspace-contracts/model.d.ts.map +0 -1
- package/dist/src/foundation/workspace-contracts/model.js.map +0 -1
- package/dist/src/foundation/workspace-contracts/validation.d.ts.map +0 -1
- package/dist/src/foundation/workspace-contracts/validation.js.map +0 -1
- /package/bin/{addone-supervisor.js → supervisor.js} +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SGR mouse reporting. A screen that wants hover, click, and drag needs the
|
|
3
|
+
* terminal to send reports; nothing else in A1 turns this on, and the sequences
|
|
4
|
+
* are paired so the terminal is always left as it was found.
|
|
5
|
+
*/
|
|
6
|
+
export const MOUSE_TRACKING_ON = "\u001b[?1006h\u001b[?1000h\u001b[?1003h";
|
|
7
|
+
export const MOUSE_TRACKING_OFF = "\u001b[?1003l\u001b[?1000l\u001b[?1006l";
|
|
8
|
+
const SGR_PATTERN = /\u001b\[<(\d+);(\d+);(\d+)([Mm])/g;
|
|
9
|
+
/** Extracts SGR mouse reports, leaving any keyboard input untouched. */
|
|
10
|
+
export function parseMouseInput(data) {
|
|
11
|
+
if (!data.includes("\u001b[<"))
|
|
12
|
+
return { events: [], rest: data };
|
|
13
|
+
const events = [];
|
|
14
|
+
let rest = "";
|
|
15
|
+
let index = 0;
|
|
16
|
+
SGR_PATTERN.lastIndex = 0;
|
|
17
|
+
for (let match = SGR_PATTERN.exec(data); match !== null; match = SGR_PATTERN.exec(data)) {
|
|
18
|
+
rest += data.slice(index, match.index);
|
|
19
|
+
index = match.index + match[0].length;
|
|
20
|
+
const code = Number.parseInt(match[1] ?? "", 10);
|
|
21
|
+
const column = Number.parseInt(match[2] ?? "", 10);
|
|
22
|
+
const row = Number.parseInt(match[3] ?? "", 10);
|
|
23
|
+
const released = match[4] === "m";
|
|
24
|
+
if (!Number.isInteger(code) || !Number.isInteger(column) || !Number.isInteger(row))
|
|
25
|
+
continue;
|
|
26
|
+
const event = toEvent(code, column, row, released);
|
|
27
|
+
if (event !== null)
|
|
28
|
+
events.push(event);
|
|
29
|
+
}
|
|
30
|
+
rest += data.slice(index);
|
|
31
|
+
return { events: Object.freeze(events), rest };
|
|
32
|
+
}
|
|
33
|
+
function toEvent(code, column, row, released) {
|
|
34
|
+
if ((code & 64) !== 0) {
|
|
35
|
+
const kind = (code & 1) === 0 ? "wheel-up" : "wheel-down";
|
|
36
|
+
return { kind, button: 0, column, row };
|
|
37
|
+
}
|
|
38
|
+
const button = code & 3;
|
|
39
|
+
if ((code & 32) !== 0)
|
|
40
|
+
return { kind: "motion", button, column, row };
|
|
41
|
+
if (released)
|
|
42
|
+
return { kind: "release", button, column, row };
|
|
43
|
+
if (button === 3)
|
|
44
|
+
return { kind: "release", button: 0, column, row };
|
|
45
|
+
return { kind: "press", button, column, row };
|
|
46
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { PaneRect } from "./frame.js";
|
|
2
|
+
import type { RenderCacheContract } from "./revision.js";
|
|
3
|
+
export interface PaneMouseEvent {
|
|
4
|
+
readonly kind: "press" | "release" | "motion" | "wheel-up" | "wheel-down";
|
|
5
|
+
/** 0 left, 1 middle, 2 right. Meaningless for wheel events. */
|
|
6
|
+
readonly button: number;
|
|
7
|
+
/** One-based column within the pane. */
|
|
8
|
+
readonly column: number;
|
|
9
|
+
/** One-based row within the pane. */
|
|
10
|
+
readonly row: number;
|
|
11
|
+
}
|
|
12
|
+
export interface PaneInputResult {
|
|
13
|
+
/** True when the pane handled the event; an unconsumed event continues to the host. */
|
|
14
|
+
readonly consumed: boolean;
|
|
15
|
+
/** True when the pane's appearance changed and the host should repaint. */
|
|
16
|
+
readonly render?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface Pane {
|
|
19
|
+
/** Renders exactly `rect.height` rows, each at most `rect.width` columns. */
|
|
20
|
+
render(rect: PaneRect, focused: boolean): readonly string[];
|
|
21
|
+
onInput?(data: string): PaneInputResult;
|
|
22
|
+
/** Mouse events arrive in coordinates local to this pane's own origin. */
|
|
23
|
+
onMouse?(event: PaneMouseEvent): PaneInputResult;
|
|
24
|
+
/** Drops cached layout after its data changed underneath it. */
|
|
25
|
+
invalidate?(): void;
|
|
26
|
+
readonly renderCache?: RenderCacheContract;
|
|
27
|
+
}
|
|
28
|
+
/** Translates a host-level mouse event into one pane's local coordinates. */
|
|
29
|
+
export declare function toPaneLocalMouse(event: PaneMouseEvent, origin: {
|
|
30
|
+
readonly column: number;
|
|
31
|
+
readonly row: number;
|
|
32
|
+
}): PaneMouseEvent;
|
|
33
|
+
export declare function isInsidePane(event: PaneMouseEvent, rect: PaneRect): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Translates a host-level mouse event into one pane's local coordinates. */
|
|
2
|
+
export function toPaneLocalMouse(event, origin) {
|
|
3
|
+
return { ...event, column: event.column - origin.column + 1, row: event.row - origin.row + 1 };
|
|
4
|
+
}
|
|
5
|
+
export function isInsidePane(event, rect) {
|
|
6
|
+
return event.column >= 1 && event.column <= rect.width && event.row >= 1 && event.row <= rect.height;
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PaneRect } from "./frame.js";
|
|
2
|
+
export type RenderRevisionKind = "content" | "selection" | "hover" | "layout" | "theme";
|
|
3
|
+
export declare const RENDER_REVISION_KINDS: readonly RenderRevisionKind[];
|
|
4
|
+
export type RenderRevisions = Readonly<Record<RenderRevisionKind, number>>;
|
|
5
|
+
export declare const ZERO_REVISIONS: RenderRevisions;
|
|
6
|
+
/**
|
|
7
|
+
* A component declares what changed. A host reuses a cached frame only while
|
|
8
|
+
* every declared revision and the rectangle are unchanged; a component that
|
|
9
|
+
* declares nothing is always stale rather than cached incorrectly.
|
|
10
|
+
*/
|
|
11
|
+
export interface RenderCacheContract {
|
|
12
|
+
revisions(): Partial<RenderRevisions>;
|
|
13
|
+
}
|
|
14
|
+
export declare function normalizeRevisions(revisions: Partial<RenderRevisions> | undefined): RenderRevisions;
|
|
15
|
+
export declare function revisionsEqual(left: RenderRevisions, right: RenderRevisions): boolean;
|
|
16
|
+
/** Bumps revisions by kind so a component can declare what it invalidated. */
|
|
17
|
+
export declare class RenderRevisionTracker {
|
|
18
|
+
#private;
|
|
19
|
+
bump(kind: RenderRevisionKind): void;
|
|
20
|
+
bumpAll(): void;
|
|
21
|
+
revisions(): RenderRevisions;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Caches one component's frame. A component with no cache contract is rendered
|
|
25
|
+
* every time, so adoption is incremental rather than all-or-nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare class FrameCache {
|
|
28
|
+
#private;
|
|
29
|
+
get hits(): number;
|
|
30
|
+
get misses(): number;
|
|
31
|
+
render(component: {
|
|
32
|
+
readonly renderCache?: RenderCacheContract;
|
|
33
|
+
}, rect: PaneRect, render: () => readonly string[]): readonly string[];
|
|
34
|
+
invalidate(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const RENDER_REVISION_KINDS = Object.freeze([
|
|
2
|
+
"content",
|
|
3
|
+
"selection",
|
|
4
|
+
"hover",
|
|
5
|
+
"layout",
|
|
6
|
+
"theme",
|
|
7
|
+
]);
|
|
8
|
+
export const ZERO_REVISIONS = Object.freeze({
|
|
9
|
+
content: 0,
|
|
10
|
+
selection: 0,
|
|
11
|
+
hover: 0,
|
|
12
|
+
layout: 0,
|
|
13
|
+
theme: 0,
|
|
14
|
+
});
|
|
15
|
+
export function normalizeRevisions(revisions) {
|
|
16
|
+
if (revisions === undefined)
|
|
17
|
+
return ZERO_REVISIONS;
|
|
18
|
+
const normalized = { ...ZERO_REVISIONS };
|
|
19
|
+
for (const kind of RENDER_REVISION_KINDS) {
|
|
20
|
+
const value = revisions[kind];
|
|
21
|
+
normalized[kind] = typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
22
|
+
}
|
|
23
|
+
return Object.freeze(normalized);
|
|
24
|
+
}
|
|
25
|
+
export function revisionsEqual(left, right) {
|
|
26
|
+
return RENDER_REVISION_KINDS.every(kind => left[kind] === right[kind]);
|
|
27
|
+
}
|
|
28
|
+
/** Bumps revisions by kind so a component can declare what it invalidated. */
|
|
29
|
+
export class RenderRevisionTracker {
|
|
30
|
+
#revisions = { ...ZERO_REVISIONS };
|
|
31
|
+
bump(kind) {
|
|
32
|
+
this.#revisions[kind] += 1;
|
|
33
|
+
}
|
|
34
|
+
bumpAll() {
|
|
35
|
+
for (const kind of RENDER_REVISION_KINDS)
|
|
36
|
+
this.#revisions[kind] += 1;
|
|
37
|
+
}
|
|
38
|
+
revisions() {
|
|
39
|
+
return Object.freeze({ ...this.#revisions });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Caches one component's frame. A component with no cache contract is rendered
|
|
44
|
+
* every time, so adoption is incremental rather than all-or-nothing.
|
|
45
|
+
*/
|
|
46
|
+
export class FrameCache {
|
|
47
|
+
#cached;
|
|
48
|
+
#hits = 0;
|
|
49
|
+
#misses = 0;
|
|
50
|
+
get hits() {
|
|
51
|
+
return this.#hits;
|
|
52
|
+
}
|
|
53
|
+
get misses() {
|
|
54
|
+
return this.#misses;
|
|
55
|
+
}
|
|
56
|
+
render(component, rect, render) {
|
|
57
|
+
if (component.renderCache === undefined) {
|
|
58
|
+
this.#misses += 1;
|
|
59
|
+
this.#cached = undefined;
|
|
60
|
+
return render();
|
|
61
|
+
}
|
|
62
|
+
const revisions = normalizeRevisions(component.renderCache.revisions());
|
|
63
|
+
const cached = this.#cached;
|
|
64
|
+
if (cached
|
|
65
|
+
&& cached.rect.width === rect.width
|
|
66
|
+
&& cached.rect.height === rect.height
|
|
67
|
+
&& revisionsEqual(cached.revisions, revisions)) {
|
|
68
|
+
this.#hits += 1;
|
|
69
|
+
return cached.lines;
|
|
70
|
+
}
|
|
71
|
+
this.#misses += 1;
|
|
72
|
+
const lines = render();
|
|
73
|
+
this.#cached = { rect: { width: rect.width, height: rect.height }, revisions, lines };
|
|
74
|
+
return lines;
|
|
75
|
+
}
|
|
76
|
+
invalidate() {
|
|
77
|
+
this.#cached = undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One scrollbar for every scrollable surface. Hover and drag belong to a named
|
|
3
|
+
* rail rather than to a global, because two scrollable surfaces can be visible
|
|
4
|
+
* at once and a shared flag lights up the wrong one.
|
|
5
|
+
*/
|
|
6
|
+
export interface ScrollbarGeometry {
|
|
7
|
+
/** Rows in the track. */
|
|
8
|
+
readonly trackHeight: number;
|
|
9
|
+
/** Thumb height in rows, at least one. */
|
|
10
|
+
readonly thumbHeight: number;
|
|
11
|
+
/** Zero-based row of the thumb's top within the track. */
|
|
12
|
+
readonly thumbTop: number;
|
|
13
|
+
/** Highest scroll position the content allows. */
|
|
14
|
+
readonly maxScroll: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ScrollbarInput {
|
|
17
|
+
readonly contentLength: number;
|
|
18
|
+
readonly viewportHeight: number;
|
|
19
|
+
readonly scroll: number;
|
|
20
|
+
readonly trackHeight: number;
|
|
21
|
+
}
|
|
22
|
+
/** Null when the content fits: no scrollbar is drawn and no width is reserved. */
|
|
23
|
+
export declare function scrollbarGeometry(input: ScrollbarInput): ScrollbarGeometry | null;
|
|
24
|
+
export declare function scrollbarReservesSpace(geometry: ScrollbarGeometry | null): boolean;
|
|
25
|
+
/** True when this track row is part of the thumb. */
|
|
26
|
+
export declare function isThumbRow(geometry: ScrollbarGeometry | null, trackRow: number): boolean;
|
|
27
|
+
/** Scroll position for a thumb dragged to a track row. */
|
|
28
|
+
export declare function scrollForThumbRow(geometry: ScrollbarGeometry | null, trackRow: number): number;
|
|
29
|
+
/** Scroll position after paging on the track above or below the thumb. */
|
|
30
|
+
export declare function scrollForTrackPage(geometry: ScrollbarGeometry | null, trackRow: number, scroll: number, viewportHeight: number): number;
|
|
31
|
+
export interface RailPosition {
|
|
32
|
+
/** Identity of this rail. Two surfaces never share one. */
|
|
33
|
+
readonly key: string;
|
|
34
|
+
/** Column the rail is drawn in, one-based. */
|
|
35
|
+
readonly column: number;
|
|
36
|
+
/** First row of the track within the surface, zero-based. */
|
|
37
|
+
readonly rowStart: number;
|
|
38
|
+
readonly trackHeight: number;
|
|
39
|
+
}
|
|
40
|
+
export interface RailPointer {
|
|
41
|
+
readonly column: number;
|
|
42
|
+
readonly row: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Hover and drag state for every rail on screen. State is keyed by rail, so a
|
|
46
|
+
* pointer over one rail cannot make another appear hot, and a drag started on
|
|
47
|
+
* one rail cannot be continued by a report addressed to another.
|
|
48
|
+
*/
|
|
49
|
+
export declare class ScrollbarRails {
|
|
50
|
+
#private;
|
|
51
|
+
isHovered(key: string): boolean;
|
|
52
|
+
isDragging(key: string): boolean;
|
|
53
|
+
get draggingKey(): string | null;
|
|
54
|
+
/** Records the pointer position. Returns the rail it is over, if any. */
|
|
55
|
+
notePointer(rails: readonly RailPosition[], pointer: RailPointer): string | null;
|
|
56
|
+
/** Starts a drag when the pointer is on that rail's thumb. */
|
|
57
|
+
beginDrag(rail: RailPosition, geometry: ScrollbarGeometry | null, pointer: RailPointer): boolean;
|
|
58
|
+
/** Scroll position for a drag in progress, or null when this rail is not being dragged. */
|
|
59
|
+
dragTo(rail: RailPosition, geometry: ScrollbarGeometry | null, pointer: RailPointer): number | null;
|
|
60
|
+
endDrag(): void;
|
|
61
|
+
clear(): void;
|
|
62
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One scrollbar for every scrollable surface. Hover and drag belong to a named
|
|
3
|
+
* rail rather than to a global, because two scrollable surfaces can be visible
|
|
4
|
+
* at once and a shared flag lights up the wrong one.
|
|
5
|
+
*/
|
|
6
|
+
/** Null when the content fits: no scrollbar is drawn and no width is reserved. */
|
|
7
|
+
export function scrollbarGeometry(input) {
|
|
8
|
+
const { contentLength, viewportHeight, trackHeight } = input;
|
|
9
|
+
if (trackHeight <= 0 || viewportHeight <= 0)
|
|
10
|
+
return null;
|
|
11
|
+
if (contentLength <= viewportHeight)
|
|
12
|
+
return null;
|
|
13
|
+
const maxScroll = contentLength - viewportHeight;
|
|
14
|
+
const scroll = Math.min(Math.max(input.scroll, 0), maxScroll);
|
|
15
|
+
const thumbHeight = Math.max(1, Math.min(trackHeight, Math.round(trackHeight * viewportHeight / contentLength)));
|
|
16
|
+
const travel = trackHeight - thumbHeight;
|
|
17
|
+
const thumbTop = maxScroll === 0 ? 0 : Math.min(travel, Math.round(travel * scroll / maxScroll));
|
|
18
|
+
return { trackHeight, thumbHeight, thumbTop, maxScroll };
|
|
19
|
+
}
|
|
20
|
+
export function scrollbarReservesSpace(geometry) {
|
|
21
|
+
return geometry !== null;
|
|
22
|
+
}
|
|
23
|
+
/** True when this track row is part of the thumb. */
|
|
24
|
+
export function isThumbRow(geometry, trackRow) {
|
|
25
|
+
if (geometry === null)
|
|
26
|
+
return false;
|
|
27
|
+
return trackRow >= geometry.thumbTop && trackRow < geometry.thumbTop + geometry.thumbHeight;
|
|
28
|
+
}
|
|
29
|
+
/** Scroll position for a thumb dragged to a track row. */
|
|
30
|
+
export function scrollForThumbRow(geometry, trackRow) {
|
|
31
|
+
if (geometry === null)
|
|
32
|
+
return 0;
|
|
33
|
+
const travel = geometry.trackHeight - geometry.thumbHeight;
|
|
34
|
+
if (travel <= 0)
|
|
35
|
+
return 0;
|
|
36
|
+
const clamped = Math.min(Math.max(trackRow, 0), travel);
|
|
37
|
+
return Math.round(clamped * geometry.maxScroll / travel);
|
|
38
|
+
}
|
|
39
|
+
/** Scroll position after paging on the track above or below the thumb. */
|
|
40
|
+
export function scrollForTrackPage(geometry, trackRow, scroll, viewportHeight) {
|
|
41
|
+
if (geometry === null)
|
|
42
|
+
return scroll;
|
|
43
|
+
const page = Math.max(1, viewportHeight);
|
|
44
|
+
const next = trackRow < geometry.thumbTop ? scroll - page : scroll + page;
|
|
45
|
+
return Math.min(Math.max(next, 0), geometry.maxScroll);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Hover and drag state for every rail on screen. State is keyed by rail, so a
|
|
49
|
+
* pointer over one rail cannot make another appear hot, and a drag started on
|
|
50
|
+
* one rail cannot be continued by a report addressed to another.
|
|
51
|
+
*/
|
|
52
|
+
export class ScrollbarRails {
|
|
53
|
+
#hovered = new Set();
|
|
54
|
+
#dragging;
|
|
55
|
+
isHovered(key) {
|
|
56
|
+
return this.#hovered.has(key);
|
|
57
|
+
}
|
|
58
|
+
isDragging(key) {
|
|
59
|
+
return this.#dragging?.key === key;
|
|
60
|
+
}
|
|
61
|
+
get draggingKey() {
|
|
62
|
+
return this.#dragging?.key ?? null;
|
|
63
|
+
}
|
|
64
|
+
/** Records the pointer position. Returns the rail it is over, if any. */
|
|
65
|
+
notePointer(rails, pointer) {
|
|
66
|
+
this.#hovered.clear();
|
|
67
|
+
for (const rail of rails) {
|
|
68
|
+
if (pointer.column !== rail.column)
|
|
69
|
+
continue;
|
|
70
|
+
const trackRow = pointer.row - rail.rowStart;
|
|
71
|
+
if (trackRow < 0 || trackRow >= rail.trackHeight)
|
|
72
|
+
continue;
|
|
73
|
+
this.#hovered.add(rail.key);
|
|
74
|
+
return rail.key;
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
/** Starts a drag when the pointer is on that rail's thumb. */
|
|
79
|
+
beginDrag(rail, geometry, pointer) {
|
|
80
|
+
if (geometry === null || pointer.column !== rail.column)
|
|
81
|
+
return false;
|
|
82
|
+
const trackRow = pointer.row - rail.rowStart;
|
|
83
|
+
if (!isThumbRow(geometry, trackRow))
|
|
84
|
+
return false;
|
|
85
|
+
this.#dragging = { key: rail.key, grabOffset: trackRow - geometry.thumbTop };
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
/** Scroll position for a drag in progress, or null when this rail is not being dragged. */
|
|
89
|
+
dragTo(rail, geometry, pointer) {
|
|
90
|
+
const dragging = this.#dragging;
|
|
91
|
+
if (dragging === undefined || dragging.key !== rail.key || geometry === null)
|
|
92
|
+
return null;
|
|
93
|
+
return scrollForThumbRow(geometry, pointer.row - rail.rowStart - dragging.grabOffset);
|
|
94
|
+
}
|
|
95
|
+
endDrag() {
|
|
96
|
+
this.#dragging = undefined;
|
|
97
|
+
}
|
|
98
|
+
clear() {
|
|
99
|
+
this.#hovered.clear();
|
|
100
|
+
this.#dragging = undefined;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shortcuts as declared data. Dispatch resolves a key through declarations
|
|
3
|
+
* rather than inline comparisons, conflicts are reported when the registry is
|
|
4
|
+
* assembled, and any listing is generated from the same declarations — so a
|
|
5
|
+
* listed shortcut is one dispatch would actually invoke.
|
|
6
|
+
*/
|
|
7
|
+
export interface ShortcutDeclaration {
|
|
8
|
+
/** Key token, for example `up`, `shift+down`, `ctrl+c`, or a literal character. */
|
|
9
|
+
readonly key: string;
|
|
10
|
+
/** Screen this applies to, or `global` for every screen. */
|
|
11
|
+
readonly scope: string;
|
|
12
|
+
readonly description: string;
|
|
13
|
+
/** Grouping label for the listing. */
|
|
14
|
+
readonly section?: string;
|
|
15
|
+
/**
|
|
16
|
+
* How this key reads on a screen's hint line, when it belongs there. Keys that
|
|
17
|
+
* do one thing together — the two arrows, enter and space — declare the same
|
|
18
|
+
* pair and are shown once.
|
|
19
|
+
*/
|
|
20
|
+
readonly hint?: {
|
|
21
|
+
readonly keys: string;
|
|
22
|
+
readonly does: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare const GLOBAL_SCOPE = "global";
|
|
26
|
+
export interface ShortcutConflict {
|
|
27
|
+
readonly key: string;
|
|
28
|
+
readonly scopes: readonly [string, string];
|
|
29
|
+
readonly descriptions: readonly [string, string];
|
|
30
|
+
readonly kind: "duplicate" | "shadowed";
|
|
31
|
+
}
|
|
32
|
+
export interface ShortcutRegistryResult {
|
|
33
|
+
readonly declarations: readonly ShortcutDeclaration[];
|
|
34
|
+
readonly conflicts: readonly ShortcutConflict[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Assembles declarations and reports every key claimed twice in overlapping
|
|
38
|
+
* scopes. A screen claiming a global key is reported as shadowed rather than
|
|
39
|
+
* silently resolved by declaration order.
|
|
40
|
+
*/
|
|
41
|
+
export declare function assembleShortcuts(declarations: readonly ShortcutDeclaration[]): ShortcutRegistryResult;
|
|
42
|
+
export declare function assertNoShortcutConflicts(result: ShortcutRegistryResult): void;
|
|
43
|
+
export declare class ShortcutRegistry<Action extends string = string> {
|
|
44
|
+
#private;
|
|
45
|
+
declare(declaration: ShortcutDeclaration, action: Action): void;
|
|
46
|
+
/** The action this key invokes in this scope, preferring a screen over a global. */
|
|
47
|
+
resolve(key: string, scope: string): Action | null;
|
|
48
|
+
assemble(): ShortcutRegistryResult;
|
|
49
|
+
/**
|
|
50
|
+
* The hint line, in the order the screen declares its keys. It is rendered from
|
|
51
|
+
* the same declarations dispatch reads, so a key cannot be described here and
|
|
52
|
+
* bound to something else, or bound and never mentioned.
|
|
53
|
+
*/
|
|
54
|
+
hint(scope: string, separator?: string): string;
|
|
55
|
+
/** The listing, derived from the declarations dispatch reads. */
|
|
56
|
+
list(scope?: string): readonly ShortcutDeclaration[];
|
|
57
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shortcuts as declared data. Dispatch resolves a key through declarations
|
|
3
|
+
* rather than inline comparisons, conflicts are reported when the registry is
|
|
4
|
+
* assembled, and any listing is generated from the same declarations — so a
|
|
5
|
+
* listed shortcut is one dispatch would actually invoke.
|
|
6
|
+
*/
|
|
7
|
+
export const GLOBAL_SCOPE = "global";
|
|
8
|
+
function overlaps(left, right) {
|
|
9
|
+
return left === right || left === GLOBAL_SCOPE || right === GLOBAL_SCOPE;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Assembles declarations and reports every key claimed twice in overlapping
|
|
13
|
+
* scopes. A screen claiming a global key is reported as shadowed rather than
|
|
14
|
+
* silently resolved by declaration order.
|
|
15
|
+
*/
|
|
16
|
+
export function assembleShortcuts(declarations) {
|
|
17
|
+
const conflicts = [];
|
|
18
|
+
for (let left = 0; left < declarations.length; left++) {
|
|
19
|
+
for (let right = left + 1; right < declarations.length; right++) {
|
|
20
|
+
const a = declarations[left];
|
|
21
|
+
const b = declarations[right];
|
|
22
|
+
if (a === undefined || b === undefined)
|
|
23
|
+
continue;
|
|
24
|
+
if (a.key !== b.key || !overlaps(a.scope, b.scope))
|
|
25
|
+
continue;
|
|
26
|
+
conflicts.push({
|
|
27
|
+
key: a.key,
|
|
28
|
+
scopes: [a.scope, b.scope],
|
|
29
|
+
descriptions: [a.description, b.description],
|
|
30
|
+
kind: a.scope === b.scope ? "duplicate" : "shadowed",
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return { declarations: Object.freeze([...declarations]), conflicts: Object.freeze(conflicts) };
|
|
35
|
+
}
|
|
36
|
+
export function assertNoShortcutConflicts(result) {
|
|
37
|
+
const duplicate = result.conflicts.find(conflict => conflict.kind === "duplicate");
|
|
38
|
+
if (duplicate) {
|
|
39
|
+
throw new Error(`shortcut ${duplicate.key} is declared twice in scope ${duplicate.scopes[0]}: `
|
|
40
|
+
+ `"${duplicate.descriptions[0]}" and "${duplicate.descriptions[1]}"`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export class ShortcutRegistry {
|
|
44
|
+
#declarations = [];
|
|
45
|
+
#actions = new Map();
|
|
46
|
+
declare(declaration, action) {
|
|
47
|
+
this.#declarations.push(declaration);
|
|
48
|
+
this.#actions.set(`${declaration.scope}\u0000${declaration.key}`, action);
|
|
49
|
+
}
|
|
50
|
+
/** The action this key invokes in this scope, preferring a screen over a global. */
|
|
51
|
+
resolve(key, scope) {
|
|
52
|
+
return this.#actions.get(`${scope}\u0000${key}`) ?? this.#actions.get(`${GLOBAL_SCOPE}\u0000${key}`) ?? null;
|
|
53
|
+
}
|
|
54
|
+
assemble() {
|
|
55
|
+
return assembleShortcuts(this.#declarations);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The hint line, in the order the screen declares its keys. It is rendered from
|
|
59
|
+
* the same declarations dispatch reads, so a key cannot be described here and
|
|
60
|
+
* bound to something else, or bound and never mentioned.
|
|
61
|
+
*/
|
|
62
|
+
hint(scope, separator = " · ") {
|
|
63
|
+
const shown = new Map();
|
|
64
|
+
for (const declaration of this.#declarations) {
|
|
65
|
+
if (declaration.hint === undefined)
|
|
66
|
+
continue;
|
|
67
|
+
if (declaration.scope !== scope && declaration.scope !== GLOBAL_SCOPE)
|
|
68
|
+
continue;
|
|
69
|
+
if (!shown.has(declaration.hint.keys))
|
|
70
|
+
shown.set(declaration.hint.keys, declaration.hint.does);
|
|
71
|
+
}
|
|
72
|
+
return [...shown].map(([keys, does]) => `${keys} ${does}`).join(separator);
|
|
73
|
+
}
|
|
74
|
+
/** The listing, derived from the declarations dispatch reads. */
|
|
75
|
+
list(scope) {
|
|
76
|
+
const inScope = scope === undefined
|
|
77
|
+
? this.#declarations
|
|
78
|
+
: this.#declarations.filter(declaration => declaration.scope === scope || declaration.scope === GLOBAL_SCOPE);
|
|
79
|
+
return Object.freeze([...inScope].sort((left, right) => (left.section ?? "").localeCompare(right.section ?? "") || left.key.localeCompare(right.key)));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replaces the visible columns `[from, to)` of `line` with `span`, preserving
|
|
3
|
+
* the styling before it and re-asserting whatever was still open afterwards, so
|
|
4
|
+
* the tail keeps the colour it had. A wide character straddling either edge is
|
|
5
|
+
* replaced by spaces rather than split.
|
|
6
|
+
*/
|
|
7
|
+
export declare function overlaySpan(line: string, from: number, to: number, span: string): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { displayWidth } from "./text.js";
|
|
2
|
+
/**
|
|
3
|
+
* Ported from the A1 UI reference implementation (`core/presentation/spans.ts`).
|
|
4
|
+
* Writing over part of a rendered row is not string slicing: the row carries
|
|
5
|
+
* styling and hyperlink sequences, and cutting through them either loses the
|
|
6
|
+
* styling of the tail or leaks the span's own reset into it.
|
|
7
|
+
*/
|
|
8
|
+
const ANSI_SEQUENCE = "\\u001b(?:\\[[0-?]*[ -/]*[@-~]|[\\]_][^\\u0007\\u001b]*(?:\\u0007|\\u001b\\\\|$))";
|
|
9
|
+
const ANSI_SPLIT = new RegExp(`(${ANSI_SEQUENCE})`);
|
|
10
|
+
const HYPERLINK = /^\]8;;([^]*)(?:|\\)?$/;
|
|
11
|
+
const HYPERLINK_OFF = "]8;;\\";
|
|
12
|
+
const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
13
|
+
/**
|
|
14
|
+
* Replaces the visible columns `[from, to)` of `line` with `span`, preserving
|
|
15
|
+
* the styling before it and re-asserting whatever was still open afterwards, so
|
|
16
|
+
* the tail keeps the colour it had. A wide character straddling either edge is
|
|
17
|
+
* replaced by spaces rather than split.
|
|
18
|
+
*/
|
|
19
|
+
export function overlaySpan(line, from, to, span) {
|
|
20
|
+
let head = "";
|
|
21
|
+
let replay = "";
|
|
22
|
+
let tail = "";
|
|
23
|
+
let column = 0;
|
|
24
|
+
let hyperlinkOpen = false;
|
|
25
|
+
for (const token of line.split(ANSI_SPLIT)) {
|
|
26
|
+
if (!token)
|
|
27
|
+
continue;
|
|
28
|
+
if (token.startsWith("")) {
|
|
29
|
+
if (column >= to) {
|
|
30
|
+
tail += token;
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (column < from) {
|
|
34
|
+
head += token;
|
|
35
|
+
const link = HYPERLINK.exec(token);
|
|
36
|
+
if (link)
|
|
37
|
+
hyperlinkOpen = (link[1] ?? "").length > 0;
|
|
38
|
+
}
|
|
39
|
+
// Re-assert everything still active: the span's own reset clobbers the tail.
|
|
40
|
+
replay += token;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
for (const { segment } of GRAPHEMES.segment(token)) {
|
|
44
|
+
const width = displayWidth(segment);
|
|
45
|
+
if (column + width <= from)
|
|
46
|
+
head += segment;
|
|
47
|
+
else if (column >= to)
|
|
48
|
+
tail += segment;
|
|
49
|
+
else if (column < from)
|
|
50
|
+
head += " ".repeat(from - column);
|
|
51
|
+
else if (column + width > to)
|
|
52
|
+
tail += " ".repeat(column + width - to);
|
|
53
|
+
column += width;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (column < from)
|
|
57
|
+
head += " ".repeat(from - column);
|
|
58
|
+
return head + (hyperlinkOpen ? HYPERLINK_OFF : "") + span + replay + tail;
|
|
59
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { UiTheme } from "./theme.js";
|
|
2
|
+
/**
|
|
3
|
+
* The one line a screen speaks on. It says the standing hint until there is
|
|
4
|
+
* something to report, and what is reported stands until it is superseded — one
|
|
5
|
+
* thing at a time, so a reader never has to work out which of two lines is now.
|
|
6
|
+
*/
|
|
7
|
+
export interface StatusLineInput {
|
|
8
|
+
/** What the screen always offers: its keys, usually. */
|
|
9
|
+
readonly hint: string;
|
|
10
|
+
/** Something that happened and would not otherwise be known. */
|
|
11
|
+
readonly report?: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** What the line says: the report when there is one, else the hint. */
|
|
14
|
+
export declare function statusText(input: StatusLineInput): string;
|
|
15
|
+
/** The line as drawn: quiet, and set against the right edge. */
|
|
16
|
+
export declare function renderStatusLine(input: StatusLineInput, width: number, theme: UiTheme): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { displayWidth, truncateToWidth } from "./text.js";
|
|
2
|
+
/** What the line says: the report when there is one, else the hint. */
|
|
3
|
+
export function statusText(input) {
|
|
4
|
+
const report = input.report ?? null;
|
|
5
|
+
return report === null || report.length === 0 ? input.hint : report;
|
|
6
|
+
}
|
|
7
|
+
/** The line as drawn: quiet, and set against the right edge. */
|
|
8
|
+
export function renderStatusLine(input, width, theme) {
|
|
9
|
+
const text = statusText(input);
|
|
10
|
+
const painted = theme.fg("dim", text);
|
|
11
|
+
if (displayWidth(text) >= width)
|
|
12
|
+
return truncateToWidth(painted, width);
|
|
13
|
+
return `${" ".repeat(width - displayWidth(text))}${painted}`;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A value stepped through a range or through the numbers it is offered. The two
|
|
3
|
+
* are the same control: a list of numbers is a range whose entries are its ends.
|
|
4
|
+
*/
|
|
5
|
+
export interface NumericRange {
|
|
6
|
+
/** Smallest value accepted, or null when nothing states one. */
|
|
7
|
+
readonly minimum: number | null;
|
|
8
|
+
/** Largest value accepted, or null when nothing states one. */
|
|
9
|
+
readonly maximum: number | null;
|
|
10
|
+
/** The numbers offered, when the offer is the whole domain rather than shortcuts. */
|
|
11
|
+
readonly values: readonly number[] | null;
|
|
12
|
+
}
|
|
13
|
+
/** The numbers a list of choices offers, or null when it is not all numbers. */
|
|
14
|
+
export declare function numericValues(choices: readonly unknown[] | null): readonly number[] | null;
|
|
15
|
+
/**
|
|
16
|
+
* Where a step lands, or null when there is nowhere further to go. At an end the
|
|
17
|
+
* caller draws the control as unavailable rather than reporting a refusal.
|
|
18
|
+
*/
|
|
19
|
+
export declare function steppedValue(range: NumericRange, from: number, delta: -1 | 1): number | null;
|
|
20
|
+
/** Which ends of the range a value can still move towards. */
|
|
21
|
+
export declare function stepperEnds(range: NumericRange, from: number): {
|
|
22
|
+
readonly lower: boolean;
|
|
23
|
+
readonly raise: boolean;
|
|
24
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A value stepped through a range or through the numbers it is offered. The two
|
|
3
|
+
* are the same control: a list of numbers is a range whose entries are its ends.
|
|
4
|
+
*/
|
|
5
|
+
/** The numbers a list of choices offers, or null when it is not all numbers. */
|
|
6
|
+
export function numericValues(choices) {
|
|
7
|
+
if (choices === null || choices.length === 0)
|
|
8
|
+
return null;
|
|
9
|
+
const numbers = choices.filter((choice) => typeof choice === "number");
|
|
10
|
+
return numbers.length === choices.length ? [...numbers].sort((left, right) => left - right) : null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Where a step lands, or null when there is nowhere further to go. At an end the
|
|
14
|
+
* caller draws the control as unavailable rather than reporting a refusal.
|
|
15
|
+
*/
|
|
16
|
+
export function steppedValue(range, from, delta) {
|
|
17
|
+
if (range.values !== null) {
|
|
18
|
+
const at = range.values.indexOf(from);
|
|
19
|
+
const next = (at < 0 ? 0 : at) + delta;
|
|
20
|
+
return next >= 0 && next < range.values.length ? range.values[next] ?? null : null;
|
|
21
|
+
}
|
|
22
|
+
const next = from + delta;
|
|
23
|
+
if (range.minimum !== null && next < range.minimum)
|
|
24
|
+
return null;
|
|
25
|
+
return range.maximum !== null && next > range.maximum ? null : next;
|
|
26
|
+
}
|
|
27
|
+
/** Which ends of the range a value can still move towards. */
|
|
28
|
+
export function stepperEnds(range, from) {
|
|
29
|
+
return {
|
|
30
|
+
lower: steppedValue(range, from, -1) !== null,
|
|
31
|
+
raise: steppedValue(range, from, 1) !== null,
|
|
32
|
+
};
|
|
33
|
+
}
|