add instructions for agent host development

This commit is contained in:
Connor Peet
2026-03-13 10:10:17 -07:00
parent 247bd102ef
commit b1781a18ba
3 changed files with 51 additions and 9 deletions

View File

@@ -11,24 +11,39 @@ const minimist = require('minimist');
async function main() {
const args = minimist(process.argv.slice(2), {
boolean: ['help', 'no-launch'],
string: ['port'],
boolean: ['help', 'enable-mock-agent', 'quiet'],
string: ['port', 'log'],
});
if (args.help) {
console.log(
'Usage: ./scripts/code-agent-host.sh [options]\n' +
'\n' +
'Options:\n' +
' --port <number> Port to listen on (default: 8081, or VSCODE_AGENT_HOST_PORT env)\n' +
' --no-launch Start server without additional actions\n' +
' --help Show this help message',
'\n' +
'Options:\n' +
' --port <number> Port to listen on (default: 8081, or VSCODE_AGENT_HOST_PORT env)\n' +
' --enable-mock-agent Enable the mock agent for testing\n' +
' --quiet Suppress logging output\n' +
' --log <level> Log level to use (trace, debug, info, warning, error, off)\n' +
' --help Show this help message',
);
return;
}
const port = args.port || process.env['VSCODE_AGENT_HOST_PORT'] || '8081';
const addr = await startServer(['--port', String(port)]);
/** @type {string[]} */
const serverArgs = ['--port', String(port)];
if (args['enable-mock-agent']) {
serverArgs.push('--enable-mock-agent');
}
if (args.quiet) {
serverArgs.push('--quiet');
}
if (args.log) {
serverArgs.push('--log', String(args.log));
}
const addr = await startServer(serverArgs);
console.log(`Agent Host server listening on ${addr}`);
}