@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,295 @@
|
|
|
1
|
+
import type { Line } from '../types/grid.ts';
|
|
2
|
+
import { ScrollableListPanel } from './scrollable-list-panel.ts';
|
|
3
|
+
import type { TokenAuditResult } from '@pellux/goodvibes-sdk/platform/security';
|
|
4
|
+
import type { UiReadModel, UiSecuritySnapshot } from '../runtime/ui-read-models.ts';
|
|
5
|
+
import {
|
|
6
|
+
buildEmptyState,
|
|
7
|
+
buildGuidanceLine,
|
|
8
|
+
buildPanelLine,
|
|
9
|
+
buildPanelWorkspace,
|
|
10
|
+
buildStatusPill,
|
|
11
|
+
DEFAULT_PANEL_PALETTE,
|
|
12
|
+
} from './polish.ts';
|
|
13
|
+
import { createEmptyLine } from '../types/grid.ts';
|
|
14
|
+
|
|
15
|
+
const C = {
|
|
16
|
+
...DEFAULT_PANEL_PALETTE,
|
|
17
|
+
header: '#94a3b8',
|
|
18
|
+
headerBg: '#1e293b',
|
|
19
|
+
dim: '#475569',
|
|
20
|
+
ok: '#22c55e',
|
|
21
|
+
warn: '#eab308',
|
|
22
|
+
error: '#ef4444',
|
|
23
|
+
selectBg: '#0f172a',
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
function managedColor(managed: boolean): string {
|
|
27
|
+
return managed ? C.warn : C.info;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function resultColor(result: TokenAuditResult): string {
|
|
31
|
+
if (result.blocked) return C.error;
|
|
32
|
+
if (result.scope.outcome === 'violation') return C.error;
|
|
33
|
+
if (result.rotation.outcome === 'overdue') return C.error;
|
|
34
|
+
if (result.rotation.outcome === 'warning') return C.warn;
|
|
35
|
+
return C.ok;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function resultSummary(result: TokenAuditResult): string {
|
|
39
|
+
const parts: string[] = [];
|
|
40
|
+
if (result.scope.outcome === 'violation') parts.push(`scope:${result.scope.excessScopes.join(',')}`);
|
|
41
|
+
if (result.rotation.outcome === 'warning') parts.push('rotation warning');
|
|
42
|
+
if (result.rotation.outcome === 'overdue') parts.push('rotation overdue');
|
|
43
|
+
if (result.blocked) parts.push('blocked');
|
|
44
|
+
return parts.length > 0 ? parts.join(' | ') : 'in policy';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function severityColor(severity: 'low' | 'medium' | 'high' | 'critical'): string {
|
|
48
|
+
switch (severity) {
|
|
49
|
+
case 'critical':
|
|
50
|
+
case 'high':
|
|
51
|
+
return C.error;
|
|
52
|
+
case 'medium':
|
|
53
|
+
return C.warn;
|
|
54
|
+
case 'low':
|
|
55
|
+
default:
|
|
56
|
+
return C.ok;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export class SecurityPanel extends ScrollableListPanel<TokenAuditResult> {
|
|
61
|
+
private readonly unsub: (() => void) | null;
|
|
62
|
+
|
|
63
|
+
public constructor(private readonly readModel: UiReadModel<UiSecuritySnapshot>) {
|
|
64
|
+
super('security', 'Security', 'U', 'monitoring');
|
|
65
|
+
this.showSelectionGutter = true; // I5: non-color selection affordance
|
|
66
|
+
this.unsub = this.readModel.subscribe(() => this.markDirty());
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public override onDestroy(): void {
|
|
70
|
+
this.unsub?.();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected override getPalette() { return C; }
|
|
74
|
+
protected override getEmptyStateMessage() { return ' No API tokens are registered with the security auditor yet.'; }
|
|
75
|
+
protected override getEmptyStateActions() {
|
|
76
|
+
return [
|
|
77
|
+
{ command: '/storage review', summary: 'inspect secure secret storage and environment overrides' },
|
|
78
|
+
{ command: '/policy preflight', summary: 'run a live preflight posture review' },
|
|
79
|
+
{ command: '/mcp trust', summary: 'inspect active MCP trust and quarantine posture' },
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
protected getItems(): readonly TokenAuditResult[] {
|
|
84
|
+
return this.readModel.getSnapshot().audit.results;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
protected renderItem(result: TokenAuditResult, index: number, selected: boolean, width: number): Line {
|
|
88
|
+
const bg = selected ? C.selectBg : undefined;
|
|
89
|
+
return buildPanelLine(width, [
|
|
90
|
+
[' ', C.label, bg],
|
|
91
|
+
[result.label.padEnd(22), C.value, bg],
|
|
92
|
+
[` ${result.tokenId.padEnd(12)}`, C.info, bg],
|
|
93
|
+
[` ${result.scope.policyId.padEnd(10)}`, C.label, bg],
|
|
94
|
+
[` ${resultSummary(result).slice(0, Math.max(0, width - 49))}`, resultColor(result), bg],
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
public handleInput(key: string): boolean {
|
|
99
|
+
if (key === 'r') {
|
|
100
|
+
this.markDirty();
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
return super.handleInput(key);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
public render(width: number, height: number): Line[] {
|
|
107
|
+
this.clampSelection();
|
|
108
|
+
const snapshot = this.readModel.getSnapshot();
|
|
109
|
+
const view = snapshot.audit;
|
|
110
|
+
const preflightStatus = snapshot.policy.preflightStatus;
|
|
111
|
+
const preflightIssueCount = snapshot.policy.preflightIssueCount;
|
|
112
|
+
const lintFindingCount = snapshot.policy.lintFindingCount;
|
|
113
|
+
const quarantinedMcp = snapshot.mcpServers.filter((server) => server.schemaFreshness === 'quarantined');
|
|
114
|
+
const elevatedMcp = snapshot.mcpServers.filter((server) => server.trustMode === 'allow-all');
|
|
115
|
+
const incidents = snapshot.incidents;
|
|
116
|
+
const latestIncident = snapshot.latestIncident;
|
|
117
|
+
const quarantinedPlugins = snapshot.quarantinedPlugins;
|
|
118
|
+
const untrustedPlugins = snapshot.untrustedPlugins;
|
|
119
|
+
const attackPathReview = snapshot.attackPathReview;
|
|
120
|
+
const intro = 'Token audit, policy posture, MCP attack-path review, plugin trust, and incident pressure.';
|
|
121
|
+
const footerLine = buildGuidanceLine(width, '/policy preflight', 'run a proactive policy review before risky work starts', C);
|
|
122
|
+
|
|
123
|
+
const governanceLines: Line[] = [
|
|
124
|
+
buildPanelLine(width, [
|
|
125
|
+
[' mode ', C.label],
|
|
126
|
+
[view.managed ? 'MANAGED' : 'ADVISORY', managedColor(view.managed)],
|
|
127
|
+
[' tokens ', C.label],
|
|
128
|
+
[String(view.totalTokens), C.value],
|
|
129
|
+
[' blocked ', C.label],
|
|
130
|
+
...buildStatusPill(view.blocked.length > 0 ? 'bad' : 'good', String(view.blocked.length)),
|
|
131
|
+
[' scope violations ', C.label],
|
|
132
|
+
...buildStatusPill(view.scopeViolations.length > 0 ? 'bad' : 'good', String(view.scopeViolations.length)),
|
|
133
|
+
[' overdue ', C.label],
|
|
134
|
+
...buildStatusPill(view.rotationOverdue.length > 0 ? 'bad' : 'good', String(view.rotationOverdue.length)),
|
|
135
|
+
[' warnings ', C.label],
|
|
136
|
+
...buildStatusPill(view.rotationWarnings.length > 0 ? 'warn' : 'good', String(view.rotationWarnings.length)),
|
|
137
|
+
]),
|
|
138
|
+
buildPanelLine(width, [
|
|
139
|
+
[' preflight ', C.label],
|
|
140
|
+
...buildStatusPill(preflightStatus === 'block' ? 'bad' : preflightStatus === 'warn' ? 'warn' : preflightStatus === 'pass' ? 'good' : 'info', preflightStatus.toUpperCase()),
|
|
141
|
+
[' issues ', C.label],
|
|
142
|
+
...buildStatusPill(preflightIssueCount > 0 ? 'warn' : 'good', String(preflightIssueCount)),
|
|
143
|
+
[' lint ', C.label],
|
|
144
|
+
...buildStatusPill(lintFindingCount > 0 ? 'warn' : 'good', String(lintFindingCount)),
|
|
145
|
+
[' denied permissions ', C.label],
|
|
146
|
+
...buildStatusPill(snapshot.deniedPermissions > 0 ? 'warn' : 'good', String(snapshot.deniedPermissions)),
|
|
147
|
+
]),
|
|
148
|
+
buildPanelLine(width, [
|
|
149
|
+
[' quarantined MCP ', C.label],
|
|
150
|
+
...buildStatusPill(quarantinedMcp.length > 0 ? 'bad' : 'good', String(quarantinedMcp.length)),
|
|
151
|
+
[' elevated MCP ', C.label],
|
|
152
|
+
...buildStatusPill(elevatedMcp.length > 0 ? 'warn' : 'good', String(elevatedMcp.length)),
|
|
153
|
+
[' quarantined plugins ', C.label],
|
|
154
|
+
...buildStatusPill(quarantinedPlugins.length > 0 ? 'bad' : 'good', String(quarantinedPlugins.length)),
|
|
155
|
+
[' untrusted plugins ', C.label],
|
|
156
|
+
...buildStatusPill(untrustedPlugins.length > 0 ? 'warn' : 'good', String(untrustedPlugins.length)),
|
|
157
|
+
]),
|
|
158
|
+
buildPanelLine(width, [
|
|
159
|
+
[' incidents ', C.label],
|
|
160
|
+
...buildStatusPill(incidents.length > 0 ? 'warn' : 'good', String(incidents.length)),
|
|
161
|
+
]),
|
|
162
|
+
];
|
|
163
|
+
|
|
164
|
+
const attackPathLines: Line[] = [
|
|
165
|
+
buildPanelLine(width, [
|
|
166
|
+
[' attack paths ', C.label],
|
|
167
|
+
...buildStatusPill(attackPathReview.criticalFindings > 0 ? 'bad' : 'good', String(attackPathReview.criticalFindings)),
|
|
168
|
+
[' critical ', C.label],
|
|
169
|
+
...buildStatusPill(attackPathReview.incoherentFindings > 0 ? 'warn' : 'good', String(attackPathReview.incoherentFindings)),
|
|
170
|
+
[' review ', C.label],
|
|
171
|
+
[attackPathReview.summary.slice(0, Math.max(0, width - 36)), C.dim],
|
|
172
|
+
]),
|
|
173
|
+
];
|
|
174
|
+
|
|
175
|
+
// Empty state: no token results yet — show governance + threat posture before base empty state
|
|
176
|
+
if (view.results.length === 0) {
|
|
177
|
+
const emptyStateLines = [
|
|
178
|
+
...governanceLines,
|
|
179
|
+
...buildEmptyState(
|
|
180
|
+
width,
|
|
181
|
+
this.getEmptyStateMessage(),
|
|
182
|
+
'The security control room can already review policy, MCP, plugin, and incident posture, but token-specific scope and rotation audit data has not been registered.',
|
|
183
|
+
this.getEmptyStateActions(),
|
|
184
|
+
C,
|
|
185
|
+
),
|
|
186
|
+
];
|
|
187
|
+
if (quarantinedMcp.length > 0) {
|
|
188
|
+
emptyStateLines.push(buildPanelLine(width, [[' MCP quarantine still active despite no registered tokens.', C.warn]]));
|
|
189
|
+
}
|
|
190
|
+
const workspace = buildPanelWorkspace(width, height, {
|
|
191
|
+
title: 'Security Control Room',
|
|
192
|
+
intro,
|
|
193
|
+
sections: [
|
|
194
|
+
{ title: 'Governance', lines: emptyStateLines },
|
|
195
|
+
{ title: 'Attack Paths', lines: attackPathLines },
|
|
196
|
+
],
|
|
197
|
+
footerLines: [footerLine],
|
|
198
|
+
palette: C,
|
|
199
|
+
});
|
|
200
|
+
while (workspace.length < height) workspace.push(createEmptyLine(width));
|
|
201
|
+
return workspace.slice(0, height);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if (attackPathReview.findings.length > 0) {
|
|
205
|
+
attackPathLines.push(buildPanelLine(width, [[' MCP attack-path review', C.label]]));
|
|
206
|
+
for (const finding of attackPathReview.findings.slice(0, 3)) {
|
|
207
|
+
attackPathLines.push(buildPanelLine(width, [[
|
|
208
|
+
` ${finding.severity.toUpperCase()} ${finding.serverName}: ${finding.route}`.slice(0, width),
|
|
209
|
+
severityColor(finding.severity),
|
|
210
|
+
]]));
|
|
211
|
+
attackPathLines.push(buildPanelLine(width, [[
|
|
212
|
+
` ${finding.reason}`.slice(0, width),
|
|
213
|
+
C.dim,
|
|
214
|
+
]]));
|
|
215
|
+
attackPathLines.push(buildPanelLine(width, [[
|
|
216
|
+
` evidence: ${finding.evidence.join(' | ')}`.slice(0, width),
|
|
217
|
+
C.dim,
|
|
218
|
+
]]));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const selected = view.results[this.selectedIndex];
|
|
223
|
+
const detailLines: Line[] = [];
|
|
224
|
+
if (selected) {
|
|
225
|
+
detailLines.push(buildPanelLine(width, [
|
|
226
|
+
[' Token: ', C.label],
|
|
227
|
+
[selected.label, C.value],
|
|
228
|
+
[' Policy: ', C.label],
|
|
229
|
+
[selected.scope.policyId, C.info],
|
|
230
|
+
[' Blocked: ', C.label],
|
|
231
|
+
[selected.blocked ? 'yes' : 'no', selected.blocked ? C.error : C.ok],
|
|
232
|
+
]));
|
|
233
|
+
detailLines.push(buildPanelLine(width, [
|
|
234
|
+
[' Scope: ', C.label],
|
|
235
|
+
[selected.scope.outcome, selected.scope.outcome === 'violation' ? C.error : C.ok],
|
|
236
|
+
[' Excess: ', C.label],
|
|
237
|
+
[(selected.scope.excessScopes.length > 0 ? selected.scope.excessScopes.join(', ') : 'none').slice(0, Math.max(0, width - 27)), selected.scope.excessScopes.length > 0 ? C.error : C.dim],
|
|
238
|
+
]));
|
|
239
|
+
detailLines.push(buildPanelLine(width, [
|
|
240
|
+
[' Rotation: ', C.label],
|
|
241
|
+
[selected.rotation.outcome, selected.rotation.outcome === 'ok' ? C.ok : selected.rotation.outcome === 'warning' ? C.warn : C.error],
|
|
242
|
+
[' Due: ', C.label],
|
|
243
|
+
[new Date(selected.rotation.dueAt).toISOString(), C.value],
|
|
244
|
+
[' Age(d): ', C.label],
|
|
245
|
+
[String(Math.floor(selected.rotation.ageMs / (24 * 60 * 60 * 1000))), C.value],
|
|
246
|
+
]));
|
|
247
|
+
detailLines.push(buildPanelLine(width, [[
|
|
248
|
+
`Last audit: ${view.lastAuditAt ? new Date(view.lastAuditAt).toISOString() : 'never'} Press r to refresh.`,
|
|
249
|
+
C.dim,
|
|
250
|
+
]]));
|
|
251
|
+
if (preflightStatus !== 'n/a') {
|
|
252
|
+
detailLines.push(buildPanelLine(width, [[
|
|
253
|
+
`Policy preflight: ${preflightStatus} (${preflightIssueCount} issue${preflightIssueCount === 1 ? '' : 's'})`.slice(0, width),
|
|
254
|
+
preflightStatus === 'block' ? C.error : preflightStatus === 'warn' ? C.warn : C.dim,
|
|
255
|
+
]]));
|
|
256
|
+
}
|
|
257
|
+
if (quarantinedMcp.length > 0) {
|
|
258
|
+
const server = quarantinedMcp[0]!;
|
|
259
|
+
detailLines.push(buildPanelLine(width, [[
|
|
260
|
+
`MCP quarantine: ${server.name} ${server.quarantineReason ?? 'unknown'}${server.quarantineDetail ? ` - ${server.quarantineDetail}` : ''}`.slice(0, width),
|
|
261
|
+
C.error,
|
|
262
|
+
]]));
|
|
263
|
+
}
|
|
264
|
+
if (quarantinedPlugins.length > 0) {
|
|
265
|
+
const plugin = quarantinedPlugins[0]!;
|
|
266
|
+
detailLines.push(buildPanelLine(width, [[
|
|
267
|
+
`Plugin quarantine: ${plugin.name} (${plugin.trustTier})`.slice(0, width),
|
|
268
|
+
C.error,
|
|
269
|
+
]]));
|
|
270
|
+
} else if (untrustedPlugins.length > 0) {
|
|
271
|
+
const plugin = untrustedPlugins[0]!;
|
|
272
|
+
detailLines.push(buildPanelLine(width, [[
|
|
273
|
+
`Plugin trust warning: ${plugin.name} remains untrusted.`.slice(0, width),
|
|
274
|
+
C.warn,
|
|
275
|
+
]]));
|
|
276
|
+
}
|
|
277
|
+
if (latestIncident) {
|
|
278
|
+
detailLines.push(buildPanelLine(width, [[
|
|
279
|
+
`Latest incident: ${latestIncident.classification} - ${latestIncident.summary}`.slice(0, width),
|
|
280
|
+
C.warn,
|
|
281
|
+
]]));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return this.renderList(width, height, {
|
|
286
|
+
title: 'Security Control Room',
|
|
287
|
+
header: governanceLines,
|
|
288
|
+
footer: [
|
|
289
|
+
...detailLines,
|
|
290
|
+
...attackPathLines,
|
|
291
|
+
footerLine,
|
|
292
|
+
],
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import type { Line } from '../types/grid.ts';
|
|
2
|
+
import { createEmptyLine } from '../types/grid.ts';
|
|
3
|
+
import { ScrollableListPanel } from './scrollable-list-panel.ts';
|
|
4
|
+
import {
|
|
5
|
+
type ServiceConfig,
|
|
6
|
+
type ServiceInspection,
|
|
7
|
+
type ServiceConnectionTestResult,
|
|
8
|
+
} from '@pellux/goodvibes-sdk/platform/config';
|
|
9
|
+
import type { ServiceInspectionQuery, SubscriptionAccessQuery } from '../runtime/ui-service-queries.ts';
|
|
10
|
+
import {
|
|
11
|
+
buildEmptyState,
|
|
12
|
+
buildPanelLine,
|
|
13
|
+
buildPanelWorkspace,
|
|
14
|
+
buildStatusPill,
|
|
15
|
+
DEFAULT_PANEL_PALETTE,
|
|
16
|
+
} from './polish.ts';
|
|
17
|
+
|
|
18
|
+
const C = {
|
|
19
|
+
...DEFAULT_PANEL_PALETTE,
|
|
20
|
+
header: '#94a3b8',
|
|
21
|
+
headerBg: '#1e293b',
|
|
22
|
+
label: '#64748b',
|
|
23
|
+
value: '#e2e8f0',
|
|
24
|
+
dim: '#475569',
|
|
25
|
+
ok: '#22c55e',
|
|
26
|
+
warn: '#eab308',
|
|
27
|
+
error: '#ef4444',
|
|
28
|
+
info: '#38bdf8',
|
|
29
|
+
selectBg: '#0f172a',
|
|
30
|
+
empty: '#334155',
|
|
31
|
+
} as const;
|
|
32
|
+
|
|
33
|
+
interface ServicePanelEntry {
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly inspection: ServiceInspection;
|
|
36
|
+
readonly lastTest?: ServiceConnectionTestResult;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function statusLabel(entry: ServicePanelEntry): string {
|
|
40
|
+
if (!entry.inspection.hasPrimaryCredential) return 'UNCONFIGURED';
|
|
41
|
+
if (entry.lastTest?.ok) return 'HEALTHY';
|
|
42
|
+
if (entry.lastTest && !entry.lastTest.ok) return 'ERROR';
|
|
43
|
+
return 'CONFIGURED';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function statusColor(entry: ServicePanelEntry): string {
|
|
47
|
+
const label = statusLabel(entry);
|
|
48
|
+
if (label === 'HEALTHY') return C.ok;
|
|
49
|
+
if (label === 'ERROR') return C.error;
|
|
50
|
+
if (label === 'CONFIGURED') return C.warn;
|
|
51
|
+
return C.dim;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function authSummary(config: ServiceConfig, manager: SubscriptionAccessQuery): string {
|
|
55
|
+
const provider = config.providerId ?? config.name;
|
|
56
|
+
const hasOverride = manager.getAccessToken(provider) != null;
|
|
57
|
+
switch (config.authType) {
|
|
58
|
+
case 'bearer':
|
|
59
|
+
return hasOverride ? 'bearer+subscription' : 'bearer';
|
|
60
|
+
case 'basic':
|
|
61
|
+
return 'basic';
|
|
62
|
+
case 'api-key':
|
|
63
|
+
return hasOverride
|
|
64
|
+
? 'oauth-override'
|
|
65
|
+
: config.apiKeyHeader ? `api-key:${config.apiKeyHeader}` : 'api-key';
|
|
66
|
+
case 'oauth':
|
|
67
|
+
return manager.get(provider) != null ? 'oauth(active)' : 'oauth';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export class ServicesPanel extends ScrollableListPanel<ServicePanelEntry> {
|
|
72
|
+
private readonly registry: ServiceInspectionQuery;
|
|
73
|
+
private readonly subscriptionManager: SubscriptionAccessQuery;
|
|
74
|
+
private entries: ServicePanelEntry[] = [];
|
|
75
|
+
private loading = false;
|
|
76
|
+
|
|
77
|
+
public constructor(
|
|
78
|
+
registry: ServiceInspectionQuery,
|
|
79
|
+
subscriptionManager: SubscriptionAccessQuery,
|
|
80
|
+
) {
|
|
81
|
+
super('services', 'Services', 'V', 'monitoring');
|
|
82
|
+
this.showSelectionGutter = true; // I5: non-color selection affordance
|
|
83
|
+
this.registry = registry;
|
|
84
|
+
this.subscriptionManager = subscriptionManager;
|
|
85
|
+
void this.refresh();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public override onActivate(): void {
|
|
89
|
+
super.onActivate();
|
|
90
|
+
if (this.entries.length === 0 && !this.loading) {
|
|
91
|
+
void this.refresh();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
protected override getPalette() { return C; }
|
|
96
|
+
protected override getEmptyStateMessage() { return ' No services configured.'; }
|
|
97
|
+
protected override getEmptyStateActions() {
|
|
98
|
+
return [
|
|
99
|
+
{ command: '/services auth-review', summary: 'inspect service auth posture and registry config' },
|
|
100
|
+
{ command: '/subscription', summary: 'review provider login state and override posture' },
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
protected getItems(): readonly ServicePanelEntry[] {
|
|
105
|
+
return this.entries;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
protected renderItem(entry: ServicePanelEntry, index: number, selected: boolean, width: number): Line {
|
|
109
|
+
const bg = selected ? C.selectBg : undefined;
|
|
110
|
+
return buildPanelLine(width, [
|
|
111
|
+
[' ', C.label, bg],
|
|
112
|
+
[entry.name.padEnd(16), C.value, bg],
|
|
113
|
+
[` ${statusLabel(entry).padEnd(12)}`, statusColor(entry), bg],
|
|
114
|
+
[` ${authSummary(entry.inspection.config, this.subscriptionManager).padEnd(18)}`, C.info, bg],
|
|
115
|
+
[` ${entry.inspection.config.baseUrl ?? '(no baseUrl)'}`, C.dim, bg],
|
|
116
|
+
]);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
public handleInput(key: string): boolean {
|
|
120
|
+
if (key === 'r') {
|
|
121
|
+
void this.refresh();
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
if (key === 't') {
|
|
125
|
+
void this.testSelected();
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
return super.handleInput(key);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private async refresh(): Promise<void> {
|
|
132
|
+
this.loading = true;
|
|
133
|
+
this.markDirty();
|
|
134
|
+
const configs = this.registry.getAll();
|
|
135
|
+
const names = Object.keys(configs).sort((a, b) => a.localeCompare(b));
|
|
136
|
+
const inspections = await Promise.all(
|
|
137
|
+
names.map(async (name) => ({
|
|
138
|
+
name,
|
|
139
|
+
inspection: (await this.registry.inspect(name))!,
|
|
140
|
+
})),
|
|
141
|
+
);
|
|
142
|
+
const previousTests = new Map(this.entries.map((entry) => [entry.name, entry.lastTest] as const));
|
|
143
|
+
this.entries = inspections.map((entry) => ({
|
|
144
|
+
...entry,
|
|
145
|
+
...(previousTests.get(entry.name) ? { lastTest: previousTests.get(entry.name) } : {}),
|
|
146
|
+
}));
|
|
147
|
+
this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.entries.length - 1));
|
|
148
|
+
this.loading = false;
|
|
149
|
+
this.markDirty();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private async testSelected(): Promise<void> {
|
|
153
|
+
const selected = this.entries[this.selectedIndex];
|
|
154
|
+
if (!selected) return;
|
|
155
|
+
const result = await this.registry.testConnection(selected.name);
|
|
156
|
+
this.entries = this.entries.map((entry) => (
|
|
157
|
+
entry.name === selected.name
|
|
158
|
+
? { ...entry, lastTest: result }
|
|
159
|
+
: entry
|
|
160
|
+
));
|
|
161
|
+
this.markDirty();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
public render(width: number, height: number): Line[] {
|
|
165
|
+
this.clampSelection();
|
|
166
|
+
const intro = 'Credential posture, subscription overrides, and live connection checks for configured services.';
|
|
167
|
+
|
|
168
|
+
if (this.loading && this.entries.length === 0) {
|
|
169
|
+
const lines = buildPanelWorkspace(width, height, {
|
|
170
|
+
title: 'Service Control Room',
|
|
171
|
+
intro,
|
|
172
|
+
sections: [{ lines: [buildPanelLine(width, [[' Loading configured services...', C.info]])] }],
|
|
173
|
+
palette: C,
|
|
174
|
+
});
|
|
175
|
+
while (lines.length < height) lines.push(createEmptyLine(width));
|
|
176
|
+
return lines;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const selected = this.entries[this.selectedIndex];
|
|
180
|
+
const detailLines: Line[] = [];
|
|
181
|
+
if (selected) {
|
|
182
|
+
const inspect = selected.inspection;
|
|
183
|
+
detailLines.push(buildPanelLine(width, [
|
|
184
|
+
[' Service: ', C.label],
|
|
185
|
+
[selected.name, C.value],
|
|
186
|
+
[' State: ', C.label],
|
|
187
|
+
[statusLabel(selected), statusColor(selected)],
|
|
188
|
+
[' Auth: ', C.label],
|
|
189
|
+
[authSummary(inspect.config, this.subscriptionManager), C.info],
|
|
190
|
+
]));
|
|
191
|
+
detailLines.push(buildPanelLine(width, [
|
|
192
|
+
[' Primary credential: ', C.label],
|
|
193
|
+
...buildStatusPill(inspect.hasPrimaryCredential ? 'good' : 'bad', inspect.hasPrimaryCredential ? 'present' : 'missing'),
|
|
194
|
+
[' Webhook URL: ', C.label],
|
|
195
|
+
...buildStatusPill(inspect.hasWebhookUrl ? 'good' : 'info', inspect.hasWebhookUrl ? 'present' : 'missing'),
|
|
196
|
+
[' Signing secret: ', C.label],
|
|
197
|
+
...buildStatusPill(inspect.hasSigningSecret ? 'good' : 'info', inspect.hasSigningSecret ? 'present' : 'missing'),
|
|
198
|
+
[' App token: ', C.label],
|
|
199
|
+
...buildStatusPill(inspect.hasAppToken ? 'good' : 'info', inspect.hasAppToken ? 'present' : 'missing'),
|
|
200
|
+
]));
|
|
201
|
+
if (selected.lastTest) {
|
|
202
|
+
detailLines.push(buildPanelLine(width, [
|
|
203
|
+
[' Last test: ', C.label],
|
|
204
|
+
...buildStatusPill(selected.lastTest.ok ? 'good' : 'bad', selected.lastTest.ok ? 'ok' : 'failed'),
|
|
205
|
+
[' Status: ', C.label],
|
|
206
|
+
[selected.lastTest.status != null ? String(selected.lastTest.status) : 'n/a', C.value],
|
|
207
|
+
[' URL: ', C.label],
|
|
208
|
+
[(selected.lastTest.testedUrl ?? 'n/a').slice(0, Math.max(0, width - 34)), C.dim],
|
|
209
|
+
]));
|
|
210
|
+
if (selected.lastTest.error) {
|
|
211
|
+
detailLines.push(buildPanelLine(width, [
|
|
212
|
+
[' Error: ', C.label],
|
|
213
|
+
[selected.lastTest.error.slice(0, Math.max(0, width - 10)), C.error],
|
|
214
|
+
]));
|
|
215
|
+
}
|
|
216
|
+
} else {
|
|
217
|
+
detailLines.push(buildPanelLine(width, [[' Press t to test the selected service or r to refresh credential status.', C.dim]]));
|
|
218
|
+
}
|
|
219
|
+
detailLines.push(buildPanelLine(width, [[' Services resolve credentials through hierarchy-aware secure storage, plaintext fallback policy, and project-local config.', C.dim]]));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return this.renderList(width, height, {
|
|
223
|
+
title: 'Service Control Room',
|
|
224
|
+
footer: [
|
|
225
|
+
...detailLines,
|
|
226
|
+
buildPanelLine(width, [[' Up/Down move t test selected service r refresh inspections', C.dim]]),
|
|
227
|
+
],
|
|
228
|
+
emptyMessage: intro,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|