Merge remote-tracking branch 'origin/master' into worktree/web-plugin-config
# Conflicts: # docs/event-producer-consumer.i18n.yaml # docs/event-producer-consumer.md # docs/event-producer-consumer.zh.md # docs/module-graph.i18n.yaml # docs/module-graph.md # docs/module-graph.zh.md # packages/client/ui-conversation/README.i18n.yaml # packages/client/ui-conversation/README.md # packages/client/ui-conversation/README.zh.md # packages/client/ui-conversation/package.json # pnpm-lock.yaml
This commit is contained in:
@@ -46,6 +46,8 @@ flowchart LR
|
||||
cfg --> plugin_dsh_base_llm_pi_ai
|
||||
plugin_dsh_base_session_persistence_jsonl["session-persistence-jsonl<br/>@deepseek-ai/dsh-session-persistence-jsonl"]
|
||||
cfg --> plugin_dsh_base_session_persistence_jsonl
|
||||
plugin_dsh_base_attachment_local["attachment-local<br/>@deepseek-ai/dsh-attachment-local"]
|
||||
cfg --> plugin_dsh_base_attachment_local
|
||||
plugin_dsh_base_session_query_sqlite["session-query-sqlite<br/>@deepseek-ai/dsh-session-query-sqlite"]
|
||||
cfg --> plugin_dsh_base_session_query_sqlite
|
||||
plugin_dsh_base_session_projection["session-projection<br/>@deepseek-ai/dsh-session-projection"]
|
||||
@@ -183,6 +185,7 @@ flowchart LR
|
||||
| `credentials` | `@deepseek-ai/dsh-credentials-local` |
|
||||
| `llm-pi-ai` | `@deepseek-ai/dsh-llm-pi-ai` |
|
||||
| `session-persistence-jsonl` | `@deepseek-ai/dsh-session-persistence-jsonl` |
|
||||
| `attachment-local` | `@deepseek-ai/dsh-attachment-local` |
|
||||
| `session-query-sqlite` | `@deepseek-ai/dsh-session-query-sqlite` |
|
||||
| `session-projection` | `@deepseek-ai/dsh-session-projection` |
|
||||
| `telemetry-otel` | `@deepseek-ai/dsh-session-telemetry-otel` |
|
||||
|
||||
@@ -243,7 +243,7 @@ export async function runProfile(options: RunProfileOptions): Promise<{ ctx: Con
|
||||
shutdown.interrupt(code)
|
||||
}
|
||||
// Signals own teardown throughout the startup window, not only after boot()
|
||||
// settles: an inserted front door can publish readiness before sibling rows
|
||||
// settles: an inserted entry point can publish readiness before sibling rows
|
||||
// finish mounting.
|
||||
process.on('SIGTERM', () => { interrupt(options.task === undefined ? 0 : 143) })
|
||||
process.on('SIGINT', () => { interrupt(130) })
|
||||
|
||||
@@ -44,9 +44,15 @@ describe('web e2e: agent-preset authoring is a host-side copy', () => {
|
||||
return page.getByRole('dialog', { name: '设置' })
|
||||
}
|
||||
|
||||
/** Tokenize the lane-owned preset root the way the scaffold tokenizes cwd. */
|
||||
/** Tokenize the lane-owned preset root after general aria normalization. */
|
||||
function withPresetRoot(snapshot: string): string {
|
||||
return snapshot.split(userRoot).join('{{presetRoot}}')
|
||||
const rootSuffix = `/${userRoot.split('/').pop()!}`
|
||||
return snapshot.split('\n').map((line) => {
|
||||
const rootStart = line.indexOf(rootSuffix)
|
||||
if (rootStart === -1) return line
|
||||
const pathStart = line.lastIndexOf(' ', rootStart) + 1
|
||||
return `${line.slice(0, pathStart)}{{presetRoot}}${line.slice(rootStart + rootSuffix.length)}`
|
||||
}).join('\n')
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
//
|
||||
// Zero model calls: no replay fixture mounts, so a stray stream fails loud.
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { mkdir, writeFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import type { Browser, Page } from 'playwright'
|
||||
import { chromium } from 'playwright'
|
||||
@@ -29,6 +30,30 @@ const HEADER_EXPECTED = join(SNAPSHOT_DIR, 'header.expected.md')
|
||||
const SHIPPED_PRESETS = fileURLToPath(new URL('../../cli/config/agent-presets', import.meta.url))
|
||||
const MODE = webSnapshotMode()
|
||||
const SEED_ID = 'agent-preset-selection-web-e2e'
|
||||
/** A project skill only a preset that mounts `skill-local` can discover. */
|
||||
const SKILL_NAME = 'preset-catalog-demo'
|
||||
|
||||
/**
|
||||
* Seed one project skill under the connected workspace.
|
||||
*
|
||||
* Local skill discovery is a PRESET row, so this file is visible through
|
||||
* `standard` and invisible through `minimal` — which makes the '/' menu's
|
||||
* skill group a statement about the session's composition.
|
||||
* @param workspaceCwd - the scaffold's temp project parent.
|
||||
*/
|
||||
async function seedWorkspaceSkill(workspaceCwd: string): Promise<void> {
|
||||
const directory = join(workspaceCwd, 'workspace', '.agents', 'skills', SKILL_NAME)
|
||||
await mkdir(directory, { recursive: true })
|
||||
await writeFile(join(directory, 'SKILL.md'), [
|
||||
'---',
|
||||
`name: ${SKILL_NAME}`,
|
||||
'description: Prove the slash catalog follows the session composition',
|
||||
'---',
|
||||
'',
|
||||
'Body.',
|
||||
'',
|
||||
].join('\n'))
|
||||
}
|
||||
|
||||
/**
|
||||
* A settled one-turn session with no model content: this lane asserts chrome
|
||||
@@ -53,6 +78,35 @@ function seedLog(): string {
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
/**
|
||||
* The preset the host reports for the blank session the workspace connect
|
||||
* produced. Addressed by id rather than by scanning the serialized list: the
|
||||
* seeded session records `minimal` too, so a substring match over the whole
|
||||
* list answers before the switch has landed.
|
||||
* @param baseUrl - the scaffold's origin.
|
||||
* @returns the live session's preset, or undefined before it is listed.
|
||||
*/
|
||||
async function livePreset(baseUrl: string): Promise<string | undefined> {
|
||||
const response = await fetch(`${baseUrl}/api/session.list`, {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
type: 'client-request', rpcId: 'agent-preset-live', method: 'session.list', payload: {},
|
||||
}),
|
||||
})
|
||||
const body = await response.json() as {
|
||||
result: { value?: { items: { sessionId: string; agentPreset?: string }[] } }
|
||||
}
|
||||
return body.result.value?.items.find(item => item.sessionId !== SEED_ID)?.agentPreset
|
||||
}
|
||||
|
||||
/** Every option label the trigger menu currently lists. */
|
||||
async function menuOptions(page: Page): Promise<string[]> {
|
||||
const menu = page.getByRole('listbox', { name: 'Trigger suggestions' })
|
||||
await menu.waitFor({ timeout: 10_000 })
|
||||
return await menu.getByRole('option').allTextContents()
|
||||
}
|
||||
|
||||
describe('web e2e: agent-preset selection', () => {
|
||||
let scaffold: WebScaffold
|
||||
let browser: Browser
|
||||
@@ -67,6 +121,7 @@ describe('web e2e: agent-preset selection', () => {
|
||||
// records `minimal` is what makes the header label a claim about the
|
||||
// session rather than an echo of the current default.
|
||||
await seedSession(scaffold, seedLog(), SEED_ID, 'minimal')
|
||||
await seedWorkspaceSkill(scaffold.workspaceCwd)
|
||||
browser = await chromium.launch()
|
||||
page = await newEnglishPage(browser)
|
||||
tripwire = watchConsole(page)
|
||||
@@ -114,21 +169,47 @@ describe('web e2e: agent-preset selection', () => {
|
||||
|
||||
// The chip stages; the blank session the workspace connect produced is
|
||||
// what the stage lands on. The host's own answer is what comes back.
|
||||
await expect.poll(async () => {
|
||||
const response = await fetch(`${scaffold.baseUrl}/api/session.list`, {
|
||||
method: 'POST',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
type: 'client-request', rpcId: 'agent-preset-stage', method: 'session.list', payload: {},
|
||||
}),
|
||||
})
|
||||
const body = await response.json() as {
|
||||
result: { value?: { sessions: { blank: boolean; agentPreset?: string }[] } }
|
||||
}
|
||||
return JSON.stringify(body.result.value?.sessions ?? body.result)
|
||||
}, { timeout: 15_000 }).toContain('minimal')
|
||||
await expect.poll(() => livePreset(scaffold.baseUrl), { timeout: 15_000 }).toBe('minimal')
|
||||
})
|
||||
|
||||
it('re-reads the slash catalog through the composition the switch installed', async () => {
|
||||
// Continues the previous case: the chip has already applied `minimal` to
|
||||
// the blank session, and this one reads the menu that switch left behind.
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-agent-preset-slash-catalog'))
|
||||
const composer = page.locator('textarea:enabled').last()
|
||||
|
||||
// `minimal` mounts neither the compaction group nor plan mode nor local
|
||||
// skill discovery, so the catalog the composer warmed under the
|
||||
// deployment default must not survive the switch.
|
||||
await composer.fill('/')
|
||||
await expect.poll(() => menuOptions(page), { timeout: 15_000 })
|
||||
.not.toEqual(expect.arrayContaining([expect.stringContaining(SKILL_NAME)]))
|
||||
const onMinimal = await menuOptions(page)
|
||||
expect(onMinimal.some(option => option.startsWith('compact'))).toBe(false)
|
||||
expect(onMinimal.some(option => option.startsWith('plan'))).toBe(false)
|
||||
// The host-plane commands and the client's own contribution are the
|
||||
// floor: they belong to no preset and never move.
|
||||
expect(onMinimal.some(option => option.startsWith('goal'))).toBe(true)
|
||||
expect(onMinimal.some(option => option.startsWith('model'))).toBe(true)
|
||||
await composer.fill('')
|
||||
|
||||
// Switching back up reaches the host at all — the chip compares the pick
|
||||
// against its list row, so a row that never reprojected the first switch
|
||||
// answers "already standard" and sends nothing — and restores the catalog
|
||||
// instead of leaving the session reading the narrower composition.
|
||||
await page.getByRole('button', { name: '极简模式' }).click()
|
||||
await page.getByRole('menuitem', { name: /^标准模式/ }).first().click()
|
||||
await expect.poll(() => livePreset(scaffold.baseUrl), { timeout: 15_000 }).toBe('standard')
|
||||
|
||||
await composer.fill('/')
|
||||
await expect.poll(() => menuOptions(page), { timeout: 15_000 })
|
||||
.toEqual(expect.arrayContaining([expect.stringContaining(SKILL_NAME)]))
|
||||
const onStandard = await menuOptions(page)
|
||||
expect(onStandard.some(option => option.startsWith('compact'))).toBe(true)
|
||||
expect(onStandard.some(option => option.startsWith('plan'))).toBe(true)
|
||||
await composer.fill('')
|
||||
}, 90_000)
|
||||
|
||||
it('labels a resumed session with the preset it was created under', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-agent-preset-header'))
|
||||
// The seeded session's cwd is the scaffold root rather than the connected
|
||||
|
||||
138
apps/web/tests/image-display.snapshot.ts
Normal file
138
apps/web/tests/image-display.snapshot.ts
Normal file
@@ -0,0 +1,138 @@
|
||||
// @vitest-environment jsdom
|
||||
// Multimodal image surfaces over the BUILT client graph (the code-mode-fixture
|
||||
// idiom: real bundles via AppWebEntry, keyless FixtureApiClient transport).
|
||||
// Opens the fixture history session whose turn 72 carries an image in BOTH a
|
||||
// user message and an assistant message, and pins the product surfaces: the
|
||||
// history ImageGallery loading real fixture bytes through the authorized
|
||||
// sessions.attachment route, the double-click ImageLightbox, and the composer
|
||||
// intake chain (paste → ordered thumbnail rail → image-only send enablement → remove).
|
||||
import { fireEvent, screen, waitFor, within } from '@testing-library/react'
|
||||
import { expect, it } from 'vitest'
|
||||
import { installAssembledBootEnv, mountAssembledApp } from './assembled-boot.ts'
|
||||
|
||||
installAssembledBootEnv()
|
||||
|
||||
/** Open the fixture history session (the alpha log carrying the turn-72 image pair) and wait for its gallery. */
|
||||
async function openFixtureSession(): Promise<void> {
|
||||
const tree = await screen.findByRole('tree', { name: '会话' }, { timeout: 10_000 })
|
||||
const group = (await within(tree).findAllByText('fixture'))
|
||||
.map(el => el.closest<HTMLElement>('[role="treeitem"]'))
|
||||
.find(el => el?.getAttribute('aria-expanded') !== null)
|
||||
if (group === null || group === undefined) throw new Error('fixture Workspace group missing')
|
||||
if (group.getAttribute('aria-expanded') === 'false') {
|
||||
fireEvent.click(within(group).getByText('fixture'))
|
||||
await waitFor(() => {
|
||||
expect(group.getAttribute('aria-expanded')).toBe('true')
|
||||
})
|
||||
}
|
||||
const session = await within(tree).findByText('Fixture 历史会话')
|
||||
fireEvent.click(session)
|
||||
await waitFor(() => {
|
||||
expect(document.querySelectorAll('[data-align] img').length).toBeGreaterThan(0)
|
||||
}, { timeout: 10_000 })
|
||||
}
|
||||
|
||||
it('renders the history image pair through the authorized attachment route and opens the lightbox', async () => {
|
||||
localStorage.setItem('dsh.locale', 'zh')
|
||||
mountAssembledApp()
|
||||
await openFixtureSession()
|
||||
|
||||
// Both the user-side (align=end) and assistant-side (align=start) galleries
|
||||
// load real fixture bytes over sessions.attachment. jsdom provides
|
||||
// createObjectURL, so this environment MUST take the object-URL path — a
|
||||
// data: src here would mean the fallback ran where it should not.
|
||||
await waitFor(() => {
|
||||
if (document.querySelector('[data-align="end"] img') === null
|
||||
|| document.querySelector('[data-align="start"] img') === null) {
|
||||
throw new Error('history image galleries missing')
|
||||
}
|
||||
}, { timeout: 10_000 })
|
||||
const galleryShape = (align: string) => [...document.querySelectorAll(`[data-align="${align}"] img`)]
|
||||
.map(img => ({ alt: img.getAttribute('alt'), scheme: img.getAttribute('src')?.split(':')[0] }))
|
||||
expect({ user: galleryShape('end'), assistant: galleryShape('start') }).toMatchInlineSnapshot(`
|
||||
{
|
||||
"assistant": [
|
||||
{
|
||||
"alt": "fixture-image.png",
|
||||
"scheme": "blob",
|
||||
},
|
||||
],
|
||||
"user": [
|
||||
{
|
||||
"alt": "fixture-image.png",
|
||||
"scheme": "blob",
|
||||
},
|
||||
],
|
||||
}
|
||||
`)
|
||||
const userImage = document.querySelector<HTMLElement>('[data-align="end"] img')!
|
||||
|
||||
// Double-click opens the original-size lightbox; Escape/close dismisses it.
|
||||
const frame = userImage.closest('button')
|
||||
if (frame === null) throw new Error('image frame button missing')
|
||||
fireEvent.doubleClick(frame)
|
||||
const lightbox = await screen.findByRole('dialog')
|
||||
expect(within(lightbox).getByRole('img').getAttribute('src')?.split(':')[0]).toBe('blob')
|
||||
fireEvent.click(within(lightbox).getByRole('button', { name: /关闭/ }))
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByRole('dialog')).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
it('accepts pasted images into the composer rail in order and removes them', async () => {
|
||||
localStorage.setItem('dsh.locale', 'zh')
|
||||
mountAssembledApp()
|
||||
|
||||
const tree = await screen.findByRole('tree', { name: '会话' }, { timeout: 10_000 })
|
||||
const start = tree.querySelector<HTMLButtonElement>('button[aria-label="在“fixture”中新建会话"]')
|
||||
if (start === null) throw new Error('fixture Workspace new-session action missing')
|
||||
fireEvent.click(start)
|
||||
|
||||
// Image-only send arming is pinned at package level (input-bar.spec.tsx);
|
||||
// this assembled lane pins the intake chain over the built graph.
|
||||
const textarea = await screen.findByPlaceholderText('描述你想要构建的内容', {}, { timeout: 10_000 })
|
||||
const image = new File([new Uint8Array([137, 80, 78, 71])], 'pasted.png', { type: 'image/png' })
|
||||
fireEvent.paste(textarea, {
|
||||
clipboardData: {
|
||||
items: [{ kind: 'file', type: 'image/png', getAsFile: () => image }],
|
||||
getData: () => '',
|
||||
},
|
||||
})
|
||||
|
||||
// The rail is an accessible group holding the draft thumbnail (queried via
|
||||
// DOM: jsdom's a11y-visibility computation hides the composer subtree).
|
||||
const rail = await waitFor(() => {
|
||||
const el = document.querySelector('[role="group"][aria-label="待发送图片"]')
|
||||
if (el === null) throw new Error('attachment rail missing')
|
||||
return el
|
||||
}, { timeout: 5_000 })
|
||||
expect([...rail.querySelectorAll('img')].map(img => ({
|
||||
alt: img.getAttribute('alt'), scheme: img.getAttribute('src')?.split(':')[0],
|
||||
}))).toMatchInlineSnapshot(`
|
||||
[
|
||||
{
|
||||
"alt": "pasted.png",
|
||||
"scheme": "blob",
|
||||
},
|
||||
]
|
||||
`)
|
||||
|
||||
const second = new File([new Uint8Array([137, 80, 78, 71])], 'second.png', { type: 'image/png' })
|
||||
fireEvent.paste(textarea, {
|
||||
clipboardData: {
|
||||
items: [{ kind: 'file', type: 'image/png', getAsFile: () => second }],
|
||||
getData: () => '',
|
||||
},
|
||||
})
|
||||
await waitFor(() => {
|
||||
expect([...rail.querySelectorAll('img')].map(img => img.getAttribute('alt')))
|
||||
.toEqual(['pasted.png', 'second.png'])
|
||||
})
|
||||
|
||||
const remove = [...rail.querySelectorAll('button[aria-label^="移除图片"]')]
|
||||
if (remove.length !== 2) throw new Error('remove buttons missing')
|
||||
for (const button of remove) fireEvent.click(button)
|
||||
await waitFor(() => {
|
||||
expect(document.querySelector('[role="group"][aria-label="待发送图片"]')).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -16,7 +16,7 @@
|
||||
- paragraph: partial
|
||||
- status: Deep diving...
|
||||
- button "2 queued messages"
|
||||
- textbox "Message the agent"
|
||||
- textbox "Cmd/Ctrl+Enter steers all queued messages"
|
||||
- button "Commands":
|
||||
- img
|
||||
- 'button "Access mode, current: Workspace Write"': Workspace Write
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
- tooltip "Save queued message"
|
||||
- button "Cancel editing":
|
||||
- img
|
||||
- textbox "Message the agent"
|
||||
- textbox "Cmd/Ctrl+Enter steers all queued messages"
|
||||
- button "Commands":
|
||||
- img
|
||||
- 'button "Access mode, current: Workspace Write"': Workspace Write
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
- button "Clear goal":
|
||||
- img
|
||||
- button "2 queued messages"
|
||||
- textbox "Message the agent"
|
||||
- textbox "Cmd/Ctrl+Enter steers all queued messages"
|
||||
- button "Commands":
|
||||
- img
|
||||
- 'button "Access mode, current: Workspace Write"': Workspace Write
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
- img
|
||||
- button "Steer queued message":
|
||||
- img
|
||||
- textbox "Message the agent"
|
||||
- textbox "Cmd/Ctrl+Enter steers all queued messages"
|
||||
- button "Commands":
|
||||
- img
|
||||
- 'button "Access mode, current: Workspace Write"': Workspace Write
|
||||
|
||||
35
apps/web/tests/snapshots/steer-all/mid-steer.expected.md
Normal file
35
apps/web/tests/snapshots/steer-all/mid-steer.expected.md
Normal file
@@ -0,0 +1,35 @@
|
||||
- banner:
|
||||
- navigation "Session hierarchy":
|
||||
- button "Use the ask_user_question tool to" [disabled]
|
||||
- img
|
||||
- text: 标准模式
|
||||
- tablist:
|
||||
- tab "Chat" [selected]
|
||||
- tab "Trajectory"
|
||||
- text: Use the ask_user_question tool to ask me exactly one question with id "checkpoint", question "Ready to continue?", header "Checkpoint", and options labeled "Yes" and "No". After I answer, reply with one short sentence acknowledging my answer and stop. {{clock}}
|
||||
- button "Copy":
|
||||
- img
|
||||
- button "Context injection @deepseek-ai/dsh-system-prompt":
|
||||
- img
|
||||
- img
|
||||
- text: Context injection @deepseek-ai/dsh-system-prompt
|
||||
- text: Running
|
||||
- button "Think The user wants me to ask them a checkpoint question first, then continue with whatever they interject. Let me do exactly that.":
|
||||
- img
|
||||
- img
|
||||
- text: Think The user wants me to ask them a checkpoint question first, then continue with whatever they interject. Let me do exactly that.
|
||||
- status: Deep diving...
|
||||
- text: "Interjection Interjection: include the word BANANA in your final reply."
|
||||
- button "Copy":
|
||||
- img
|
||||
- text: "Interjection Interjection: include the word ORANGE in your final reply."
|
||||
- button "Copy":
|
||||
- img
|
||||
- textbox "Message the agent"
|
||||
- button "Commands":
|
||||
- img
|
||||
- 'button "Access mode, current: Workspace Write"': Workspace Write
|
||||
- button "Select model, current DeepSeek-V4-Flash":
|
||||
- text: DeepSeek-V4-Flash
|
||||
- img
|
||||
- button "Stop generating"
|
||||
47
apps/web/tests/snapshots/steer-all/replay.override.json
Normal file
47
apps/web/tests/snapshots/steer-all/replay.override.json
Normal file
@@ -0,0 +1,47 @@
|
||||
[
|
||||
{
|
||||
"kind": "chunks",
|
||||
"chunks": [
|
||||
{ "type": "block-start", "index": 0, "blockType": "reasoning" },
|
||||
{ "type": "reasoning-delta", "index": 0, "text": "The user wants me to ask them a checkpoint question first, then continue with whatever they interject. Let me do exactly that." },
|
||||
{ "type": "block-start", "index": 1, "blockType": "tool-call" },
|
||||
{
|
||||
"type": "tool-call-delta",
|
||||
"index": 1,
|
||||
"id": "call_00_steer_all",
|
||||
"name": "ask_user_question",
|
||||
"argumentsDelta": "{\"questions\": [{\"id\": \"checkpoint\", \"question\": \"Ready to continue?\", \"header\": \"Checkpoint\", \"options\": [{\"label\": \"Yes\"}, {\"label\": \"No\"}]}]}"
|
||||
},
|
||||
{
|
||||
"type": "block-end",
|
||||
"index": 0,
|
||||
"block": {
|
||||
"type": "reasoning",
|
||||
"text": "The user wants me to ask them a checkpoint question first, then continue with whatever they interject. Let me do exactly that."
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "block-end",
|
||||
"index": 1,
|
||||
"block": {
|
||||
"type": "tool-call",
|
||||
"id": "call_00_steer_all",
|
||||
"name": "ask_user_question",
|
||||
"arguments": "{\"questions\": [{\"id\": \"checkpoint\", \"question\": \"Ready to continue?\", \"header\": \"Checkpoint\", \"options\": [{\"label\": \"Yes\"}, {\"label\": \"No\"}]}]}"
|
||||
}
|
||||
},
|
||||
{ "type": "usage", "usage": { "inputTokens": 10, "outputTokens": 10, "cacheReadTokens": 0, "reasoningTokens": 0 } },
|
||||
{ "type": "finish", "reason": { "kind": "tool-calls" } }
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "chunks",
|
||||
"chunks": [
|
||||
{ "type": "block-start", "index": 0, "blockType": "text" },
|
||||
{ "type": "text-delta", "index": 0, "text": "Got it: BANANA and ORANGE." },
|
||||
{ "type": "block-end", "index": 0, "block": { "type": "text", "text": "Got it: BANANA and ORANGE." } },
|
||||
{ "type": "usage", "usage": { "inputTokens": 10, "outputTokens": 10, "cacheReadTokens": 0, "reasoningTokens": 0 } },
|
||||
{ "type": "finish", "reason": { "kind": "stop" } }
|
||||
]
|
||||
}
|
||||
]
|
||||
45
apps/web/tests/snapshots/steer-all/settled.expected.md
Normal file
45
apps/web/tests/snapshots/steer-all/settled.expected.md
Normal file
@@ -0,0 +1,45 @@
|
||||
- banner:
|
||||
- navigation "Session hierarchy":
|
||||
- button "Use the ask_user_question tool to" [disabled]
|
||||
- img
|
||||
- text: 标准模式
|
||||
- tablist:
|
||||
- tab "Chat" [selected]
|
||||
- tab "Trajectory"
|
||||
- text: Use the ask_user_question tool to ask me exactly one question with id "checkpoint", question "Ready to continue?", header "Checkpoint", and options labeled "Yes" and "No". After I answer, reply with one short sentence acknowledging my answer and stop. {{clock}}
|
||||
- button "Copy":
|
||||
- img
|
||||
- button "Context injection @deepseek-ai/dsh-system-prompt":
|
||||
- img
|
||||
- img
|
||||
- text: Context injection @deepseek-ai/dsh-system-prompt
|
||||
- button "Think The user wants me to ask them a checkpoint question first, then continue with whatever they interject. Let me do exactly that.":
|
||||
- img
|
||||
- img
|
||||
- text: Think The user wants me to ask them a checkpoint question first, then continue with whatever they interject. Let me do exactly that.
|
||||
- button "Ask question 1/1 answered":
|
||||
- img
|
||||
- img
|
||||
- text: Ask question 1/1 answered
|
||||
- text: "Interjection Interjection: include the word BANANA in your final reply. {{clock}}"
|
||||
- button "Copy":
|
||||
- img
|
||||
- text: "Interjection Interjection: include the word ORANGE in your final reply. {{clock}}"
|
||||
- button "Copy":
|
||||
- img
|
||||
- paragraph: "Got it: BANANA and ORANGE."
|
||||
- button "Copy":
|
||||
- img
|
||||
- button "Branch into a new conversation":
|
||||
- img
|
||||
- text: {{clock}} Ran for {{duration}} TTFT {{duration}} {{throughput}} tok/s
|
||||
- textbox "Message the agent"
|
||||
- button "Commands":
|
||||
- img
|
||||
- 'button "Access mode, current: Workspace Write"': Workspace Write
|
||||
- button "Select model, current DeepSeek-V4-Flash":
|
||||
- text: DeepSeek-V4-Flash
|
||||
- img
|
||||
- button "0% of context used"
|
||||
- button "Send message" [disabled]
|
||||
- text: 1 turns · 2 steps LLM {{duration}} · Tool call {{duration}} TTFT avg {{duration}} · {{throughput}} tok/s Cache hit 0% Input 20 tok · Output 20 tok
|
||||
@@ -34,6 +34,18 @@ const REPLAY_PACE_MS = 100
|
||||
const PROMPT = 'Use the ask_user_question tool to ask me exactly one question with id "checkpoint", question "Ready to continue?", header "Checkpoint", and options labeled "Yes" and "No". After I answer, reply with one short sentence acknowledging my answer and stop.'
|
||||
const STEER = 'Interjection: include the word BANANA in your final reply.'
|
||||
|
||||
// Empty-draft flush scenario: an override-only fixture. The whole-script
|
||||
// replacement answers both model calls of a FRESH session (no recorded
|
||||
// session.jsonl exists — call 0 keeps the turn open with a question-tool
|
||||
// call, call 1 is the reply after both steerings drain).
|
||||
const STEER_ALL_DIR = fileURLToPath(new URL('./snapshots/steer-all', import.meta.url))
|
||||
const STEER_ALL_FIXTURE = join(STEER_ALL_DIR, 'session.jsonl')
|
||||
const STEER_ALL_OVERRIDE = join(STEER_ALL_DIR, 'replay.override.json')
|
||||
const STEER_ALL_MID = join(STEER_ALL_DIR, 'mid-steer.expected.md')
|
||||
const STEER_ALL_SETTLED = join(STEER_ALL_DIR, 'settled.expected.md')
|
||||
const STEER_ONE = 'Interjection: include the word BANANA in your final reply.'
|
||||
const STEER_TWO = 'Interjection: include the word ORANGE in your final reply.'
|
||||
|
||||
/** Concatenated assistant text deltas — the model-visible reply body. */
|
||||
function assistantText(events: SessionEvent[]): string {
|
||||
return events
|
||||
@@ -278,3 +290,103 @@ describe('web e2e: composer shortcut follows the swapped busy behavior', () => {
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
}, 90_000)
|
||||
})
|
||||
|
||||
describe('web e2e: empty-draft Cmd+Enter steers the whole queue', () => {
|
||||
let scaffold: WebScaffold
|
||||
let browser: Browser
|
||||
let page: Page
|
||||
let tripwire: ReturnType<typeof watchConsole>
|
||||
const sessionEvents: SessionEvent[] = []
|
||||
|
||||
beforeAll(async () => {
|
||||
// The scenario boots a fresh session against the override-only fixture;
|
||||
// the replay.override.json sidecar replaces the derived script, so the
|
||||
// (deliberately absent) session.jsonl is never read.
|
||||
scaffold = await launchWebScaffold({
|
||||
replayFixture: STEER_ALL_FIXTURE,
|
||||
replayOverride: STEER_ALL_OVERRIDE,
|
||||
paceMs: REPLAY_PACE_MS,
|
||||
})
|
||||
scaffold.ctx.on('session/event', (_session, event) => { sessionEvents.push(event) })
|
||||
browser = await chromium.launch()
|
||||
page = await newEnglishPage(browser)
|
||||
tripwire = watchConsole(page)
|
||||
await page.goto(scaffold.baseUrl, { waitUntil: 'load' })
|
||||
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
|
||||
await connectFreshWorkspace(page, scaffold.workspaceCwd)
|
||||
await page.getByText('标准模式', { exact: true }).waitFor({ timeout: 10_000 })
|
||||
}, 120_000)
|
||||
|
||||
afterAll(async () => {
|
||||
await browser?.close()
|
||||
await scaffold?.close()
|
||||
})
|
||||
|
||||
it.skipIf(MODE === 'record')('queues two messages, then flushes both with an empty-draft Cmd+Enter', async () => {
|
||||
onTestFailed(() => saveFailureShot(page, 'web-e2e-steer-all'))
|
||||
const input = page.locator('textarea').first()
|
||||
await input.waitFor({ timeout: 10_000 })
|
||||
const settled = scaffold.whenTurnSettled(30_000)
|
||||
|
||||
// Call 0 streams a question-tool call; the fills must land inside the
|
||||
// first replay window, before the question composer replaces the textarea.
|
||||
await input.fill(PROMPT)
|
||||
await input.press('Enter')
|
||||
await input.fill(STEER_ONE)
|
||||
await input.press('Enter')
|
||||
await input.fill(STEER_TWO)
|
||||
await input.press('Enter')
|
||||
const dock = page.locator('[data-queue-dock]')
|
||||
// Both messages queued: the two-row dock shows a collapsed count header,
|
||||
// and Playwright text matching skips the hidden rows — expand the list,
|
||||
// then assert each row's content.
|
||||
await dock.getByText('2 queued messages').waitFor({ timeout: 10_000 })
|
||||
await dock.getByRole('button').click()
|
||||
await dock.getByText(STEER_ONE, { exact: true }).waitFor({ timeout: 10_000 })
|
||||
await dock.getByText(STEER_TWO, { exact: true }).waitFor({ timeout: 10_000 })
|
||||
expect(await page.locator('[data-pending-steering]').count()).toBe(0)
|
||||
|
||||
// Empty draft + Cmd+Enter: both queued rows steer in FIFO order, the dock
|
||||
// empties, and the pending steering renders at the conversation tail.
|
||||
await input.press('Meta+Enter')
|
||||
await expect.poll(
|
||||
() => page.locator('[data-pending-steering]').filter({ hasText: /BANANA|ORANGE/ }).count(),
|
||||
{ timeout: 10_000 },
|
||||
).toBe(2)
|
||||
expect(await page.locator('[data-queue-dock]').count()).toBe(0)
|
||||
// The reasoning row streams independently of the steering handoff; wait
|
||||
// for it so the mid snapshot pins the assistant step, not the pre-render
|
||||
// gap a fast machine can catch between steering acceptance and the block.
|
||||
await page.locator('[data-variant="think"]').first().waitFor({ timeout: 10_000 })
|
||||
const mid = await captureStableAria(page, '[class*="centerCol"]', scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(STEER_ALL_MID, mid, MODE)
|
||||
|
||||
// Answer the question; the step closes, the loop drains both steerings
|
||||
// into one next-step request, and the final reply obeys both markers.
|
||||
const composer = page.locator('[data-question-key]')
|
||||
await composer.waitFor({ timeout: 30_000 })
|
||||
await composer.getByRole('radio', { name: 'Yes' }).click()
|
||||
await composer.getByRole('radio', { name: 'Yes' }).press('Enter')
|
||||
await settled
|
||||
|
||||
const first = claimedMessages(sessionEvents, STEER_ONE)
|
||||
const second = claimedMessages(sessionEvents, STEER_TWO)
|
||||
expect(first).toHaveLength(1)
|
||||
expect(second).toHaveLength(1)
|
||||
expect(assistantText(sessionEvents)).toContain('BANANA')
|
||||
expect(assistantText(sessionEvents)).toContain('ORANGE')
|
||||
await expect.poll(() => page.getByText(STEER_ONE, { exact: true }).count(), { timeout: 15_000 }).toBe(1)
|
||||
await expect.poll(() => page.getByText(STEER_TWO, { exact: true }).count(), { timeout: 15_000 }).toBe(1)
|
||||
expect(await page.locator('[data-pending-steering]').count()).toBe(0)
|
||||
const snapshot = await captureStableAria(page, '[class*="centerCol"]', scaffold.workspaceCwd)
|
||||
await compareOrRefreshGolden(STEER_ALL_SETTLED, snapshot, MODE)
|
||||
expect(tripwire.pageErrors).toEqual([])
|
||||
expect(tripwire.warnings).toEqual([])
|
||||
}, 200_000)
|
||||
|
||||
it.skipIf(MODE === 'record')('keeps the fixture inventory closed', async () => {
|
||||
await assertFixtureInventory(STEER_ALL_DIR, [
|
||||
'replay.override.json', 'mid-steer.expected.md', 'settled.expected.md',
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -446,7 +446,7 @@ describe('web e2e: persisted subagent conversation and human continuation', () =
|
||||
).toBe(3)
|
||||
expect(await page.getByText('Ungrouped', { exact: true }).count()).toBe(0)
|
||||
const hierarchy = page.getByRole('navigation', { name: 'Session hierarchy' })
|
||||
expect(await hierarchy.getByRole('button').count()).toBe(1)
|
||||
await expect.poll(() => hierarchy.getByRole('button').count()).toBe(1)
|
||||
await compareOrRefreshGolden(
|
||||
FORK_EXPECTED,
|
||||
await captureStableAria(page, '[role="tree"][aria-label="Sessions"]', scaffold.workspaceCwd),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Assembled todo snapshot: boots the real built `packages/client/*/lib/
|
||||
// client.js` bundles through AppWebEntry's ModuleLoader path against the
|
||||
// keyless FixtureApiClient transport, opens the fixture session, and pins the
|
||||
// two surfaces the fixture's parallel plan (turn 72, two items `in_progress`)
|
||||
// two surfaces the fixture's parallel plan (turn 73, two items `in_progress`)
|
||||
// reaches — the `todo_write` tool row and the dock's plan strip.
|
||||
//
|
||||
// The row is pinned as three separate fields on purpose. `summary=` is the
|
||||
|
||||
Reference in New Issue
Block a user