Files
memind/executor-display-label.test.mjs
T
john a29e1ec5c8 fix(agent-run): align cursor executor path with 103 production hotfixes
Recover requiredExecutor fallback, direct cursor launch in tool gateway,
and user-facing brand sanitization in source so the next portal release
can replace manual bundled edits on 103.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-27 09:31:36 +08:00

37 lines
1.6 KiB
JavaScript

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',
);
});