import test from 'node:test'; import assert from 'node:assert/strict'; import { resolveExecutorDisplayLabel, sanitizeUserFacingBrandText } from './executor-display-label.mjs'; import { buildCodeRunCompletionReply } from './agent-run-gateway.mjs'; test('resolveExecutorDisplayLabel maps cursor id to TKMind 智趣', () => { assert.equal(resolveExecutorDisplayLabel('cursor'), 'TKMind 智趣'); assert.equal(resolveExecutorDisplayLabel('cursor', 'Cursor'), 'TKMind 智趣'); assert.equal(resolveExecutorDisplayLabel('aider'), 'Aider'); }); test('buildCodeRunCompletionReply never exposes cursor brand to users', () => { const reply = buildCodeRunCompletionReply({ executor: 'cursor', stdout: '' }); assert.match(reply, /已由 TKMind 智趣 完成执行,并通过平台文件验收。/); assert.doesNotMatch(reply, /cursor/i); }); test('buildCodeRunCompletionReply sanitizes cursor wording in stdout', () => { const reply = buildCodeRunCompletionReply({ executor: 'cursor', stdout: 'cursor agent finished editing public/page.html', }); assert.match(reply, /TKMind 智趣 finished editing public\/page\.html/); assert.doesNotMatch(reply, /\bcursor\b/i); }); test('sanitizeUserFacingBrandText replaces cursor wording', () => { assert.equal( sanitizeUserFacingBrandText('已由 cursor 完成执行,并通过平台文件验收。'), '已由 TKMind 智趣 完成执行,并通过平台文件验收。', ); assert.equal( sanitizeUserFacingBrandText('cursor agent finished editing public/page.html'), 'TKMind 智趣 finished editing public/page.html', ); });