fix(cli): isolate Web runtime context from headless

This commit is contained in:
Yichen Jiang
2026-08-06 20:11:44 +08:00
parent 0cf1ba7f87
commit 50c46be948
9 changed files with 46 additions and 12 deletions

View File

@@ -8,6 +8,7 @@
import { fileURLToPath } from 'node:url'
import type { Context } from 'cordis'
import type { PatchOptions } from '@cordisjs/plugin-include'
import { addHarnessSourceSection, resolveConfigPath } from '@deepseek-ai/dsh-app-boot'
import type {} from '@deepseek-ai/dsh-host-webserver'
import type {} from '@deepseek-ai/dsh-system-prompt'
@@ -24,6 +25,12 @@ const DSH_WEB_URL = 'DSH_WEB_URL' as const
const DSH_WEB_MODE = 'DSH_WEB_MODE' as const
const WEB_RUNTIME_CONTEXT_BUILTIN = 'web-runtime-context' as const
/** Web-launcher activation applied before personal or explicit configuration. */
export const WEB_RUNTIME_CONTEXT_ENABLE_PATCH = {
id: WEB_RUNTIME_CONTEXT_BUILTIN,
disabled: false,
} as const satisfies PatchOptions
type WebMode = 'production' | 'development'
// Display-only mirror of the webserver schema's loopback host: the address the
@@ -125,6 +132,7 @@ export async function runWeb(
const entry = new AppCLIEntry({
configPath: BASE_CONFIG,
overlayPath: WEB_OVERLAY,
launcherPatches: [WEB_RUNTIME_CONTEXT_ENABLE_PATCH],
...config !== undefined && { extraOverlayPath: resolveConfigPath(config, undefined) },
dev,
prepare: (ctx) => { prepareWebRuntimeContext(ctx, SOURCE_ROOT, mode) },