test(cursor): add executor routing and help remediation scenarios
Memind CI / Test, build, and release guards (push) Successful in 10m3s
Memind CI / Test, build, and release guards (push) Successful in 10m3s
Add dry-run, e2e, and poem-page remediation scripts for cursor executor and help escalation verification. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Dry-run Cursor executor launch plan via Tool Gateway (no agent spawn).
|
||||
*
|
||||
* Usage:
|
||||
* MEMIND_CURSOR_EXECUTOR_ENABLED=1 \
|
||||
* MEMIND_TOOL_GATEWAY_ENABLED=1 \
|
||||
* MEMIND_TOOL_GATEWAY_DRY_RUN=1 \
|
||||
* node scripts/test-cursor-executor-dry-run.mjs
|
||||
*/
|
||||
|
||||
import { buildCursorExecutorLaunchPlan } from '../cursor-agent-launch.mjs';
|
||||
import { createToolGateway } from '../tool-gateway.mjs';
|
||||
|
||||
const cwd = process.argv[2] ?? process.cwd();
|
||||
const instruction = process.argv[3]
|
||||
?? '写一首春日诗,生成精美 HTML 页面 public/spring-poem.html';
|
||||
|
||||
process.env.MEMIND_CURSOR_EXECUTOR_ENABLED = process.env.MEMIND_CURSOR_EXECUTOR_ENABLED ?? '1';
|
||||
process.env.MEMIND_TOOL_GATEWAY_ENABLED = process.env.MEMIND_TOOL_GATEWAY_ENABLED ?? '1';
|
||||
process.env.MEMIND_TOOL_GATEWAY_DRY_RUN = process.env.MEMIND_TOOL_GATEWAY_DRY_RUN ?? '1';
|
||||
|
||||
const gateway = createToolGateway({
|
||||
env: process.env,
|
||||
llmProviderService: {
|
||||
async getExecutorLaunchPlan(executor, options) {
|
||||
return buildCursorExecutorLaunchPlan({
|
||||
cwd: options.cwd,
|
||||
instruction: options.instruction,
|
||||
env: process.env,
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const status = gateway.getStatus();
|
||||
console.log('[cursor-executor-dry-run] gateway status:', JSON.stringify(status, null, 2));
|
||||
|
||||
const result = await gateway.executeJob({
|
||||
runId: 'dry-run-cursor',
|
||||
requestId: 'dry-run-req',
|
||||
userId: 'local-user',
|
||||
cwd,
|
||||
taskType: 'h5_chat_code_task',
|
||||
userMessage: {
|
||||
content: [{ type: 'text', text: instruction }],
|
||||
metadata: {
|
||||
memindRun: {
|
||||
executor: 'cursor',
|
||||
toolMode: 'code',
|
||||
taskType: 'h5_chat_code_task',
|
||||
validation: {
|
||||
expectedFile: { path: 'public/spring-poem.html' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
console.log('[cursor-executor-dry-run] result:', JSON.stringify(result, null, 2));
|
||||
|
||||
if (!result?.ok || result.executor !== 'cursor') {
|
||||
process.exitCode = 1;
|
||||
}
|
||||
Reference in New Issue
Block a user