(
config: CliBackendConfig,
params: {
prompt?: string;
sessionId: string;
model?: string;
systemPrompt?: string;
},
)
| 23 | * path). Session id flows through `sessionArg` when the agent supports it. |
| 24 | */ |
| 25 | export function buildStartArgs( |
| 26 | config: CliBackendConfig, |
| 27 | params: { |
| 28 | prompt?: string; |
| 29 | sessionId: string; |
| 30 | model?: string; |
| 31 | systemPrompt?: string; |
| 32 | }, |
| 33 | ): string[] { |
| 34 | const args = [...(config.args || [])]; |
| 35 | |
| 36 | if (config.sessionArg && config.sessionMode === 'always') { |
| 37 | args.push(config.sessionArg, params.sessionId); |
| 38 | } |
| 39 | |
| 40 | if (config.allowedTools && config.allowedTools.length > 0) { |
| 41 | for (const tool of config.allowedTools) { |
| 42 | args.push('--allowedTools', tool); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | if (config.disallowedTools && config.disallowedTools.length > 0) { |
| 47 | for (const tool of config.disallowedTools) { |
| 48 | args.push('--disallowedTools', tool); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | if (params.model && config.modelArg) { |
| 53 | args.push(config.modelArg, params.model); |
| 54 | } |
| 55 | |
| 56 | if (params.systemPrompt && config.systemPromptArg) { |
| 57 | args.push(config.systemPromptArg, params.systemPrompt); |
| 58 | } |
| 59 | |
| 60 | if (params.prompt) { |
| 61 | args.push(params.prompt); |
| 62 | } |
| 63 | return args; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Build CLI args for resuming an agent via `resumeArgs` (`{sessionId}` is |
no test coverage detected