@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
package/src/main.ts
ADDED
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { Compositor } from './renderer/compositor.ts';
|
|
4
|
+
import { type Line } from './types/grid.ts';
|
|
5
|
+
import { UIFactory } from './renderer/ui-factory.ts';
|
|
6
|
+
import { Orchestrator } from './core/orchestrator';
|
|
7
|
+
import { InputHandler } from './input/handler.ts';
|
|
8
|
+
import { SelectionManager } from './input/selection.ts';
|
|
9
|
+
import type { ContentPart } from '@pellux/goodvibes-sdk/platform/providers';
|
|
10
|
+
import { ToolRegistry } from '@pellux/goodvibes-sdk/platform/tools';
|
|
11
|
+
import { registerAllTools } from '@pellux/goodvibes-sdk/platform/tools';
|
|
12
|
+
import { FileUndoManager } from '@pellux/goodvibes-sdk/platform/state';
|
|
13
|
+
import { PermissionManager } from '@pellux/goodvibes-sdk/platform/permissions';
|
|
14
|
+
import { AcpManager } from '@pellux/goodvibes-sdk/platform/acp';
|
|
15
|
+
import { PermissionPromptUI } from './permissions/prompt.ts';
|
|
16
|
+
import { CommandRegistry } from './input/command-registry.ts';
|
|
17
|
+
import type { CommandContext } from './input/command-registry.ts';
|
|
18
|
+
import { renderProcessIndicator } from './renderer/process-indicator.ts';
|
|
19
|
+
import { registerBuiltinCommands } from './input/commands.ts';
|
|
20
|
+
import { ScheduleManager } from '@pellux/goodvibes-sdk/platform/tools';
|
|
21
|
+
import { InputHistory } from './input/input-history.ts';
|
|
22
|
+
import { getTierPromptSupplement, getTierForContextWindow } from '@pellux/goodvibes-sdk/platform/providers';
|
|
23
|
+
import { GitStatusProvider } from './renderer/git-status.ts';
|
|
24
|
+
import type { GitHeaderInfo } from './renderer/git-status.ts';
|
|
25
|
+
import { createShellLayout } from './renderer/layout-engine.ts';
|
|
26
|
+
import { buildShellFooter, estimateShellFooterHeight } from './renderer/shell-surface.ts';
|
|
27
|
+
import { buildConversationViewport } from './renderer/conversation-layout.ts';
|
|
28
|
+
import { applyConversationOverlays } from './renderer/conversation-overlays.ts';
|
|
29
|
+
import { buildPanelCompositeData } from './renderer/panel-composite.ts';
|
|
30
|
+
import { logger } from '@pellux/goodvibes-sdk/platform/utils';
|
|
31
|
+
import { registerBuiltinPanels } from './panels/builtin-panels.ts';
|
|
32
|
+
import { renderPanelTabBar } from './renderer/panel-tab-bar.ts';
|
|
33
|
+
import { bootstrapRuntime } from './runtime/bootstrap.ts';
|
|
34
|
+
import type { BootstrapContext } from './runtime/bootstrap.ts';
|
|
35
|
+
import type { HITLMode } from '@pellux/goodvibes-sdk/platform/state';
|
|
36
|
+
import type { HookPhase, HookCategory, HookEventPath } from '@pellux/goodvibes-sdk/platform/hooks';
|
|
37
|
+
import {
|
|
38
|
+
checkRecoveryFile,
|
|
39
|
+
deleteRecoveryFile,
|
|
40
|
+
loadRecoveryConversation,
|
|
41
|
+
persistConversation,
|
|
42
|
+
writeRecoveryFile,
|
|
43
|
+
} from '@/runtime/index.ts';
|
|
44
|
+
import { handleBlockingShellInput, type PendingPermissionState } from './shell/blocking-input.ts';
|
|
45
|
+
import { wireShellUiOpeners } from './shell/ui-openers.ts';
|
|
46
|
+
import { deriveComposerState } from './core/composer-state.ts';
|
|
47
|
+
import { buildPersistedSessionContext, formatReturnContextForDisplay, getReturnContextMode, maybeAssistReturnContextSummary } from '@/runtime/index.ts';
|
|
48
|
+
import { summarizeError } from '@pellux/goodvibes-sdk/platform/utils';
|
|
49
|
+
import { prepareShellCliRuntime } from './cli/entrypoint.ts';
|
|
50
|
+
import { applyInitialTuiCliState } from './cli/tui-startup.ts';
|
|
51
|
+
import { wireSpokenTurnRuntime } from './audio/spoken-turn-wiring.ts';
|
|
52
|
+
import { attachSpokenTurnModelRouting, createSpokenTurnInputOptions } from './audio/spoken-turn-model-routing.ts';
|
|
53
|
+
import { allowTerminalWrite, installTuiTerminalOutputGuard } from './runtime/terminal-output-guard.ts';
|
|
54
|
+
import { ProjectPlanningCoordinator } from './planning/project-planning-coordinator.ts';
|
|
55
|
+
import { buildCommandArgsHint } from './input/command-args-hint.ts';
|
|
56
|
+
import { summarizeRunningAgents } from './renderer/process-summary.ts';
|
|
57
|
+
|
|
58
|
+
const ALT_SCREEN_ENTER = '\x1b[?1049h';
|
|
59
|
+
const ALT_SCREEN_EXIT = '\x1b[?1049l';
|
|
60
|
+
const MOUSE_ENABLE = '\x1b[?1000h\x1b[?1002h\x1b[?1006h';
|
|
61
|
+
const MOUSE_DISABLE = '\x1b[?1006l\x1b[?1002l\x1b[?1000l';
|
|
62
|
+
const CURSOR_HIDE = '\x1b[?25l';
|
|
63
|
+
const CURSOR_SHOW = '\x1b[?25h';
|
|
64
|
+
const CLEAR_SCREEN = '\x1b[2J\x1b[3J\x1b[H';
|
|
65
|
+
const KEYBOARD_EXT_ENABLE = '\x1b[>4;2m' + '\x1b[?1u';
|
|
66
|
+
const KEYBOARD_EXT_DISABLE = '\x1b[>4;0m' + '\x1b[?1l';
|
|
67
|
+
const PASTE_ENABLE = '\x1b[?2004h';
|
|
68
|
+
const PASTE_DISABLE = '\x1b[?2004l';
|
|
69
|
+
|
|
70
|
+
async function main() {
|
|
71
|
+
const stdout = process.stdout;
|
|
72
|
+
const stdin = process.stdin;
|
|
73
|
+
const { cli, configManager, bootstrapWorkingDir, bootstrapHomeDirectory } = await prepareShellCliRuntime(process.argv.slice(2), {
|
|
74
|
+
defaultWorkingDirectory: process.env['GOODVIBES_WORKING_DIR'] ?? process.cwd(),
|
|
75
|
+
homeDirectory: homedir(),
|
|
76
|
+
}, 'goodvibes-agent');
|
|
77
|
+
|
|
78
|
+
const ctx: BootstrapContext = await bootstrapRuntime(stdout, {
|
|
79
|
+
configManager,
|
|
80
|
+
workingDir: bootstrapWorkingDir,
|
|
81
|
+
homeDirectory: bootstrapHomeDirectory,
|
|
82
|
+
});
|
|
83
|
+
const {
|
|
84
|
+
conversation,
|
|
85
|
+
orchestrator,
|
|
86
|
+
runtime,
|
|
87
|
+
toolRegistry,
|
|
88
|
+
compositor,
|
|
89
|
+
selection,
|
|
90
|
+
commandContext,
|
|
91
|
+
uiServices,
|
|
92
|
+
commandRegistry,
|
|
93
|
+
inputHistory,
|
|
94
|
+
hookDispatcher,
|
|
95
|
+
gitStatusProvider,
|
|
96
|
+
lastGitInfoRef,
|
|
97
|
+
bootstrapUnsubs,
|
|
98
|
+
agentStatusIntervalRef,
|
|
99
|
+
orchestratorRefs,
|
|
100
|
+
setRenderRequest,
|
|
101
|
+
permissionPromptRef,
|
|
102
|
+
_writeLastSessionPointer: writeLastSessionPointer,
|
|
103
|
+
systemMessageRouter,
|
|
104
|
+
} = ctx;
|
|
105
|
+
const workingDir = ctx.services.workingDirectory;
|
|
106
|
+
const homeDirectory = ctx.services.homeDirectory;
|
|
107
|
+
const { approvalBroker, agentManager, modeManager, processManager, providerRegistry, secretsManager, subscriptionManager } = ctx.services;
|
|
108
|
+
conversation.setSessionMemoryStore(ctx.services.sessionMemoryStore);
|
|
109
|
+
conversation.setSessionLineageTracker(ctx.services.sessionLineageTracker);
|
|
110
|
+
orchestrator.setCoreServices({
|
|
111
|
+
configManager,
|
|
112
|
+
providerRegistry,
|
|
113
|
+
favoritesStore: ctx.services.favoritesStore,
|
|
114
|
+
planManager: ctx.services.planManager,
|
|
115
|
+
adaptivePlanner: ctx.services.adaptivePlanner,
|
|
116
|
+
sessionMemoryStore: ctx.services.sessionMemoryStore,
|
|
117
|
+
sessionLineageTracker: ctx.services.sessionLineageTracker,
|
|
118
|
+
idempotencyStore: ctx.services.idempotencyStore,
|
|
119
|
+
});
|
|
120
|
+
ctx.services.wrfcController.setPlanManager(ctx.services.planManager);
|
|
121
|
+
let activeConversationWidth = stdout.columns || 80;
|
|
122
|
+
conversation.setWidthProvider(() => activeConversationWidth);
|
|
123
|
+
{
|
|
124
|
+
const hitlMode = configManager.get('behavior.hitlMode') as HITLMode | undefined;
|
|
125
|
+
if (hitlMode && (hitlMode === 'quiet' || hitlMode === 'balanced' || hitlMode === 'operator')) {
|
|
126
|
+
modeManager.setHITLMode(hitlMode);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const panelManager = ctx.services.panelManager;
|
|
131
|
+
const buildSessionContinuityHints = () => {
|
|
132
|
+
const sessionSnapshot = uiServices.readModels.session.getSnapshot();
|
|
133
|
+
const tasksSnapshot = uiServices.readModels.tasks.getSnapshot();
|
|
134
|
+
const remoteSnapshot = uiServices.readModels.remote.getSnapshot();
|
|
135
|
+
const worktreeSnapshot = uiServices.readModels.worktrees.getSnapshot();
|
|
136
|
+
return {
|
|
137
|
+
pendingApprovals: sessionSnapshot.pendingApproval ? 1 : 0,
|
|
138
|
+
activeTasks: tasksSnapshot.tasks.filter((task) => task.status === 'running' || task.status === 'queued').length,
|
|
139
|
+
blockedTasks: tasksSnapshot.tasks.filter((task) => task.status === 'blocked').length,
|
|
140
|
+
remoteContracts: remoteSnapshot.contracts.length,
|
|
141
|
+
remoteRunners: remoteSnapshot.contracts.slice(0, 4).map((contract) => contract.runnerId),
|
|
142
|
+
worktreeCount: worktreeSnapshot.records.length,
|
|
143
|
+
worktreePaths: worktreeSnapshot.records.slice(0, 3).map((record) => record.path),
|
|
144
|
+
openPanels: panelManager.getAllOpen().map((panel) => panel.id),
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
let pendingPermission: PendingPermissionState | null = null;
|
|
149
|
+
approvalBroker.subscribe((approval) => {
|
|
150
|
+
if (!pendingPermission) return;
|
|
151
|
+
if (pendingPermission.callId !== approval.callId) return;
|
|
152
|
+
if (approval.status === 'pending' || approval.status === 'claimed') return;
|
|
153
|
+
pendingPermission = null;
|
|
154
|
+
render();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
let streamStartTime = 0;
|
|
158
|
+
let streamDeltaCount = 0;
|
|
159
|
+
let streamTokenSpeed = 0;
|
|
160
|
+
|
|
161
|
+
let scrollTop = 0;
|
|
162
|
+
let scrollLocked = true;
|
|
163
|
+
|
|
164
|
+
const getPromptContentWidth = () => {
|
|
165
|
+
const w = stdout.columns || 80;
|
|
166
|
+
const boxMargin = 2;
|
|
167
|
+
const boxWidth = w - (boxMargin * 2);
|
|
168
|
+
return boxWidth - 4 - 3; // minus padding (4) minus prefix width (3: ' > ')
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const getViewportHeight = (): number => {
|
|
172
|
+
if (input.onboardingWizard.active) return stdout.rows || 24;
|
|
173
|
+
const promptLines: number = input.getVisiblePromptLineCount(getPromptContentWidth());
|
|
174
|
+
const currentModel = providerRegistry.getCurrentModel();
|
|
175
|
+
return (stdout.rows || 24) - 2 - estimateShellFooterHeight(promptLines, currentModel.contextWindow);
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const scroll = (delta: number) => {
|
|
179
|
+
const vHeight = getViewportHeight();
|
|
180
|
+
const maxScroll = Math.max(0, conversation.history.getLineCount() - vHeight);
|
|
181
|
+
scrollTop = Math.max(0, Math.min(scrollTop + delta, maxScroll));
|
|
182
|
+
// Re-lock if user scrolled to bottom, otherwise unlock
|
|
183
|
+
scrollLocked = scrollTop >= maxScroll;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const scrollToEnd = (vHeight: number) => {
|
|
187
|
+
scrollTop = Math.max(0, conversation.history.getLineCount() - vHeight);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const unsubs: Array<() => void> = [];
|
|
191
|
+
let recoveryInterval: ReturnType<typeof setInterval> | null = null;
|
|
192
|
+
let stopSpokenOutputForExit: (() => void) | null = null;
|
|
193
|
+
let recoveryPending = false;
|
|
194
|
+
|
|
195
|
+
const sigintHandler = (): void => input.feed('\x03');
|
|
196
|
+
let _unhandledRejectionCount = 0;
|
|
197
|
+
let _unhandledRejectionWindowStart = Date.now();
|
|
198
|
+
const unhandledRejectionHandler = (reason: unknown): void => {
|
|
199
|
+
const now = Date.now();
|
|
200
|
+
if (now - _unhandledRejectionWindowStart > 10000) {
|
|
201
|
+
_unhandledRejectionCount = 0;
|
|
202
|
+
_unhandledRejectionWindowStart = now;
|
|
203
|
+
}
|
|
204
|
+
_unhandledRejectionCount++;
|
|
205
|
+
const msg = reason instanceof Error ? reason.message : String(reason);
|
|
206
|
+
if (_unhandledRejectionCount > 3) {
|
|
207
|
+
logger.error('CRITICAL: cascading unhandled rejections — consider restarting', {
|
|
208
|
+
count: _unhandledRejectionCount,
|
|
209
|
+
windowMs: now - _unhandledRejectionWindowStart,
|
|
210
|
+
error: String(reason),
|
|
211
|
+
});
|
|
212
|
+
systemMessageRouter.high(
|
|
213
|
+
`[Critical] Multiple errors detected (${_unhandledRejectionCount} in 10s). If the issue persists, please restart. Latest: ${msg}`
|
|
214
|
+
);
|
|
215
|
+
} else {
|
|
216
|
+
systemMessageRouter.high(`[Error] ${msg}`);
|
|
217
|
+
logger.error('unhandledRejection', { error: String(reason) });
|
|
218
|
+
}
|
|
219
|
+
render();
|
|
220
|
+
};
|
|
221
|
+
const resizeHandler = (): void => {
|
|
222
|
+
input.setContentWidth(getPromptContentWidth());
|
|
223
|
+
compositor.resetDiff();
|
|
224
|
+
render();
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const exitApp = (): void => {
|
|
228
|
+
stopSpokenOutputForExit?.();
|
|
229
|
+
unsubs.forEach(fn => fn());
|
|
230
|
+
const snapshot = conversation.toJSON() as { messages: Array<import('./core/conversation.ts').ConversationMessageSnapshot>; timestamp?: number };
|
|
231
|
+
ctx.shutdown({ ...snapshot, ...buildPersistedSessionContext(snapshot.messages, conversation.getTitleSource(), buildSessionContinuityHints()) }).catch((err) => {
|
|
232
|
+
logger.debug('ctx.shutdown error during exitApp (non-fatal)', { error: summarizeError(err) });
|
|
233
|
+
});
|
|
234
|
+
if (recoveryInterval !== null) { clearInterval(recoveryInterval); recoveryInterval = null; }
|
|
235
|
+
deleteRecoveryFile({ homeDirectory });
|
|
236
|
+
stdin.removeAllListeners('data');
|
|
237
|
+
stdout.removeListener('resize', resizeHandler);
|
|
238
|
+
process.removeListener('SIGINT', sigintHandler);
|
|
239
|
+
process.removeListener('unhandledRejection', unhandledRejectionHandler);
|
|
240
|
+
const exitScreen = cli.flags.noAltScreen ? CLEAR_SCREEN : CLEAR_SCREEN + ALT_SCREEN_EXIT;
|
|
241
|
+
allowTerminalWrite(() => stdout.write(PASTE_DISABLE + KEYBOARD_EXT_DISABLE + MOUSE_DISABLE + CURSOR_SHOW + exitScreen));
|
|
242
|
+
terminalOutputGuard.dispose();
|
|
243
|
+
stdin.setRawMode(false);
|
|
244
|
+
process.exit(0);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
commandContext.exit = exitApp;
|
|
248
|
+
|
|
249
|
+
const spokenTurns = wireSpokenTurnRuntime({
|
|
250
|
+
voiceService: ctx.services.voiceService,
|
|
251
|
+
configManager,
|
|
252
|
+
events: uiServices.events,
|
|
253
|
+
notify: (message) => { systemMessageRouter.high(message); render(); },
|
|
254
|
+
});
|
|
255
|
+
stopSpokenOutputForExit = () => spokenTurns.stop();
|
|
256
|
+
unsubs.push(...spokenTurns.unsubs);
|
|
257
|
+
unsubs.push(attachSpokenTurnModelRouting({
|
|
258
|
+
orchestrator,
|
|
259
|
+
providerRegistry,
|
|
260
|
+
configManager,
|
|
261
|
+
notify: (message) => { systemMessageRouter.high(message); render(); },
|
|
262
|
+
}));
|
|
263
|
+
const projectPlanningCoordinator = new ProjectPlanningCoordinator({
|
|
264
|
+
service: ctx.services.projectPlanningService,
|
|
265
|
+
projectId: ctx.services.projectPlanningProjectId,
|
|
266
|
+
workingDirectory: workingDir,
|
|
267
|
+
notify: (message) => { systemMessageRouter.high(message); render(); },
|
|
268
|
+
openPanel: () => {
|
|
269
|
+
panelManager.open('project-planning');
|
|
270
|
+
panelManager.show();
|
|
271
|
+
render();
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
const submitInput = (text: string, content?: ContentPart[], options: { readonly spokenOutput?: boolean } = {}) => {
|
|
276
|
+
input.clearModalStack();
|
|
277
|
+
scrollLocked = true; // Re-lock on any user input
|
|
278
|
+
const AT_MODEL_RE = /@model:([^\s]+)/g;
|
|
279
|
+
let processedText = text;
|
|
280
|
+
let atModelMatch: RegExpExecArray | null;
|
|
281
|
+
while ((atModelMatch = AT_MODEL_RE.exec(text)) !== null) {
|
|
282
|
+
const modelId = atModelMatch[1];
|
|
283
|
+
try {
|
|
284
|
+
providerRegistry.setCurrentModel(modelId);
|
|
285
|
+
const def = providerRegistry.getCurrentModel();
|
|
286
|
+
runtime.model = def.id;
|
|
287
|
+
runtime.provider = def.provider;
|
|
288
|
+
configManager.set('provider.model', def.registryKey);
|
|
289
|
+
systemMessageRouter.high(`[Model] Switched to ${def.displayName} (${def.provider}) via @model:`);
|
|
290
|
+
} catch {
|
|
291
|
+
systemMessageRouter.high(`[Model] Unknown model: ${modelId}`);
|
|
292
|
+
}
|
|
293
|
+
processedText = processedText.replace(atModelMatch[0], '').trim();
|
|
294
|
+
}
|
|
295
|
+
if (processedText.startsWith('!#')) {
|
|
296
|
+
const memoryText = processedText.slice(2).trim();
|
|
297
|
+
if (!memoryText) {
|
|
298
|
+
systemMessageRouter.high('[Memory] Usage: !# <text to pin as session memory>');
|
|
299
|
+
render();
|
|
300
|
+
processedText = '';
|
|
301
|
+
} else {
|
|
302
|
+
const memId = ctx.services.sessionMemoryStore.add(memoryText);
|
|
303
|
+
systemMessageRouter.high(`[Memory] Pinned: "${memoryText}" (${memId})`);
|
|
304
|
+
processedText = memoryText;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
if (processedText || content) {
|
|
308
|
+
void (async () => {
|
|
309
|
+
let inputOptions = options.spokenOutput ? createSpokenTurnInputOptions() : undefined;
|
|
310
|
+
if (!options.spokenOutput && processedText) {
|
|
311
|
+
try {
|
|
312
|
+
const planning = await projectPlanningCoordinator.prepareTurn(processedText);
|
|
313
|
+
if (planning) {
|
|
314
|
+
if (planning.handledLocally) {
|
|
315
|
+
systemMessageRouter.high(planning.statusMessage);
|
|
316
|
+
render();
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
conversation.addSystemMessage(planning.systemMessage);
|
|
320
|
+
inputOptions = {
|
|
321
|
+
origin: {
|
|
322
|
+
source: 'project-planning',
|
|
323
|
+
surface: 'tui',
|
|
324
|
+
metadata: {
|
|
325
|
+
projectId: ctx.services.projectPlanningProjectId,
|
|
326
|
+
knowledgeSpaceId: planning.state.knowledgeSpaceId,
|
|
327
|
+
readiness: planning.evaluation.readiness,
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
} catch (err) {
|
|
333
|
+
systemMessageRouter.high(`[Planning] ${summarizeError(err)}`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (options.spokenOutput && processedText) {
|
|
337
|
+
spokenTurns.submitNextTurn(processedText);
|
|
338
|
+
}
|
|
339
|
+
orchestrator.handleUserInput(processedText, content, inputOptions).catch((err: unknown) => {
|
|
340
|
+
logger.debug('handleUserInput safety catch (already handled by runTurn)', { error: summarizeError(err) });
|
|
341
|
+
});
|
|
342
|
+
})();
|
|
343
|
+
} else {
|
|
344
|
+
render();
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
const cancelGeneration = () => {
|
|
349
|
+
spokenTurns.stop('Spoken output stopped.');
|
|
350
|
+
if (orchestrator.isThinking) {
|
|
351
|
+
orchestrator.abort();
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const jumpToBookmark = (key: string) => {
|
|
356
|
+
conversation.getDisplayBlocks();
|
|
357
|
+
const block = conversation.getBlockRegistry().find((entry) => entry.collapseKey === key);
|
|
358
|
+
if (!block) {
|
|
359
|
+
systemMessageRouter.high(`[Bookmark] Not found: ${key}`);
|
|
360
|
+
render();
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
scrollLocked = false;
|
|
364
|
+
scrollTop = Math.max(0, block.startLine);
|
|
365
|
+
render();
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
const scrollToLine = (line: number) => {
|
|
369
|
+
conversation.getDisplayBlocks();
|
|
370
|
+
const maxScroll = Math.max(0, conversation.history.getLineCount() - getViewportHeight());
|
|
371
|
+
scrollLocked = false;
|
|
372
|
+
scrollTop = Math.max(0, Math.min(line, maxScroll));
|
|
373
|
+
render();
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
commandContext.submitInput = submitInput;
|
|
377
|
+
commandContext.submitSpokenInput = (text, content) => submitInput(text, content, { spokenOutput: true });
|
|
378
|
+
commandContext.stopSpokenOutput = () => spokenTurns.stop();
|
|
379
|
+
commandContext.pasteFromClipboard = () => input.handlePaste();
|
|
380
|
+
commandContext.executeCommand = (name, args) => commandRegistry.execute(name, args, commandContext);
|
|
381
|
+
commandContext.cancelGeneration = cancelGeneration;
|
|
382
|
+
commandContext.jumpToBookmark = jumpToBookmark;
|
|
383
|
+
commandContext.scrollToLine = scrollToLine;
|
|
384
|
+
commandContext.clearScreen = () => {
|
|
385
|
+
compositor.resetDiff();
|
|
386
|
+
allowTerminalWrite(() => stdout.write(CLEAR_SCREEN));
|
|
387
|
+
render();
|
|
388
|
+
};
|
|
389
|
+
permissionPromptRef.requestPermission = (request) =>
|
|
390
|
+
new Promise((resolve) => {
|
|
391
|
+
pendingPermission = {
|
|
392
|
+
...request,
|
|
393
|
+
resolve: (approved: boolean, remember = false) => resolve({ approved, remember }),
|
|
394
|
+
};
|
|
395
|
+
render();
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
const input: InputHandler = new InputHandler(
|
|
399
|
+
() => render(),
|
|
400
|
+
selection,
|
|
401
|
+
() => scrollTop,
|
|
402
|
+
getViewportHeight,
|
|
403
|
+
() => conversation.history,
|
|
404
|
+
scroll,
|
|
405
|
+
exitApp,
|
|
406
|
+
{
|
|
407
|
+
agents: {
|
|
408
|
+
agentManager,
|
|
409
|
+
agentMessageBus: ctx.services.agentMessageBus,
|
|
410
|
+
wrfcController: ctx.services.wrfcController,
|
|
411
|
+
},
|
|
412
|
+
providers: {
|
|
413
|
+
benchmarkStore: ctx.services.benchmarkStore,
|
|
414
|
+
favoritesStore: ctx.services.favoritesStore,
|
|
415
|
+
providerRegistry: ctx.services.providerRegistry,
|
|
416
|
+
},
|
|
417
|
+
platform: {
|
|
418
|
+
configManager: ctx.services.configManager,
|
|
419
|
+
localUserAuthManager: ctx.services.localUserAuthManager,
|
|
420
|
+
mcpRegistry: ctx.services.mcpRegistry,
|
|
421
|
+
serviceRegistry: ctx.services.serviceRegistry,
|
|
422
|
+
surfaceRegistry: ctx.services.surfaceRegistry,
|
|
423
|
+
subscriptionManager: ctx.services.subscriptionManager,
|
|
424
|
+
secretsManager: ctx.services.secretsManager,
|
|
425
|
+
tokenAuditor: ctx.services.tokenAuditor,
|
|
426
|
+
replayEngine: ctx.services.replayEngine,
|
|
427
|
+
webhookNotifier: ctx.services.webhookNotifier,
|
|
428
|
+
policyRuntimeState: ctx.services.policyRuntimeState,
|
|
429
|
+
externalServices: uiServices.platform.externalServices,
|
|
430
|
+
},
|
|
431
|
+
shell: {
|
|
432
|
+
bookmarkManager: ctx.services.bookmarkManager,
|
|
433
|
+
keybindingsManager: ctx.services.keybindingsManager,
|
|
434
|
+
panelManager,
|
|
435
|
+
processManager,
|
|
436
|
+
profileManager: ctx.services.profileManager,
|
|
437
|
+
},
|
|
438
|
+
sessions: {
|
|
439
|
+
sessionManager: ctx.services.sessionManager,
|
|
440
|
+
sessionBroker: ctx.services.sessionBroker,
|
|
441
|
+
sessionOrchestration: ctx.services.sessionOrchestration,
|
|
442
|
+
sessionMemoryStore: ctx.services.sessionMemoryStore,
|
|
443
|
+
},
|
|
444
|
+
environment: {
|
|
445
|
+
workingDirectory: ctx.services.workingDirectory,
|
|
446
|
+
homeDirectory: ctx.services.homeDirectory,
|
|
447
|
+
shellPaths: ctx.services.shellPaths,
|
|
448
|
+
},
|
|
449
|
+
},
|
|
450
|
+
);
|
|
451
|
+
|
|
452
|
+
orchestratorRefs.getViewportHeight = getViewportHeight;
|
|
453
|
+
orchestratorRefs.scrollToEnd = scrollToEnd;
|
|
454
|
+
|
|
455
|
+
input.setCommandRegistry(commandRegistry, commandContext);
|
|
456
|
+
input.setConversationManager(conversation);
|
|
457
|
+
input.setContentWidth(getPromptContentWidth());
|
|
458
|
+
input.filePicker.setOnUpdate(() => render());
|
|
459
|
+
input.agentDetailModal.setOnRefresh(() => render());
|
|
460
|
+
input.processModal.setOnRefresh(() => render());
|
|
461
|
+
|
|
462
|
+
// Model picker callback is handled in bootstrap.ts — do not duplicate here.
|
|
463
|
+
input.setHistory(inputHistory);
|
|
464
|
+
|
|
465
|
+
const toolCount = toolRegistry.list().length;
|
|
466
|
+
conversation.splashOptions = {
|
|
467
|
+
workingDir,
|
|
468
|
+
model: runtime.model,
|
|
469
|
+
provider: runtime.provider,
|
|
470
|
+
toolCount,
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
const render = () => {
|
|
474
|
+
const width = stdout.columns || 80;
|
|
475
|
+
const height = stdout.rows || 24;
|
|
476
|
+
|
|
477
|
+
// Cache the current model for consistent values across the entire render frame
|
|
478
|
+
const currentModel = providerRegistry.getCurrentModel();
|
|
479
|
+
const sessionSnapshot = uiServices.readModels.session.getSnapshot();
|
|
480
|
+
const agentSnapshot = uiServices.readModels.agents.getSnapshot();
|
|
481
|
+
|
|
482
|
+
const headerLines = UIFactory.createHeader(width, currentModel.id, currentModel.provider, conversation.title || undefined, lastGitInfoRef.value);
|
|
483
|
+
const managerAgents = agentManager.list().filter(
|
|
484
|
+
(a) => a.status === 'running' || a.status === 'pending',
|
|
485
|
+
);
|
|
486
|
+
const runtimeAgents = agentSnapshot.active;
|
|
487
|
+
const runningAgentSummary = summarizeRunningAgents(managerAgents, runtimeAgents, ctx.services.wrfcController.listChains());
|
|
488
|
+
const runningAgentCount = runningAgentSummary.count;
|
|
489
|
+
const runningProcessCount = processManager.list().filter((p) => !p.status.startsWith('done')).length;
|
|
490
|
+
const cw = getPromptContentWidth();
|
|
491
|
+
const promptInfo = input.getWrappedPromptInfo(cw);
|
|
492
|
+
const commandArgsHint = buildCommandArgsHint(input.prompt, commandRegistry);
|
|
493
|
+
const composerState = deriveComposerState({
|
|
494
|
+
text: input.prompt,
|
|
495
|
+
commandMode: input.commandMode,
|
|
496
|
+
panelFocused: input.panelFocused,
|
|
497
|
+
pendingApproval: pendingPermission !== null,
|
|
498
|
+
hasAttachments: input.getImageAttachments().size > 0,
|
|
499
|
+
turnState: sessionSnapshot.turnState,
|
|
500
|
+
});
|
|
501
|
+
const footerLines = buildShellFooter({
|
|
502
|
+
width,
|
|
503
|
+
promptText: promptInfo.visibleLines.join('\n'),
|
|
504
|
+
promptLineCount: promptInfo.visibleLines.length,
|
|
505
|
+
promptCursorPos: promptInfo.visibleCursorLine >= 0
|
|
506
|
+
? promptInfo.visibleLines
|
|
507
|
+
.slice(0, promptInfo.visibleCursorLine)
|
|
508
|
+
.reduce((sum: number, line: string) => sum + line.length + 1, 0) + promptInfo.visibleCursorCol
|
|
509
|
+
: undefined,
|
|
510
|
+
usage: { up: orchestrator.usage.input, down: orchestrator.usage.output },
|
|
511
|
+
showExitNotice: input.showExitNotice,
|
|
512
|
+
lastCopyTime: input.lastCopyTime,
|
|
513
|
+
model: runtime.model,
|
|
514
|
+
toolCount: toolRegistry.list().length,
|
|
515
|
+
workingDir,
|
|
516
|
+
provider: runtime.provider,
|
|
517
|
+
contextWindow: currentModel.contextWindow,
|
|
518
|
+
compactThreshold: configManager.get('behavior.autoCompactThreshold') as number,
|
|
519
|
+
dangerMode: (() => {
|
|
520
|
+
if (configManager.get('behavior.autoApprove')) return true;
|
|
521
|
+
const permMode = configManager.get('permissions.mode');
|
|
522
|
+
if (permMode === 'allow-all') return true;
|
|
523
|
+
if (permMode === 'custom') {
|
|
524
|
+
const tools = configManager.getCategory('permissions').tools;
|
|
525
|
+
if (Object.values(tools).every(v => v === 'allow')) return true;
|
|
526
|
+
}
|
|
527
|
+
return false;
|
|
528
|
+
})(),
|
|
529
|
+
lastInputTokens: orchestrator.lastInputTokens,
|
|
530
|
+
commandArgsHint,
|
|
531
|
+
hitlMode: modeManager.getHITLMode(),
|
|
532
|
+
runningAgentCount,
|
|
533
|
+
runningProcessCount,
|
|
534
|
+
indicatorFocused: input.indicatorFocused,
|
|
535
|
+
runningAgentProgress: runningAgentSummary.progress,
|
|
536
|
+
composerMode: composerState.modeLabel,
|
|
537
|
+
composerStatus: composerState.statusLabel,
|
|
538
|
+
composerFlags: composerState.flags,
|
|
539
|
+
composerPendingRisk: composerState.pendingRisk,
|
|
540
|
+
}).lines;
|
|
541
|
+
|
|
542
|
+
const onboardingOwnsScreen = input.onboardingWizard.active;
|
|
543
|
+
const shellHeaderLines = onboardingOwnsScreen ? [] : headerLines;
|
|
544
|
+
const shellFooterLines = onboardingOwnsScreen ? [] : footerLines;
|
|
545
|
+
const panelWidth = !onboardingOwnsScreen && panelManager.isVisible() && panelManager.getAllOpen().length > 0
|
|
546
|
+
? panelManager.getRightWidth(width)
|
|
547
|
+
: 0;
|
|
548
|
+
const shellLayout = createShellLayout({
|
|
549
|
+
width,
|
|
550
|
+
height,
|
|
551
|
+
headerHeight: shellHeaderLines.length,
|
|
552
|
+
footerHeight: shellFooterLines.length,
|
|
553
|
+
panelWidth,
|
|
554
|
+
});
|
|
555
|
+
input.setPanelMouseLayout(shellLayout.panel
|
|
556
|
+
? {
|
|
557
|
+
x: shellLayout.panel.x,
|
|
558
|
+
y: shellLayout.panel.y,
|
|
559
|
+
width: shellLayout.panel.width,
|
|
560
|
+
height: shellLayout.panel.height,
|
|
561
|
+
hasBottomPane: panelManager.isBottomPaneVisible() && panelManager.getBottomPane().panels.length > 0,
|
|
562
|
+
verticalSplitRatio: panelManager.getVerticalSplitRatio(),
|
|
563
|
+
}
|
|
564
|
+
: null);
|
|
565
|
+
const vHeight = shellLayout.body.height;
|
|
566
|
+
const conversationWidth = shellLayout.conversation.width;
|
|
567
|
+
activeConversationWidth = conversationWidth;
|
|
568
|
+
const hasPanelWorkspace = !onboardingOwnsScreen && panelManager.isVisible() && panelManager.getAllOpen().length > 0;
|
|
569
|
+
conversation.setSplashSuppressed(hasPanelWorkspace);
|
|
570
|
+
|
|
571
|
+
// Flush pending renders after updating the width provider and splash posture
|
|
572
|
+
// so the transcript and splash rebuild against the current shell layout.
|
|
573
|
+
conversation.getDisplayBlocks();
|
|
574
|
+
|
|
575
|
+
// Calculate how many rows are consumed by overlays (thinking, permissions, queue, file picker)
|
|
576
|
+
let overlayRows = 0;
|
|
577
|
+
if (orchestrator.isThinking) overlayRows += 2; // spinner + blank
|
|
578
|
+
if (pendingPermission) overlayRows += PermissionPromptUI.getPromptHeight(pendingPermission);
|
|
579
|
+
overlayRows += orchestrator.messageQueue.length * 3; // queued messages
|
|
580
|
+
// File picker and model picker overlay rows computed from actual rendered line count below
|
|
581
|
+
// Selection modal overlay rows are computed from actual rendered line count below
|
|
582
|
+
if (input.searchManager.active) {
|
|
583
|
+
overlayRows += 1;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const conversationViewport = buildConversationViewport({
|
|
587
|
+
conversation,
|
|
588
|
+
width: conversationWidth,
|
|
589
|
+
viewportHeight: vHeight,
|
|
590
|
+
scrollTop,
|
|
591
|
+
scrollLocked,
|
|
592
|
+
overlayRows,
|
|
593
|
+
});
|
|
594
|
+
scrollTop = conversationViewport.nextScrollTop;
|
|
595
|
+
let viewport = conversationViewport.viewport;
|
|
596
|
+
|
|
597
|
+
if (orchestrator.isThinking) {
|
|
598
|
+
const showSpeed = configManager.get('display.showTokenSpeed') as boolean;
|
|
599
|
+
const showPreview = configManager.get('display.showToolPreview') as boolean;
|
|
600
|
+
const partialToolPreview = showPreview ? sessionSnapshot.streamToolPreview : undefined;
|
|
601
|
+
const thinking = UIFactory.createThinkingFragment(
|
|
602
|
+
conversationWidth,
|
|
603
|
+
orchestrator.getSpinner(),
|
|
604
|
+
orchestrator.thinkingFrame,
|
|
605
|
+
showSpeed ? streamTokenSpeed : undefined,
|
|
606
|
+
showPreview ? partialToolPreview : undefined,
|
|
607
|
+
orchestrator.streamingInputTokens > 0 ? orchestrator.streamingInputTokens : undefined,
|
|
608
|
+
orchestrator.streamingOutputTokens > 0 ? orchestrator.streamingOutputTokens : undefined,
|
|
609
|
+
);
|
|
610
|
+
viewport.push(...thinking);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
if (pendingPermission) {
|
|
614
|
+
viewport.push(...PermissionPromptUI.createPromptLines(conversationWidth, pendingPermission));
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
orchestrator.messageQueue.forEach(msg => {
|
|
618
|
+
viewport.push(...UIFactory.createQueuedMessageFragment(conversationWidth, msg.text));
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
viewport = applyConversationOverlays(viewport, {
|
|
622
|
+
input,
|
|
623
|
+
conversation,
|
|
624
|
+
commandRegistry,
|
|
625
|
+
keybindingsManager: ctx.services.keybindingsManager,
|
|
626
|
+
conversationWidth,
|
|
627
|
+
viewportHeight: vHeight,
|
|
628
|
+
contextWindow: currentModel.contextWindow,
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
// Panel composite data
|
|
632
|
+
const panelComposite = onboardingOwnsScreen
|
|
633
|
+
? { panelData: undefined, panelWidth: 0 }
|
|
634
|
+
: buildPanelCompositeData(
|
|
635
|
+
panelManager,
|
|
636
|
+
input,
|
|
637
|
+
shellLayout.panel?.width ?? 0,
|
|
638
|
+
shellLayout.panel?.height ?? vHeight,
|
|
639
|
+
);
|
|
640
|
+
|
|
641
|
+
compositor.composite({
|
|
642
|
+
width, height,
|
|
643
|
+
header: shellHeaderLines,
|
|
644
|
+
viewport,
|
|
645
|
+
footer: shellFooterLines,
|
|
646
|
+
selection: onboardingOwnsScreen ? undefined : {
|
|
647
|
+
isCellSelected: (col, row) => selection.isCellSelected(col, row),
|
|
648
|
+
scrollTop,
|
|
649
|
+
lineCount: conversation.history.getLineCount(),
|
|
650
|
+
},
|
|
651
|
+
search: !onboardingOwnsScreen && input.searchManager.active ? {
|
|
652
|
+
manager: input.searchManager,
|
|
653
|
+
scrollTop,
|
|
654
|
+
viewportStartY: shellHeaderLines.length,
|
|
655
|
+
} : undefined,
|
|
656
|
+
panel: panelComposite.panelData,
|
|
657
|
+
panelWidth: panelComposite.panelWidth,
|
|
658
|
+
});
|
|
659
|
+
};
|
|
660
|
+
const terminalOutputGuard = installTuiTerminalOutputGuard({ stdout, stderr: process.stderr, notify: (message) => { systemMessageRouter.low(message); render(); } });
|
|
661
|
+
|
|
662
|
+
setRenderRequest(render);
|
|
663
|
+
orchestratorRefs.requestRender = render;
|
|
664
|
+
commandContext.renderRequest = render;
|
|
665
|
+
wireShellUiOpeners({
|
|
666
|
+
commandContext,
|
|
667
|
+
input,
|
|
668
|
+
panelManager,
|
|
669
|
+
conversation,
|
|
670
|
+
configManager,
|
|
671
|
+
providerRegistry,
|
|
672
|
+
runtime,
|
|
673
|
+
featureFlags: ctx.featureFlags,
|
|
674
|
+
mcpRegistry: ctx.services.mcpRegistry,
|
|
675
|
+
subscriptionManager,
|
|
676
|
+
secretsManager,
|
|
677
|
+
serviceRegistry: ctx.services.serviceRegistry,
|
|
678
|
+
workingDirectory: workingDir,
|
|
679
|
+
homeDirectory,
|
|
680
|
+
getConfiguredProviderIds: ctx._getConfiguredProviderIds,
|
|
681
|
+
getPinned: ctx._getPinned,
|
|
682
|
+
render,
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
// --- Streaming speed + tool preview wiring ---
|
|
686
|
+
const refreshGit = () => gitStatusProvider.refresh().then((info) => { lastGitInfoRef.value = info; render(); }).catch(() => { /* non-fatal */ });
|
|
687
|
+
// Refresh git status after each turn completes or after tool results arrive
|
|
688
|
+
unsubs.push(uiServices.events.turns.on('TURN_COMPLETED', () => {
|
|
689
|
+
// Auto-save after every LLM turn so kills don't lose the session
|
|
690
|
+
try {
|
|
691
|
+
const snapshot = conversation.toJSON() as { messages: Array<import('./core/conversation.ts').ConversationMessageSnapshot>; timestamp?: number };
|
|
692
|
+
const persisted = buildPersistedSessionContext(snapshot.messages, conversation.getTitleSource(), buildSessionContinuityHints());
|
|
693
|
+
persistConversation(
|
|
694
|
+
runtime.sessionId,
|
|
695
|
+
{ ...snapshot, ...persisted },
|
|
696
|
+
runtime.model,
|
|
697
|
+
runtime.provider,
|
|
698
|
+
conversation.title || '',
|
|
699
|
+
{ workingDirectory: workingDir, homeDirectory, sessionManager: ctx.services.sessionManager },
|
|
700
|
+
);
|
|
701
|
+
hookDispatcher.fire({ path: 'Lifecycle:session:save' as HookEventPath, phase: 'Lifecycle' as HookPhase, category: 'session' as HookCategory, specific: 'save', sessionId: runtime.sessionId, timestamp: Date.now(), payload: { sessionId: runtime.sessionId } }).catch((err: unknown) => logger.debug('hook fire error', { error: summarizeError(err) }));
|
|
702
|
+
} catch (e) { logger.debug('auto-save on turn:complete failed', { error: summarizeError(e) }); }
|
|
703
|
+
refreshGit();
|
|
704
|
+
}));
|
|
705
|
+
unsubs.push(uiServices.events.tools.on('TOOL_SUCCEEDED', () => {
|
|
706
|
+
refreshGit();
|
|
707
|
+
}));
|
|
708
|
+
unsubs.push(uiServices.events.tools.on('TOOL_FAILED', () => {
|
|
709
|
+
refreshGit();
|
|
710
|
+
}));
|
|
711
|
+
|
|
712
|
+
unsubs.push(uiServices.events.turns.on('STREAM_START', () => {
|
|
713
|
+
streamStartTime = Date.now();
|
|
714
|
+
streamDeltaCount = 0;
|
|
715
|
+
streamTokenSpeed = 0;
|
|
716
|
+
}));
|
|
717
|
+
unsubs.push(uiServices.events.turns.on('STREAM_DELTA', () => {
|
|
718
|
+
streamDeltaCount++;
|
|
719
|
+
const elapsed = (Date.now() - streamStartTime) / 1000;
|
|
720
|
+
// Note: counts stream deltas, not actual tokens. ~1 delta per token for most providers.
|
|
721
|
+
streamTokenSpeed = elapsed > 0 ? streamDeltaCount / elapsed : 0;
|
|
722
|
+
}));
|
|
723
|
+
|
|
724
|
+
// --- Terminal setup ---
|
|
725
|
+
stdin.setRawMode(true);
|
|
726
|
+
stdin.resume();
|
|
727
|
+
stdin.setEncoding('utf8');
|
|
728
|
+
allowTerminalWrite(() => stdout.write((cli.flags.noAltScreen ? '' : ALT_SCREEN_ENTER) + CLEAR_SCREEN + CURSOR_HIDE + MOUSE_ENABLE + KEYBOARD_EXT_ENABLE + PASTE_ENABLE));
|
|
729
|
+
|
|
730
|
+
applyInitialTuiCliState({
|
|
731
|
+
cli,
|
|
732
|
+
input,
|
|
733
|
+
commandRegistry,
|
|
734
|
+
commandContext,
|
|
735
|
+
shellPaths: ctx.services.shellPaths,
|
|
736
|
+
render,
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
stdin.on('data', (data: string) => {
|
|
740
|
+
const blocking = handleBlockingShellInput({
|
|
741
|
+
data,
|
|
742
|
+
pendingPermission,
|
|
743
|
+
recoveryPending,
|
|
744
|
+
abortTurn: () => orchestrator.abort(),
|
|
745
|
+
conversation,
|
|
746
|
+
systemMessageRouter,
|
|
747
|
+
render,
|
|
748
|
+
loadRecoveryConversation: () => loadRecoveryConversation({ homeDirectory }),
|
|
749
|
+
deleteRecoveryFile: () => deleteRecoveryFile({ homeDirectory }),
|
|
750
|
+
});
|
|
751
|
+
pendingPermission = blocking.pendingPermission;
|
|
752
|
+
recoveryPending = blocking.recoveryPending;
|
|
753
|
+
if (blocking.handled) {
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
input.feed(data);
|
|
758
|
+
});
|
|
759
|
+
process.on('SIGINT', sigintHandler);
|
|
760
|
+
process.on('unhandledRejection', unhandledRejectionHandler);
|
|
761
|
+
stdout.on('resize', resizeHandler);
|
|
762
|
+
|
|
763
|
+
// Initial render
|
|
764
|
+
conversation.rebuildHistory();
|
|
765
|
+
render();
|
|
766
|
+
|
|
767
|
+
// --- Crash recovery check ---
|
|
768
|
+
const recoveryInfo = checkRecoveryFile({ workingDirectory: workingDir, homeDirectory });
|
|
769
|
+
if (recoveryInfo) {
|
|
770
|
+
systemMessageRouter.high(`[Recovery] Found unsaved session from ${new Date(recoveryInfo.timestamp).toLocaleString()}. Title: "${recoveryInfo.title}". Press Ctrl+R to restore, Esc to discard, or start typing to ignore it.`);
|
|
771
|
+
for (const line of formatReturnContextForDisplay(recoveryInfo.returnContext)) {
|
|
772
|
+
systemMessageRouter.low(`[Recovery] ${line}`);
|
|
773
|
+
}
|
|
774
|
+
render();
|
|
775
|
+
recoveryPending = true;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// --- Auto-save to recovery file every 60s ---
|
|
779
|
+
recoveryInterval = setInterval(() => {
|
|
780
|
+
const snapshot = conversation.toJSON() as { messages: Array<import('./core/conversation.ts').ConversationMessageSnapshot> };
|
|
781
|
+
const persisted = buildPersistedSessionContext(snapshot.messages, conversation.getTitleSource(), buildSessionContinuityHints());
|
|
782
|
+
writeRecoveryFile(
|
|
783
|
+
{ ...snapshot, ...persisted },
|
|
784
|
+
runtime.sessionId,
|
|
785
|
+
conversation.title ?? '',
|
|
786
|
+
{ workingDirectory: workingDir, homeDirectory },
|
|
787
|
+
);
|
|
788
|
+
}, 60_000);
|
|
789
|
+
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
main().catch(err => logger.error('Fatal error', { error: err }));
|