MCPcopy
hub / github.com/Doorman11991/smallcode / runAgent

Function runAgent

test/e2e_smoke.js:46–80  ·  view source on GitHub ↗
(prompt, opts = {})

Source from the content-addressed store, hash-verified

44}
45
46function runAgent(prompt, opts = {}) {
47 return new Promise((resolve) => {
48 const cwd = opts.cwd || freshTmpDir('e2e');
49 const env = {
50 ...process.env,
51 SMALLCODE_MODEL: MODEL,
52 SMALLCODE_BASE_URL: BASE_URL,
53 SMALLCODE_PROVIDER: 'openai',
54 SMALLCODE_AUTO_APPROVE: 'true',
55 NO_COLOR: '1',
56 FORCE_COLOR: '0',
57 // Keep features deterministic for the smoke run
58 SMALLCODE_REVIEWER: 'false',
59 SMALLCODE_PLAN: 'false',
60 SMALLCODE_BOOTSTRAP: 'false',
61 ...(opts.env || {}),
62 };
63 const child = spawn('node', [SMALLCODE_BIN, '--non-interactive', '-P', prompt], {
64 cwd,
65 env,
66 stdio: ['ignore', 'pipe', 'pipe'],
67 });
68 let stdout = '';
69 let stderr = '';
70 child.stdout.on('data', (d) => { stdout += d.toString(); });
71 child.stderr.on('data', (d) => { stderr += d.toString(); });
72 const t = setTimeout(() => {
73 try { child.kill('SIGKILL'); } catch {}
74 }, TURN_TIMEOUT_S * 1000);
75 child.on('exit', (code) => {
76 clearTimeout(t);
77 resolve({ code, stdout, stderr, cwd });
78 });
79 });
80}
81
82let failures = 0;
83function check(name, ok, details) {

Callers 2

caseIdempotentDedupFunction · 0.85
caseContractGuardFunction · 0.85

Calls 2

freshTmpDirFunction · 0.85
killMethod · 0.80

Tested by

no test coverage detected