import assert from 'node:assert/strict' import path from 'node:path' import { pathToFileURL } from 'node:url' import { build } from 'esbuild' const output = path.resolve('.tmp/modern-conversation-labels-regression.mjs') await build({ entryPoints: ['src/renderer/src/workbuddy/conversation/source-labels.ts'], bundle: true, platform: 'node', format: 'esm', outfile: output, logLevel: 'silent' }) const labels = await import(`${pathToFileURL(output).href}?run=${Date.now()}`) const label = labels.sourceConversationLabel assert.equal(labels.SOURCE_CONVERSATION_DEFAULT_LOCALE, 'zh-CN') assert.equal(label('tool.command.confirm'), '确认执行命令?') assert.equal(label('tool.command.run'), '运行') assert.equal(label('tool.command.skip'), '跳过') assert.equal(label('tool.command.reject'), '拒绝') assert.equal(label('tool.writeFile.editing'), '修改中') assert.equal(label('tool.writeFile.create'), '创建') assert.equal(label('tool.writeFile.accept'), '接受') assert.equal(label('fold.completedWithDuration', { duration: '2.4 秒' }), '已完成 2.4 秒') assert.equal(label('chatInput.modelSelector.thinkingMode'), '思考模式') assert.equal(label('tool.command.confirm', undefined, 'en-US'), 'Run this command?') assert.equal(label('tool.command.run', undefined, 'en-US'), 'Run') assert.equal(label('tool.command.skip', undefined, 'en-US'), 'Skip') assert.equal(label('tool.command.reject', undefined, 'en-US'), 'Reject') assert.equal(label('tool.writeFile.editing', undefined, 'en-US'), 'Editing') assert.equal(label('tool.writeFile.create', undefined, 'en-US'), 'Create') assert.equal(label('tool.writeFile.accept', undefined, 'en-US'), 'Accept') assert.equal(label('fold.completedWithDuration', { duration: '2.4 sec' }, 'en-US'), 'Completed 2.4 sec') assert.equal(label('chatInput.modelSelector.thinkingMode', undefined, 'en-US'), 'Thinking mode') assert.equal(label('fold.completedWithDuration'), '已完成 {duration}') assert.equal(label('fold.completedWithDuration', { duration: 0 }), '已完成 0') assert.equal(label('not.a.source.label'), 'not.a.source.label') console.log('Modern conversation label regression passed (zh-CN/en-US, source anchors, interpolation, fallback).')