@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,108 @@
|
|
|
1
|
+
import type { Line } from '../types/grid.ts';
|
|
2
|
+
import { getDisplayWidth } from '../utils/terminal-width.ts';
|
|
3
|
+
import { buildStyledPanelLine, type StyledPanelSegment } from '../panels/polish.ts';
|
|
4
|
+
|
|
5
|
+
export interface TabStripItem {
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly active?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface TabStripStyle {
|
|
11
|
+
readonly activeFg: string;
|
|
12
|
+
readonly activeBg?: string;
|
|
13
|
+
readonly activeBold?: boolean;
|
|
14
|
+
readonly inactiveFg: string;
|
|
15
|
+
readonly inactiveBg?: string;
|
|
16
|
+
readonly separatorFg: string;
|
|
17
|
+
readonly labelFg?: string;
|
|
18
|
+
readonly labelBg?: string;
|
|
19
|
+
readonly labelBold?: boolean;
|
|
20
|
+
readonly overflowFg?: string;
|
|
21
|
+
readonly trailingFg?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TabStripConfig {
|
|
25
|
+
readonly width: number;
|
|
26
|
+
readonly tabs: readonly TabStripItem[];
|
|
27
|
+
readonly style: TabStripStyle;
|
|
28
|
+
readonly prefixLabel?: string;
|
|
29
|
+
readonly suffixLabel?: string;
|
|
30
|
+
readonly overflowIndicator?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function makeSegments(
|
|
34
|
+
tabs: readonly TabStripItem[],
|
|
35
|
+
style: TabStripStyle,
|
|
36
|
+
maxWidth: number,
|
|
37
|
+
): { segments: StyledPanelSegment[]; hasOverflow: boolean } {
|
|
38
|
+
const segments: StyledPanelSegment[] = [];
|
|
39
|
+
let used = 0;
|
|
40
|
+
let hasOverflow = false;
|
|
41
|
+
for (const tab of tabs) {
|
|
42
|
+
const separatorWidth = getDisplayWidth('│');
|
|
43
|
+
const labelText = tab.active ? `[${tab.label}]` : tab.label;
|
|
44
|
+
const labelWidth = getDisplayWidth(labelText);
|
|
45
|
+
const entryWidth = separatorWidth + labelWidth + 1;
|
|
46
|
+
if (used + entryWidth > maxWidth) {
|
|
47
|
+
hasOverflow = true;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
segments.push({ text: '│', fg: style.separatorFg });
|
|
51
|
+
segments.push({
|
|
52
|
+
text: `${labelText} `,
|
|
53
|
+
fg: tab.active ? style.activeFg : style.inactiveFg,
|
|
54
|
+
bg: tab.active ? style.activeBg : style.inactiveBg,
|
|
55
|
+
bold: tab.active ? (style.activeBold ?? false) : false,
|
|
56
|
+
});
|
|
57
|
+
used += entryWidth;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (segments.length > 0 && used + getDisplayWidth('│') <= maxWidth) {
|
|
61
|
+
segments.push({ text: '│', fg: style.separatorFg });
|
|
62
|
+
}
|
|
63
|
+
return { segments, hasOverflow };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function renderTabStrip(config: TabStripConfig): Line {
|
|
67
|
+
const {
|
|
68
|
+
width,
|
|
69
|
+
tabs,
|
|
70
|
+
style,
|
|
71
|
+
prefixLabel,
|
|
72
|
+
suffixLabel,
|
|
73
|
+
overflowIndicator = '›',
|
|
74
|
+
} = config;
|
|
75
|
+
|
|
76
|
+
const reservedSuffixWidth = suffixLabel ? getDisplayWidth(suffixLabel) : 0;
|
|
77
|
+
const reservedOverflowWidth = getDisplayWidth(overflowIndicator);
|
|
78
|
+
const maxTabWidth = Math.max(
|
|
79
|
+
0,
|
|
80
|
+
width
|
|
81
|
+
- (prefixLabel ? getDisplayWidth(prefixLabel) + 1 : 0)
|
|
82
|
+
- (suffixLabel ? reservedSuffixWidth : 0)
|
|
83
|
+
- reservedOverflowWidth,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const baseSegments: StyledPanelSegment[] = [];
|
|
87
|
+
if (prefixLabel) {
|
|
88
|
+
baseSegments.push({
|
|
89
|
+
text: prefixLabel,
|
|
90
|
+
fg: style.labelFg ?? style.inactiveFg,
|
|
91
|
+
bg: style.labelBg,
|
|
92
|
+
bold: style.labelBold ?? false,
|
|
93
|
+
});
|
|
94
|
+
baseSegments.push({ text: ' ', fg: style.separatorFg });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const { segments: tabSegments, hasOverflow } = makeSegments(tabs, style, maxTabWidth);
|
|
98
|
+
const suffixSegments: StyledPanelSegment[] = [];
|
|
99
|
+
if (hasOverflow) suffixSegments.push({ text: overflowIndicator, fg: style.overflowFg ?? style.separatorFg });
|
|
100
|
+
if (suffixLabel) {
|
|
101
|
+
suffixSegments.push({
|
|
102
|
+
text: suffixLabel,
|
|
103
|
+
fg: style.trailingFg ?? style.inactiveFg,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return buildStyledPanelLine(width, [...baseSegments, ...tabSegments, ...suffixSegments]);
|
|
108
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getDisplayWidth, truncateDisplay, wrapText } from '../utils/terminal-width.ts';
|
|
2
|
+
|
|
3
|
+
export function wrapWithHangingIndent(
|
|
4
|
+
text: string,
|
|
5
|
+
width: number,
|
|
6
|
+
indent: string,
|
|
7
|
+
maxLines?: number,
|
|
8
|
+
): string[] {
|
|
9
|
+
const safeWidth = Math.max(1, width);
|
|
10
|
+
const indentWidth = getDisplayWidth(indent);
|
|
11
|
+
const wrapped = wrapText(text, safeWidth);
|
|
12
|
+
const lines = wrapped.map((line, index) => {
|
|
13
|
+
if (index === 0) return truncateDisplay(line, safeWidth);
|
|
14
|
+
return `${indent}${truncateDisplay(line, Math.max(1, safeWidth - indentWidth))}`;
|
|
15
|
+
});
|
|
16
|
+
return typeof maxLines === 'number' ? lines.slice(0, maxLines) : lines;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function fitLabelDetailColumns(
|
|
20
|
+
label: string,
|
|
21
|
+
detail: string,
|
|
22
|
+
totalWidth: number,
|
|
23
|
+
labelRatio = 0.55,
|
|
24
|
+
): { labelWidth: number; detailWidth: number } {
|
|
25
|
+
const safeWidth = Math.max(8, totalWidth);
|
|
26
|
+
const labelWidth = Math.max(10, Math.min(safeWidth - 2, Math.floor(safeWidth * labelRatio)));
|
|
27
|
+
return {
|
|
28
|
+
labelWidth,
|
|
29
|
+
detailWidth: Math.max(0, safeWidth - labelWidth - 2),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Line } from '../types/grid.ts';
|
|
2
|
+
import { BORDERS, COLORS } from './layout.ts';
|
|
3
|
+
import { renderConversationNotice } from './conversation-surface.ts';
|
|
4
|
+
|
|
5
|
+
export function renderThinkingBlock(text: string, width: number): Line[] {
|
|
6
|
+
return renderConversationNotice(
|
|
7
|
+
text,
|
|
8
|
+
width,
|
|
9
|
+
{
|
|
10
|
+
accent: BORDERS.THINKING.color,
|
|
11
|
+
text: COLORS.DIM_TEXT,
|
|
12
|
+
dim: true,
|
|
13
|
+
italic: true,
|
|
14
|
+
},
|
|
15
|
+
BORDERS.THINKING.char,
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { type Line, createStyledCell, createEmptyLine } from '../types/grid.ts';
|
|
2
|
+
import { LAYOUT, TOOL_STATUS } from './layout.ts';
|
|
3
|
+
import { getDisplayWidth, truncateDisplay } from '../utils/terminal-width.ts';
|
|
4
|
+
import type { ToolCall } from '@pellux/goodvibes-sdk/platform/types';
|
|
5
|
+
import { stripDangerousAnsi } from './ansi-sanitize.ts';
|
|
6
|
+
|
|
7
|
+
const TOOL_NAME_MIN_WIDTH = 8;
|
|
8
|
+
const TOOL_NAME_MAX_WIDTH = 20;
|
|
9
|
+
|
|
10
|
+
function writeStyledText(
|
|
11
|
+
line: Line,
|
|
12
|
+
startCol: number,
|
|
13
|
+
endColExclusive: number,
|
|
14
|
+
text: string,
|
|
15
|
+
style: { readonly fg: string; readonly bold?: boolean; readonly dim?: boolean },
|
|
16
|
+
): number {
|
|
17
|
+
let col = startCol;
|
|
18
|
+
for (const ch of text) {
|
|
19
|
+
const width = getDisplayWidth(ch);
|
|
20
|
+
if (width <= 0) continue;
|
|
21
|
+
if (col + width > endColExclusive) break;
|
|
22
|
+
line[col] = createStyledCell(ch, {
|
|
23
|
+
fg: style.fg,
|
|
24
|
+
bold: style.bold ?? false,
|
|
25
|
+
dim: style.dim ?? false,
|
|
26
|
+
});
|
|
27
|
+
if (width > 1 && col + 1 < endColExclusive) {
|
|
28
|
+
line[col + 1] = createStyledCell('', {
|
|
29
|
+
fg: style.fg,
|
|
30
|
+
bold: style.bold ?? false,
|
|
31
|
+
dim: style.dim ?? false,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
col += width;
|
|
35
|
+
}
|
|
36
|
+
return col;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function buildLeftSegments(
|
|
40
|
+
toolName: string,
|
|
41
|
+
keyArg: string,
|
|
42
|
+
suffixText: string,
|
|
43
|
+
leftBudget: number,
|
|
44
|
+
): Array<{ text: string; fg: string; bold?: boolean; dim?: boolean }> {
|
|
45
|
+
if (leftBudget <= 0) return [];
|
|
46
|
+
|
|
47
|
+
const segments: Array<{ text: string; fg: string; bold?: boolean; dim?: boolean }> = [];
|
|
48
|
+
const suffixBudget = suffixText ? Math.min(Math.max(12, Math.floor(leftBudget * 0.3)), 20) : 0;
|
|
49
|
+
const suffixDisplay = suffixBudget > 0 ? truncateDisplay(suffixText, suffixBudget) : '';
|
|
50
|
+
const suffixWidth = getDisplayWidth(suffixDisplay);
|
|
51
|
+
const separatorBeforeSuffix = suffixDisplay ? 2 : 0;
|
|
52
|
+
const mainBudget = Math.max(1, leftBudget - suffixWidth - separatorBeforeSuffix);
|
|
53
|
+
|
|
54
|
+
let toolNameDisplay = '';
|
|
55
|
+
let keyArgDisplay = '';
|
|
56
|
+
if (keyArg) {
|
|
57
|
+
const rawToolWidth = getDisplayWidth(toolName);
|
|
58
|
+
const preferredToolWidth = Math.min(
|
|
59
|
+
Math.max(rawToolWidth, TOOL_NAME_MIN_WIDTH),
|
|
60
|
+
TOOL_NAME_MAX_WIDTH,
|
|
61
|
+
Math.max(TOOL_NAME_MIN_WIDTH, Math.floor(mainBudget * 0.4)),
|
|
62
|
+
);
|
|
63
|
+
const toolNameWidth = Math.min(preferredToolWidth, Math.max(1, mainBudget - 3));
|
|
64
|
+
const keyArgWidth = Math.max(0, mainBudget - toolNameWidth - 2);
|
|
65
|
+
toolNameDisplay = truncateDisplay(toolName, toolNameWidth);
|
|
66
|
+
keyArgDisplay = truncateDisplay(keyArg, keyArgWidth);
|
|
67
|
+
} else {
|
|
68
|
+
toolNameDisplay = truncateDisplay(toolName, mainBudget);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (toolNameDisplay) {
|
|
72
|
+
segments.push({ text: toolNameDisplay, fg: '#00ffcc', bold: true });
|
|
73
|
+
}
|
|
74
|
+
if (keyArgDisplay) {
|
|
75
|
+
segments.push({ text: ' ', fg: '#e2e8f0' });
|
|
76
|
+
segments.push({ text: keyArgDisplay, fg: '252' });
|
|
77
|
+
}
|
|
78
|
+
if (suffixDisplay) {
|
|
79
|
+
segments.push({ text: ' ', fg: '#e2e8f0' });
|
|
80
|
+
segments.push({
|
|
81
|
+
text: suffixDisplay,
|
|
82
|
+
fg: suffixText.startsWith('- ') ? '#ef4444' : '244',
|
|
83
|
+
dim: true,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return segments;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Extract the most meaningful argument from a tool call for display.
|
|
91
|
+
*/
|
|
92
|
+
function extractKeyArg(toolCall: ToolCall): string {
|
|
93
|
+
const args = toolCall.arguments;
|
|
94
|
+
// Path-based tools
|
|
95
|
+
if (typeof args.path === 'string') return args.path;
|
|
96
|
+
if (typeof args.file === 'string') return args.file;
|
|
97
|
+
if (typeof args.query === 'string') return args.query;
|
|
98
|
+
if (typeof args.title === 'string') return args.title;
|
|
99
|
+
// Array-based (read/write)
|
|
100
|
+
if (Array.isArray(args.files) && args.files.length > 0) {
|
|
101
|
+
const first = args.files[0];
|
|
102
|
+
if (typeof first === 'string') return first;
|
|
103
|
+
if (first && typeof first === 'object' && typeof (first as Record<string, unknown>).path === 'string')
|
|
104
|
+
return (first as Record<string, unknown>).path as string;
|
|
105
|
+
}
|
|
106
|
+
// Exec
|
|
107
|
+
if (typeof args.command === 'string') return args.command;
|
|
108
|
+
if (typeof args.cmd === 'string') return args.cmd;
|
|
109
|
+
if (Array.isArray(args.commands) && args.commands.length > 0) {
|
|
110
|
+
const first = args.commands[0];
|
|
111
|
+
if (first && typeof first === 'object' && typeof (first as Record<string, unknown>).cmd === 'string')
|
|
112
|
+
return (first as Record<string, unknown>).cmd as string;
|
|
113
|
+
}
|
|
114
|
+
// Find/grep
|
|
115
|
+
if (typeof args.pattern === 'string') return args.pattern;
|
|
116
|
+
if (Array.isArray(args.queries) && args.queries.length > 0) {
|
|
117
|
+
const first = args.queries[0];
|
|
118
|
+
if (first && typeof first === 'object') {
|
|
119
|
+
const firstRecord = first as Record<string, unknown>;
|
|
120
|
+
if (typeof firstRecord.query === 'string') return firstRecord.query;
|
|
121
|
+
if (typeof firstRecord.pattern === 'string') return firstRecord.pattern;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Fetch
|
|
125
|
+
if (Array.isArray(args.urls) && args.urls.length > 0) {
|
|
126
|
+
const first = args.urls[0];
|
|
127
|
+
if (first && typeof first === 'object' && typeof (first as Record<string, unknown>).url === 'string')
|
|
128
|
+
return (first as Record<string, unknown>).url as string;
|
|
129
|
+
}
|
|
130
|
+
// Agent
|
|
131
|
+
if (typeof args.task === 'string') return args.task.slice(0, 40);
|
|
132
|
+
if (typeof args.mode === 'string') return args.mode;
|
|
133
|
+
// Fallback: first string value
|
|
134
|
+
for (const val of Object.values(args)) {
|
|
135
|
+
if (typeof val === 'string' && val.length > 0) return val.slice(0, 40);
|
|
136
|
+
}
|
|
137
|
+
return '';
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Render a tool call as a single collapsed line.
|
|
142
|
+
*
|
|
143
|
+
* Layout: [margin] [icon] [space] [tool name padded] [key arg] [summary] [duration]
|
|
144
|
+
*
|
|
145
|
+
* @param toolCall - The tool call being executed
|
|
146
|
+
* @param status - 'executing' | 'done' | 'error'
|
|
147
|
+
* @param resultSummary - Optional brief summary (e.g., "3 files", "exit 0")
|
|
148
|
+
* @param width - Terminal width
|
|
149
|
+
* @param durationMs - Optional duration in milliseconds
|
|
150
|
+
* @param errorMsg - Optional error message for failed calls
|
|
151
|
+
*/
|
|
152
|
+
export function renderToolCallBlock(
|
|
153
|
+
toolCall: ToolCall,
|
|
154
|
+
status: 'executing' | 'done' | 'error',
|
|
155
|
+
resultSummary: string | undefined,
|
|
156
|
+
width: number,
|
|
157
|
+
durationMs?: number,
|
|
158
|
+
errorMsg?: string,
|
|
159
|
+
frameIndex?: number,
|
|
160
|
+
): Line[] {
|
|
161
|
+
const line = createEmptyLine(width);
|
|
162
|
+
const margin = LAYOUT.LEFT_MARGIN;
|
|
163
|
+
const rightMargin = LAYOUT.RIGHT_MARGIN;
|
|
164
|
+
const contentEnd = width - rightMargin;
|
|
165
|
+
|
|
166
|
+
// Status icon
|
|
167
|
+
const icon = status === 'done' ? TOOL_STATUS.SUCCESS_ICON
|
|
168
|
+
: status === 'error' ? TOOL_STATUS.FAIL_ICON
|
|
169
|
+
: TOOL_STATUS.SPINNER_FRAMES[(frameIndex ?? 0) % TOOL_STATUS.SPINNER_FRAMES.length];
|
|
170
|
+
const iconColor = status === 'done' ? '#22c55e'
|
|
171
|
+
: status === 'error' ? '#ef4444'
|
|
172
|
+
: '244';
|
|
173
|
+
const rightText = (() => {
|
|
174
|
+
if (durationMs !== undefined && status === 'done') {
|
|
175
|
+
return durationMs < 1000 ? `${durationMs}ms` : `${(durationMs / 1000).toFixed(1)}s`;
|
|
176
|
+
}
|
|
177
|
+
return status === 'executing' ? '...' : '';
|
|
178
|
+
})();
|
|
179
|
+
const rightWidth = getDisplayWidth(rightText);
|
|
180
|
+
const rightStart = rightText
|
|
181
|
+
? Math.max(margin + 2, contentEnd - rightWidth)
|
|
182
|
+
: contentEnd;
|
|
183
|
+
const leftStart = margin;
|
|
184
|
+
const leftEndExclusive = rightText
|
|
185
|
+
? Math.max(leftStart, rightStart - 1)
|
|
186
|
+
: contentEnd;
|
|
187
|
+
let col: number = leftStart;
|
|
188
|
+
|
|
189
|
+
if (col < leftEndExclusive) {
|
|
190
|
+
line[col] = createStyledCell(icon, { fg: iconColor, bold: status !== 'executing' });
|
|
191
|
+
}
|
|
192
|
+
col += 2; // icon + space
|
|
193
|
+
|
|
194
|
+
// Tool name — extract short name for long MCP tool names, but keep a readable dynamic width.
|
|
195
|
+
const rawName = toolCall.name.includes('__')
|
|
196
|
+
? toolCall.name.split('__').pop()!
|
|
197
|
+
: toolCall.name;
|
|
198
|
+
const keyArg = stripDangerousAnsi(extractKeyArg(toolCall));
|
|
199
|
+
const suffixText = status === 'error' && errorMsg
|
|
200
|
+
? `- ${stripDangerousAnsi(errorMsg).slice(0, 40)}`
|
|
201
|
+
: status === 'done' && resultSummary
|
|
202
|
+
? `(${stripDangerousAnsi(resultSummary)})`
|
|
203
|
+
: '';
|
|
204
|
+
const leftBudget = Math.max(0, leftEndExclusive - col);
|
|
205
|
+
const leftSegments = buildLeftSegments(rawName, keyArg, suffixText, leftBudget);
|
|
206
|
+
for (const segment of leftSegments) {
|
|
207
|
+
col = writeStyledText(line, col, leftEndExclusive, segment.text, {
|
|
208
|
+
fg: segment.fg,
|
|
209
|
+
bold: segment.bold ?? false,
|
|
210
|
+
dim: segment.dim ?? false,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (rightText) {
|
|
215
|
+
writeStyledText(line, rightStart, contentEnd, rightText, { fg: '238', dim: true });
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return [line];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Render a list of tool calls. All calls are treated as completed (done).
|
|
223
|
+
* Used for historical message rendering where status/timing is unavailable.
|
|
224
|
+
*/
|
|
225
|
+
export function renderToolCallList(
|
|
226
|
+
toolCalls: ToolCall[],
|
|
227
|
+
width: number,
|
|
228
|
+
): Line[] {
|
|
229
|
+
const lines: Line[] = [];
|
|
230
|
+
for (const tc of toolCalls) {
|
|
231
|
+
lines.push(...renderToolCallBlock(tc, 'done', undefined, width));
|
|
232
|
+
}
|
|
233
|
+
return lines;
|
|
234
|
+
}
|