fix(web): align core profile with RL prompt

This commit is contained in:
Yichen Jiang
2026-08-06 19:52:08 +08:00
parent 6afca00a77
commit 0cf1ba7f87
17 changed files with 118 additions and 40 deletions

View File

@@ -1,18 +1,26 @@
import { sep } from 'node:path'
import { Context } from 'cordis'
import { describe, expect, it } from 'vitest'
import Loader from '@cordisjs/plugin-loader'
import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
import { HARNESS_SOURCE_SECTION } from '@deepseek-ai/dsh-app-boot'
import type {} from '@deepseek-ai/dsh-host-webserver'
import { prepareWebRuntimeContext } from '../src/web.ts'
describe('prepareWebRuntimeContext', () => {
it('installs both sections before a later systemPrompt consumer activates', async () => {
it('registers the config-tree builtin that installs both prompt sections', async () => {
const ctx = new Context()
const sourceRoot = `${sep}opt${sep}harness-src`
let observedSections: { name: string; text: string }[] | undefined
try {
await ctx.plugin(Loader)
prepareWebRuntimeContext(ctx, sourceRoot, 'production')
expect(() => {
prepareWebRuntimeContext(ctx, sourceRoot, 'production')
}).toThrow(
'Loader builtin "web-runtime-context" is already registered',
)
await ctx.loader.create({ name: 'cordis:web-runtime-context' })
ctx.provide('httpServer', { port: 3080 } as Context['httpServer'])
const consumer = ctx.inject(['systemPrompt'], async (promptCtx) => {
const assembly = await promptCtx.systemPrompt.assemble()