@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,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fallback chain visualization data builder.
|
|
3
|
+
*
|
|
4
|
+
* Converts the raw fallback chain from ModelDomainState and current
|
|
5
|
+
* provider health records into a structured FallbackChainData snapshot
|
|
6
|
+
* suitable for UI rendering.
|
|
7
|
+
*/
|
|
8
|
+
import type { ModelDomainState } from '@/runtime/index.ts';
|
|
9
|
+
import type { ProviderHealthDomainState } from '@/runtime/index.ts';
|
|
10
|
+
import type { FallbackChainData, FallbackChainNode } from '@/runtime/index.ts';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Build a FallbackChainData snapshot from the current model and health state.
|
|
14
|
+
*
|
|
15
|
+
* The primary model is always node 0. Each entry in ModelDomainState.fallbackChain
|
|
16
|
+
* becomes a subsequent node. Health status is enriched from the provider health domain.
|
|
17
|
+
*
|
|
18
|
+
* @param modelState - Current model domain state.
|
|
19
|
+
* @param healthState - Current provider health domain state.
|
|
20
|
+
* @returns Immutable FallbackChainData for visualization.
|
|
21
|
+
*/
|
|
22
|
+
export function buildFallbackChainData(
|
|
23
|
+
modelState: ModelDomainState,
|
|
24
|
+
healthState: ProviderHealthDomainState,
|
|
25
|
+
): FallbackChainData {
|
|
26
|
+
const nodes: FallbackChainNode[] = [];
|
|
27
|
+
|
|
28
|
+
// Node 0 — primary (active model)
|
|
29
|
+
const primaryRecord = healthState.providers.get(modelState.activeProviderId);
|
|
30
|
+
nodes.push({
|
|
31
|
+
registryKey: `${modelState.activeProviderId}:${modelState.activeModelId}`,
|
|
32
|
+
providerId: modelState.activeProviderId,
|
|
33
|
+
modelId: modelState.activeModelId,
|
|
34
|
+
displayName: modelState.displayName,
|
|
35
|
+
position: 0,
|
|
36
|
+
isCurrent: modelState.activeFallbackIndex === -1,
|
|
37
|
+
providerStatus: primaryRecord?.status ?? 'unknown',
|
|
38
|
+
reason: undefined,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Nodes 1..N — fallback chain entries
|
|
42
|
+
for (let i = 0; i < modelState.fallbackChain.length; i++) {
|
|
43
|
+
const entry = modelState.fallbackChain[i];
|
|
44
|
+
const record = healthState.providers.get(entry.providerId);
|
|
45
|
+
nodes.push({
|
|
46
|
+
registryKey: `${entry.providerId}:${entry.modelId}`,
|
|
47
|
+
providerId: entry.providerId,
|
|
48
|
+
modelId: entry.modelId,
|
|
49
|
+
displayName: entry.displayName,
|
|
50
|
+
position: i + 1,
|
|
51
|
+
isCurrent: modelState.activeFallbackIndex === i,
|
|
52
|
+
providerStatus: record?.status ?? 'unknown',
|
|
53
|
+
reason: entry.reason,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const hasUnhealthyNode = nodes.some(
|
|
58
|
+
(n) =>
|
|
59
|
+
n.providerStatus === 'degraded' ||
|
|
60
|
+
n.providerStatus === 'rate_limited' ||
|
|
61
|
+
n.providerStatus === 'unavailable' ||
|
|
62
|
+
n.providerStatus === 'auth_error',
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
nodes,
|
|
67
|
+
activeIndex: modelState.activeFallbackIndex,
|
|
68
|
+
falloverCount: modelState.falloverCount,
|
|
69
|
+
hasUnhealthyNode,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider health UI data surface barrel.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports all types and the ProviderHealthDataProvider class.
|
|
5
|
+
* Also provides the createProviderHealthData() factory for one-shot snapshots.
|
|
6
|
+
*/
|
|
7
|
+
export type {
|
|
8
|
+
ProviderStatus,
|
|
9
|
+
CompositeHealthStatus,
|
|
10
|
+
HealthTimelinePoint,
|
|
11
|
+
HealthTimeline,
|
|
12
|
+
ProviderHealthEntry,
|
|
13
|
+
FallbackChainNode,
|
|
14
|
+
FallbackChainData,
|
|
15
|
+
ProviderHealthData,
|
|
16
|
+
} from '@/runtime/index.ts';
|
|
17
|
+
|
|
18
|
+
export { ProviderHealthDataProvider } from '@/runtime/index.ts';
|
|
19
|
+
export { buildFallbackChainData } from '@/runtime/index.ts';
|
|
20
|
+
|
|
21
|
+
import type { ProviderHealthDomainState } from '@/runtime/index.ts';
|
|
22
|
+
import type { ModelDomainState } from '@/runtime/index.ts';
|
|
23
|
+
import { ProviderHealthDataProvider } from '@/runtime/index.ts';
|
|
24
|
+
import type { ProviderHealthData } from '@/runtime/index.ts';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Produce a one-shot ProviderHealthData snapshot without creating a long-lived provider.
|
|
28
|
+
*
|
|
29
|
+
* Use this when you need a single render pass and do not require change subscriptions.
|
|
30
|
+
* For reactive/subscription-based UIs, prefer ProviderHealthDataProvider.
|
|
31
|
+
*
|
|
32
|
+
* @param healthState - Current provider health domain state.
|
|
33
|
+
* @param modelState - Current model domain state.
|
|
34
|
+
* @returns Immutable ProviderHealthData snapshot.
|
|
35
|
+
*/
|
|
36
|
+
export function createProviderHealthData(
|
|
37
|
+
healthState: ProviderHealthDomainState,
|
|
38
|
+
modelState: ModelDomainState,
|
|
39
|
+
): ProviderHealthData {
|
|
40
|
+
// Delegate to the data provider for consistent derivation logic,
|
|
41
|
+
// then dispose immediately since no subscriptions are needed.
|
|
42
|
+
const dp = new ProviderHealthDataProvider(healthState, modelState);
|
|
43
|
+
const snapshot = dp.getSnapshot();
|
|
44
|
+
dp.dispose();
|
|
45
|
+
return snapshot;
|
|
46
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider health UI data types.
|
|
3
|
+
*
|
|
4
|
+
* Purely data-oriented — no rendering logic. These types are produced by
|
|
5
|
+
* ProviderHealthDataProvider and consumed by renderers/components.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProviderStatus, CompositeHealthStatus } from '@/runtime/index.ts';
|
|
8
|
+
|
|
9
|
+
// Re-exports for convenience
|
|
10
|
+
export type { ProviderStatus, CompositeHealthStatus };
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A single point in a provider health timeline.
|
|
14
|
+
* Used to render charts of success rate, latency, or error rate over time.
|
|
15
|
+
*/
|
|
16
|
+
export interface HealthTimelinePoint {
|
|
17
|
+
/** Epoch ms timestamp of this sample. */
|
|
18
|
+
readonly ts: number;
|
|
19
|
+
/** Observed success rate at this point (0–1). */
|
|
20
|
+
readonly successRate: number;
|
|
21
|
+
/** Observed average latency in ms at this point. */
|
|
22
|
+
readonly avgLatencyMs: number;
|
|
23
|
+
/** Observed error rate at this point (0–1). */
|
|
24
|
+
readonly errorRate: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Timeline data for a single provider, for chart rendering.
|
|
29
|
+
*/
|
|
30
|
+
export interface HealthTimeline {
|
|
31
|
+
/** Provider ID this timeline belongs to. */
|
|
32
|
+
readonly providerId: string;
|
|
33
|
+
/** Ordered timeline points (oldest first). */
|
|
34
|
+
readonly points: readonly HealthTimelinePoint[];
|
|
35
|
+
/** The number of points retained in this timeline. */
|
|
36
|
+
readonly length: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Full health entry for a single provider, enriched for UI consumption.
|
|
41
|
+
*/
|
|
42
|
+
export interface ProviderHealthEntry {
|
|
43
|
+
// ── Identity ──────────────────────────────────────────────────────────────
|
|
44
|
+
/** Provider identifier. */
|
|
45
|
+
readonly providerId: string;
|
|
46
|
+
/** Human-readable provider name. */
|
|
47
|
+
readonly displayName: string;
|
|
48
|
+
|
|
49
|
+
// ── Status ────────────────────────────────────────────────────────────────
|
|
50
|
+
/** Current health status. */
|
|
51
|
+
readonly status: ProviderStatus;
|
|
52
|
+
/** True when this provider is the active selection. */
|
|
53
|
+
readonly isActive: boolean;
|
|
54
|
+
/** True when this provider is configured with a valid API key. */
|
|
55
|
+
readonly isConfigured: boolean;
|
|
56
|
+
|
|
57
|
+
// ── Performance metrics ───────────────────────────────────────────────────
|
|
58
|
+
/** Success rate (0–1), derived from totalCalls and successCalls. */
|
|
59
|
+
readonly successRate: number;
|
|
60
|
+
/** Error rate (0–1), derived from totalCalls and errorCalls. */
|
|
61
|
+
readonly errorRate: number;
|
|
62
|
+
/** Approximate p95 latency in ms (max of recent observations). */
|
|
63
|
+
readonly p95LatencyMs: number;
|
|
64
|
+
/** Moving average latency in ms. */
|
|
65
|
+
readonly avgLatencyMs: number;
|
|
66
|
+
/** Total API calls recorded. */
|
|
67
|
+
readonly totalCalls: number;
|
|
68
|
+
|
|
69
|
+
// ── Cache metrics ─────────────────────────────────────────────────────────
|
|
70
|
+
/** Cache hit rate (0–1). Present only when cache metrics are available. */
|
|
71
|
+
readonly cacheHitRate?: number;
|
|
72
|
+
/** Cumulative cache read tokens saved. */
|
|
73
|
+
readonly cacheReadTokens?: number;
|
|
74
|
+
/** Cumulative cache write tokens. */
|
|
75
|
+
readonly cacheWriteTokens?: number;
|
|
76
|
+
|
|
77
|
+
// ── Timing ────────────────────────────────────────────────────────────────
|
|
78
|
+
/** Epoch ms of the last successful call, if any. */
|
|
79
|
+
readonly lastSuccessAt?: number;
|
|
80
|
+
/** Epoch ms of the last error, if any. */
|
|
81
|
+
readonly lastErrorAt?: number;
|
|
82
|
+
/** Most recent error message, if any. */
|
|
83
|
+
readonly lastErrorMessage?: string;
|
|
84
|
+
/** Epoch ms of the last health check. */
|
|
85
|
+
readonly lastCheckedAt?: number;
|
|
86
|
+
/** Rate limit reset time (epoch ms), if currently rate-limited. */
|
|
87
|
+
readonly rateLimitResetAt?: number;
|
|
88
|
+
|
|
89
|
+
// ── Timeline ──────────────────────────────────────────────────────────────
|
|
90
|
+
/** Timeline data for chart rendering. */
|
|
91
|
+
readonly timeline: HealthTimeline;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* A single node in the fallback chain visualization.
|
|
96
|
+
*/
|
|
97
|
+
export interface FallbackChainNode {
|
|
98
|
+
/** Provider identifier. */
|
|
99
|
+
readonly providerId: string;
|
|
100
|
+
/** Model identifier on this provider. */
|
|
101
|
+
readonly modelId: string;
|
|
102
|
+
/** Human-readable display label. */
|
|
103
|
+
readonly displayName: string;
|
|
104
|
+
/** Position in the chain (0 = primary). */
|
|
105
|
+
readonly position: number;
|
|
106
|
+
/** Whether this node is the currently active entry in the chain. */
|
|
107
|
+
readonly isCurrent: boolean;
|
|
108
|
+
/** Current health status of this provider. */
|
|
109
|
+
readonly providerStatus: ProviderStatus;
|
|
110
|
+
/** Reason this fallback was configured. */
|
|
111
|
+
readonly reason?: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Fallback chain visualization data for the current model configuration.
|
|
116
|
+
*/
|
|
117
|
+
export interface FallbackChainData {
|
|
118
|
+
/** Ordered nodes in the fallback chain (primary first). */
|
|
119
|
+
readonly nodes: readonly FallbackChainNode[];
|
|
120
|
+
/** Index of the currently active node (-1 = primary is active). */
|
|
121
|
+
readonly activeIndex: number;
|
|
122
|
+
/** Number of fallover events since session start. */
|
|
123
|
+
readonly falloverCount: number;
|
|
124
|
+
/** True when the chain has at least one degraded or unavailable node. */
|
|
125
|
+
readonly hasUnhealthyNode: boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Complete data snapshot produced by ProviderHealthDataProvider.
|
|
130
|
+
*/
|
|
131
|
+
export interface ProviderHealthData {
|
|
132
|
+
/** All provider health entries, sorted by status priority then name. */
|
|
133
|
+
readonly entries: readonly ProviderHealthEntry[];
|
|
134
|
+
/** Composite health status across all providers. */
|
|
135
|
+
readonly compositeStatus: CompositeHealthStatus;
|
|
136
|
+
/** Number of providers currently in a non-healthy state. */
|
|
137
|
+
readonly degradedCount: number;
|
|
138
|
+
/** Number of providers currently unavailable. */
|
|
139
|
+
readonly unavailableCount: number;
|
|
140
|
+
/** Fallback chain visualization data. */
|
|
141
|
+
readonly fallbackChain: FallbackChainData;
|
|
142
|
+
/** Warning messages from provider discovery. */
|
|
143
|
+
readonly warnings: readonly string[];
|
|
144
|
+
/** Epoch ms when this snapshot was produced. */
|
|
145
|
+
readonly snapshotAt: number;
|
|
146
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/runtime/index.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/runtime/index.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/runtime/index.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/runtime/index.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/runtime/index.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/runtime/index.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/runtime/index.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/runtime/index.ts';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type { UiReadModel } from '@/runtime/index.ts';
|
|
2
|
+
export type {
|
|
3
|
+
UiCoreReadModels,
|
|
4
|
+
UiProvidersSnapshot,
|
|
5
|
+
UiSessionSnapshot,
|
|
6
|
+
UiAgentsSnapshot,
|
|
7
|
+
UiTasksSnapshot,
|
|
8
|
+
} from '@/runtime/index.ts';
|
|
9
|
+
export type {
|
|
10
|
+
UiOperationsReadModels,
|
|
11
|
+
UiAutomationSnapshot,
|
|
12
|
+
UiRoutesSnapshot,
|
|
13
|
+
UiWatchersSnapshot,
|
|
14
|
+
UiOrchestrationSnapshot,
|
|
15
|
+
UiCommunicationSnapshot,
|
|
16
|
+
UiControlPlaneSnapshot,
|
|
17
|
+
} from '@/runtime/index.ts';
|
|
18
|
+
export type {
|
|
19
|
+
UiObservabilityReadModels,
|
|
20
|
+
UiRemoteSnapshot,
|
|
21
|
+
UiIntelligenceSnapshot,
|
|
22
|
+
UiMarketplaceSnapshot,
|
|
23
|
+
UiCockpitSnapshot,
|
|
24
|
+
UiSecuritySnapshot,
|
|
25
|
+
UiHealthSnapshot,
|
|
26
|
+
UiMcpServerSnapshot,
|
|
27
|
+
UiMcpSnapshot,
|
|
28
|
+
UiLocalAuthSnapshot,
|
|
29
|
+
UiSettingsSnapshot,
|
|
30
|
+
UiContinuitySnapshot,
|
|
31
|
+
UiWorktreeSnapshot,
|
|
32
|
+
} from '@/runtime/index.ts';
|
|
33
|
+
export type { UiObservabilityReadModelOptions } from '@/runtime/index.ts';
|
|
34
|
+
|
|
35
|
+
import type { RuntimeServices } from './services.ts';
|
|
36
|
+
import { createCoreReadModels, type UiCoreReadModels } from '@/runtime/index.ts';
|
|
37
|
+
import {
|
|
38
|
+
createOperationsReadModels,
|
|
39
|
+
type UiOperationsReadModels,
|
|
40
|
+
type UiOperationsReadModelOptions,
|
|
41
|
+
} from '@/runtime/index.ts';
|
|
42
|
+
import {
|
|
43
|
+
createObservabilityReadModels,
|
|
44
|
+
type UiObservabilityReadModels,
|
|
45
|
+
type UiObservabilityReadModelOptions,
|
|
46
|
+
} from '@/runtime/index.ts';
|
|
47
|
+
|
|
48
|
+
export type UiReadModelOptions = UiOperationsReadModelOptions & UiObservabilityReadModelOptions;
|
|
49
|
+
|
|
50
|
+
export type UiReadModels = UiCoreReadModels & UiOperationsReadModels & UiObservabilityReadModels;
|
|
51
|
+
|
|
52
|
+
export function createUiReadModels(
|
|
53
|
+
runtimeServices: RuntimeServices,
|
|
54
|
+
options: UiReadModelOptions = {},
|
|
55
|
+
): UiReadModels {
|
|
56
|
+
return {
|
|
57
|
+
...createCoreReadModels(runtimeServices),
|
|
58
|
+
...createOperationsReadModels(runtimeServices, options),
|
|
59
|
+
...createObservabilityReadModels(runtimeServices, options),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@/runtime/index.ts';
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { RuntimeServices } from './services.ts';
|
|
2
|
+
import type { RemoteRunnerRegistry } from '@/runtime/index.ts';
|
|
3
|
+
import type { RemoteSupervisor } from '@/runtime/index.ts';
|
|
4
|
+
import { createUiRuntimeEvents, type UiRuntimeEvents } from './ui-events.ts';
|
|
5
|
+
import { createUiReadModels, type UiReadModels, type UiReadModelOptions } from './ui-read-models.ts';
|
|
6
|
+
import type { ForensicsRegistry } from '@/runtime/index.ts';
|
|
7
|
+
import type { ControlPlaneRecentEvent } from '@pellux/goodvibes-sdk/platform/control-plane';
|
|
8
|
+
import type { ApprovalBroker } from '@pellux/goodvibes-sdk/platform/control-plane';
|
|
9
|
+
import type { SharedSessionBroker } from '@pellux/goodvibes-sdk/platform/control-plane';
|
|
10
|
+
import type { ShellPathService } from '@/runtime/index.ts';
|
|
11
|
+
import type { HostServiceStatus } from '@/runtime/index.ts';
|
|
12
|
+
import type { SecretsManager } from '../config/secrets.ts';
|
|
13
|
+
|
|
14
|
+
export interface UiEnvironmentServices {
|
|
15
|
+
readonly workingDirectory: string;
|
|
16
|
+
readonly homeDirectory: string;
|
|
17
|
+
readonly shellPaths: ShellPathService;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface UiShellServices {
|
|
21
|
+
readonly keybindingsManager: RuntimeServices['keybindingsManager'];
|
|
22
|
+
readonly panelManager: RuntimeServices['panelManager'];
|
|
23
|
+
readonly processManager: RuntimeServices['processManager'];
|
|
24
|
+
readonly profileManager: RuntimeServices['profileManager'];
|
|
25
|
+
readonly bookmarkManager: RuntimeServices['bookmarkManager'];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface UiAgentServices {
|
|
29
|
+
readonly agentManager: RuntimeServices['agentManager'];
|
|
30
|
+
readonly agentMessageBus: RuntimeServices['agentMessageBus'];
|
|
31
|
+
readonly wrfcController: RuntimeServices['wrfcController'];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface UiProviderServices {
|
|
35
|
+
readonly providerRegistry: RuntimeServices['providerRegistry'];
|
|
36
|
+
readonly favoritesStore: RuntimeServices['favoritesStore'];
|
|
37
|
+
readonly benchmarkStore: RuntimeServices['benchmarkStore'];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface UiSessionServices {
|
|
41
|
+
readonly sessionManager: RuntimeServices['sessionManager'];
|
|
42
|
+
readonly sessionBroker: SharedSessionBroker;
|
|
43
|
+
readonly sessionOrchestration: RuntimeServices['sessionOrchestration'];
|
|
44
|
+
readonly sessionMemoryStore: RuntimeServices['sessionMemoryStore'];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface UiPlatformServices {
|
|
48
|
+
readonly configManager: RuntimeServices['configManager'];
|
|
49
|
+
readonly localUserAuthManager: RuntimeServices['localUserAuthManager'];
|
|
50
|
+
readonly mcpRegistry: RuntimeServices['mcpRegistry'];
|
|
51
|
+
readonly serviceRegistry: RuntimeServices['serviceRegistry'];
|
|
52
|
+
readonly surfaceRegistry: RuntimeServices['surfaceRegistry'];
|
|
53
|
+
readonly subscriptionManager: RuntimeServices['subscriptionManager'];
|
|
54
|
+
readonly secretsManager: SecretsManager;
|
|
55
|
+
readonly tokenAuditor: RuntimeServices['tokenAuditor'];
|
|
56
|
+
readonly replayEngine: RuntimeServices['replayEngine'];
|
|
57
|
+
readonly webhookNotifier: RuntimeServices['webhookNotifier'];
|
|
58
|
+
readonly policyRuntimeState: RuntimeServices['policyRuntimeState'];
|
|
59
|
+
readonly externalServices?: {
|
|
60
|
+
inspect(): {
|
|
61
|
+
readonly daemonRunning: boolean;
|
|
62
|
+
readonly daemonPortInUse?: boolean;
|
|
63
|
+
readonly httpListenerRunning: boolean;
|
|
64
|
+
readonly httpListenerPortInUse?: boolean;
|
|
65
|
+
readonly daemonStatus?: HostServiceStatus;
|
|
66
|
+
readonly httpListenerStatus?: HostServiceStatus;
|
|
67
|
+
};
|
|
68
|
+
restart(): Promise<{
|
|
69
|
+
readonly daemonRunning: boolean;
|
|
70
|
+
readonly daemonPortInUse?: boolean;
|
|
71
|
+
readonly httpListenerRunning: boolean;
|
|
72
|
+
readonly httpListenerPortInUse?: boolean;
|
|
73
|
+
readonly daemonStatus?: HostServiceStatus;
|
|
74
|
+
readonly httpListenerStatus?: HostServiceStatus;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface UiPlanningServices {
|
|
80
|
+
readonly planManager: RuntimeServices['planManager'];
|
|
81
|
+
readonly adaptivePlanner: RuntimeServices['adaptivePlanner'];
|
|
82
|
+
readonly projectPlanningService: RuntimeServices['projectPlanningService'];
|
|
83
|
+
readonly projectPlanningProjectId: RuntimeServices['projectPlanningProjectId'];
|
|
84
|
+
readonly workPlanStore: RuntimeServices['workPlanStore'];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface UiCoordinationServices {
|
|
88
|
+
readonly approvalBroker: ApprovalBroker;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface UiRuntimeSharedServices {
|
|
92
|
+
readonly environment: UiEnvironmentServices;
|
|
93
|
+
readonly shell: UiShellServices;
|
|
94
|
+
readonly agents: UiAgentServices;
|
|
95
|
+
readonly providers: UiProviderServices;
|
|
96
|
+
readonly sessions: UiSessionServices;
|
|
97
|
+
readonly platform: UiPlatformServices;
|
|
98
|
+
readonly planning: UiPlanningServices;
|
|
99
|
+
readonly coordination: UiCoordinationServices;
|
|
100
|
+
readonly runtime: {
|
|
101
|
+
readonly distributedRuntime: RuntimeServices['distributedRuntime'];
|
|
102
|
+
readonly remoteRunnerRegistry: RuntimeServices['remoteRunnerRegistry'] & RemoteRunnerRegistry;
|
|
103
|
+
readonly remoteSupervisor: RuntimeServices['remoteSupervisor'] & RemoteSupervisor;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface UiRuntimeServices {
|
|
108
|
+
readonly environment: UiEnvironmentServices;
|
|
109
|
+
readonly shell: UiShellServices;
|
|
110
|
+
readonly agents: UiAgentServices;
|
|
111
|
+
readonly providers: UiProviderServices;
|
|
112
|
+
readonly sessions: UiSessionServices;
|
|
113
|
+
readonly platform: UiPlatformServices;
|
|
114
|
+
readonly planning: UiPlanningServices;
|
|
115
|
+
readonly coordination: UiCoordinationServices;
|
|
116
|
+
readonly runtime: UiRuntimeSharedServices['runtime'];
|
|
117
|
+
readonly events: UiRuntimeEvents;
|
|
118
|
+
readonly readModels: UiReadModels;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface UiRuntimeServicesOptions extends UiReadModelOptions {
|
|
122
|
+
readonly forensicsRegistry?: ForensicsRegistry;
|
|
123
|
+
readonly getControlPlaneRecentEvents?: (limit: number) => readonly ControlPlaneRecentEvent[];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function createUiRuntimeServices(
|
|
127
|
+
runtimeServices: RuntimeServices,
|
|
128
|
+
options: UiRuntimeServicesOptions = {},
|
|
129
|
+
): UiRuntimeServices {
|
|
130
|
+
return {
|
|
131
|
+
environment: {
|
|
132
|
+
workingDirectory: runtimeServices.workingDirectory,
|
|
133
|
+
homeDirectory: runtimeServices.homeDirectory,
|
|
134
|
+
shellPaths: runtimeServices.shellPaths,
|
|
135
|
+
},
|
|
136
|
+
shell: {
|
|
137
|
+
keybindingsManager: runtimeServices.keybindingsManager,
|
|
138
|
+
panelManager: runtimeServices.panelManager,
|
|
139
|
+
processManager: runtimeServices.processManager,
|
|
140
|
+
profileManager: runtimeServices.profileManager,
|
|
141
|
+
bookmarkManager: runtimeServices.bookmarkManager,
|
|
142
|
+
},
|
|
143
|
+
agents: {
|
|
144
|
+
agentManager: runtimeServices.agentManager,
|
|
145
|
+
agentMessageBus: runtimeServices.agentMessageBus,
|
|
146
|
+
wrfcController: runtimeServices.wrfcController,
|
|
147
|
+
},
|
|
148
|
+
providers: {
|
|
149
|
+
providerRegistry: runtimeServices.providerRegistry,
|
|
150
|
+
favoritesStore: runtimeServices.favoritesStore,
|
|
151
|
+
benchmarkStore: runtimeServices.benchmarkStore,
|
|
152
|
+
},
|
|
153
|
+
sessions: {
|
|
154
|
+
sessionManager: runtimeServices.sessionManager,
|
|
155
|
+
sessionBroker: runtimeServices.sessionBroker,
|
|
156
|
+
sessionOrchestration: runtimeServices.sessionOrchestration,
|
|
157
|
+
sessionMemoryStore: runtimeServices.sessionMemoryStore,
|
|
158
|
+
},
|
|
159
|
+
platform: {
|
|
160
|
+
configManager: runtimeServices.configManager,
|
|
161
|
+
localUserAuthManager: runtimeServices.localUserAuthManager,
|
|
162
|
+
mcpRegistry: runtimeServices.mcpRegistry,
|
|
163
|
+
serviceRegistry: runtimeServices.serviceRegistry,
|
|
164
|
+
surfaceRegistry: runtimeServices.surfaceRegistry,
|
|
165
|
+
subscriptionManager: runtimeServices.subscriptionManager,
|
|
166
|
+
secretsManager: runtimeServices.secretsManager,
|
|
167
|
+
tokenAuditor: runtimeServices.tokenAuditor,
|
|
168
|
+
replayEngine: runtimeServices.replayEngine,
|
|
169
|
+
webhookNotifier: runtimeServices.webhookNotifier,
|
|
170
|
+
policyRuntimeState: runtimeServices.policyRuntimeState,
|
|
171
|
+
},
|
|
172
|
+
planning: {
|
|
173
|
+
planManager: runtimeServices.planManager,
|
|
174
|
+
adaptivePlanner: runtimeServices.adaptivePlanner,
|
|
175
|
+
projectPlanningService: runtimeServices.projectPlanningService,
|
|
176
|
+
projectPlanningProjectId: runtimeServices.projectPlanningProjectId,
|
|
177
|
+
workPlanStore: runtimeServices.workPlanStore,
|
|
178
|
+
},
|
|
179
|
+
coordination: {
|
|
180
|
+
approvalBroker: runtimeServices.approvalBroker,
|
|
181
|
+
},
|
|
182
|
+
runtime: {
|
|
183
|
+
distributedRuntime: runtimeServices.distributedRuntime,
|
|
184
|
+
remoteRunnerRegistry: runtimeServices.remoteRunnerRegistry,
|
|
185
|
+
remoteSupervisor: runtimeServices.remoteSupervisor,
|
|
186
|
+
},
|
|
187
|
+
events: createUiRuntimeEvents(runtimeServices.runtimeBus),
|
|
188
|
+
readModels: createUiReadModels(runtimeServices, options),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// CLI utility script — not imported by the app. console usage is intentional.
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import { AgentMessageBus } from '@pellux/goodvibes-sdk/platform/agents';
|
|
4
|
+
|
|
5
|
+
// Simple script to read messages from a file and broadcast them via the AgentMessageBus.
|
|
6
|
+
// Expected file format: each line contains an optional index and a message separated by '|', e.g. "1 | Hello".
|
|
7
|
+
// Empty lines or lines without a '|' are ignored.
|
|
8
|
+
|
|
9
|
+
const MESSAGE_FILE = `${__dirname}/../msg_target.txt`;
|
|
10
|
+
|
|
11
|
+
function parseMessages(fileContent: string): string[] {
|
|
12
|
+
const lines = fileContent.split(/\r?\n/);
|
|
13
|
+
const messages: string[] = [];
|
|
14
|
+
for (const line of lines) {
|
|
15
|
+
const trimmed = line.trim();
|
|
16
|
+
if (!trimmed) continue;
|
|
17
|
+
const parts = trimmed.split('|');
|
|
18
|
+
if (parts.length < 2) continue;
|
|
19
|
+
const msg = parts[1].trim();
|
|
20
|
+
if (msg) messages.push(msg);
|
|
21
|
+
}
|
|
22
|
+
return messages;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function main() {
|
|
26
|
+
try {
|
|
27
|
+
const raw = readFileSync(MESSAGE_FILE, { encoding: 'utf-8' });
|
|
28
|
+
const msgs = parseMessages(raw);
|
|
29
|
+
const bus = new AgentMessageBus();
|
|
30
|
+
for (const m of msgs) {
|
|
31
|
+
bus.broadcast('system', m);
|
|
32
|
+
console.log(`Broadcasted: ${m}`);
|
|
33
|
+
}
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.error('Failed to process messages:', err);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (require.main === module) {
|
|
41
|
+
main();
|
|
42
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ConversationManager } from '../core/conversation';
|
|
2
|
+
import type { PermissionRequest } from '@pellux/goodvibes-sdk/platform/permissions';
|
|
3
|
+
import type { SessionSnapshot } from '@/runtime/index.ts';
|
|
4
|
+
import type { SystemMessageRouter } from '../core/system-message-router.ts';
|
|
5
|
+
|
|
6
|
+
export type PendingPermissionState = PermissionRequest & {
|
|
7
|
+
resolve: (approved: boolean, remember?: boolean) => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type BlockingInputHandlerOptions = {
|
|
11
|
+
data: string;
|
|
12
|
+
pendingPermission: PendingPermissionState | null;
|
|
13
|
+
recoveryPending: boolean;
|
|
14
|
+
abortTurn: () => void;
|
|
15
|
+
conversation: ConversationManager;
|
|
16
|
+
systemMessageRouter: SystemMessageRouter;
|
|
17
|
+
render: () => void;
|
|
18
|
+
loadRecoveryConversation: () => SessionSnapshot | null;
|
|
19
|
+
deleteRecoveryFile: () => void;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type BlockingInputHandlerResult = {
|
|
23
|
+
handled: boolean;
|
|
24
|
+
pendingPermission: PendingPermissionState | null;
|
|
25
|
+
recoveryPending: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export function handleBlockingShellInput(
|
|
29
|
+
options: BlockingInputHandlerOptions,
|
|
30
|
+
): BlockingInputHandlerResult {
|
|
31
|
+
const {
|
|
32
|
+
data,
|
|
33
|
+
pendingPermission,
|
|
34
|
+
recoveryPending,
|
|
35
|
+
abortTurn,
|
|
36
|
+
conversation,
|
|
37
|
+
systemMessageRouter,
|
|
38
|
+
render,
|
|
39
|
+
loadRecoveryConversation,
|
|
40
|
+
deleteRecoveryFile,
|
|
41
|
+
} = options;
|
|
42
|
+
|
|
43
|
+
if (pendingPermission) {
|
|
44
|
+
const req = pendingPermission;
|
|
45
|
+
const key = data.toLowerCase().trim();
|
|
46
|
+
|
|
47
|
+
if (key === 'y') {
|
|
48
|
+
req.resolve(true, false);
|
|
49
|
+
render();
|
|
50
|
+
return { handled: true, pendingPermission: null, recoveryPending };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (key === 'a') {
|
|
54
|
+
req.resolve(true, true);
|
|
55
|
+
render();
|
|
56
|
+
return { handled: true, pendingPermission: null, recoveryPending };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (key === 'n' || data === '\x1b' || data === '\x03') {
|
|
60
|
+
req.resolve(false, false);
|
|
61
|
+
abortTurn();
|
|
62
|
+
render();
|
|
63
|
+
return { handled: true, pendingPermission: null, recoveryPending };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
render();
|
|
67
|
+
return { handled: true, pendingPermission, recoveryPending };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (recoveryPending) {
|
|
71
|
+
if (data === '\x12') {
|
|
72
|
+
const recovery = loadRecoveryConversation();
|
|
73
|
+
if (recovery) {
|
|
74
|
+
conversation.fromJSON({ messages: recovery.messages as Parameters<typeof conversation.fromJSON>[0]['messages'] });
|
|
75
|
+
systemMessageRouter.high('[Recovery] Session restored.');
|
|
76
|
+
} else {
|
|
77
|
+
systemMessageRouter.high('[Recovery] Failed to restore saved data.');
|
|
78
|
+
}
|
|
79
|
+
deleteRecoveryFile();
|
|
80
|
+
render();
|
|
81
|
+
return { handled: true, pendingPermission: null, recoveryPending: false };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (data === '\x1b' || data === '\x03') {
|
|
85
|
+
systemMessageRouter.high('[Recovery] Discarded recovery data.');
|
|
86
|
+
deleteRecoveryFile();
|
|
87
|
+
render();
|
|
88
|
+
return { handled: true, pendingPermission: null, recoveryPending: false };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
systemMessageRouter.high('[Recovery] Ignored saved session; starting a new prompt.');
|
|
92
|
+
deleteRecoveryFile();
|
|
93
|
+
render();
|
|
94
|
+
return { handled: false, pendingPermission: null, recoveryPending: false };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return { handled: false, pendingPermission, recoveryPending };
|
|
98
|
+
}
|