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>
This commit is contained in:
@@ -32,10 +32,59 @@ test('tool gateway is disabled by default and reports protocol', () => {
|
||||
protocol: 'agent-run-v1',
|
||||
executors: ['aider', 'openhands'],
|
||||
defaultExecutor: 'aider',
|
||||
cursorEnabled: false,
|
||||
cursorTaskTypes: ['h5_chat_code_task', 'mindspace_page', 'mindspace_html_page'],
|
||||
openhandsTaskTypes: ['repo_refactor', 'multi_file', 'complex_repo', 'page_data_dev_complex'],
|
||||
});
|
||||
});
|
||||
|
||||
test('tool gateway exposes cursor executor when enabled', () => {
|
||||
const gateway = createToolGateway({
|
||||
env: {
|
||||
MEMIND_CURSOR_EXECUTOR_ENABLED: '1',
|
||||
MEMIND_TOOL_GATEWAY_CURSOR_TASK_TYPES: 'h5_chat_code_task',
|
||||
},
|
||||
});
|
||||
assert.deepEqual(gateway.getStatus().executors, ['cursor', 'aider', 'openhands']);
|
||||
assert.equal(
|
||||
gateway.selectExecutor({ taskType: 'h5_chat_code_task' }),
|
||||
'cursor',
|
||||
);
|
||||
assert.equal(gateway.selectExecutor({ taskType: 'small_patch' }), 'aider');
|
||||
});
|
||||
|
||||
test('tool gateway honors explicit cursor executor in run metadata', () => {
|
||||
const gateway = createToolGateway({
|
||||
env: { MEMIND_CURSOR_EXECUTOR_ENABLED: '1' },
|
||||
});
|
||||
assert.equal(gateway.selectExecutor({
|
||||
taskType: 'page_data_dev_complex',
|
||||
userMessage: {
|
||||
metadata: {
|
||||
memindRun: {
|
||||
executor: 'cursor',
|
||||
},
|
||||
},
|
||||
},
|
||||
}), 'cursor');
|
||||
});
|
||||
|
||||
test('tool gateway honors requiredExecutor when executor is absent', () => {
|
||||
const gateway = createToolGateway({
|
||||
env: { MEMIND_CURSOR_EXECUTOR_ENABLED: '1' },
|
||||
});
|
||||
assert.equal(gateway.selectExecutor({
|
||||
userMessage: {
|
||||
metadata: {
|
||||
memindRun: {
|
||||
requiredExecutor: 'cursor',
|
||||
channel: 'wechat_mp',
|
||||
},
|
||||
},
|
||||
},
|
||||
}), 'cursor');
|
||||
});
|
||||
|
||||
test('tool gateway selects openhands for configured task types', () => {
|
||||
const gateway = createToolGateway({
|
||||
env: {
|
||||
@@ -144,3 +193,33 @@ test('tool gateway dry run builds executor launch plan without spawning', async
|
||||
assert.equal(plans.length, 1);
|
||||
assert.equal(plans[0].options.instruction, 'fix it');
|
||||
});
|
||||
|
||||
test('tool gateway cursor dry run does not require llm provider service', async () => {
|
||||
const gateway = createToolGateway({
|
||||
env: {
|
||||
MEMIND_TOOL_GATEWAY_ENABLED: '1',
|
||||
MEMIND_TOOL_GATEWAY_DRY_RUN: '1',
|
||||
MEMIND_CURSOR_EXECUTOR_ENABLED: '1',
|
||||
},
|
||||
});
|
||||
|
||||
const result = await gateway.executeJob({
|
||||
runId: 'run-cursor',
|
||||
requestId: 'req-cursor',
|
||||
userId: 'user-1',
|
||||
cwd: '/tmp/work',
|
||||
userMessage: {
|
||||
content: [{ type: 'text', text: 'build page' }],
|
||||
metadata: {
|
||||
memindRun: {
|
||||
requiredExecutor: 'cursor',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(result.dryRun, true);
|
||||
assert.equal(result.executor, 'cursor');
|
||||
assert.equal(result.executorLabel, 'TKMind 智趣');
|
||||
assert.match(String(result.command), /agent$/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user