@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,391 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloudflareDaemonRouteError,
|
|
3
|
+
createCloudflareDaemonClient,
|
|
4
|
+
type CloudflareComponentSelection,
|
|
5
|
+
type CloudflareDaemonClient,
|
|
6
|
+
type CloudflareDiscoverResult,
|
|
7
|
+
type CloudflareOperationalTokenResult,
|
|
8
|
+
type CloudflareProvisionRequest,
|
|
9
|
+
type CloudflareProvisionResult,
|
|
10
|
+
type CloudflareTokenRequirementsResult,
|
|
11
|
+
type CloudflareValidateResult,
|
|
12
|
+
type CloudflareVerifyResult,
|
|
13
|
+
} from '../runtime/cloudflare-control-plane.ts';
|
|
14
|
+
import type { OnboardingVerificationItem } from '../runtime/onboarding/index.ts';
|
|
15
|
+
import type { InputHandler } from './handler.ts';
|
|
16
|
+
import type { OnboardingWizardAction, OnboardingWizardApplyFeedback } from './onboarding/onboarding-wizard.ts';
|
|
17
|
+
import {
|
|
18
|
+
buildCloudflareApiTokenRef,
|
|
19
|
+
buildCloudflareProvisionRequest,
|
|
20
|
+
getCloudflareBatchMode,
|
|
21
|
+
getCloudflareComponentSelection,
|
|
22
|
+
getCloudflareSetupSource,
|
|
23
|
+
shouldShowCloudflareStep,
|
|
24
|
+
} from './onboarding/onboarding-wizard-cloudflare.ts';
|
|
25
|
+
|
|
26
|
+
type CloudflareOnboardingAction = Extract<OnboardingWizardAction,
|
|
27
|
+
| 'cloudflare-token-requirements'
|
|
28
|
+
| 'cloudflare-create-operational-token'
|
|
29
|
+
| 'cloudflare-discover'
|
|
30
|
+
| 'cloudflare-validate'
|
|
31
|
+
| 'cloudflare-provision'
|
|
32
|
+
| 'cloudflare-verify'
|
|
33
|
+
| 'cloudflare-disable'
|
|
34
|
+
>;
|
|
35
|
+
|
|
36
|
+
function getCloudflareDaemonClientForHandler(handler: InputHandler): CloudflareDaemonClient {
|
|
37
|
+
return createCloudflareDaemonClient({
|
|
38
|
+
configManager: handler.uiServices.platform.configManager,
|
|
39
|
+
homeDirectory: handler.uiServices.environment.homeDirectory,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function normalizeCloudflareActionError(error: unknown): string {
|
|
44
|
+
if (error instanceof CloudflareDaemonRouteError) {
|
|
45
|
+
return `${error.message} (HTTP ${error.status}, ${error.code})`;
|
|
46
|
+
}
|
|
47
|
+
return error instanceof Error ? error.message : String(error);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function setCloudflareWizardStatusForHandler(
|
|
51
|
+
handler: InputHandler,
|
|
52
|
+
title: string,
|
|
53
|
+
lines: readonly string[],
|
|
54
|
+
severity: OnboardingWizardApplyFeedback['severity'] = 'info',
|
|
55
|
+
): void {
|
|
56
|
+
const message = [title, ...lines].filter((line) => line.length > 0).join('\n');
|
|
57
|
+
handler.onboardingWizard.textState.set('cloudflare.action-status', message);
|
|
58
|
+
handler.onboardingWizard.setApplyFeedback({
|
|
59
|
+
severity,
|
|
60
|
+
title,
|
|
61
|
+
summary: lines[0] ?? title,
|
|
62
|
+
messages: lines.length > 0 ? lines : [title],
|
|
63
|
+
});
|
|
64
|
+
const targetIndex = handler.onboardingWizard.steps.findIndex((step) => step.id === 'cloudflare');
|
|
65
|
+
if (targetIndex >= 0) handler.onboardingWizard.setStep(targetIndex);
|
|
66
|
+
handler.commandContext?.print?.(message);
|
|
67
|
+
handler.requestRender();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function formatCloudflareComponents(components: CloudflareComponentSelection): string {
|
|
71
|
+
const enabled = Object.entries(components)
|
|
72
|
+
.filter(([, selected]) => selected === true)
|
|
73
|
+
.map(([component]) => component);
|
|
74
|
+
return enabled.length > 0 ? enabled.join(', ') : 'none';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function formatCloudflareRequirements(result: CloudflareTokenRequirementsResult): string[] {
|
|
78
|
+
const permissionLines = result.permissions.length > 0
|
|
79
|
+
? result.permissions.map((permission) => ` ${permission.scope}: ${permission.permission} (${permission.component}) - ${permission.reason}`)
|
|
80
|
+
: [' No permissions returned for the selected components.'];
|
|
81
|
+
return [
|
|
82
|
+
`components: ${formatCloudflareComponents(result.components)}`,
|
|
83
|
+
'required permissions:',
|
|
84
|
+
...permissionLines,
|
|
85
|
+
...(result.bootstrapToken.instructions.length > 0
|
|
86
|
+
? ['', 'bootstrap token instructions:', ...result.bootstrapToken.instructions.map((line) => ` ${line}`)]
|
|
87
|
+
: []),
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function formatCloudflareValidation(result: CloudflareValidateResult): string[] {
|
|
92
|
+
return [
|
|
93
|
+
`token: ${result.ok ? 'valid' : 'not valid'}`,
|
|
94
|
+
`source: ${result.tokenSource}`,
|
|
95
|
+
result.account
|
|
96
|
+
? `account: ${result.account.name} (${result.account.id})`
|
|
97
|
+
: 'account: not resolved',
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function formatCloudflareDiscovery(result: CloudflareDiscoverResult): string[] {
|
|
102
|
+
return [
|
|
103
|
+
`token source: ${result.tokenSource}`,
|
|
104
|
+
`accounts: ${result.accounts.length}`,
|
|
105
|
+
`zones: ${result.zones.length}`,
|
|
106
|
+
`worker subdomain: ${result.workerSubdomain || 'not detected'}`,
|
|
107
|
+
`queues: ${result.queues?.length ?? 0}`,
|
|
108
|
+
`KV namespaces: ${result.kvNamespaces?.length ?? 0}`,
|
|
109
|
+
`R2 buckets: ${result.r2Buckets?.length ?? 0}`,
|
|
110
|
+
...(result.selectedAccount ? [`selected account: ${result.selectedAccount.name} (${result.selectedAccount.id})`] : []),
|
|
111
|
+
...(result.selectedZone ? [`selected zone: ${result.selectedZone.name} (${result.selectedZone.id})`] : []),
|
|
112
|
+
...result.warnings.map((warning) => `warning: ${warning}`),
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function formatCloudflareTokenCreate(result: CloudflareOperationalTokenResult): string[] {
|
|
117
|
+
return [
|
|
118
|
+
`token: ${result.tokenName}${result.tokenId ? ` (${result.tokenId})` : ''}`,
|
|
119
|
+
`account: ${result.accountId}`,
|
|
120
|
+
`stored ref: ${result.apiTokenRef ?? 'not stored'}`,
|
|
121
|
+
`permissions: ${result.permissions.length}`,
|
|
122
|
+
'Delete or expire the temporary bootstrap token in Cloudflare after confirming the operational token works.',
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function formatCloudflareProvision(result: CloudflareProvisionResult): string[] {
|
|
127
|
+
return [
|
|
128
|
+
`result: ${result.ok ? 'ok' : 'needs attention'}`,
|
|
129
|
+
...(result.worker ? [`worker: ${result.worker.name}${result.worker.baseUrl ? ` at ${result.worker.baseUrl}` : ''}`] : []),
|
|
130
|
+
...(result.queues ? [`queue: ${result.queues.queueName}; DLQ: ${result.queues.deadLetterQueueName}`] : []),
|
|
131
|
+
...result.steps.map((step) => `${step.status}: ${step.name}${step.message ? ` - ${step.message}` : ''}`),
|
|
132
|
+
...(result.verification ? formatCloudflareVerify(result.verification).map((line) => `verify ${line}`) : []),
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function formatCloudflareVerify(result: CloudflareVerifyResult): string[] {
|
|
137
|
+
return [
|
|
138
|
+
`worker health: ${result.workerHealth.ok ? 'ok' : 'failed'} (HTTP ${result.workerHealth.status})${result.workerHealth.error ? ` - ${result.workerHealth.error}` : ''}`,
|
|
139
|
+
...(result.daemonBatchProxy
|
|
140
|
+
? [`daemon batch proxy: ${result.daemonBatchProxy.ok ? 'ok' : 'failed'} (HTTP ${result.daemonBatchProxy.status})${result.daemonBatchProxy.error ? ` - ${result.daemonBatchProxy.error}` : ''}`]
|
|
141
|
+
: []),
|
|
142
|
+
];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function getCloudflareBootstrapTokenFromWizard(handler: InputHandler): string {
|
|
146
|
+
const wizard = handler.onboardingWizard;
|
|
147
|
+
const setupSource = getCloudflareSetupSource(wizard);
|
|
148
|
+
if (setupSource === 'bootstrap-token') {
|
|
149
|
+
return wizard.getStringFieldValue('cloudflare.bootstrap-token', '');
|
|
150
|
+
}
|
|
151
|
+
if (setupSource === 'bootstrap-env') {
|
|
152
|
+
const envName = wizard.getStringFieldValue('cloudflare.bootstrap-env-name', 'GOODVIBES_CLOUDFLARE_BOOTSTRAP_TOKEN');
|
|
153
|
+
return process.env[envName] ?? '';
|
|
154
|
+
}
|
|
155
|
+
return '';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function getCloudflareOperationalTokenFromWizard(handler: InputHandler): string {
|
|
159
|
+
const wizard = handler.onboardingWizard;
|
|
160
|
+
return getCloudflareSetupSource(wizard) === 'operational-token'
|
|
161
|
+
? wizard.getStringFieldValue('cloudflare.operational-token', '')
|
|
162
|
+
: '';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function getCloudflareApiTokenRefFromWizard(handler: InputHandler): string {
|
|
166
|
+
const wizard = handler.onboardingWizard;
|
|
167
|
+
const setupSource = getCloudflareSetupSource(wizard);
|
|
168
|
+
if (setupSource === 'operational-env') {
|
|
169
|
+
return buildCloudflareApiTokenRef(wizard.getStringFieldValue('cloudflare.operational-env-name', 'CLOUDFLARE_API_TOKEN'));
|
|
170
|
+
}
|
|
171
|
+
return wizard.runtimeSnapshot?.config.cloudflare.apiTokenRef ?? '';
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function createCloudflareOperationalTokenForHandler(handler: InputHandler): Promise<CloudflareOperationalTokenResult> {
|
|
175
|
+
const wizard = handler.onboardingWizard;
|
|
176
|
+
const bootstrapToken = getCloudflareBootstrapTokenFromWizard(handler);
|
|
177
|
+
if (!bootstrapToken) {
|
|
178
|
+
throw new Error('A bootstrap token is required. Paste it in the wizard or select an environment variable that is set in this TUI process.');
|
|
179
|
+
}
|
|
180
|
+
const accountId = wizard.getStringFieldValue('cloudflare.account-id', wizard.runtimeSnapshot?.config.cloudflare.accountId ?? '');
|
|
181
|
+
const zoneId = wizard.getStringFieldValue('cloudflare.zone-id', wizard.runtimeSnapshot?.config.cloudflare.zoneId ?? '');
|
|
182
|
+
const zoneName = wizard.getStringFieldValue('cloudflare.zone-name', wizard.runtimeSnapshot?.config.cloudflare.zoneName ?? '');
|
|
183
|
+
return await getCloudflareDaemonClientForHandler(handler).createOperationalToken({
|
|
184
|
+
components: getCloudflareComponentSelection(wizard),
|
|
185
|
+
bootstrapToken,
|
|
186
|
+
...(accountId ? { accountId } : {}),
|
|
187
|
+
...(zoneId ? { zoneId } : {}),
|
|
188
|
+
...(zoneName ? { zoneName } : {}),
|
|
189
|
+
storeApiToken: true,
|
|
190
|
+
persistConfig: true,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function buildCloudflareProvisionInputForHandler(handler: InputHandler): Promise<CloudflareProvisionRequest> {
|
|
195
|
+
const input = buildCloudflareProvisionRequest(handler.onboardingWizard, { includeTransientSecrets: true });
|
|
196
|
+
const setupSource = getCloudflareSetupSource(handler.onboardingWizard);
|
|
197
|
+
if (setupSource === 'bootstrap-token' || setupSource === 'bootstrap-env') {
|
|
198
|
+
const tokenResult = await createCloudflareOperationalTokenForHandler(handler);
|
|
199
|
+
if (tokenResult.apiTokenRef) {
|
|
200
|
+
const withoutInlineToken = { ...input };
|
|
201
|
+
delete withoutInlineToken.apiToken;
|
|
202
|
+
return { ...withoutInlineToken, apiTokenRef: tokenResult.apiTokenRef };
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return input;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function buildCloudflareDiscoveryInputForHandler(handler: InputHandler): Parameters<CloudflareDaemonClient['discover']>[0] {
|
|
209
|
+
const wizard = handler.onboardingWizard;
|
|
210
|
+
const accountId = wizard.getStringFieldValue('cloudflare.account-id', wizard.runtimeSnapshot?.config.cloudflare.accountId ?? '');
|
|
211
|
+
const zoneId = wizard.getStringFieldValue('cloudflare.zone-id', wizard.runtimeSnapshot?.config.cloudflare.zoneId ?? '');
|
|
212
|
+
const zoneName = wizard.getStringFieldValue('cloudflare.zone-name', wizard.runtimeSnapshot?.config.cloudflare.zoneName ?? '');
|
|
213
|
+
const bootstrapToken = getCloudflareBootstrapTokenFromWizard(handler);
|
|
214
|
+
const apiToken = getCloudflareOperationalTokenFromWizard(handler) || bootstrapToken;
|
|
215
|
+
const apiTokenRef = getCloudflareApiTokenRefFromWizard(handler);
|
|
216
|
+
return {
|
|
217
|
+
components: getCloudflareComponentSelection(wizard),
|
|
218
|
+
includeResources: true,
|
|
219
|
+
...(accountId ? { accountId } : {}),
|
|
220
|
+
...(zoneId ? { zoneId } : {}),
|
|
221
|
+
...(zoneName ? { zoneName } : {}),
|
|
222
|
+
...(apiToken ? { apiToken } : apiTokenRef ? { apiTokenRef } : {}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function buildCloudflareValidateInputForHandler(handler: InputHandler): Parameters<CloudflareDaemonClient['validate']>[0] {
|
|
227
|
+
const wizard = handler.onboardingWizard;
|
|
228
|
+
const accountId = wizard.getStringFieldValue('cloudflare.account-id', wizard.runtimeSnapshot?.config.cloudflare.accountId ?? '');
|
|
229
|
+
const bootstrapToken = getCloudflareBootstrapTokenFromWizard(handler);
|
|
230
|
+
const apiToken = getCloudflareOperationalTokenFromWizard(handler) || bootstrapToken;
|
|
231
|
+
const apiTokenRef = getCloudflareApiTokenRefFromWizard(handler);
|
|
232
|
+
return {
|
|
233
|
+
...(accountId ? { accountId } : {}),
|
|
234
|
+
...(apiToken ? { apiToken } : apiTokenRef ? { apiTokenRef } : {}),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export async function handleCloudflareOnboardingActionForHandler(
|
|
239
|
+
handler: InputHandler,
|
|
240
|
+
action: CloudflareOnboardingAction,
|
|
241
|
+
): Promise<void> {
|
|
242
|
+
if (handler.onboardingApplyPending) return;
|
|
243
|
+
handler.onboardingApplyPending = true;
|
|
244
|
+
handler.onboardingWizard.clearApplyFeedback();
|
|
245
|
+
handler.requestRender();
|
|
246
|
+
try {
|
|
247
|
+
const client = getCloudflareDaemonClientForHandler(handler);
|
|
248
|
+
if (action === 'cloudflare-token-requirements') {
|
|
249
|
+
const result = await client.tokenRequirements({
|
|
250
|
+
components: getCloudflareComponentSelection(handler.onboardingWizard),
|
|
251
|
+
includeBootstrap: true,
|
|
252
|
+
});
|
|
253
|
+
setCloudflareWizardStatusForHandler(handler, 'Cloudflare token requirements', formatCloudflareRequirements(result));
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (action === 'cloudflare-create-operational-token') {
|
|
258
|
+
const result = await createCloudflareOperationalTokenForHandler(handler);
|
|
259
|
+
setCloudflareWizardStatusForHandler(handler, 'Cloudflare operational token created', formatCloudflareTokenCreate(result));
|
|
260
|
+
await handler.refreshOnboardingHydration({ preserveValues: true, targetStepId: 'cloudflare' });
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (action === 'cloudflare-discover') {
|
|
265
|
+
const result = await client.discover(buildCloudflareDiscoveryInputForHandler(handler));
|
|
266
|
+
if (result.selectedAccount && !handler.onboardingWizard.getStringFieldValue('cloudflare.account-id', '')) {
|
|
267
|
+
handler.onboardingWizard.setFieldValue('cloudflare.account-id', result.selectedAccount.id);
|
|
268
|
+
} else if (result.accounts.length === 1 && !handler.onboardingWizard.getStringFieldValue('cloudflare.account-id', '')) {
|
|
269
|
+
handler.onboardingWizard.setFieldValue('cloudflare.account-id', result.accounts[0]!.id);
|
|
270
|
+
}
|
|
271
|
+
if (result.selectedZone && !handler.onboardingWizard.getStringFieldValue('cloudflare.zone-id', '')) {
|
|
272
|
+
handler.onboardingWizard.setFieldValue('cloudflare.zone-id', result.selectedZone.id);
|
|
273
|
+
handler.onboardingWizard.setFieldValue('cloudflare.zone-name', result.selectedZone.name);
|
|
274
|
+
} else if (result.zones.length === 1 && !handler.onboardingWizard.getStringFieldValue('cloudflare.zone-id', '')) {
|
|
275
|
+
handler.onboardingWizard.setFieldValue('cloudflare.zone-id', result.zones[0]!.id);
|
|
276
|
+
handler.onboardingWizard.setFieldValue('cloudflare.zone-name', result.zones[0]!.name);
|
|
277
|
+
}
|
|
278
|
+
if (result.workerSubdomain && !handler.onboardingWizard.getStringFieldValue('cloudflare.worker-subdomain', '')) {
|
|
279
|
+
handler.onboardingWizard.setFieldValue('cloudflare.worker-subdomain', result.workerSubdomain);
|
|
280
|
+
}
|
|
281
|
+
setCloudflareWizardStatusForHandler(handler, 'Cloudflare discovery completed', formatCloudflareDiscovery(result));
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (action === 'cloudflare-validate') {
|
|
286
|
+
const result = await client.validate(buildCloudflareValidateInputForHandler(handler));
|
|
287
|
+
setCloudflareWizardStatusForHandler(
|
|
288
|
+
handler,
|
|
289
|
+
result.ok ? 'Cloudflare token validated' : 'Cloudflare token validation needs attention',
|
|
290
|
+
formatCloudflareValidation(result),
|
|
291
|
+
result.ok ? 'info' : 'warning',
|
|
292
|
+
);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (action === 'cloudflare-provision') {
|
|
297
|
+
const input = await buildCloudflareProvisionInputForHandler(handler);
|
|
298
|
+
const result = await client.provision(input);
|
|
299
|
+
setCloudflareWizardStatusForHandler(
|
|
300
|
+
handler,
|
|
301
|
+
result.ok ? 'Cloudflare provisioning completed' : 'Cloudflare provisioning needs attention',
|
|
302
|
+
formatCloudflareProvision(result),
|
|
303
|
+
result.ok ? 'info' : 'warning',
|
|
304
|
+
);
|
|
305
|
+
await handler.refreshOnboardingHydration({ preserveValues: true, targetStepId: 'cloudflare' });
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (action === 'cloudflare-verify') {
|
|
310
|
+
const result = await client.verify({
|
|
311
|
+
workerBaseUrl: handler.onboardingWizard.getStringFieldValue('cloudflare.worker-base-url', handler.onboardingWizard.runtimeSnapshot?.config.cloudflare.workerBaseUrl ?? ''),
|
|
312
|
+
workerClientTokenRef: handler.onboardingWizard.runtimeSnapshot?.config.cloudflare.workerClientTokenRef ?? '',
|
|
313
|
+
});
|
|
314
|
+
setCloudflareWizardStatusForHandler(
|
|
315
|
+
handler,
|
|
316
|
+
result.ok ? 'Cloudflare Worker verified' : 'Cloudflare Worker verification needs attention',
|
|
317
|
+
formatCloudflareVerify(result),
|
|
318
|
+
result.ok ? 'info' : 'warning',
|
|
319
|
+
);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (action === 'cloudflare-disable') {
|
|
324
|
+
const result = await client.disable({
|
|
325
|
+
accountId: handler.onboardingWizard.getStringFieldValue('cloudflare.account-id', handler.onboardingWizard.runtimeSnapshot?.config.cloudflare.accountId ?? ''),
|
|
326
|
+
apiTokenRef: getCloudflareApiTokenRefFromWizard(handler),
|
|
327
|
+
workerName: handler.onboardingWizard.getStringFieldValue('cloudflare.worker-name', handler.onboardingWizard.runtimeSnapshot?.config.cloudflare.workerName ?? 'goodvibes-batch-worker'),
|
|
328
|
+
persistConfig: true,
|
|
329
|
+
});
|
|
330
|
+
setCloudflareWizardStatusForHandler(
|
|
331
|
+
handler,
|
|
332
|
+
result.ok ? 'Cloudflare integration disabled' : 'Cloudflare disable needs attention',
|
|
333
|
+
result.steps.map((step) => `${step.status}: ${step.name}${step.message ? ` - ${step.message}` : ''}`),
|
|
334
|
+
result.ok ? 'info' : 'warning',
|
|
335
|
+
);
|
|
336
|
+
await handler.refreshOnboardingHydration({ preserveValues: true, targetStepId: 'cloudflare' });
|
|
337
|
+
}
|
|
338
|
+
} catch (error) {
|
|
339
|
+
setCloudflareWizardStatusForHandler(handler, 'Cloudflare action failed', [normalizeCloudflareActionError(error)], 'error');
|
|
340
|
+
} finally {
|
|
341
|
+
handler.onboardingApplyPending = false;
|
|
342
|
+
handler.requestRender();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export async function maybeProvisionCloudflareOnFinalApplyForHandler(handler: InputHandler): Promise<readonly OnboardingVerificationItem[]> {
|
|
347
|
+
const wizard = handler.onboardingWizard;
|
|
348
|
+
if (!shouldShowCloudflareStep(wizard)) return [];
|
|
349
|
+
const cloudflareEnabled = wizard.getBooleanFieldValue('cloudflare.enabled', wizard.isCapabilitySelected('cloudflare-batch') || wizard.runtimeSnapshot?.config.cloudflare.enabled === true);
|
|
350
|
+
if (!cloudflareEnabled) {
|
|
351
|
+
return [{
|
|
352
|
+
id: 'cloudflare:disabled',
|
|
353
|
+
status: 'pass',
|
|
354
|
+
message: 'Cloudflare integration is disabled; local daemon behavior remains active.',
|
|
355
|
+
target: 'cloudflare',
|
|
356
|
+
}];
|
|
357
|
+
}
|
|
358
|
+
const provisionOnApply = wizard.getStringFieldValue('cloudflare.provision-on-apply', 'no') === 'yes';
|
|
359
|
+
if (!provisionOnApply) {
|
|
360
|
+
return [{
|
|
361
|
+
id: 'cloudflare:configuration-saved',
|
|
362
|
+
status: 'pass',
|
|
363
|
+
message: `Cloudflare settings were saved. Batch mode is ${getCloudflareBatchMode(wizard)}; provisioning was not requested on final apply.`,
|
|
364
|
+
target: 'cloudflare',
|
|
365
|
+
}];
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
try {
|
|
369
|
+
const client = getCloudflareDaemonClientForHandler(handler);
|
|
370
|
+
const result = await client.provision(await buildCloudflareProvisionInputForHandler(handler));
|
|
371
|
+
handler.onboardingWizard.textState.set('cloudflare.action-status', [
|
|
372
|
+
result.ok ? 'Cloudflare provisioning completed during final apply.' : 'Cloudflare provisioning needs attention after final apply.',
|
|
373
|
+
...formatCloudflareProvision(result),
|
|
374
|
+
].join('\n'));
|
|
375
|
+
return [{
|
|
376
|
+
id: 'cloudflare:provision',
|
|
377
|
+
status: result.ok ? 'pass' : 'warn',
|
|
378
|
+
message: result.ok
|
|
379
|
+
? 'Cloudflare resources were provisioned and verified through the daemon SDK route.'
|
|
380
|
+
: 'Cloudflare provisioning returned warnings or failed verification. Settings were saved; rerun the Cloudflare wizard action after correcting token/resource issues.',
|
|
381
|
+
target: 'cloudflare',
|
|
382
|
+
}];
|
|
383
|
+
} catch (error) {
|
|
384
|
+
return [{
|
|
385
|
+
id: 'cloudflare:provision',
|
|
386
|
+
status: 'warn',
|
|
387
|
+
message: `Cloudflare provisioning did not complete: ${normalizeCloudflareActionError(error)} Settings were saved; retry from the Cloudflare wizard or /cloudflare command.`,
|
|
388
|
+
target: 'cloudflare',
|
|
389
|
+
}];
|
|
390
|
+
}
|
|
391
|
+
}
|