chore: establish YCode replication baseline and TODO

This commit is contained in:
xiaohan.yuan committed 2026-10-17 02:43:49 +08:00
commit 6dc59f89ba
1118 files changed
+196002

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
// Isolated YCode host fixtures, not claims about WorkBuddy runtime screenshots.
const now = Date.now()
const tool = (id, name, args, result) => ({ id, name, args, argsRaw: JSON.stringify(args), status: 'ok', result, output: JSON.stringify(result) })
const manyLines = Array.from({ length: 300 }, (_, index) => `export const value${index} = ${index}`).join('\n')
const writes = [
tool('source-edit', 'edit_file', { path: 'src/example.ts', oldText: '1', newText: '2' }, { path: 'src/example.ts', oldContent: 'export const value = 1\n', newContent: 'export const value = 2\n' }),
tool('source-create', 'write_file', { path: 'new.txt', content: 'created\n' }, { path: 'new.txt', oldContent: null, newContent: 'created\n' }),
tool('source-empty', 'edit_file', { path: 'empty.txt', oldText: 'removed', newText: '' }, { path: 'empty.txt', oldContent: 'removed\n', newContent: '' }),
tool('source-many', 'write_file', { path: 'many.ts', content: manyLines }, { path: 'many.ts', oldContent: null, newContent: manyLines })
]
const artifact = (id, name, preview) => ({ type: 'artifact', artifact: { id, name, path: preview.uri || id, preview } })
export const artifactSourceFixture = {
sessions: [{ id: 'artifact-source', title: '产物源码分支验证', createdAt: now, updatedAt: now }],
messages: { 'artifact-source': [
{ id: 'user', role: 'user', content: '验证完整 Diff、异步 Markdown、HTML 和原生下载。', status: 'done', createdAt: now },
{ id: 'assistant', role: 'assistant', content: '', status: 'done', createdAt: now + 1, tools: writes, parts: [
...writes.flatMap(item => [{ type: 'text', text: `**${item.id}**` }, { type: 'tool', toolId: item.id }]),
artifact('custom', '异步 Markdown', { id: 'custom', type: 'custom-artifact', uri: 'notes/readme.md' }),
artifact('cached', '缓存 Markdown', { id: 'cached', type: 'custom-artifact', uri: 'missing.md', content: '# 缓存内容\n\n没有读取磁盘。' }),
artifact('slow', '慢速 Markdown', { id: 'slow', type: 'custom-artifact', uri: 'slow.md' }),
artifact('html', 'HTML 预览', { id: 'html', type: 'media-artifact', category: 'artifact', url: 'preview.html', contentType: 'code' }),
artifact('missing', '读取失败', { id: 'missing', type: 'custom-artifact', uri: 'missing.md' }),
artifact('timeout', 'Diff 超时', { id: 'timeout', type: 'file-changes', title: 'large.txt', fileChangeInfo: { uri: 'large.txt', diffStatus: 'timeout' } }),
{ type: 'plan', plan: { id: 'plan', title: '计划下载', steps: [{ id: '1', text: '验证 Markdown 保存', status: 'pending' }] } }
] }
] },
files: { 'src/example.ts': 'export const value = 2\n', 'new.txt': 'created\n', 'empty.txt': '', 'many.ts': manyLines,
'notes/readme.md': '# 异步加载成功\n\n真实调用文件读取桥。', 'slow.md': '# 过期读取不能覆盖新预览', 'preview.html': '<!doctype html><html><body><h1>HTML 预览成功</h1></body></html>' },
delays: { 'slow.md': 300 }
}