mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
fix(daemon): stop passing literal dash to cursor-agent (#160)
This commit is contained in:
parent
8f34e39b7b
commit
39c0399ded
2 changed files with 20 additions and 3 deletions
|
|
@ -312,8 +312,10 @@ export const AGENT_DEFS = [
|
|||
{ id: 'sonnet-4-thinking', label: 'sonnet-4-thinking' },
|
||||
{ id: 'gpt-5', label: 'gpt-5' },
|
||||
],
|
||||
// Prompt delivered via stdin (`cursor-agent -`) to avoid Windows
|
||||
// `spawn ENAMETOOLONG` while preserving Cursor Agent's structured stream.
|
||||
// Cursor Agent does not use `-` as a "read prompt from stdin" sentinel.
|
||||
// Passing it makes the CLI treat the dash as the literal user prompt,
|
||||
// which then surfaces as "your message only contains '-'". Keep stdin
|
||||
// piped for prompt delivery, but do not append a fake prompt arg.
|
||||
buildArgs: (_prompt, _imagePaths, _extra, options = {}, runtimeContext = {}) => {
|
||||
const args = [];
|
||||
args.push('--print', '--output-format', 'stream-json', '--stream-partial-output', '--force', '--trust');
|
||||
|
|
@ -323,7 +325,6 @@ export const AGENT_DEFS = [
|
|||
if (options.model && options.model !== 'default') {
|
||||
args.push('--model', options.model);
|
||||
}
|
||||
args.push('-');
|
||||
return args;
|
||||
},
|
||||
promptViaStdin: true,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import assert from 'node:assert/strict';
|
|||
import { AGENT_DEFS } from '../src/agents.js';
|
||||
|
||||
const codex = AGENT_DEFS.find((agent) => agent.id === 'codex');
|
||||
const cursorAgent = AGENT_DEFS.find((agent) => agent.id === 'cursor-agent');
|
||||
const originalDisablePlugins = process.env.OD_CODEX_DISABLE_PLUGINS;
|
||||
|
||||
afterEach(() => {
|
||||
|
|
@ -49,3 +50,18 @@ test('codex args keep plugins enabled when OD_CODEX_DISABLE_PLUGINS is not 1', (
|
|||
assert.equal(args.includes('plugins'), false);
|
||||
assert.equal(args.at(-1), '-');
|
||||
});
|
||||
|
||||
test('cursor-agent args deliver prompts via stdin without passing a literal dash prompt', () => {
|
||||
const args = cursorAgent.buildArgs('', [], [], {}, { cwd: '/tmp/od-project' });
|
||||
|
||||
assert.deepEqual(args, [
|
||||
'--print',
|
||||
'--output-format',
|
||||
'stream-json',
|
||||
'--stream-partial-output',
|
||||
'--force',
|
||||
'--trust',
|
||||
'--workspace',
|
||||
'/tmp/od-project',
|
||||
]);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue