rivet-design 0.23.0 → 0.24.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/dist/agent-variants/SessionStore.d.ts +6 -0
- package/dist/agent-variants/SessionStore.d.ts.map +1 -1
- package/dist/agent-variants/SessionStore.js +21 -4
- package/dist/agent-variants/SessionStore.js.map +1 -1
- package/dist/agent-variants/WorkerExecutorService.d.ts.map +1 -1
- package/dist/agent-variants/WorkerExecutorService.js +37 -10
- package/dist/agent-variants/WorkerExecutorService.js.map +1 -1
- package/dist/agent-variants/WorktreeOrchestrator.d.ts +3 -32
- package/dist/agent-variants/WorktreeOrchestrator.d.ts.map +1 -1
- package/dist/agent-variants/WorktreeOrchestrator.js +9 -0
- package/dist/agent-variants/WorktreeOrchestrator.js.map +1 -1
- package/dist/agent-variants/contracts.d.ts +274 -272
- package/dist/agent-variants/contracts.d.ts.map +1 -1
- package/dist/agent-variants/contracts.js.map +1 -1
- package/dist/agent-variants/staticPreviewRefinements.d.ts +2 -0
- package/dist/agent-variants/staticPreviewRefinements.d.ts.map +1 -1
- package/dist/agent-variants/staticPreviewRefinements.js +3 -0
- package/dist/agent-variants/staticPreviewRefinements.js.map +1 -1
- package/dist/agent-variants/variant-start-types.d.ts +38 -0
- package/dist/agent-variants/variant-start-types.d.ts.map +1 -0
- package/dist/agent-variants/variant-start-types.js +3 -0
- package/dist/agent-variants/variant-start-types.js.map +1 -0
- package/dist/agent-variants/videoKeyframes.d.ts.map +1 -1
- package/dist/agent-variants/videoKeyframes.js +3 -2
- package/dist/agent-variants/videoKeyframes.js.map +1 -1
- package/dist/agent-variants/workItemBriefing.d.ts +1 -0
- package/dist/agent-variants/workItemBriefing.d.ts.map +1 -1
- package/dist/agent-variants/workItemBriefing.js +20 -6
- package/dist/agent-variants/workItemBriefing.js.map +1 -1
- package/dist/agent-variants/workItemInput.d.ts +172 -162
- package/dist/agent-variants/workItemInput.d.ts.map +1 -1
- package/dist/agent-variants/workItemInput.js +1 -0
- package/dist/agent-variants/workItemInput.js.map +1 -1
- package/dist/agent-variants/workerRuntime.d.ts +8 -1
- package/dist/agent-variants/workerRuntime.d.ts.map +1 -1
- package/dist/agent-variants/workerRuntime.js +59 -40
- package/dist/agent-variants/workerRuntime.js.map +1 -1
- package/dist/cli/browser.d.ts.map +1 -1
- package/dist/cli/browser.js +5 -3
- package/dist/cli/browser.js.map +1 -1
- package/dist/cli/client.d.ts.map +1 -1
- package/dist/cli/client.js +23 -3
- package/dist/cli/client.js.map +1 -1
- package/dist/cli/commands/context.d.ts.map +1 -1
- package/dist/cli/commands/context.js +10 -35
- package/dist/cli/commands/context.js.map +1 -1
- package/dist/cli/commands/contextRequest.d.ts +1 -0
- package/dist/cli/commands/contextRequest.d.ts.map +1 -1
- package/dist/cli/commands/contextRequest.js +8 -1
- package/dist/cli/commands/contextRequest.js.map +1 -1
- package/dist/cli/commands/contextVerification.d.ts +12 -0
- package/dist/cli/commands/contextVerification.d.ts.map +1 -0
- package/dist/cli/commands/contextVerification.js +48 -0
- package/dist/cli/commands/contextVerification.js.map +1 -0
- package/dist/cli/commands/guidanceReferences.d.ts +1 -1
- package/dist/cli/commands/mcpServe.d.ts +1 -3
- package/dist/cli/commands/mcpServe.d.ts.map +1 -1
- package/dist/cli/commands/mcpServe.js +21 -744
- package/dist/cli/commands/mcpServe.js.map +1 -1
- package/dist/cli/commands/open.d.ts.map +1 -1
- package/dist/cli/commands/open.js +2 -1
- package/dist/cli/commands/open.js.map +1 -1
- package/dist/cli/commands/profile.d.ts.map +1 -1
- package/dist/cli/commands/profile.js +2 -1
- package/dist/cli/commands/profile.js.map +1 -1
- package/dist/cli/commands/serve.d.ts.map +1 -1
- package/dist/cli/commands/serve.js +0 -2
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/shared.d.ts.map +1 -1
- package/dist/cli/commands/shared.js +5 -2
- package/dist/cli/commands/shared.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +4 -1
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/variants.d.ts.map +1 -1
- package/dist/cli/commands/variants.js +2 -1
- package/dist/cli/commands/variants.js.map +1 -1
- package/dist/cli/editorSession.d.ts +27 -0
- package/dist/cli/editorSession.d.ts.map +1 -0
- package/dist/cli/editorSession.js +50 -0
- package/dist/cli/editorSession.js.map +1 -0
- package/dist/cli/entry.d.ts.map +1 -1
- package/dist/cli/entry.js +2 -0
- package/dist/cli/entry.js.map +1 -1
- package/dist/cli/hostWorkNextAction.d.ts +3 -5
- package/dist/cli/hostWorkNextAction.d.ts.map +1 -1
- package/dist/cli/hostWorkNextAction.js +7 -23
- package/dist/cli/hostWorkNextAction.js.map +1 -1
- package/dist/cli/router.d.ts.map +1 -1
- package/dist/cli/router.js +4 -2
- package/dist/cli/router.js.map +1 -1
- package/dist/cli/serverHandshake.d.ts +1 -0
- package/dist/cli/serverHandshake.d.ts.map +1 -1
- package/dist/cli/serverHandshake.js.map +1 -1
- package/dist/cli/serverUnavailable.d.ts +1 -1
- package/dist/cli/serverUnavailable.d.ts.map +1 -1
- package/dist/cli/serverUnavailable.js +1 -0
- package/dist/cli/serverUnavailable.js.map +1 -1
- package/dist/config/flags.d.ts +3 -0
- package/dist/config/flags.d.ts.map +1 -1
- package/dist/config/flags.js +1 -0
- package/dist/config/flags.js.map +1 -1
- package/dist/config/pluginMetrics.d.ts +2 -0
- package/dist/config/pluginMetrics.d.ts.map +1 -0
- package/dist/config/pluginMetrics.js +234 -0
- package/dist/config/pluginMetrics.js.map +1 -0
- package/dist/config/proxy.d.ts +0 -2
- package/dist/config/proxy.d.ts.map +1 -1
- package/dist/config/proxy.js +1 -10
- package/dist/config/proxy.js.map +1 -1
- package/dist/config/telemetryPolicy.d.ts +8 -0
- package/dist/config/telemetryPolicy.d.ts.map +1 -0
- package/dist/config/telemetryPolicy.js +25 -0
- package/dist/config/telemetryPolicy.js.map +1 -0
- package/dist/index-core.d.ts +0 -1
- package/dist/index-core.d.ts.map +1 -1
- package/dist/index-core.js +1 -3
- package/dist/index-core.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -15
- package/dist/index.js.map +1 -1
- package/dist/install/allowlists.d.ts.map +1 -1
- package/dist/install/allowlists.js +6 -1
- package/dist/install/allowlists.js.map +1 -1
- package/dist/install/automaticCliUpdate.d.ts.map +1 -1
- package/dist/install/automaticCliUpdate.js +9 -2
- package/dist/install/automaticCliUpdate.js.map +1 -1
- package/dist/install/channelCli.d.ts.map +1 -1
- package/dist/install/channelCli.js +2 -1
- package/dist/install/channelCli.js.map +1 -1
- package/dist/install/channelManager.d.ts.map +1 -1
- package/dist/install/channelManager.js +11 -6
- package/dist/install/channelManager.js.map +1 -1
- package/dist/install/globalBootstrap.d.ts.map +1 -1
- package/dist/install/globalBootstrap.js +5 -1
- package/dist/install/globalBootstrap.js.map +1 -1
- package/dist/install/harnesses.js +1 -1
- package/dist/install/mcpRegistration.d.ts.map +1 -1
- package/dist/install/mcpRegistration.js +7 -4
- package/dist/install/mcpRegistration.js.map +1 -1
- package/dist/library/HubClient.d.ts.map +1 -1
- package/dist/library/HubClient.js +25 -5
- package/dist/library/HubClient.js.map +1 -1
- package/dist/mcp/designContextTools.d.ts +3 -0
- package/dist/mcp/designContextTools.d.ts.map +1 -0
- package/dist/mcp/designContextTools.js +44 -0
- package/dist/mcp/designContextTools.js.map +1 -0
- package/dist/mcp/explorationSchema.d.ts +56 -0
- package/dist/mcp/explorationSchema.d.ts.map +1 -0
- package/dist/mcp/explorationSchema.js +123 -0
- package/dist/mcp/explorationSchema.js.map +1 -0
- package/dist/mcp/explorationTools.d.ts +3 -0
- package/dist/mcp/explorationTools.d.ts.map +1 -0
- package/dist/mcp/explorationTools.js +117 -0
- package/dist/mcp/explorationTools.js.map +1 -0
- package/dist/mcp/getExploration.d.ts +13 -0
- package/dist/mcp/getExploration.d.ts.map +1 -0
- package/dist/mcp/getExploration.js +130 -0
- package/dist/mcp/getExploration.js.map +1 -0
- package/dist/mcp/intentTool.d.ts +60 -0
- package/dist/mcp/intentTool.d.ts.map +1 -0
- package/dist/mcp/intentTool.js +57 -0
- package/dist/mcp/intentTool.js.map +1 -0
- package/dist/mcp/preferenceTools.d.ts +3 -0
- package/dist/mcp/preferenceTools.d.ts.map +1 -0
- package/dist/mcp/preferenceTools.js +164 -0
- package/dist/mcp/preferenceTools.js.map +1 -0
- package/dist/mcp/profileAccess.d.ts +4 -0
- package/dist/mcp/profileAccess.d.ts.map +1 -0
- package/dist/mcp/profileAccess.js +31 -0
- package/dist/mcp/profileAccess.js.map +1 -0
- package/dist/mcp/referenceTools.d.ts +3 -0
- package/dist/mcp/referenceTools.d.ts.map +1 -0
- package/dist/mcp/referenceTools.js +128 -0
- package/dist/mcp/referenceTools.js.map +1 -0
- package/dist/prototype-host.js +37 -2
- package/dist/prototype-host.js.map +1 -1
- package/dist/routes/agentVariants.d.ts.map +1 -1
- package/dist/routes/agentVariants.js +10 -36
- package/dist/routes/agentVariants.js.map +1 -1
- package/dist/routes/editorAccess.d.ts +3 -0
- package/dist/routes/editorAccess.d.ts.map +1 -0
- package/dist/routes/editorAccess.js +33 -0
- package/dist/routes/editorAccess.js.map +1 -0
- package/dist/routes/library/app.d.ts.map +1 -1
- package/dist/routes/library/app.js +2 -0
- package/dist/routes/library/app.js.map +1 -1
- package/dist/routes/library/index.d.ts.map +1 -1
- package/dist/routes/library/index.js +2 -0
- package/dist/routes/library/index.js.map +1 -1
- package/dist/routes/shareAvailability.d.ts +8 -0
- package/dist/routes/shareAvailability.d.ts.map +1 -0
- package/dist/routes/shareAvailability.js +25 -0
- package/dist/routes/shareAvailability.js.map +1 -0
- package/dist/routes/telemetry.d.ts +4 -0
- package/dist/routes/telemetry.d.ts.map +1 -0
- package/dist/routes/telemetry.js +60 -0
- package/dist/routes/telemetry.js.map +1 -0
- package/dist/routes/variantRequestSchema.d.ts +33 -4
- package/dist/routes/variantRequestSchema.d.ts.map +1 -1
- package/dist/routes/variantRequestSchema.js +13 -1
- package/dist/routes/variantRequestSchema.js.map +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +230 -131
- package/dist/server.js.map +1 -1
- package/dist/services/AuthService.d.ts +2 -2
- package/dist/services/CliLogForwarder.js +2 -1
- package/dist/services/CliLogForwarder.js.map +1 -1
- package/dist/services/ConfigManager.d.ts +7 -0
- package/dist/services/ConfigManager.d.ts.map +1 -1
- package/dist/services/ConfigManager.js +31 -24
- package/dist/services/ConfigManager.js.map +1 -1
- package/dist/services/DependencyPreparationService.d.ts.map +1 -1
- package/dist/services/DependencyPreparationService.js +2 -1
- package/dist/services/DependencyPreparationService.js.map +1 -1
- package/dist/services/FeatureFlagService.d.ts.map +1 -1
- package/dist/services/FeatureFlagService.js +13 -2
- package/dist/services/FeatureFlagService.js.map +1 -1
- package/dist/services/GuidanceVerifierRunner.d.ts +0 -1
- package/dist/services/GuidanceVerifierRunner.d.ts.map +1 -1
- package/dist/services/GuidanceVerifierRunner.js +11 -22
- package/dist/services/GuidanceVerifierRunner.js.map +1 -1
- package/dist/services/IntegrationsClient.d.ts +3 -3
- package/dist/services/OperatingSystemServices.d.ts +1 -0
- package/dist/services/OperatingSystemServices.d.ts.map +1 -1
- package/dist/services/OperatingSystemServices.js +3 -2
- package/dist/services/OperatingSystemServices.js.map +1 -1
- package/dist/services/ProjectDetectionService.d.ts.map +1 -1
- package/dist/services/ProjectDetectionService.js +6 -4
- package/dist/services/ProjectDetectionService.js.map +1 -1
- package/dist/services/ProjectFolderPicker.d.ts.map +1 -1
- package/dist/services/ProjectFolderPicker.js +2 -0
- package/dist/services/ProjectFolderPicker.js.map +1 -1
- package/dist/services/ProjectLibrary.d.ts +2 -0
- package/dist/services/ProjectLibrary.d.ts.map +1 -1
- package/dist/services/ProjectLibrary.js +16 -6
- package/dist/services/ProjectLibrary.js.map +1 -1
- package/dist/services/ProjectRegistry.d.ts +3 -2
- package/dist/services/ProjectRegistry.d.ts.map +1 -1
- package/dist/services/ProjectRegistry.js +4 -0
- package/dist/services/ProjectRegistry.js.map +1 -1
- package/dist/services/PrototypeBuildService.d.ts.map +1 -1
- package/dist/services/PrototypeBuildService.js +2 -1
- package/dist/services/PrototypeBuildService.js.map +1 -1
- package/dist/services/StaticPreviewServer.d.ts.map +1 -1
- package/dist/services/StaticPreviewServer.js +2 -1
- package/dist/services/StaticPreviewServer.js.map +1 -1
- package/dist/services/TelemetryService.d.ts +3 -1
- package/dist/services/TelemetryService.d.ts.map +1 -1
- package/dist/services/TelemetryService.js +60 -21
- package/dist/services/TelemetryService.js.map +1 -1
- package/dist/services/TreeStore.d.ts.map +1 -1
- package/dist/services/TreeStore.js +7 -2
- package/dist/services/TreeStore.js.map +1 -1
- package/dist/services/VariantGenerationService.d.ts.map +1 -1
- package/dist/services/VariantGenerationService.js +6 -7
- package/dist/services/VariantGenerationService.js.map +1 -1
- package/dist/services/VariantRunService.d.ts.map +1 -1
- package/dist/services/VariantRunService.js +10 -6
- package/dist/services/VariantRunService.js.map +1 -1
- package/dist/services/WorktreeManager.d.ts.map +1 -1
- package/dist/services/WorktreeManager.js +9 -1
- package/dist/services/WorktreeManager.js.map +1 -1
- package/dist/services/packageManagerProcess.d.ts.map +1 -1
- package/dist/services/packageManagerProcess.js +3 -0
- package/dist/services/packageManagerProcess.js.map +1 -1
- package/dist/services/profiles/DesignProfiles.d.ts +278 -58
- package/dist/services/profiles/DesignProfiles.d.ts.map +1 -1
- package/dist/services/profiles/DesignProfiles.js +346 -91
- package/dist/services/profiles/DesignProfiles.js.map +1 -1
- package/dist/services/profiles/MemoryRuntime.d.ts.map +1 -1
- package/dist/services/profiles/MemoryRuntime.js +4 -6
- package/dist/services/profiles/MemoryRuntime.js.map +1 -1
- package/dist/services/profiles/ProfileAgent.d.ts.map +1 -1
- package/dist/services/profiles/ProfileAgent.js +4 -3
- package/dist/services/profiles/ProfileAgent.js.map +1 -1
- package/dist/services/profiles/ProfileImports.d.ts +2 -2
- package/dist/services/profiles/ProfilePlanning.d.ts +3 -3
- package/dist/services/profiles/ProfilePreparation.d.ts.map +1 -1
- package/dist/services/profiles/ProfilePreparation.js +1 -0
- package/dist/services/profiles/ProfilePreparation.js.map +1 -1
- package/dist/services/profiles/ProfileVariants.d.ts +1 -1
- package/dist/services/profiles/ProfileVariants.d.ts.map +1 -1
- package/dist/services/profiles/ProfileVariants.js +1 -1
- package/dist/services/profiles/ProfileVariants.js.map +1 -1
- package/dist/services/profiles/ReferenceReader.d.ts +3 -3
- package/dist/services/profiles/profileContext.d.ts +1 -1
- package/dist/services/stopRuntimeProcess.d.ts.map +1 -1
- package/dist/services/stopRuntimeProcess.js +2 -0
- package/dist/services/stopRuntimeProcess.js.map +1 -1
- package/dist/storage/library/BundleMetadataStore.d.ts +1 -0
- package/dist/storage/library/BundleMetadataStore.d.ts.map +1 -1
- package/dist/storage/library/BundleMetadataStore.js +17 -0
- package/dist/storage/library/BundleMetadataStore.js.map +1 -1
- package/dist/storage/library/ProjectPreviewCache.d.ts +2 -2
- package/dist/storage/library/ProjectRecords.d.ts +1 -0
- package/dist/storage/library/ProjectRecords.d.ts.map +1 -1
- package/dist/storage/library/ProjectRecords.js +7 -0
- package/dist/storage/library/ProjectRecords.js.map +1 -1
- package/dist/storage/library/database.d.ts +4 -0
- package/dist/storage/library/database.d.ts.map +1 -1
- package/dist/storage/library/database.js +18 -1
- package/dist/storage/library/database.js.map +1 -1
- package/dist/storage/profiles/ProfilePlans.d.ts +16 -15
- package/dist/storage/profiles/ProfilePlans.d.ts.map +1 -1
- package/dist/storage/profiles/ProfilePlans.js +5 -2
- package/dist/storage/profiles/ProfilePlans.js.map +1 -1
- package/dist/storage/profiles/ProfileRecords.d.ts +44 -13
- package/dist/storage/profiles/ProfileRecords.d.ts.map +1 -1
- package/dist/storage/profiles/ProfileRecords.js +59 -4
- package/dist/storage/profiles/ProfileRecords.js.map +1 -1
- package/dist/storage/profiles/planSchema.d.ts +4 -4
- package/dist/storage/profiles/schema.d.ts +8 -8
- package/dist/types/cosmos.d.ts +10 -10
- package/dist/types/design-profile.d.ts +38 -38
- package/dist/types/guidance-references.d.ts +14 -14
- package/dist/types/guidance.d.ts +112 -112
- package/dist/types/reference-connectors.d.ts +2 -2
- package/dist/types/reference-onboarding.d.ts +55 -55
- package/dist/types/reference-pages.d.ts +14 -14
- package/dist/types/variant-reference.d.ts +4 -4
- package/dist/types/x-bookmarks.d.ts +16 -16
- package/dist/utils/cloneOrCopyDirSync.d.ts.map +1 -1
- package/dist/utils/cloneOrCopyDirSync.js +2 -0
- package/dist/utils/cloneOrCopyDirSync.js.map +1 -1
- package/dist/utils/editorAccess.d.ts +8 -0
- package/dist/utils/editorAccess.d.ts.map +1 -0
- package/dist/utils/editorAccess.js +23 -0
- package/dist/utils/editorAccess.js.map +1 -0
- package/dist/utils/hostedLogPrivacy.d.ts +2 -0
- package/dist/utils/hostedLogPrivacy.d.ts.map +1 -0
- package/dist/utils/hostedLogPrivacy.js +29 -0
- package/dist/utils/hostedLogPrivacy.js.map +1 -0
- package/dist/utils/hostedLogging.d.ts +2 -0
- package/dist/utils/hostedLogging.d.ts.map +1 -0
- package/dist/utils/hostedLogging.js +18 -0
- package/dist/utils/hostedLogging.js.map +1 -0
- package/dist/utils/loginShellPath.d.ts.map +1 -1
- package/dist/utils/loginShellPath.js +2 -0
- package/dist/utils/loginShellPath.js.map +1 -1
- package/dist/utils/skills/claude-skill.d.ts +1 -1
- package/dist/utils/skills/claude-skill.js +1 -1
- package/dist/utils/skills/cli-guidance.d.ts +1 -1
- package/dist/utils/skills/cli-guidance.d.ts.map +1 -1
- package/dist/utils/skills/cli-guidance.js +56 -27
- package/dist/utils/skills/cli-guidance.js.map +1 -1
- package/dist/utils/skills/codex-skill.d.ts +1 -1
- package/dist/utils/skills/codex-skill.d.ts.map +1 -1
- package/dist/utils/skills/codex-skill.js +6 -2
- package/dist/utils/skills/codex-skill.js.map +1 -1
- package/dist/utils/skills/cursor-rules.d.ts +1 -1
- package/dist/utils/skills/cursor-rules.js +1 -1
- package/dist/utils/subprocessEnvironment.d.ts +6 -0
- package/dist/utils/subprocessEnvironment.d.ts.map +1 -0
- package/dist/utils/subprocessEnvironment.js +214 -0
- package/dist/utils/subprocessEnvironment.js.map +1 -0
- package/package.json +8 -3
- package/src/ui/dist/assets/{LibraryEntry-B9ZkJUtN.js → LibraryEntry-DS6EDW1V.js} +2 -2
- package/src/ui/dist/assets/main-CdH16hGP.js +435 -0
- package/src/ui/dist/index.html +1 -1
- package/dist/prompts/gitPrompts.d.ts +0 -4
- package/dist/prompts/gitPrompts.d.ts.map +0 -1
- package/dist/prompts/gitPrompts.js +0 -61
- package/dist/prompts/gitPrompts.js.map +0 -1
- package/dist/routes/git.d.ts +0 -6
- package/dist/routes/git.d.ts.map +0 -1
- package/dist/routes/git.js +0 -266
- package/dist/routes/git.js.map +0 -1
- package/dist/services/CommitMessageGenerator.d.ts +0 -11
- package/dist/services/CommitMessageGenerator.d.ts.map +0 -1
- package/dist/services/CommitMessageGenerator.js +0 -45
- package/dist/services/CommitMessageGenerator.js.map +0 -1
- package/dist/services/GatewayClient.d.ts +0 -44
- package/dist/services/GatewayClient.d.ts.map +0 -1
- package/dist/services/GatewayClient.js +0 -204
- package/dist/services/GatewayClient.js.map +0 -1
- package/dist/services/LocalGitService.d.ts +0 -64
- package/dist/services/LocalGitService.d.ts.map +0 -1
- package/dist/services/LocalGitService.js +0 -602
- package/dist/services/LocalGitService.js.map +0 -1
- package/dist/services/PRTitleGenerator.d.ts +0 -15
- package/dist/services/PRTitleGenerator.d.ts.map +0 -1
- package/dist/services/PRTitleGenerator.js +0 -98
- package/dist/services/PRTitleGenerator.js.map +0 -1
- package/dist/services/SessionService.d.ts +0 -41
- package/dist/services/SessionService.d.ts.map +0 -1
- package/dist/services/SessionService.js +0 -200
- package/dist/services/SessionService.js.map +0 -1
- package/dist/utils/branchNames.d.ts +0 -2
- package/dist/utils/branchNames.d.ts.map +0 -1
- package/dist/utils/branchNames.js +0 -92
- package/dist/utils/branchNames.js.map +0 -1
- package/dist/utils/hostAgentEnv.d.ts +0 -2
- package/dist/utils/hostAgentEnv.d.ts.map +0 -1
- package/dist/utils/hostAgentEnv.js +0 -15
- package/dist/utils/hostAgentEnv.js.map +0 -1
- package/src/ui/dist/assets/main-Dls3YqrM.js +0 -435
package/dist/server.js
CHANGED
|
@@ -37,11 +37,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.startServer = exports.runServerShutdownTasks = exports.isRivetCorsOriginAllowed = exports.isRivetUiStaticAssetPath = exports.isEmbeddedAgentUiHost = exports.resolveEmbeddedAgentUiOrigin = exports.resolveRivetListenHost = exports.sendInactiveVariantsEventStream = exports.readRivetUiIndexHtml = exports.injectRivetUiBootstrap = exports.DIST_UI_PATH = exports.RIVET_CORS_ALLOWED_HEADERS = exports.INACTIVE_VARIANTS_EVENT_HEARTBEAT_MS = void 0;
|
|
40
|
+
const editorSession_1 = require("./cli/editorSession");
|
|
41
|
+
const editorAccess_1 = require("./routes/editorAccess");
|
|
42
|
+
const editorAccess_2 = require("./utils/editorAccess");
|
|
40
43
|
const RuntimeAdmission_1 = require("./services/RuntimeAdmission");
|
|
41
44
|
const account_1 = require("./routes/account");
|
|
42
45
|
const installRef_1 = require("./routes/installRef");
|
|
43
46
|
const installationChannel_1 = require("./install/installationChannel");
|
|
44
47
|
const Sentry = __importStar(require("@sentry/node"));
|
|
48
|
+
const telemetryPolicy_1 = require("./config/telemetryPolicy");
|
|
49
|
+
const telemetry_1 = require("./routes/telemetry");
|
|
45
50
|
const express_1 = __importDefault(require("express"));
|
|
46
51
|
const cors_1 = __importDefault(require("cors"));
|
|
47
52
|
const crypto_1 = require("crypto");
|
|
@@ -53,7 +58,6 @@ const _1 = require(".");
|
|
|
53
58
|
const integrations_1 = require("./routes/integrations");
|
|
54
59
|
const referenceProfiles_1 = require("./routes/referenceProfiles");
|
|
55
60
|
const WorktreeManager_1 = require("./services/WorktreeManager");
|
|
56
|
-
const git_1 = require("./routes/git");
|
|
57
61
|
const support_1 = require("./routes/support");
|
|
58
62
|
const proxy_config_1 = require("./proxy-middleware/proxy-config");
|
|
59
63
|
const StaticFileService_1 = require("./services/StaticFileService");
|
|
@@ -67,7 +71,7 @@ const cli_1 = require("./routes/cli");
|
|
|
67
71
|
const agentVariants_1 = require("./routes/agentVariants");
|
|
68
72
|
const inlineStartTracker_1 = require("./routes/inlineStartTracker");
|
|
69
73
|
const serverHandshake_1 = require("./cli/serverHandshake");
|
|
70
|
-
const
|
|
74
|
+
const telemetry_2 = require("./config/telemetry");
|
|
71
75
|
const HistoryReplayService_1 = require("./services/HistoryReplayService");
|
|
72
76
|
const VariantHistoryService_1 = require("./services/VariantHistoryService");
|
|
73
77
|
const RequestAuthContext_1 = require("./services/RequestAuthContext");
|
|
@@ -81,12 +85,13 @@ const RIVET_UI_INDEX_FILENAME = 'index.html';
|
|
|
81
85
|
const EMBEDDED_AGENT_LISTEN_HOST = '127.0.0.1';
|
|
82
86
|
const EMBEDDED_AGENT_PREVIEW_HOST = 'localhost';
|
|
83
87
|
const OPAQUE_PREVIEW_ORIGIN = 'null';
|
|
84
|
-
const PREVIEW_PORT_ALLOWED_API_RE = /^\/api\/variants\/(?:[^/]+\/static\/|history\/[^/]+\/[^/]+\/preview)/;
|
|
88
|
+
const PREVIEW_PORT_ALLOWED_API_RE = /^\/api\/variants\/(?:[^/]+\/static\/|history\/[^/]+\/[^/]+\/(?:preview|site\/))/;
|
|
85
89
|
exports.INACTIVE_VARIANTS_EVENT_HEARTBEAT_MS = 30_000;
|
|
86
90
|
exports.RIVET_CORS_ALLOWED_HEADERS = [
|
|
87
91
|
'Content-Type',
|
|
88
92
|
'Authorization',
|
|
89
93
|
'x-rivet-queue-token',
|
|
94
|
+
editorAccess_2.EDITOR_ACCESS_TOKEN_HEADER,
|
|
90
95
|
];
|
|
91
96
|
const resolveUiPath = () => {
|
|
92
97
|
const bundledPath = path_1.default.join(__dirname, 'ui/dist');
|
|
@@ -136,7 +141,7 @@ const sendInactiveVariantsEventStream = (req, res) => {
|
|
|
136
141
|
});
|
|
137
142
|
};
|
|
138
143
|
exports.sendInactiveVariantsEventStream = sendInactiveVariantsEventStream;
|
|
139
|
-
const resolveRivetListenHost = (
|
|
144
|
+
const resolveRivetListenHost = (_agentApplyMode) => EMBEDDED_AGENT_LISTEN_HOST;
|
|
140
145
|
exports.resolveRivetListenHost = resolveRivetListenHost;
|
|
141
146
|
const resolveEmbeddedAgentUiOrigin = (port) => `http://${EMBEDDED_AGENT_LISTEN_HOST}:${port}`;
|
|
142
147
|
exports.resolveEmbeddedAgentUiOrigin = resolveEmbeddedAgentUiOrigin;
|
|
@@ -198,17 +203,17 @@ exports.runServerShutdownTasks = runServerShutdownTasks;
|
|
|
198
203
|
const startServer = async (options) => {
|
|
199
204
|
const { userPort, userHost, telemetry, projectPath, framework, staticEntry, sessionBridge, mcpEditor, skipProcessHandlers, } = options;
|
|
200
205
|
const agentApplyMode = options.agentApplyMode;
|
|
201
|
-
const
|
|
206
|
+
const editorAccessToken = (0, editorSession_1.createEditorAccessToken)();
|
|
207
|
+
const startedAt = new Date().toISOString();
|
|
202
208
|
const userPortWithFallback = userPort ?? _1.DEFAULT_USER_PORT;
|
|
203
209
|
const userHostWithFallback = userHost ?? 'localhost';
|
|
204
210
|
const hasUserDevServer = typeof userPort === 'number' && Number.isInteger(userPort) && userPort > 0;
|
|
205
|
-
const isGitEnabled = options.isGitEnabled ?? true;
|
|
206
211
|
const queueAccessToken = sessionBridge && agentApplyMode === 'embedded'
|
|
207
212
|
? (0, crypto_1.randomBytes)(QUEUE_ACCESS_TOKEN_BYTES).toString('base64url')
|
|
208
213
|
: null;
|
|
209
214
|
const variantsOrchestrator = options.variantsRuntime?.orchestrator ?? options.agentVariantsOrchestrator;
|
|
210
215
|
const inlineStartTracker = (0, inlineStartTracker_1.createInlineStartTracker)();
|
|
211
|
-
const runtimeAdmission = new RuntimeAdmission_1.RuntimeAdmission(
|
|
216
|
+
const runtimeAdmission = new RuntimeAdmission_1.RuntimeAdmission(telemetry_2.RIVET_VERSION);
|
|
212
217
|
const variantsBridge = options.variantsRuntime?.bridge ?? sessionBridge;
|
|
213
218
|
const variantRunService = options.variantsRuntime?.runService ?? options.variantRunService;
|
|
214
219
|
const variantHistory = variantsOrchestrator
|
|
@@ -223,67 +228,41 @@ const startServer = async (options) => {
|
|
|
223
228
|
: undefined,
|
|
224
229
|
})
|
|
225
230
|
: null;
|
|
226
|
-
if (process.env.SENTRY_DSN) {
|
|
231
|
+
if (process.env.SENTRY_DSN && (0, telemetryPolicy_1.getTelemetryMode)() === 'full') {
|
|
227
232
|
Sentry.init({
|
|
228
233
|
dsn: process.env.SENTRY_DSN,
|
|
229
234
|
environment: process.env.NODE_ENV ?? 'development',
|
|
230
235
|
});
|
|
231
236
|
}
|
|
232
|
-
const sessionService = new index_core_1.SessionService(projectPath, isGitEnabled, 'main', {
|
|
233
|
-
isGatewayLlmEnabled,
|
|
234
|
-
});
|
|
235
|
-
try {
|
|
236
|
-
await sessionService.initializeSession();
|
|
237
|
-
log.info('Git session initialized successfully');
|
|
238
|
-
}
|
|
239
|
-
catch (error) {
|
|
240
|
-
log.warn('Failed to initialize git session, continuing without git tracking:', error);
|
|
241
|
-
}
|
|
242
237
|
let staticService = null;
|
|
243
238
|
if (framework === 'static') {
|
|
244
239
|
const entryPoint = staticEntry || 'index.html';
|
|
245
240
|
staticService = new StaticFileService_1.StaticFileService(projectPath, entryPoint);
|
|
246
241
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
(0, WorktreeManager_1.cleanupOrphanedWorktrees)();
|
|
251
|
-
const results = await Promise.allSettled([
|
|
252
|
-
options.beforeShutdown?.(),
|
|
253
|
-
telemetry?.shutdown(),
|
|
254
|
-
(0, FeatureFlagService_1.getFeatureFlagService)().shutdown(),
|
|
255
|
-
]);
|
|
256
|
-
const labels = ['shutdown hook', 'telemetry', 'feature flags'];
|
|
257
|
-
for (let i = 0; i < results.length; i++) {
|
|
258
|
-
if (results[i].status === 'rejected') {
|
|
259
|
-
log.error(`Failed to cleanup ${labels[i]}:`, results[i].reason);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
(0, serverHandshake_1.removeHandshake)(projectPath, process.pid);
|
|
263
|
-
process.exit(code);
|
|
264
|
-
};
|
|
265
|
-
process.on('SIGINT', () => shutdownAndExit(0));
|
|
266
|
-
process.on('SIGTERM', () => shutdownAndExit(0));
|
|
267
|
-
process.on('uncaughtException', (err) => {
|
|
268
|
-
log.error('Uncaught exception:', err);
|
|
269
|
-
telemetry?.captureException(err, 'uncaught_exception');
|
|
270
|
-
shutdownAndExit(1);
|
|
271
|
-
});
|
|
272
|
-
process.on('unhandledRejection', (reason) => {
|
|
273
|
-
log.error('Unhandled rejection:', reason);
|
|
274
|
-
telemetry?.captureException(reason, 'unhandled_rejection');
|
|
275
|
-
shutdownAndExit(1);
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
const listenPort = options.rivetPort ?? _1.DEFAULT_PORT;
|
|
279
|
-
const previewPort = agentApplyMode === 'embedded' ? options.previewPort : undefined;
|
|
280
|
-
const previewOrigin = previewPort !== undefined
|
|
242
|
+
let listenPort = options.rivetPort ?? _1.DEFAULT_PORT;
|
|
243
|
+
const previewPort = options.previewPort;
|
|
244
|
+
let previewOrigin = previewPort !== undefined
|
|
281
245
|
? `http://${EMBEDDED_AGENT_LISTEN_HOST}:${previewPort}`
|
|
282
|
-
:
|
|
246
|
+
: `http://${EMBEDDED_AGENT_PREVIEW_HOST}:${listenPort}`;
|
|
247
|
+
let userDevProxy = null;
|
|
283
248
|
const app = (0, express_1.default)();
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
249
|
+
const requireEditorAccess = (0, editorAccess_1.authenticateEditor)(editorAccessToken);
|
|
250
|
+
app.use(editorAccess_2.EDITOR_ACCOUNT_PATHS, requireEditorAccess);
|
|
251
|
+
const editorHost = () => `${EMBEDDED_AGENT_LISTEN_HOST}:${listenPort}`;
|
|
252
|
+
const isPreviewRequest = (req) => req.headers.host === new URL(previewOrigin).host &&
|
|
253
|
+
(previewPort === undefined || req.socket.localPort === previewPort);
|
|
254
|
+
app.use((req, res, next) => {
|
|
255
|
+
const requestHost = req.headers.host;
|
|
256
|
+
const isEditorRequest = requestHost === editorHost() && req.socket.localPort === listenPort;
|
|
257
|
+
if (!isEditorRequest && !isPreviewRequest(req)) {
|
|
258
|
+
res.sendStatus(403);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
next();
|
|
262
|
+
});
|
|
263
|
+
const corsOrigins = new Set([
|
|
264
|
+
(0, exports.resolveEmbeddedAgentUiOrigin)(listenPort),
|
|
265
|
+
]);
|
|
287
266
|
const rawCorsOrigins = process.env.RIVET_CORS_ORIGINS;
|
|
288
267
|
if (rawCorsOrigins) {
|
|
289
268
|
rawCorsOrigins
|
|
@@ -308,22 +287,41 @@ const startServer = async (options) => {
|
|
|
308
287
|
allowedHeaders: exports.RIVET_CORS_ALLOWED_HEADERS,
|
|
309
288
|
})(req, res, next);
|
|
310
289
|
});
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
290
|
+
app.use((req, res, next) => {
|
|
291
|
+
if (!isPreviewRequest(req)) {
|
|
292
|
+
next();
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (req.headers[editorAccess_2.EDITOR_ACCESS_TOKEN_HEADER]) {
|
|
296
|
+
res.sendStatus(403);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const isAppApi = req.path.toLowerCase().startsWith('/api/') &&
|
|
300
|
+
!PREVIEW_PORT_ALLOWED_API_RE.test(req.path.toLowerCase());
|
|
301
|
+
const isEditorUi = req.path.toLowerCase() === '/rivet' ||
|
|
302
|
+
req.path.toLowerCase().startsWith('/rivet/');
|
|
303
|
+
if (isEditorUi || /^\/api\/git(?:\/|$)/i.test(req.path)) {
|
|
304
|
+
res.status(404).end();
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (isAppApi) {
|
|
308
|
+
if (userDevProxy) {
|
|
309
|
+
userDevProxy.middleware(req, res, (error) => {
|
|
310
|
+
if (error) {
|
|
311
|
+
next(error);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
res.sendStatus(404);
|
|
315
|
+
});
|
|
316
316
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
const isEditorUi = req.path === '/rivet' || req.path.startsWith('/rivet/');
|
|
320
|
-
if (isBlockedApi || isEditorUi) {
|
|
321
|
-
res.status(404).end();
|
|
322
|
-
return;
|
|
317
|
+
else {
|
|
318
|
+
res.sendStatus(404);
|
|
323
319
|
}
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
next();
|
|
323
|
+
});
|
|
324
|
+
app.use('/api/telemetry', (0, telemetry_1.createTelemetryRouter)(telemetry));
|
|
327
325
|
const jsonBodyParser = express_1.default.json({ limit: '50mb' });
|
|
328
326
|
app.use(jsonBodyParser);
|
|
329
327
|
app.use((req, res, next) => {
|
|
@@ -344,21 +342,27 @@ const startServer = async (options) => {
|
|
|
344
342
|
},
|
|
345
343
|
};
|
|
346
344
|
const sendRivetUiIndex = (req, res) => {
|
|
347
|
-
if (!(0, exports.isEmbeddedAgentUiHost)(req.hostname,
|
|
345
|
+
if (!(0, exports.isEmbeddedAgentUiHost)(req.hostname, 'embedded')) {
|
|
348
346
|
res.redirect(302, `${(0, exports.resolveEmbeddedAgentUiOrigin)(listenPort)}${req.originalUrl}`);
|
|
349
347
|
return;
|
|
350
348
|
}
|
|
351
349
|
setNoStoreHeaders(res);
|
|
350
|
+
const libraryOrigin = options.resolveLibraryOrigin?.();
|
|
351
|
+
res.setHeader('Content-Security-Policy', `frame-ancestors 'self'${libraryOrigin ? ` ${new URL(libraryOrigin).origin}` : ''}`);
|
|
352
352
|
res.type('html').send((0, exports.injectRivetUiBootstrap)((0, exports.readRivetUiIndexHtml)(), {
|
|
353
353
|
agentApplyMode: agentApplyMode ?? null,
|
|
354
354
|
queueAccessToken,
|
|
355
355
|
previewOrigin,
|
|
356
356
|
}));
|
|
357
357
|
};
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
358
|
+
const serveEditorAssets = (directory) => {
|
|
359
|
+
const serve = express_1.default.static(directory, uiStaticOptions);
|
|
360
|
+
return (req, res, next) => isPreviewRequest(req) ? next() : serve(req, res, next);
|
|
361
|
+
};
|
|
362
|
+
app.use('/assets', serveEditorAssets(path_1.default.join(exports.DIST_UI_PATH, 'assets')));
|
|
363
|
+
app.use('/rivet/assets', serveEditorAssets(path_1.default.join(exports.DIST_UI_PATH, 'assets')));
|
|
364
|
+
app.use('/fonts', serveEditorAssets(path_1.default.join(exports.DIST_UI_PATH, 'fonts')));
|
|
365
|
+
app.use('/rivet/fonts', serveEditorAssets(path_1.default.join(exports.DIST_UI_PATH, 'fonts')));
|
|
362
366
|
app.get('/favicon.ico', (_req, res) => {
|
|
363
367
|
res.sendFile('favicon.ico', { root: exports.DIST_UI_PATH });
|
|
364
368
|
});
|
|
@@ -374,7 +378,11 @@ const startServer = async (options) => {
|
|
|
374
378
|
});
|
|
375
379
|
log.info(`Serving UI assets from: ${exports.DIST_UI_PATH}`);
|
|
376
380
|
if (framework === 'static' && !hasUserDevServer) {
|
|
377
|
-
app.get('/', (req, res) => {
|
|
381
|
+
app.get('/', (req, res, next) => {
|
|
382
|
+
if (isPreviewRequest(req)) {
|
|
383
|
+
next();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
378
386
|
log.debug(`${framework} mode - serving Rivet at root`);
|
|
379
387
|
sendRivetUiIndex(req, res);
|
|
380
388
|
});
|
|
@@ -413,20 +421,28 @@ const startServer = async (options) => {
|
|
|
413
421
|
app.use('/api', (0, integrations_1.createIntegrationsRouter)());
|
|
414
422
|
app.use('/api', (0, referenceProfiles_1.createReferenceProfilesRouter)());
|
|
415
423
|
void (0, WorktreeManager_1.pruneWorktrees)(projectPath);
|
|
416
|
-
|
|
417
|
-
log.info('Git routes disabled for this server instance');
|
|
418
|
-
}
|
|
419
|
-
app.use('/api', (0, git_1.createGitRouter)(sessionService, projectPath, {
|
|
420
|
-
isGitEnabled,
|
|
421
|
-
isGatewayLlmEnabled,
|
|
422
|
-
}));
|
|
424
|
+
app.use('/api/git', (_req, res) => res.sendStatus(404));
|
|
423
425
|
app.use('/api', (0, support_1.createSupportRouter)(telemetry));
|
|
426
|
+
app.use((req, res, next) => {
|
|
427
|
+
const isPreviewPath = req.path.toLowerCase().startsWith('/static') ||
|
|
428
|
+
req.path.toLowerCase().startsWith('/__rivet/preview/') ||
|
|
429
|
+
PREVIEW_PORT_ALLOWED_API_RE.test(req.path.toLowerCase());
|
|
430
|
+
if (!isPreviewRequest(req) && isPreviewPath) {
|
|
431
|
+
if (req.headers[editorAccess_2.EDITOR_ACCESS_TOKEN_HEADER]) {
|
|
432
|
+
res.sendStatus(403);
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
res.redirect(302, `${previewOrigin}${req.originalUrl}`);
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
next();
|
|
439
|
+
});
|
|
424
440
|
if (staticService) {
|
|
425
441
|
app.use((0, static_1.createStaticRoutes)(staticService, projectPath, {
|
|
426
|
-
isPreviewBridgeEnabled:
|
|
427
|
-
expectedPreviewParentOrigin
|
|
428
|
-
|
|
429
|
-
|
|
442
|
+
isPreviewBridgeEnabled: true,
|
|
443
|
+
get expectedPreviewParentOrigin() {
|
|
444
|
+
return (0, exports.resolveEmbeddedAgentUiOrigin)(listenPort);
|
|
445
|
+
},
|
|
430
446
|
}));
|
|
431
447
|
log.info('Static routes mounted at /static');
|
|
432
448
|
}
|
|
@@ -445,8 +461,9 @@ const startServer = async (options) => {
|
|
|
445
461
|
projectPath,
|
|
446
462
|
pid: process.pid,
|
|
447
463
|
channel: (0, installationChannel_1.installationChannel)(),
|
|
448
|
-
rivetVersion:
|
|
464
|
+
rivetVersion: telemetry_2.RIVET_VERSION,
|
|
449
465
|
pluginName: (0, pluginContext_1.getPluginName)(),
|
|
466
|
+
telemetryMode: (0, telemetryPolicy_1.getTelemetryMode)(),
|
|
450
467
|
timestamp: new Date().toISOString(),
|
|
451
468
|
framework,
|
|
452
469
|
ports: {
|
|
@@ -493,7 +510,7 @@ const startServer = async (options) => {
|
|
|
493
510
|
const url = await options.createLibraryViewUrl?.(view);
|
|
494
511
|
if (!url)
|
|
495
512
|
return res.sendStatus(503);
|
|
496
|
-
return res.
|
|
513
|
+
return res.json({ url });
|
|
497
514
|
}
|
|
498
515
|
catch (error) {
|
|
499
516
|
log.error('Could not open the project library', error);
|
|
@@ -522,11 +539,11 @@ const startServer = async (options) => {
|
|
|
522
539
|
}
|
|
523
540
|
if (variantsOrchestrator) {
|
|
524
541
|
app.use('/api', (0, agentVariants_1.createAgentVariantsRouter)(variantsOrchestrator, variantsBridge, telemetry, variantHistory ?? undefined, undefined, variantRunService, historyReplay ?? undefined, {
|
|
525
|
-
isEnabled:
|
|
542
|
+
isEnabled: true,
|
|
526
543
|
resolveLibraryOrigin: options.resolveLibraryOrigin,
|
|
527
|
-
expectedParentOrigin
|
|
528
|
-
|
|
529
|
-
|
|
544
|
+
get expectedParentOrigin() {
|
|
545
|
+
return (0, exports.resolveEmbeddedAgentUiOrigin)(listenPort);
|
|
546
|
+
},
|
|
530
547
|
}, inlineStartTracker, runtimeAdmission));
|
|
531
548
|
log.info('agent-variants routes mounted at /api/variants');
|
|
532
549
|
}
|
|
@@ -538,16 +555,15 @@ const startServer = async (options) => {
|
|
|
538
555
|
(0, exports.sendInactiveVariantsEventStream)(req, res);
|
|
539
556
|
});
|
|
540
557
|
}
|
|
541
|
-
let userDevProxy = null;
|
|
542
558
|
if (framework !== 'static' || hasUserDevServer || variantsBridge) {
|
|
543
559
|
const proxyUserPort = framework === 'static' && !hasUserDevServer
|
|
544
560
|
? NO_USER_DEV_SERVER_PORT
|
|
545
561
|
: userPortWithFallback;
|
|
546
562
|
userDevProxy = (0, proxy_config_1.createUserDevServerProxy)(proxyUserPort, userHostWithFallback, {
|
|
547
|
-
isPreviewBridgeEnabled:
|
|
548
|
-
expectedPreviewParentOrigin
|
|
549
|
-
|
|
550
|
-
|
|
563
|
+
isPreviewBridgeEnabled: true,
|
|
564
|
+
get expectedPreviewParentOrigin() {
|
|
565
|
+
return (0, exports.resolveEmbeddedAgentUiOrigin)(listenPort);
|
|
566
|
+
},
|
|
551
567
|
resolveVariantPreviewPort: (sessionId, variantId, options) => {
|
|
552
568
|
if (options?.source === 'history') {
|
|
553
569
|
return historyReplay?.getPort(sessionId, variantId) ?? null;
|
|
@@ -559,6 +575,25 @@ const startServer = async (options) => {
|
|
|
559
575
|
},
|
|
560
576
|
});
|
|
561
577
|
variantsBridge?.registerVariantTargetSetter(userDevProxy.setVariantTarget);
|
|
578
|
+
app.use((req, res, next) => {
|
|
579
|
+
if (!isPreviewRequest(req)) {
|
|
580
|
+
if (req.path.toLowerCase().startsWith('/api/')) {
|
|
581
|
+
res.sendStatus(404);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
if (req.headers[editorAccess_2.EDITOR_ACCESS_TOKEN_HEADER]) {
|
|
585
|
+
res.sendStatus(403);
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
res.redirect(302, `${previewOrigin}${req.originalUrl}`);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if (req.headers[editorAccess_2.EDITOR_ACCESS_TOKEN_HEADER]) {
|
|
592
|
+
res.sendStatus(403);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
next();
|
|
596
|
+
});
|
|
562
597
|
app.get('/{*any}', userDevProxy.middleware);
|
|
563
598
|
app.post('/{*any}', userDevProxy.middleware);
|
|
564
599
|
app.put('/{*any}', userDevProxy.middleware);
|
|
@@ -571,7 +606,7 @@ const startServer = async (options) => {
|
|
|
571
606
|
else {
|
|
572
607
|
log.info(`${framework} mode - skipping proxy setup`);
|
|
573
608
|
}
|
|
574
|
-
if (process.env.SENTRY_DSN) {
|
|
609
|
+
if (process.env.SENTRY_DSN && (0, telemetryPolicy_1.getTelemetryMode)() === 'full') {
|
|
575
610
|
Sentry.setupExpressErrorHandler(app);
|
|
576
611
|
}
|
|
577
612
|
app.use((err, req, res, _next) => {
|
|
@@ -602,12 +637,13 @@ const startServer = async (options) => {
|
|
|
602
637
|
pid: process.pid,
|
|
603
638
|
rivetPort: listenPort,
|
|
604
639
|
projectPath,
|
|
605
|
-
startedAt
|
|
640
|
+
startedAt,
|
|
606
641
|
sessionId: sessionBridge?.getSessionId() ?? null,
|
|
607
642
|
applyMode: handshakeApplyMode,
|
|
608
643
|
queueAccessToken,
|
|
609
|
-
rivetVersion:
|
|
644
|
+
rivetVersion: telemetry_2.RIVET_VERSION,
|
|
610
645
|
pluginName: (0, pluginContext_1.getPluginName)(),
|
|
646
|
+
telemetryMode: (0, telemetryPolicy_1.getTelemetryMode)(),
|
|
611
647
|
});
|
|
612
648
|
}
|
|
613
649
|
catch (err) {
|
|
@@ -616,22 +652,37 @@ const startServer = async (options) => {
|
|
|
616
652
|
};
|
|
617
653
|
const retireCliHandshake = () => {
|
|
618
654
|
(0, serverHandshake_1.removeHandshake)(projectPath, process.pid);
|
|
655
|
+
(0, editorSession_1.removeEditorSession)({ pid: process.pid, port: listenPort, projectPath, startedAt }, editorAccessToken);
|
|
619
656
|
};
|
|
620
657
|
const httpServer = await new Promise((resolve, reject) => {
|
|
621
658
|
const listenHost = (0, exports.resolveRivetListenHost)(agentApplyMode);
|
|
622
|
-
const server = listenHost
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
659
|
+
const server = app.listen(listenPort, listenHost, (error) => {
|
|
660
|
+
if (error) {
|
|
661
|
+
reject(error);
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
log.info(`🎨 Rivet server running on http://${listenHost}:${listenPort}`);
|
|
665
|
+
listenPort = server.address().port;
|
|
666
|
+
if (previewPort === undefined)
|
|
667
|
+
previewOrigin = `http://${EMBEDDED_AGENT_PREVIEW_HOST}:${listenPort}`;
|
|
668
|
+
corsOrigins.add((0, exports.resolveEmbeddedAgentUiOrigin)(listenPort));
|
|
669
|
+
try {
|
|
670
|
+
(0, editorSession_1.writeEditorSession)({
|
|
671
|
+
pid: process.pid,
|
|
672
|
+
port: listenPort,
|
|
673
|
+
projectPath,
|
|
674
|
+
token: editorAccessToken,
|
|
675
|
+
startedAt,
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
catch (error) {
|
|
679
|
+
server.close(() => reject(error));
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
writeDevPortFile(listenPort);
|
|
683
|
+
advertiseCliHandshake();
|
|
684
|
+
resolve(server);
|
|
685
|
+
});
|
|
635
686
|
server.on('error', (err) => {
|
|
636
687
|
reject(err);
|
|
637
688
|
});
|
|
@@ -654,28 +705,76 @@ const startServer = async (options) => {
|
|
|
654
705
|
});
|
|
655
706
|
let previewHttpServer = null;
|
|
656
707
|
if (previewPort !== undefined) {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
proxyUpgrade
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
708
|
+
try {
|
|
709
|
+
previewHttpServer = await new Promise((resolve, reject) => {
|
|
710
|
+
const pServer = (0, http_1.createServer)(app);
|
|
711
|
+
pServer.on('error', reject);
|
|
712
|
+
pServer.on('connection', (socket) => {
|
|
713
|
+
activeSockets.add(socket);
|
|
714
|
+
socket.on('close', () => activeSockets.delete(socket));
|
|
715
|
+
});
|
|
716
|
+
pServer.on('upgrade', (req, socket, head) => {
|
|
717
|
+
const proxyUpgrade = userDevProxy?.middleware?.upgrade;
|
|
718
|
+
if (proxyUpgrade) {
|
|
719
|
+
proxyUpgrade(req, socket, head);
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
socket.destroy();
|
|
723
|
+
});
|
|
724
|
+
pServer.listen(previewPort, EMBEDDED_AGENT_LISTEN_HOST, () => {
|
|
725
|
+
log.info(`🔒 Rivet isolated preview origin on http://${EMBEDDED_AGENT_LISTEN_HOST}:${previewPort}`);
|
|
726
|
+
resolve(pServer);
|
|
727
|
+
});
|
|
671
728
|
});
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
729
|
+
}
|
|
730
|
+
catch (error) {
|
|
731
|
+
removeDevPortFile();
|
|
732
|
+
retireCliHandshake();
|
|
733
|
+
await new Promise((resolve) => {
|
|
734
|
+
httpServer.close(() => resolve());
|
|
735
|
+
for (const socket of activeSockets)
|
|
736
|
+
socket.destroy();
|
|
675
737
|
});
|
|
738
|
+
throw error;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
if (!skipProcessHandlers) {
|
|
742
|
+
const shutdownAndExit = async (code) => {
|
|
743
|
+
log.info('Server shutting down, cleaning up...');
|
|
744
|
+
(0, WorktreeManager_1.cleanupOrphanedWorktrees)();
|
|
745
|
+
const results = await Promise.allSettled([
|
|
746
|
+
options.beforeShutdown?.(),
|
|
747
|
+
telemetry?.shutdown(),
|
|
748
|
+
(0, FeatureFlagService_1.getFeatureFlagService)().shutdown(),
|
|
749
|
+
]);
|
|
750
|
+
const labels = ['shutdown hook', 'telemetry', 'feature flags'];
|
|
751
|
+
for (let i = 0; i < results.length; i++) {
|
|
752
|
+
if (results[i].status === 'rejected') {
|
|
753
|
+
log.error(`Failed to cleanup ${labels[i]}:`, results[i].reason);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
(0, serverHandshake_1.removeHandshake)(projectPath, process.pid);
|
|
757
|
+
(0, editorSession_1.removeEditorSession)({ pid: process.pid, port: listenPort, projectPath, startedAt }, editorAccessToken);
|
|
758
|
+
process.exit(code);
|
|
759
|
+
};
|
|
760
|
+
process.on('SIGINT', () => shutdownAndExit(0));
|
|
761
|
+
process.on('SIGTERM', () => shutdownAndExit(0));
|
|
762
|
+
process.on('uncaughtException', (err) => {
|
|
763
|
+
log.error('Uncaught exception:', err);
|
|
764
|
+
telemetry?.captureException(err, 'uncaught_exception');
|
|
765
|
+
shutdownAndExit(1);
|
|
766
|
+
});
|
|
767
|
+
process.on('unhandledRejection', (reason) => {
|
|
768
|
+
log.error('Unhandled rejection:', reason);
|
|
769
|
+
telemetry?.captureException(reason, 'unhandled_rejection');
|
|
770
|
+
shutdownAndExit(1);
|
|
676
771
|
});
|
|
677
772
|
}
|
|
678
773
|
return {
|
|
774
|
+
editorUrl: (0, editorAccess_2.createEditorUrl)({
|
|
775
|
+
port: httpServer.address().port,
|
|
776
|
+
token: editorAccessToken,
|
|
777
|
+
}),
|
|
679
778
|
close: () => new Promise((resolve, reject) => {
|
|
680
779
|
removeDevPortFile();
|
|
681
780
|
retireCliHandshake();
|