fix(web): guide clickable file references
This commit is contained in:
@@ -27,7 +27,6 @@ import {
|
||||
type DeliverablesTurnData,
|
||||
} from '../src/client/turn-deliverables.ts'
|
||||
import { apply, inject } from '../src/client/index.ts'
|
||||
import { apply as applyNode } from '../src/index.ts'
|
||||
import { apply as applyInvariant } from '../src/invariant.ts'
|
||||
import { en, zh } from '../src/client/locales.ts'
|
||||
|
||||
@@ -438,9 +437,7 @@ describe('producedFileMentions resolver', () => {
|
||||
})
|
||||
|
||||
describe('package shells', () => {
|
||||
it('the node half mounts inert and the invariant companion registers ownership', async () => {
|
||||
// The node half is deliberately inert; mounting it must simply not throw.
|
||||
applyNode()
|
||||
it('the invariant companion registers ownership', async () => {
|
||||
const registered: string[] = []
|
||||
const ctx = new Context()
|
||||
ctx.provide('invariants')
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/** Node-half coverage for the model guidance paired with Web file references. */
|
||||
|
||||
import { Context } from '@deepseek-ai/cordis'
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
|
||||
import { apply, inject } from '../src/index.ts'
|
||||
|
||||
let ctx: Context | undefined
|
||||
|
||||
afterEach(async () => {
|
||||
await ctx?.fiber.dispose()
|
||||
ctx = undefined
|
||||
})
|
||||
|
||||
describe('ui-deliverables node plugin', () => {
|
||||
it('registers final-response file-reference guidance only while mounted', async () => {
|
||||
ctx = new Context()
|
||||
await ctx.plugin(SystemPrompt, { persona: '' })
|
||||
const mounted = ctx.plugin({ apply, inject })
|
||||
await mounted.await()
|
||||
|
||||
const section = (await ctx.systemPrompt.assemble()).sections
|
||||
.find(entry => entry.name === 'ui:deliverable-file-references')
|
||||
expect(section?.text).toMatchInlineSnapshot('"When you successfully create or modify files, mention the primary outputs in your final response. To make those and any other changed-file references clickable in Web, format them as Markdown inline code using the exact file-tool path, or a basename when unique among the files changed in that turn."')
|
||||
|
||||
await mounted.dispose()
|
||||
expect((await ctx.systemPrompt.assemble()).sections
|
||||
.some(entry => entry.name === 'ui:deliverable-file-references')).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user