Merge branch 'stack/agent-profiles-2-configs' into stack/agent-profiles-3-wire

This commit is contained in:
Yichen Jiang
2026-08-07 01:01:49 +08:00
188 changed files with 8407 additions and 654 deletions

View File

@@ -14,7 +14,7 @@ import { dshHomePath } from '@deepseek-ai/dsh-paths'
import type { Context } from 'cordis'
import type { PatchOptions } from '@cordisjs/plugin-include'
import { addHarnessSourceSection } from '@deepseek-ai/dsh-app-boot'
import { runProfile } from './profile-boot.ts'
import { runProfile, type ProfileRows } from './profile-boot.ts'
const SOURCE_ROOT = fileURLToPath(new URL('../../..', import.meta.url))
@@ -78,7 +78,7 @@ export interface WebFlags {
* @returns the flag patch list, in application order.
*/
function deriveWebFlagPatches(
rows: Map<string, { name?: string; config?: unknown }>,
rows: ProfileRows,
flags: WebFlags,
): PatchOptions[] {
const overrides = new Map<string, Record<string, unknown>>()
@@ -122,6 +122,18 @@ function deriveWebFlagPatches(
return patches
}
/**
* Whether the composed Web runtime keeps its model- and shell-visible surface
* context. The bundle schema defaults the field to true, so only an explicit
* false suppresses both the bundle contributions and the launcher-owned
* source-checkout section.
* @param rows - the composed Web profile rows before launcher flag patches.
* @returns true unless the web-runtime row explicitly disables surface context.
*/
export function webSurfaceContextEnabled(rows: ProfileRows): boolean {
return (rows.get('web-runtime')?.config as { surfaceContext?: boolean } | undefined)?.surfaceContext !== false
}
/**
* Serve the browser UI from the web profile. Host/port/workspace-root flags
* are passed through only when given (absent, the composed profile values
@@ -135,7 +147,8 @@ export async function runWeb(flags: WebFlags): Promise<void> {
profile: 'web',
patchFiles: flags.patches,
deriveFlagPatches: rows => deriveWebFlagPatches(rows, flags),
prepare: (ctx: Context) => {
prepare: (ctx: Context, rows: ProfileRows) => {
if (!webSurfaceContextEnabled(rows)) return
ctx.inject(['systemPrompt'], (promptCtx) => {
addHarnessSourceSection(promptCtx, SOURCE_ROOT)
})