@pellux/goodvibes-agent 0.1.0
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/.goodvibes/GOODVIBES.md +35 -0
- package/.goodvibes/agents/reviewer.md +48 -0
- package/.goodvibes/skills/add-provider/SKILL.md +199 -0
- package/CHANGELOG.md +25 -0
- package/README.md +74 -0
- package/bin/goodvibes-agent.ts +2 -0
- package/docs/README.md +23 -0
- package/docs/deployment-and-services.md +57 -0
- package/docs/getting-started.md +53 -0
- package/docs/release-and-publishing.md +46 -0
- package/package.json +134 -0
- package/scripts/check-bun.sh +20 -0
- package/src/audio/player.ts +156 -0
- package/src/audio/spoken-turn-controller.ts +203 -0
- package/src/audio/spoken-turn-model-routing.ts +117 -0
- package/src/audio/spoken-turn-wiring.ts +44 -0
- package/src/audio/text-chunker.ts +110 -0
- package/src/cli/bundle-command.ts +227 -0
- package/src/cli/completion.ts +90 -0
- package/src/cli/config-overrides.ts +159 -0
- package/src/cli/endpoints.ts +63 -0
- package/src/cli/entrypoint.ts +172 -0
- package/src/cli/help.ts +299 -0
- package/src/cli/index.ts +11 -0
- package/src/cli/management-commands.ts +426 -0
- package/src/cli/management.ts +744 -0
- package/src/cli/network-posture.ts +46 -0
- package/src/cli/package-verification.ts +123 -0
- package/src/cli/parser.ts +369 -0
- package/src/cli/provider-auth-routes.ts +22 -0
- package/src/cli/provider-classification.ts +107 -0
- package/src/cli/redaction.ts +105 -0
- package/src/cli/service-command.ts +26 -0
- package/src/cli/service-posture.ts +482 -0
- package/src/cli/status.ts +383 -0
- package/src/cli/surface-command.ts +247 -0
- package/src/cli/tui-startup.ts +32 -0
- package/src/cli/types.ts +69 -0
- package/src/cli-flags.ts +21 -0
- package/src/config/goodvibes-home-audit.ts +465 -0
- package/src/config/index.ts +57 -0
- package/src/config/provider-model.ts +23 -0
- package/src/config/secret-config.ts +119 -0
- package/src/config/secrets.ts +71 -0
- package/src/config/surface.ts +1 -0
- package/src/core/composer-state.ts +61 -0
- package/src/core/conversation-rendering.ts +359 -0
- package/src/core/conversation.ts +551 -0
- package/src/core/history.ts +45 -0
- package/src/core/orchestrator.ts +7 -0
- package/src/core/system-message-router.ts +171 -0
- package/src/daemon/cli.ts +55 -0
- package/src/daemon/safe-serve.ts +61 -0
- package/src/input/agent-workspace.ts +428 -0
- package/src/input/autocomplete.ts +96 -0
- package/src/input/bookmark-modal.ts +115 -0
- package/src/input/command-args-hint.ts +36 -0
- package/src/input/command-registry.ts +329 -0
- package/src/input/commands/agent-externalized-tui.ts +73 -0
- package/src/input/commands/agent-workspace-runtime.ts +17 -0
- package/src/input/commands/branch-runtime.ts +72 -0
- package/src/input/commands/cloudflare-runtime.ts +370 -0
- package/src/input/commands/config.ts +18 -0
- package/src/input/commands/control-room-runtime.ts +255 -0
- package/src/input/commands/conversation-runtime.ts +207 -0
- package/src/input/commands/discovery-runtime.ts +52 -0
- package/src/input/commands/eval.ts +204 -0
- package/src/input/commands/experience-runtime.ts +278 -0
- package/src/input/commands/guidance-runtime.ts +106 -0
- package/src/input/commands/health-runtime.ts +434 -0
- package/src/input/commands/hooks-runtime.ts +148 -0
- package/src/input/commands/incident-runtime.ts +95 -0
- package/src/input/commands/integration-runtime.ts +394 -0
- package/src/input/commands/intelligence-runtime.ts +223 -0
- package/src/input/commands/knowledge.ts +531 -0
- package/src/input/commands/local-auth-runtime.ts +105 -0
- package/src/input/commands/local-provider-runtime.ts +170 -0
- package/src/input/commands/local-runtime.ts +392 -0
- package/src/input/commands/local-setup-review.ts +199 -0
- package/src/input/commands/local-setup-transfer.ts +135 -0
- package/src/input/commands/local-setup.ts +282 -0
- package/src/input/commands/managed-runtime.ts +209 -0
- package/src/input/commands/marketplace-runtime.ts +290 -0
- package/src/input/commands/mcp-runtime.ts +432 -0
- package/src/input/commands/memory-product-runtime.ts +111 -0
- package/src/input/commands/memory.ts +151 -0
- package/src/input/commands/notify-runtime.ts +83 -0
- package/src/input/commands/onboarding-runtime.ts +14 -0
- package/src/input/commands/operator-panel-runtime.ts +146 -0
- package/src/input/commands/operator-runtime.ts +392 -0
- package/src/input/commands/planning-runtime.ts +205 -0
- package/src/input/commands/platform-access-runtime.ts +422 -0
- package/src/input/commands/platform-services-runtime.ts +246 -0
- package/src/input/commands/policy-dispatch.ts +339 -0
- package/src/input/commands/policy.ts +17 -0
- package/src/input/commands/product-runtime.ts +351 -0
- package/src/input/commands/profile-sync-runtime.ts +99 -0
- package/src/input/commands/provider-accounts-runtime.ts +113 -0
- package/src/input/commands/provider.ts +363 -0
- package/src/input/commands/qrcode-runtime.ts +20 -0
- package/src/input/commands/quit-shared.ts +162 -0
- package/src/input/commands/recall-bundle.ts +132 -0
- package/src/input/commands/recall-capture.ts +152 -0
- package/src/input/commands/recall-query.ts +229 -0
- package/src/input/commands/recall-review.ts +98 -0
- package/src/input/commands/recall-shared.ts +22 -0
- package/src/input/commands/remote-runtime-pool.ts +106 -0
- package/src/input/commands/remote-runtime-setup.ts +199 -0
- package/src/input/commands/remote-runtime.ts +431 -0
- package/src/input/commands/replay-runtime.ts +18 -0
- package/src/input/commands/runtime-services.ts +291 -0
- package/src/input/commands/schedule-runtime.ts +91 -0
- package/src/input/commands/services-runtime.ts +209 -0
- package/src/input/commands/session-content.ts +408 -0
- package/src/input/commands/session-workflow.ts +464 -0
- package/src/input/commands/session.ts +375 -0
- package/src/input/commands/settings-sync-runtime.ts +174 -0
- package/src/input/commands/share-runtime.ts +119 -0
- package/src/input/commands/shell-core.ts +307 -0
- package/src/input/commands/skills-runtime.ts +221 -0
- package/src/input/commands/subscription-runtime.ts +434 -0
- package/src/input/commands/tasks-runtime.ts +230 -0
- package/src/input/commands/teamwork-runtime.ts +339 -0
- package/src/input/commands/teleport-runtime.ts +57 -0
- package/src/input/commands/tts-runtime.ts +29 -0
- package/src/input/commands/work-plan-runtime.ts +169 -0
- package/src/input/commands.ts +131 -0
- package/src/input/feed-context-factory.ts +254 -0
- package/src/input/file-picker.ts +192 -0
- package/src/input/handler-command-route.ts +180 -0
- package/src/input/handler-content-actions.ts +497 -0
- package/src/input/handler-feed-routes.ts +648 -0
- package/src/input/handler-feed.ts +452 -0
- package/src/input/handler-interactions.ts +281 -0
- package/src/input/handler-modal-routes.ts +418 -0
- package/src/input/handler-modal-stack.ts +263 -0
- package/src/input/handler-modal-token-routes.ts +329 -0
- package/src/input/handler-onboarding-cloudflare.ts +391 -0
- package/src/input/handler-onboarding.ts +620 -0
- package/src/input/handler-picker-routes.ts +472 -0
- package/src/input/handler-prompt-buffer.ts +320 -0
- package/src/input/handler-shortcuts.ts +213 -0
- package/src/input/handler-ui-state.ts +372 -0
- package/src/input/handler.ts +729 -0
- package/src/input/input-history.ts +297 -0
- package/src/input/keybindings.ts +292 -0
- package/src/input/mcp-workspace.ts +554 -0
- package/src/input/model-picker-provider-filter.ts +28 -0
- package/src/input/model-picker-types.ts +137 -0
- package/src/input/model-picker.ts +797 -0
- package/src/input/onboarding/handler-onboarding-routes.ts +125 -0
- package/src/input/onboarding/onboarding-runtime-status.ts +87 -0
- package/src/input/onboarding/onboarding-wizard-apply.ts +277 -0
- package/src/input/onboarding/onboarding-wizard-cloudflare-step.ts +494 -0
- package/src/input/onboarding/onboarding-wizard-cloudflare.ts +204 -0
- package/src/input/onboarding/onboarding-wizard-constants.ts +158 -0
- package/src/input/onboarding/onboarding-wizard-external-surface-extra-specs.ts +130 -0
- package/src/input/onboarding/onboarding-wizard-external-surfaces.ts +762 -0
- package/src/input/onboarding/onboarding-wizard-helpers.ts +167 -0
- package/src/input/onboarding/onboarding-wizard-rules.ts +256 -0
- package/src/input/onboarding/onboarding-wizard-state.ts +365 -0
- package/src/input/onboarding/onboarding-wizard-steps.ts +798 -0
- package/src/input/onboarding/onboarding-wizard-types.ts +195 -0
- package/src/input/onboarding/onboarding-wizard.ts +711 -0
- package/src/input/panel-integration-actions.ts +78 -0
- package/src/input/profile-picker-modal.ts +222 -0
- package/src/input/search.ts +100 -0
- package/src/input/selection-modal.ts +163 -0
- package/src/input/selection.ts +135 -0
- package/src/input/session-picker-modal.ts +136 -0
- package/src/input/settings-modal-behavior.ts +37 -0
- package/src/input/settings-modal-secrets.ts +41 -0
- package/src/input/settings-modal-subscriptions.ts +95 -0
- package/src/input/settings-modal-types.ts +91 -0
- package/src/input/settings-modal.ts +793 -0
- package/src/input/submission-intent.ts +17 -0
- package/src/input/submission-router.ts +59 -0
- package/src/input/tts-settings-actions.ts +100 -0
- package/src/main.ts +792 -0
- package/src/mcp/runtime-reload.ts +81 -0
- package/src/panels/agent-inspector-panel.ts +521 -0
- package/src/panels/agent-inspector-shared.ts +94 -0
- package/src/panels/agent-logs-panel.ts +559 -0
- package/src/panels/agent-logs-shared.ts +129 -0
- package/src/panels/approval-panel.ts +150 -0
- package/src/panels/automation-control-panel.ts +212 -0
- package/src/panels/base-panel.ts +254 -0
- package/src/panels/builtin/agent.ts +117 -0
- package/src/panels/builtin/development.ts +31 -0
- package/src/panels/builtin/knowledge.ts +26 -0
- package/src/panels/builtin/operations.ts +349 -0
- package/src/panels/builtin/session.ts +129 -0
- package/src/panels/builtin/shared.ts +274 -0
- package/src/panels/builtin-panels.ts +23 -0
- package/src/panels/cockpit-panel.ts +183 -0
- package/src/panels/communication-panel.ts +153 -0
- package/src/panels/confirm-state.ts +61 -0
- package/src/panels/context-visualizer-panel.ts +204 -0
- package/src/panels/control-plane-panel.ts +211 -0
- package/src/panels/cost-tracker-panel.ts +444 -0
- package/src/panels/debug-panel.ts +432 -0
- package/src/panels/diff-panel.ts +520 -0
- package/src/panels/docs-panel.ts +283 -0
- package/src/panels/eval-panel.ts +399 -0
- package/src/panels/file-explorer-panel.ts +584 -0
- package/src/panels/file-preview-panel.ts +434 -0
- package/src/panels/forensics-panel.ts +364 -0
- package/src/panels/git-panel.ts +638 -0
- package/src/panels/hooks-panel.ts +239 -0
- package/src/panels/incident-review-panel.ts +197 -0
- package/src/panels/index.ts +46 -0
- package/src/panels/intelligence-panel.ts +176 -0
- package/src/panels/knowledge-panel.ts +345 -0
- package/src/panels/local-auth-panel.ts +130 -0
- package/src/panels/marketplace-panel.ts +212 -0
- package/src/panels/memory-panel.ts +225 -0
- package/src/panels/ops-control-panel.ts +150 -0
- package/src/panels/ops-strategy-panel.ts +235 -0
- package/src/panels/orchestration-panel.ts +273 -0
- package/src/panels/panel-list-panel.ts +509 -0
- package/src/panels/panel-manager.ts +570 -0
- package/src/panels/panel-picker.ts +106 -0
- package/src/panels/plan-dashboard-panel.ts +274 -0
- package/src/panels/plugins-panel.ts +178 -0
- package/src/panels/policy-panel.ts +308 -0
- package/src/panels/polish.ts +717 -0
- package/src/panels/project-planning-panel.ts +711 -0
- package/src/panels/provider-account-snapshot.ts +259 -0
- package/src/panels/provider-accounts-panel.ts +218 -0
- package/src/panels/provider-health-domains.ts +215 -0
- package/src/panels/provider-health-panel.ts +727 -0
- package/src/panels/provider-health-tracker.ts +115 -0
- package/src/panels/provider-stats-panel.ts +366 -0
- package/src/panels/qr-panel.ts +182 -0
- package/src/panels/remote-panel.ts +449 -0
- package/src/panels/routes-panel.ts +178 -0
- package/src/panels/sandbox-panel.ts +283 -0
- package/src/panels/schedule-panel.ts +329 -0
- package/src/panels/scrollable-list-panel.ts +491 -0
- package/src/panels/search-focus.ts +32 -0
- package/src/panels/security-panel.ts +295 -0
- package/src/panels/services-panel.ts +231 -0
- package/src/panels/session-browser-panel.ts +400 -0
- package/src/panels/session-maintenance.ts +125 -0
- package/src/panels/settings-sync-panel.ts +120 -0
- package/src/panels/skills-panel.ts +431 -0
- package/src/panels/subscription-panel.ts +263 -0
- package/src/panels/symbol-outline-panel.ts +486 -0
- package/src/panels/system-messages-panel.ts +230 -0
- package/src/panels/tasks-panel.ts +399 -0
- package/src/panels/thinking-panel.ts +304 -0
- package/src/panels/token-budget-panel.ts +475 -0
- package/src/panels/tool-inspector-panel.ts +429 -0
- package/src/panels/types.ts +54 -0
- package/src/panels/watchers-panel.ts +193 -0
- package/src/panels/work-plan-panel.ts +175 -0
- package/src/panels/worktree-panel.ts +182 -0
- package/src/panels/wrfc-panel.ts +609 -0
- package/src/permissions/prompt.ts +165 -0
- package/src/planning/project-planning-coordinator.ts +543 -0
- package/src/plugins/loader.ts +15 -0
- package/src/renderer/agent-detail-modal.ts +331 -0
- package/src/renderer/agent-workspace.ts +238 -0
- package/src/renderer/ansi-sanitize.ts +76 -0
- package/src/renderer/autocomplete-overlay.ts +154 -0
- package/src/renderer/block-actions.ts +76 -0
- package/src/renderer/bookmark-modal.ts +101 -0
- package/src/renderer/bottom-bar.ts +58 -0
- package/src/renderer/buffer.ts +113 -0
- package/src/renderer/code-block.ts +373 -0
- package/src/renderer/compositor.ts +283 -0
- package/src/renderer/context-inspector.ts +219 -0
- package/src/renderer/conversation-layout.ts +67 -0
- package/src/renderer/conversation-overlays.ts +140 -0
- package/src/renderer/conversation-surface.ts +260 -0
- package/src/renderer/diff-view.ts +132 -0
- package/src/renderer/diff.ts +130 -0
- package/src/renderer/file-picker-overlay.ts +101 -0
- package/src/renderer/file-tree.ts +153 -0
- package/src/renderer/fullscreen-primitives.ts +130 -0
- package/src/renderer/fullscreen-workspace.ts +199 -0
- package/src/renderer/git-status.ts +89 -0
- package/src/renderer/help-overlay.ts +267 -0
- package/src/renderer/history-search-overlay.ts +73 -0
- package/src/renderer/layout-engine.ts +97 -0
- package/src/renderer/layout.ts +32 -0
- package/src/renderer/live-tail-modal.ts +156 -0
- package/src/renderer/markdown.ts +635 -0
- package/src/renderer/mcp-workspace.ts +237 -0
- package/src/renderer/modal-factory.ts +467 -0
- package/src/renderer/modal-utils.ts +24 -0
- package/src/renderer/model-picker-overlay.ts +473 -0
- package/src/renderer/model-workspace.ts +488 -0
- package/src/renderer/onboarding/onboarding-wizard.ts +615 -0
- package/src/renderer/overlay-box.ts +146 -0
- package/src/renderer/overlay-viewport.ts +104 -0
- package/src/renderer/panel-composite.ts +158 -0
- package/src/renderer/panel-picker-overlay.ts +202 -0
- package/src/renderer/panel-tab-bar.ts +69 -0
- package/src/renderer/panel-workspace-bar.ts +42 -0
- package/src/renderer/process-indicator.ts +96 -0
- package/src/renderer/process-modal.ts +656 -0
- package/src/renderer/process-summary.ts +67 -0
- package/src/renderer/profile-picker-modal.ts +129 -0
- package/src/renderer/progress.ts +98 -0
- package/src/renderer/qr-renderer.ts +120 -0
- package/src/renderer/search-overlay.ts +54 -0
- package/src/renderer/selection-modal-overlay.ts +214 -0
- package/src/renderer/semantic-diff.ts +369 -0
- package/src/renderer/session-picker-modal.ts +127 -0
- package/src/renderer/settings-modal-helpers.ts +193 -0
- package/src/renderer/settings-modal.ts +537 -0
- package/src/renderer/shell-surface.ts +88 -0
- package/src/renderer/status-glyphs.ts +21 -0
- package/src/renderer/status-token.ts +67 -0
- package/src/renderer/surface-layout.ts +101 -0
- package/src/renderer/syntax-highlighter.ts +542 -0
- package/src/renderer/system-message.ts +83 -0
- package/src/renderer/tab-strip.ts +108 -0
- package/src/renderer/text-layout.ts +31 -0
- package/src/renderer/thinking.ts +17 -0
- package/src/renderer/tool-call.ts +234 -0
- package/src/renderer/ui-factory.ts +524 -0
- package/src/renderer/ui-primitives.ts +96 -0
- package/src/runtime/bootstrap-command-context.ts +278 -0
- package/src/runtime/bootstrap-command-parts.ts +386 -0
- package/src/runtime/bootstrap-core.ts +540 -0
- package/src/runtime/bootstrap-hook-bridge.ts +112 -0
- package/src/runtime/bootstrap-shell.ts +283 -0
- package/src/runtime/bootstrap.ts +575 -0
- package/src/runtime/cloudflare-control-plane.ts +349 -0
- package/src/runtime/context.ts +142 -0
- package/src/runtime/diagnostics/panels/index.ts +24 -0
- package/src/runtime/diagnostics/panels/ops.ts +156 -0
- package/src/runtime/diagnostics/panels/panel-resources.ts +118 -0
- package/src/runtime/diagnostics/panels/policy.ts +177 -0
- package/src/runtime/index.ts +662 -0
- package/src/runtime/onboarding/apply.ts +642 -0
- package/src/runtime/onboarding/derivation.ts +534 -0
- package/src/runtime/onboarding/index.ts +7 -0
- package/src/runtime/onboarding/markers.ts +148 -0
- package/src/runtime/onboarding/snapshot.ts +406 -0
- package/src/runtime/onboarding/state.ts +141 -0
- package/src/runtime/onboarding/types.ts +404 -0
- package/src/runtime/onboarding/verify.ts +171 -0
- package/src/runtime/operator-token-cleanup.ts +27 -0
- package/src/runtime/perf/panel-contracts.ts +32 -0
- package/src/runtime/perf/panel-health-monitor.ts +18 -0
- package/src/runtime/sandbox-public-gaps.ts +358 -0
- package/src/runtime/services.ts +670 -0
- package/src/runtime/store/domains/domain-read-matrix.ts +15 -0
- package/src/runtime/store/domains/index.ts +222 -0
- package/src/runtime/store/domains/panels.ts +117 -0
- package/src/runtime/store/domains/ui-perf.ts +103 -0
- package/src/runtime/store/index.ts +305 -0
- package/src/runtime/store/selectors/index.ts +359 -0
- package/src/runtime/store/state.ts +145 -0
- package/src/runtime/surface-feature-flags.ts +65 -0
- package/src/runtime/terminal-output-guard.ts +228 -0
- package/src/runtime/ui/index.ts +39 -0
- package/src/runtime/ui/model-picker/data-provider.ts +182 -0
- package/src/runtime/ui/model-picker/health-enrichment.ts +228 -0
- package/src/runtime/ui/model-picker/index.ts +59 -0
- package/src/runtime/ui/model-picker/types.ts +149 -0
- package/src/runtime/ui/provider-health/data-provider.ts +244 -0
- package/src/runtime/ui/provider-health/fallback-visualizer.ts +71 -0
- package/src/runtime/ui/provider-health/index.ts +46 -0
- package/src/runtime/ui/provider-health/types.ts +146 -0
- package/src/runtime/ui-events.ts +1 -0
- package/src/runtime/ui-read-model-helpers.ts +1 -0
- package/src/runtime/ui-read-models-observability-maintenance.ts +1 -0
- package/src/runtime/ui-read-models-observability-options.ts +1 -0
- package/src/runtime/ui-read-models-observability-remote.ts +1 -0
- package/src/runtime/ui-read-models-observability-security.ts +1 -0
- package/src/runtime/ui-read-models-observability-system.ts +1 -0
- package/src/runtime/ui-read-models-observability.ts +1 -0
- package/src/runtime/ui-read-models.ts +61 -0
- package/src/runtime/ui-service-queries.ts +1 -0
- package/src/runtime/ui-services.ts +190 -0
- package/src/scripts/process-messages.ts +42 -0
- package/src/shell/blocking-input.ts +98 -0
- package/src/shell/service-settings-sync.ts +273 -0
- package/src/shell/ui-openers.ts +352 -0
- package/src/tools/index.ts +1 -0
- package/src/tools/wrfc-agent-guard.ts +49 -0
- package/src/types/grid.ts +48 -0
- package/src/types/sql-js.d.ts +15 -0
- package/src/utils/clipboard.ts +22 -0
- package/src/utils/splash-lines.ts +46 -0
- package/src/utils/terminal-width.ts +185 -0
- package/src/verification/live-verifier.ts +430 -0
- package/src/verification/verification-ledger.ts +242 -0
- package/src/version.ts +17 -0
- package/src/widget/index.ts +2 -0
- package/src/widget/types.ts +9 -0
- package/src/widget/widget.ts +8 -0
- package/src/work-plans/work-plan-store.ts +374 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import type { Line } from '../../types/grid.ts';
|
|
2
|
+
import { fitDisplay, getDisplayWidth, truncateDisplay, wrapText } from '../../utils/terminal-width.ts';
|
|
3
|
+
import {
|
|
4
|
+
createOverlayBoxLayout,
|
|
5
|
+
createOverlayContentLine,
|
|
6
|
+
createOverlayFilledBorderLine,
|
|
7
|
+
DEFAULT_OVERLAY_PALETTE,
|
|
8
|
+
OVERLAY_GLYPHS,
|
|
9
|
+
putOverlayText,
|
|
10
|
+
} from '../overlay-box.ts';
|
|
11
|
+
import { clamp, drawVerticalRule, fillWidth } from '../fullscreen-primitives.ts';
|
|
12
|
+
import { UI_TONES } from '../ui-primitives.ts';
|
|
13
|
+
import {
|
|
14
|
+
getOnboardingWizardBodyRows,
|
|
15
|
+
getOnboardingWizardVisibleFieldCount,
|
|
16
|
+
type OnboardingWizardController,
|
|
17
|
+
type OnboardingWizardFieldDefinition,
|
|
18
|
+
type OnboardingWizardStepDefinition,
|
|
19
|
+
} from '../../input/onboarding/onboarding-wizard.ts';
|
|
20
|
+
|
|
21
|
+
type RenderedFieldRow =
|
|
22
|
+
| { readonly kind: 'empty' }
|
|
23
|
+
| { readonly kind: 'moreAbove'; readonly text: string }
|
|
24
|
+
| { readonly kind: 'moreBelow'; readonly text: string }
|
|
25
|
+
| {
|
|
26
|
+
readonly kind: 'field';
|
|
27
|
+
readonly field: OnboardingWizardFieldDefinition;
|
|
28
|
+
readonly absoluteIndex: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function modeLabel(mode: OnboardingWizardController['mode']): string {
|
|
32
|
+
if (mode === 'edit') return 'Edit existing';
|
|
33
|
+
if (mode === 'reopen') return 'Reopen review';
|
|
34
|
+
return 'New setup';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function changedScreensLabel(wizard: OnboardingWizardController): string {
|
|
38
|
+
if (wizard.dirtyStepCount === 0) return 'no changes';
|
|
39
|
+
if (wizard.dirtyStepCount === 1) return '1 changed screen';
|
|
40
|
+
return `${wizard.dirtyStepCount} changed screens`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function stepGlyph(
|
|
44
|
+
wizard: OnboardingWizardController,
|
|
45
|
+
step: OnboardingWizardStepDefinition,
|
|
46
|
+
stepIndex: number,
|
|
47
|
+
): { readonly glyph: string; readonly fg: string } {
|
|
48
|
+
if (stepIndex === wizard.stepIndex) {
|
|
49
|
+
return { glyph: OVERLAY_GLYPHS.selected, fg: UI_TONES.state.active };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const total = wizard.getStepFieldCount(stepIndex);
|
|
53
|
+
const completed = wizard.getCompletedFieldCount(stepIndex);
|
|
54
|
+
if (wizard.isStepDirty(stepIndex)) {
|
|
55
|
+
return { glyph: '◈', fg: UI_TONES.state.warn };
|
|
56
|
+
}
|
|
57
|
+
if (total > 0 && completed === total) {
|
|
58
|
+
return { glyph: '✓', fg: UI_TONES.state.good };
|
|
59
|
+
}
|
|
60
|
+
return { glyph: '•', fg: UI_TONES.fg.muted };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function fieldBadgeTone(
|
|
64
|
+
wizard: OnboardingWizardController,
|
|
65
|
+
field: OnboardingWizardFieldDefinition,
|
|
66
|
+
): string {
|
|
67
|
+
if (field.kind === 'status') return UI_TONES.state.info;
|
|
68
|
+
if (field.kind === 'modelPicker') return UI_TONES.state.info;
|
|
69
|
+
if (field.kind === 'acknowledgement') {
|
|
70
|
+
const label = wizard.getFieldValueLabel(field);
|
|
71
|
+
return label === 'Accepted' ? UI_TONES.state.good : label === 'Pending' ? UI_TONES.state.warn : UI_TONES.fg.muted;
|
|
72
|
+
}
|
|
73
|
+
if (field.kind === 'checklist') {
|
|
74
|
+
return wizard.getFieldValue(field) ? UI_TONES.state.good : UI_TONES.fg.muted;
|
|
75
|
+
}
|
|
76
|
+
if (field.kind === 'radio') return UI_TONES.state.active;
|
|
77
|
+
if (field.kind === 'text' || field.kind === 'masked') {
|
|
78
|
+
const missingRequired = wizard.getFieldValueLabel(field) === 'Missing';
|
|
79
|
+
if (missingRequired) return UI_TONES.state.warn;
|
|
80
|
+
if (field.kind === 'masked') return UI_TONES.state.warn;
|
|
81
|
+
}
|
|
82
|
+
return UI_TONES.fg.secondary;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function buildFieldRows(
|
|
86
|
+
wizard: OnboardingWizardController,
|
|
87
|
+
visibleFields: number,
|
|
88
|
+
capacity: number,
|
|
89
|
+
): readonly RenderedFieldRow[] {
|
|
90
|
+
wizard.ensureSelectionVisible(visibleFields);
|
|
91
|
+
const fields = wizard.currentStep.fields;
|
|
92
|
+
const rows: RenderedFieldRow[] = [];
|
|
93
|
+
if (fields.length === 0 || capacity <= 0) return rows;
|
|
94
|
+
|
|
95
|
+
const allRows: RenderedFieldRow[] = [];
|
|
96
|
+
fields.forEach((field, absoluteIndex) => {
|
|
97
|
+
const spacerRows = Math.max(0, field.spacerBeforeRows ?? 0);
|
|
98
|
+
for (let index = 0; index < spacerRows; index += 1) {
|
|
99
|
+
allRows.push({ kind: 'empty' });
|
|
100
|
+
}
|
|
101
|
+
allRows.push({ kind: 'field', field, absoluteIndex });
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const selectedFieldIndex = wizard.getSelectedFieldIndex();
|
|
105
|
+
const selectedRowIndex = Math.max(0, allRows.findIndex((row) => row.kind === 'field' && row.absoluteIndex === selectedFieldIndex));
|
|
106
|
+
const scrollFieldIndex = wizard.scrollOffsets[wizard.stepIndex] ?? 0;
|
|
107
|
+
const scrollRowIndex = allRows.findIndex((row) => row.kind === 'field' && row.absoluteIndex === scrollFieldIndex);
|
|
108
|
+
const maxStart = Math.max(0, allRows.length - capacity);
|
|
109
|
+
let start = clamp(scrollRowIndex >= 0 ? scrollRowIndex : 0, 0, maxStart);
|
|
110
|
+
|
|
111
|
+
if (selectedRowIndex < start) start = selectedRowIndex;
|
|
112
|
+
if (selectedRowIndex >= start + capacity) start = selectedRowIndex - capacity + 1;
|
|
113
|
+
start = clamp(start, 0, maxStart);
|
|
114
|
+
|
|
115
|
+
if (start > 0 && selectedRowIndex === start) start = Math.max(0, start - 1);
|
|
116
|
+
if (start + capacity < allRows.length && selectedRowIndex === start + capacity - 1) {
|
|
117
|
+
start = Math.min(maxStart, start + 1);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
rows.push(...allRows.slice(start, start + capacity));
|
|
121
|
+
if (start > 0 && rows.length > 0) {
|
|
122
|
+
rows[0] = {
|
|
123
|
+
kind: 'moreAbove',
|
|
124
|
+
text: `${OVERLAY_GLYPHS.moreAbove} ${start} more above`,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const hiddenBelow = Math.max(0, allRows.length - (start + capacity));
|
|
129
|
+
if (hiddenBelow > 0 && rows.length > 0) {
|
|
130
|
+
rows[rows.length - 1] = {
|
|
131
|
+
kind: 'moreBelow',
|
|
132
|
+
text: `${OVERLAY_GLYPHS.moreBelow} ${hiddenBelow} more below`,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
while (rows.length < capacity) rows.push({ kind: 'empty' });
|
|
137
|
+
return rows.slice(0, capacity);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function fieldHint(
|
|
141
|
+
wizard: OnboardingWizardController,
|
|
142
|
+
field: OnboardingWizardFieldDefinition,
|
|
143
|
+
selected: boolean,
|
|
144
|
+
): string {
|
|
145
|
+
if (
|
|
146
|
+
selected
|
|
147
|
+
&& wizard.isEditingTextField()
|
|
148
|
+
&& wizard.editingFieldId === field.id
|
|
149
|
+
&& (field.kind === 'text' || field.kind === 'masked')
|
|
150
|
+
) {
|
|
151
|
+
const rawValue = wizard.editBuffer.length > 0 ? wizard.editBuffer : field.placeholder;
|
|
152
|
+
const editingValue = field.kind === 'masked' && wizard.editBuffer.length > 0
|
|
153
|
+
? '•'.repeat(Math.min(12, Math.max(4, wizard.editBuffer.length)))
|
|
154
|
+
: rawValue;
|
|
155
|
+
return `Editing: ${editingValue}█`;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (selected && field.kind === 'modelPicker') return `${field.hint} Press Enter to open picker.`;
|
|
159
|
+
if (selected && field.kind === 'text') return `${field.hint} Press Enter to edit inline.`;
|
|
160
|
+
if (selected && field.kind === 'masked') return `${field.hint} Press Enter to edit inline.`;
|
|
161
|
+
return field.hint;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function fieldRowPrefix(
|
|
165
|
+
wizard: OnboardingWizardController,
|
|
166
|
+
field: OnboardingWizardFieldDefinition,
|
|
167
|
+
selected: boolean,
|
|
168
|
+
): string {
|
|
169
|
+
if (selected) return `${OVERLAY_GLYPHS.selected} `;
|
|
170
|
+
if (wizard.isFieldDirty(field.id)) return '◇ ';
|
|
171
|
+
if (field.kind === 'checklist') return (wizard.getFieldValue(field) as boolean) ? '✓ ' : '□ ';
|
|
172
|
+
if (field.kind === 'acknowledgement') return (wizard.getFieldValue(field) as boolean) ? '✓ ' : '□ ';
|
|
173
|
+
if (field.kind === 'action') return '▶ ';
|
|
174
|
+
if (field.kind === 'radio') return '◉ ';
|
|
175
|
+
return ' ';
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function selectedFieldText(wizard: OnboardingWizardController): {
|
|
179
|
+
readonly title: string;
|
|
180
|
+
readonly hint: string;
|
|
181
|
+
} {
|
|
182
|
+
if (wizard.isEditingTextField() && wizard.editingFieldId !== null) {
|
|
183
|
+
const editingField = wizard.getFieldById(wizard.editingFieldId);
|
|
184
|
+
if (editingField) {
|
|
185
|
+
return {
|
|
186
|
+
title: `Editing: ${editingField.label}`,
|
|
187
|
+
hint: fieldHint(wizard, editingField, true),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const field = wizard.getSelectedField();
|
|
193
|
+
if (!field) {
|
|
194
|
+
return {
|
|
195
|
+
title: 'Selected: none',
|
|
196
|
+
hint: 'No selectable row is active on this screen.',
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
title: `Selected: ${field.label} [${wizard.getFieldValueLabel(field)}]`,
|
|
202
|
+
hint: fieldHint(wizard, field, true),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function renderFieldRow(
|
|
207
|
+
line: Line,
|
|
208
|
+
wizard: OnboardingWizardController,
|
|
209
|
+
fieldRow: RenderedFieldRow,
|
|
210
|
+
startX: number,
|
|
211
|
+
width: number,
|
|
212
|
+
): void {
|
|
213
|
+
if (fieldRow.kind === 'empty') return;
|
|
214
|
+
|
|
215
|
+
if (fieldRow.kind === 'moreAbove' || fieldRow.kind === 'moreBelow') {
|
|
216
|
+
putOverlayText(line, startX + 1, width - 2, truncateDisplay(fieldRow.text, width - 2), {
|
|
217
|
+
fg: UI_TONES.fg.muted,
|
|
218
|
+
bg: UI_TONES.bg.base,
|
|
219
|
+
dim: true,
|
|
220
|
+
});
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const selected = fieldRow.absoluteIndex === wizard.getSelectedFieldIndex();
|
|
225
|
+
const field = fieldRow.field;
|
|
226
|
+
const fieldBg = selected ? DEFAULT_OVERLAY_PALETTE.selectedBg : UI_TONES.bg.base;
|
|
227
|
+
fillWidth(line, startX, width, fieldBg);
|
|
228
|
+
|
|
229
|
+
const badge = truncateDisplay(`[${wizard.getFieldValueLabel(field)}]`, Math.max(8, Math.floor(width * 0.34)));
|
|
230
|
+
const badgeWidth = getDisplayWidth(badge);
|
|
231
|
+
const labelWidth = Math.max(0, width - badgeWidth - 4);
|
|
232
|
+
const prefix = fieldRowPrefix(wizard, field, selected);
|
|
233
|
+
|
|
234
|
+
putOverlayText(line, startX + 1, labelWidth, truncateDisplay(`${prefix}${field.label}`, labelWidth), {
|
|
235
|
+
fg: UI_TONES.fg.primary,
|
|
236
|
+
bg: fieldBg,
|
|
237
|
+
bold: selected,
|
|
238
|
+
});
|
|
239
|
+
putOverlayText(line, startX + width - badgeWidth - 1, badgeWidth, badge, {
|
|
240
|
+
fg: fieldBadgeTone(wizard, field),
|
|
241
|
+
bg: fieldBg,
|
|
242
|
+
bold: selected,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function footerText(wizard: OnboardingWizardController): string {
|
|
247
|
+
if (wizard.isEditingTextField()) {
|
|
248
|
+
return '[Enter] Save value [Esc] Cancel edit [Backspace] Delete char [Del/Ctrl+U] Clear value';
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return '[Enter] Toggle/open [Esc] Close [Tab/Shift+Tab] Screen [↑↓] Move [Del/Ctrl+U] Clear input';
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function controlsText(wizard: OnboardingWizardController): string {
|
|
255
|
+
if (wizard.isEditingTextField()) {
|
|
256
|
+
return 'Controls: Enter saves this value, Esc cancels editing, Backspace deletes one character, Delete or Ctrl+U clears the field.';
|
|
257
|
+
}
|
|
258
|
+
return 'Controls: Enter or Space changes the selected row; Delete or Ctrl+U clears selected text inputs; Tab/Shift+Tab changes screens; arrows move.';
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function renderWideLayout(
|
|
262
|
+
wizard: OnboardingWizardController,
|
|
263
|
+
width: number,
|
|
264
|
+
viewportHeight: number,
|
|
265
|
+
layout: ReturnType<typeof createOverlayBoxLayout>,
|
|
266
|
+
): Line[] {
|
|
267
|
+
const lines: Line[] = [];
|
|
268
|
+
const bodyRows = getOnboardingWizardBodyRows(viewportHeight);
|
|
269
|
+
const visibleFields = getOnboardingWizardVisibleFieldCount(viewportHeight);
|
|
270
|
+
const currentStep = wizard.currentStep;
|
|
271
|
+
const borderFg = DEFAULT_OVERLAY_PALETTE.borderFg;
|
|
272
|
+
const headerBg = UI_TONES.bg.title;
|
|
273
|
+
const railBg = UI_TONES.bg.section;
|
|
274
|
+
const bodyBg = UI_TONES.bg.base;
|
|
275
|
+
const summaryBg = UI_TONES.bg.summary;
|
|
276
|
+
const innerLeft = layout.margin + 1;
|
|
277
|
+
const availableInner = layout.innerWidth - 2;
|
|
278
|
+
const leftWidthBase = layout.innerWidth >= 150 ? 32 : layout.innerWidth >= 108 ? 28 : 24;
|
|
279
|
+
const rightWidthBase = layout.innerWidth >= 150 ? 34 : layout.innerWidth >= 108 ? 32 : 24;
|
|
280
|
+
const minCenterWidth = layout.innerWidth >= 120 ? 48 : 40;
|
|
281
|
+
let leftWidth = Math.min(leftWidthBase, Math.max(20, availableInner - minCenterWidth - 12));
|
|
282
|
+
let rightWidth = Math.min(rightWidthBase, Math.max(22, availableInner - minCenterWidth - leftWidth));
|
|
283
|
+
let centerWidth = layout.innerWidth - leftWidth - rightWidth - 2;
|
|
284
|
+
|
|
285
|
+
if (centerWidth < minCenterWidth) {
|
|
286
|
+
const deficit = minCenterWidth - centerWidth;
|
|
287
|
+
const leftCut = Math.min(Math.max(0, leftWidth - 20), Math.ceil(deficit / 2));
|
|
288
|
+
leftWidth -= leftCut;
|
|
289
|
+
rightWidth -= Math.min(Math.max(0, rightWidth - 22), deficit - leftCut);
|
|
290
|
+
centerWidth = layout.innerWidth - leftWidth - rightWidth - 2;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const leftStart = innerLeft;
|
|
294
|
+
const leftSeparatorX = leftStart + leftWidth;
|
|
295
|
+
const centerStart = leftSeparatorX + 1;
|
|
296
|
+
const rightSeparatorX = centerStart + centerWidth;
|
|
297
|
+
const rightStart = rightSeparatorX + 1;
|
|
298
|
+
const descriptionLines = wrapText(currentStep.description, Math.max(18, centerWidth - 2)).slice(0, 2);
|
|
299
|
+
const summaryLines = [
|
|
300
|
+
currentStep.summaryTitle,
|
|
301
|
+
...currentStep.summaryLines.slice(0, 2),
|
|
302
|
+
`Fields ${wizard.getCompletedFieldCount(wizard.stepIndex)}/${wizard.getStepFieldCount(wizard.stepIndex)} complete`,
|
|
303
|
+
changedScreensLabel(wizard),
|
|
304
|
+
];
|
|
305
|
+
const fieldStartRow = 6;
|
|
306
|
+
const selectedText = selectedFieldText(wizard);
|
|
307
|
+
const fieldRows = buildFieldRows(wizard, visibleFields, Math.max(0, bodyRows - fieldStartRow));
|
|
308
|
+
|
|
309
|
+
const topLine = createOverlayFilledBorderLine(
|
|
310
|
+
width,
|
|
311
|
+
layout,
|
|
312
|
+
OVERLAY_GLYPHS.topLeft,
|
|
313
|
+
OVERLAY_GLYPHS.horizontal,
|
|
314
|
+
OVERLAY_GLYPHS.topRight,
|
|
315
|
+
borderFg,
|
|
316
|
+
headerBg,
|
|
317
|
+
);
|
|
318
|
+
putOverlayText(topLine, layout.margin + 2, layout.width - 4, 'Onboarding Wizard', {
|
|
319
|
+
fg: UI_TONES.fg.primary,
|
|
320
|
+
bg: headerBg,
|
|
321
|
+
bold: true,
|
|
322
|
+
});
|
|
323
|
+
const meta = `${modeLabel(wizard.mode)} ${wizard.stepIndex + 1}/${wizard.steps.length} ${changedScreensLabel(wizard)}`;
|
|
324
|
+
putOverlayText(topLine, Math.max(layout.margin + 2, layout.margin + layout.width - getDisplayWidth(meta) - 3), layout.width - 4, meta, {
|
|
325
|
+
fg: UI_TONES.fg.secondary,
|
|
326
|
+
bg: headerBg,
|
|
327
|
+
});
|
|
328
|
+
lines.push(topLine);
|
|
329
|
+
|
|
330
|
+
const headerLine = createOverlayContentLine(width, layout, borderFg, headerBg);
|
|
331
|
+
fillWidth(headerLine, leftStart, leftWidth, railBg);
|
|
332
|
+
fillWidth(headerLine, centerStart, centerWidth, headerBg);
|
|
333
|
+
fillWidth(headerLine, rightStart, rightWidth, summaryBg);
|
|
334
|
+
drawVerticalRule(headerLine, leftSeparatorX, borderFg, headerBg);
|
|
335
|
+
drawVerticalRule(headerLine, rightSeparatorX, borderFg, headerBg);
|
|
336
|
+
putOverlayText(headerLine, leftStart + 1, leftWidth - 2, 'Steps', {
|
|
337
|
+
fg: UI_TONES.fg.secondary,
|
|
338
|
+
bg: railBg,
|
|
339
|
+
bold: true,
|
|
340
|
+
});
|
|
341
|
+
putOverlayText(headerLine, centerStart + 1, centerWidth - 2, truncateDisplay(currentStep.title, centerWidth - 2), {
|
|
342
|
+
fg: UI_TONES.state.active,
|
|
343
|
+
bg: headerBg,
|
|
344
|
+
bold: true,
|
|
345
|
+
});
|
|
346
|
+
putOverlayText(headerLine, rightStart + 1, rightWidth - 2, 'Summary', {
|
|
347
|
+
fg: UI_TONES.fg.secondary,
|
|
348
|
+
bg: summaryBg,
|
|
349
|
+
bold: true,
|
|
350
|
+
});
|
|
351
|
+
lines.push(headerLine);
|
|
352
|
+
|
|
353
|
+
lines.push(createOverlayFilledBorderLine(
|
|
354
|
+
width,
|
|
355
|
+
layout,
|
|
356
|
+
OVERLAY_GLYPHS.teeLeft,
|
|
357
|
+
OVERLAY_GLYPHS.horizontal,
|
|
358
|
+
OVERLAY_GLYPHS.teeRight,
|
|
359
|
+
borderFg,
|
|
360
|
+
bodyBg,
|
|
361
|
+
));
|
|
362
|
+
|
|
363
|
+
for (let row = 0; row < bodyRows; row += 1) {
|
|
364
|
+
const line = createOverlayContentLine(width, layout, borderFg, bodyBg);
|
|
365
|
+
fillWidth(line, leftStart, leftWidth, railBg);
|
|
366
|
+
fillWidth(line, centerStart, centerWidth, bodyBg);
|
|
367
|
+
fillWidth(line, rightStart, rightWidth, summaryBg);
|
|
368
|
+
drawVerticalRule(line, leftSeparatorX, borderFg);
|
|
369
|
+
drawVerticalRule(line, rightSeparatorX, borderFg);
|
|
370
|
+
|
|
371
|
+
if (row === 0) {
|
|
372
|
+
putOverlayText(line, centerStart + 1, centerWidth - 2, truncateDisplay(currentStep.title, centerWidth - 2), {
|
|
373
|
+
fg: UI_TONES.fg.primary,
|
|
374
|
+
bg: bodyBg,
|
|
375
|
+
bold: true,
|
|
376
|
+
});
|
|
377
|
+
} else if (row === 1) {
|
|
378
|
+
putOverlayText(line, centerStart + 1, centerWidth - 2, descriptionLines[0] ?? '', {
|
|
379
|
+
fg: UI_TONES.fg.secondary,
|
|
380
|
+
bg: bodyBg,
|
|
381
|
+
});
|
|
382
|
+
} else if (row === 2) {
|
|
383
|
+
putOverlayText(line, centerStart + 1, centerWidth - 2, descriptionLines[1] ?? '', {
|
|
384
|
+
fg: UI_TONES.fg.secondary,
|
|
385
|
+
bg: bodyBg,
|
|
386
|
+
});
|
|
387
|
+
} else if (row === 3) {
|
|
388
|
+
fillWidth(line, centerStart, centerWidth, railBg);
|
|
389
|
+
putOverlayText(line, centerStart + 1, centerWidth - 2, truncateDisplay(controlsText(wizard), centerWidth - 2), {
|
|
390
|
+
fg: UI_TONES.state.info,
|
|
391
|
+
bg: railBg,
|
|
392
|
+
});
|
|
393
|
+
} else if (row === 4) {
|
|
394
|
+
fillWidth(line, centerStart, centerWidth, DEFAULT_OVERLAY_PALETTE.selectedBg);
|
|
395
|
+
putOverlayText(line, centerStart + 1, centerWidth - 2, truncateDisplay(`Focus: ${selectedText.title.replace(/^Selected: /, '')}`, centerWidth - 2), {
|
|
396
|
+
fg: UI_TONES.fg.primary,
|
|
397
|
+
bg: DEFAULT_OVERLAY_PALETTE.selectedBg,
|
|
398
|
+
bold: true,
|
|
399
|
+
});
|
|
400
|
+
} else if (row === 5) {
|
|
401
|
+
fillWidth(line, centerStart, centerWidth, DEFAULT_OVERLAY_PALETTE.selectedBg);
|
|
402
|
+
putOverlayText(line, centerStart + 1, centerWidth - 2, truncateDisplay(selectedText.hint, centerWidth - 2), {
|
|
403
|
+
fg: UI_TONES.fg.secondary,
|
|
404
|
+
bg: DEFAULT_OVERLAY_PALETTE.selectedBg,
|
|
405
|
+
});
|
|
406
|
+
} else {
|
|
407
|
+
renderFieldRow(line, wizard, fieldRows[row - fieldStartRow] ?? { kind: 'empty' }, centerStart, centerWidth);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const step = wizard.steps[row] ?? null;
|
|
411
|
+
if (step) {
|
|
412
|
+
const stepState = stepGlyph(wizard, step, row);
|
|
413
|
+
const completion = `${wizard.getCompletedFieldCount(row)}/${wizard.getStepFieldCount(row)}`;
|
|
414
|
+
const completionWidth = getDisplayWidth(completion);
|
|
415
|
+
const stepLabelWidth = Math.max(0, leftWidth - completionWidth - 4);
|
|
416
|
+
putOverlayText(line, leftStart + 1, stepLabelWidth, truncateDisplay(`${stepState.glyph} ${row + 1}. ${step.shortLabel}`, stepLabelWidth), {
|
|
417
|
+
fg: stepState.fg,
|
|
418
|
+
bg: railBg,
|
|
419
|
+
bold: row === wizard.stepIndex,
|
|
420
|
+
});
|
|
421
|
+
putOverlayText(line, Math.max(leftStart + 1, leftStart + leftWidth - completionWidth - 2), completionWidth, completion, {
|
|
422
|
+
fg: wizard.isStepDirty(row) ? UI_TONES.state.warn : UI_TONES.fg.muted,
|
|
423
|
+
bg: railBg,
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
const summaryText = summaryLines[row];
|
|
428
|
+
if (summaryText) {
|
|
429
|
+
putOverlayText(line, rightStart + 1, rightWidth - 2, truncateDisplay(summaryText, rightWidth - 2), {
|
|
430
|
+
fg: row === 0 ? UI_TONES.state.info : UI_TONES.fg.secondary,
|
|
431
|
+
bg: summaryBg,
|
|
432
|
+
bold: row === 0,
|
|
433
|
+
dim: row > 0,
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
lines.push(line);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
lines.push(createOverlayFilledBorderLine(
|
|
441
|
+
width,
|
|
442
|
+
layout,
|
|
443
|
+
OVERLAY_GLYPHS.teeLeft,
|
|
444
|
+
OVERLAY_GLYPHS.horizontal,
|
|
445
|
+
OVERLAY_GLYPHS.teeRight,
|
|
446
|
+
borderFg,
|
|
447
|
+
bodyBg,
|
|
448
|
+
));
|
|
449
|
+
|
|
450
|
+
const footer = createOverlayFilledBorderLine(
|
|
451
|
+
width,
|
|
452
|
+
layout,
|
|
453
|
+
OVERLAY_GLYPHS.bottomLeft,
|
|
454
|
+
OVERLAY_GLYPHS.horizontal,
|
|
455
|
+
OVERLAY_GLYPHS.bottomRight,
|
|
456
|
+
borderFg,
|
|
457
|
+
headerBg,
|
|
458
|
+
);
|
|
459
|
+
putOverlayText(footer, layout.margin + 2, layout.width - 4, truncateDisplay(footerText(wizard), layout.width - 4), {
|
|
460
|
+
fg: UI_TONES.fg.muted,
|
|
461
|
+
bg: headerBg,
|
|
462
|
+
dim: true,
|
|
463
|
+
});
|
|
464
|
+
lines.push(footer);
|
|
465
|
+
|
|
466
|
+
return lines.slice(0, viewportHeight);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function renderCollapsedLayout(
|
|
470
|
+
wizard: OnboardingWizardController,
|
|
471
|
+
width: number,
|
|
472
|
+
viewportHeight: number,
|
|
473
|
+
layout: ReturnType<typeof createOverlayBoxLayout>,
|
|
474
|
+
): Line[] {
|
|
475
|
+
const lines: Line[] = [];
|
|
476
|
+
const bodyRows = getOnboardingWizardBodyRows(viewportHeight);
|
|
477
|
+
const visibleFields = getOnboardingWizardVisibleFieldCount(viewportHeight);
|
|
478
|
+
const currentStep = wizard.currentStep;
|
|
479
|
+
const borderFg = DEFAULT_OVERLAY_PALETTE.borderFg;
|
|
480
|
+
const headerBg = UI_TONES.bg.title;
|
|
481
|
+
const bodyBg = UI_TONES.bg.base;
|
|
482
|
+
const innerStart = layout.margin + 1;
|
|
483
|
+
const innerWidth = layout.innerWidth;
|
|
484
|
+
const descriptionLines = wrapText(currentStep.description, Math.max(14, innerWidth - 2)).slice(0, 2);
|
|
485
|
+
const fieldStartRow = 6;
|
|
486
|
+
const selectedText = selectedFieldText(wizard);
|
|
487
|
+
const fieldRows = buildFieldRows(wizard, visibleFields, Math.max(0, bodyRows - fieldStartRow));
|
|
488
|
+
|
|
489
|
+
const topLine = createOverlayFilledBorderLine(
|
|
490
|
+
width,
|
|
491
|
+
layout,
|
|
492
|
+
OVERLAY_GLYPHS.topLeft,
|
|
493
|
+
OVERLAY_GLYPHS.horizontal,
|
|
494
|
+
OVERLAY_GLYPHS.topRight,
|
|
495
|
+
borderFg,
|
|
496
|
+
headerBg,
|
|
497
|
+
);
|
|
498
|
+
putOverlayText(topLine, layout.margin + 2, layout.width - 4, 'Onboarding Wizard', {
|
|
499
|
+
fg: UI_TONES.fg.primary,
|
|
500
|
+
bg: headerBg,
|
|
501
|
+
bold: true,
|
|
502
|
+
});
|
|
503
|
+
const meta = `${wizard.stepIndex + 1}/${wizard.steps.length} • ${changedScreensLabel(wizard)}`;
|
|
504
|
+
putOverlayText(topLine, Math.max(layout.margin + 2, layout.margin + layout.width - getDisplayWidth(meta) - 3), layout.width - 4, meta, {
|
|
505
|
+
fg: UI_TONES.fg.secondary,
|
|
506
|
+
bg: headerBg,
|
|
507
|
+
});
|
|
508
|
+
lines.push(topLine);
|
|
509
|
+
|
|
510
|
+
const headerLine = createOverlayContentLine(width, layout, borderFg, headerBg);
|
|
511
|
+
fillWidth(headerLine, innerStart, innerWidth, headerBg);
|
|
512
|
+
putOverlayText(headerLine, innerStart + 1, innerWidth - 2, fitDisplay(`${modeLabel(wizard.mode)} • ${currentStep.shortLabel}`, innerWidth - 2), {
|
|
513
|
+
fg: UI_TONES.state.active,
|
|
514
|
+
bg: headerBg,
|
|
515
|
+
bold: true,
|
|
516
|
+
});
|
|
517
|
+
lines.push(headerLine);
|
|
518
|
+
|
|
519
|
+
lines.push(createOverlayFilledBorderLine(
|
|
520
|
+
width,
|
|
521
|
+
layout,
|
|
522
|
+
OVERLAY_GLYPHS.teeLeft,
|
|
523
|
+
OVERLAY_GLYPHS.horizontal,
|
|
524
|
+
OVERLAY_GLYPHS.teeRight,
|
|
525
|
+
borderFg,
|
|
526
|
+
bodyBg,
|
|
527
|
+
));
|
|
528
|
+
|
|
529
|
+
for (let row = 0; row < bodyRows; row += 1) {
|
|
530
|
+
const line = createOverlayContentLine(width, layout, borderFg, bodyBg);
|
|
531
|
+
fillWidth(line, innerStart, innerWidth, bodyBg);
|
|
532
|
+
|
|
533
|
+
if (row === 0) {
|
|
534
|
+
putOverlayText(line, innerStart + 1, innerWidth - 2, truncateDisplay(currentStep.title, innerWidth - 2), {
|
|
535
|
+
fg: UI_TONES.fg.primary,
|
|
536
|
+
bg: bodyBg,
|
|
537
|
+
bold: true,
|
|
538
|
+
});
|
|
539
|
+
} else if (row === 1) {
|
|
540
|
+
putOverlayText(line, innerStart + 1, innerWidth - 2, descriptionLines[0] ?? '', {
|
|
541
|
+
fg: UI_TONES.fg.secondary,
|
|
542
|
+
bg: bodyBg,
|
|
543
|
+
});
|
|
544
|
+
} else if (row === 2) {
|
|
545
|
+
putOverlayText(line, innerStart + 1, innerWidth - 2, descriptionLines[1] ?? '', {
|
|
546
|
+
fg: UI_TONES.fg.secondary,
|
|
547
|
+
bg: bodyBg,
|
|
548
|
+
});
|
|
549
|
+
} else if (row === 3) {
|
|
550
|
+
fillWidth(line, innerStart, innerWidth, UI_TONES.bg.section);
|
|
551
|
+
putOverlayText(line, innerStart + 1, innerWidth - 2, truncateDisplay(controlsText(wizard), innerWidth - 2), {
|
|
552
|
+
fg: UI_TONES.state.info,
|
|
553
|
+
bg: UI_TONES.bg.section,
|
|
554
|
+
});
|
|
555
|
+
} else if (row === 4) {
|
|
556
|
+
fillWidth(line, innerStart, innerWidth, DEFAULT_OVERLAY_PALETTE.selectedBg);
|
|
557
|
+
putOverlayText(line, innerStart + 1, innerWidth - 2, truncateDisplay(`Focus: ${selectedText.title.replace(/^Selected: /, '')}`, innerWidth - 2), {
|
|
558
|
+
fg: UI_TONES.fg.primary,
|
|
559
|
+
bg: DEFAULT_OVERLAY_PALETTE.selectedBg,
|
|
560
|
+
bold: true,
|
|
561
|
+
});
|
|
562
|
+
} else if (row === 5) {
|
|
563
|
+
fillWidth(line, innerStart, innerWidth, DEFAULT_OVERLAY_PALETTE.selectedBg);
|
|
564
|
+
putOverlayText(line, innerStart + 1, innerWidth - 2, truncateDisplay(selectedText.hint, innerWidth - 2), {
|
|
565
|
+
fg: UI_TONES.fg.secondary,
|
|
566
|
+
bg: DEFAULT_OVERLAY_PALETTE.selectedBg,
|
|
567
|
+
});
|
|
568
|
+
} else {
|
|
569
|
+
renderFieldRow(line, wizard, fieldRows[row - fieldStartRow] ?? { kind: 'empty' }, innerStart, innerWidth);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
lines.push(line);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
lines.push(createOverlayFilledBorderLine(
|
|
576
|
+
width,
|
|
577
|
+
layout,
|
|
578
|
+
OVERLAY_GLYPHS.teeLeft,
|
|
579
|
+
OVERLAY_GLYPHS.horizontal,
|
|
580
|
+
OVERLAY_GLYPHS.teeRight,
|
|
581
|
+
borderFg,
|
|
582
|
+
bodyBg,
|
|
583
|
+
));
|
|
584
|
+
|
|
585
|
+
const footer = createOverlayFilledBorderLine(
|
|
586
|
+
width,
|
|
587
|
+
layout,
|
|
588
|
+
OVERLAY_GLYPHS.bottomLeft,
|
|
589
|
+
OVERLAY_GLYPHS.horizontal,
|
|
590
|
+
OVERLAY_GLYPHS.bottomRight,
|
|
591
|
+
borderFg,
|
|
592
|
+
headerBg,
|
|
593
|
+
);
|
|
594
|
+
putOverlayText(footer, layout.margin + 2, layout.width - 4, truncateDisplay(footerText(wizard), layout.width - 4), {
|
|
595
|
+
fg: UI_TONES.fg.muted,
|
|
596
|
+
bg: headerBg,
|
|
597
|
+
dim: true,
|
|
598
|
+
});
|
|
599
|
+
lines.push(footer);
|
|
600
|
+
|
|
601
|
+
return lines.slice(0, viewportHeight);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export function renderOnboardingWizard(
|
|
605
|
+
wizard: OnboardingWizardController,
|
|
606
|
+
width: number,
|
|
607
|
+
viewportHeight: number,
|
|
608
|
+
): Line[] {
|
|
609
|
+
const margin = width >= 64 ? 1 : 0;
|
|
610
|
+
const layout = createOverlayBoxLayout(width, margin, Math.max(20, width - margin * 2));
|
|
611
|
+
const collapsed = layout.innerWidth < 86;
|
|
612
|
+
return collapsed
|
|
613
|
+
? renderCollapsedLayout(wizard, width, viewportHeight, layout)
|
|
614
|
+
: renderWideLayout(wizard, width, viewportHeight, layout);
|
|
615
|
+
}
|