@zibby/core 0.1.15 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zibby/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Core test automation engine with multi-agent and multi-MCP support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -26,14 +26,13 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"test": "vitest run",
|
|
29
|
+
"test": "vitest run --exclude '**/memory/**'",
|
|
30
30
|
"test:watch": "vitest",
|
|
31
31
|
"test:state-schema": "vitest run src/framework/__tests__/state-schema.test.js",
|
|
32
32
|
"test:state-schema:e2e": "node src/framework/__tests__/state-schema.e2e.test.js",
|
|
33
33
|
"export:workflows": "node scripts/export-default-workflows.js",
|
|
34
34
|
"lint": "eslint .",
|
|
35
|
-
"lint:fix": "eslint --fix ."
|
|
36
|
-
"prepublishOnly": "npm run lint && npm test"
|
|
35
|
+
"lint:fix": "eslint --fix ."
|
|
37
36
|
},
|
|
38
37
|
"keywords": [
|
|
39
38
|
"testing",
|
|
@@ -327,6 +327,7 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
327
327
|
let lineCount = 0;
|
|
328
328
|
let killed = false;
|
|
329
329
|
let processStarted = false;
|
|
330
|
+
let processClosed = false;
|
|
330
331
|
|
|
331
332
|
const proc = spawn(bin, args, {
|
|
332
333
|
cwd,
|
|
@@ -336,58 +337,21 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
336
337
|
|
|
337
338
|
logger.debug(`[Agent] PID: ${proc.pid}`);
|
|
338
339
|
|
|
339
|
-
|
|
340
|
-
if (!processStarted && lineCount === 0) {
|
|
341
|
-
killed = true;
|
|
342
|
-
const binaryPath = bin.replace(/^"(.*)"$/, '$1');
|
|
343
|
-
const binaryExists = existsSync(binaryPath);
|
|
344
|
-
|
|
345
|
-
logger.error(`❌ [Agent] Process failed to start within 5 seconds.`);
|
|
346
|
-
logger.error(` Binary: ${bin}`);
|
|
347
|
-
logger.error(` File exists: ${binaryExists ? 'Yes (but not working - may be corrupted)' : 'No'}`);
|
|
348
|
-
logger.error(` PATH includes ~/.local/bin: ${process.env.PATH.includes('.local/bin') ? 'Yes' : 'No'}`);
|
|
349
|
-
|
|
350
|
-
if (binaryExists) {
|
|
351
|
-
logger.error(`\n ⚠️ Binary exists but won't start. Try reinstalling:`);
|
|
352
|
-
logger.error(` rm -f "${binaryPath}"`);
|
|
353
|
-
logger.error(` curl https://cursor.com/install -fsS | bash`);
|
|
354
|
-
logger.error(` echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc`);
|
|
355
|
-
} else {
|
|
356
|
-
logger.error(`\n Install cursor-agent:`);
|
|
357
|
-
logger.error(` curl https://cursor.com/install -fsS | bash`);
|
|
358
|
-
logger.error(` echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc`);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
proc.kill('SIGTERM');
|
|
362
|
-
setTimeout(() => { if (!proc.killed) proc.kill('SIGKILL'); }, 2000);
|
|
363
|
-
reject(new Error(
|
|
364
|
-
`Cursor Agent failed to start. Binary '${binaryPath}' ${binaryExists ? 'exists but is not working (corrupted?)' : 'not found'}.\n\n` +
|
|
365
|
-
`${binaryExists
|
|
366
|
-
? '⚠️ The binary file exists but failed to start. It may be corrupted or incomplete.\n\n' +
|
|
367
|
-
'Try reinstalling cursor-agent:\n' +
|
|
368
|
-
` rm -f "${binaryPath}"\n` +
|
|
369
|
-
' curl https://cursor.com/install -fsS | bash\n\n' +
|
|
370
|
-
'Ensure ~/.local/bin is in your PATH:\n' +
|
|
371
|
-
' echo \'export PATH="$HOME/.local/bin:$PATH"\' >> ~/.zshrc\n' +
|
|
372
|
-
' source ~/.zshrc\n\n' +
|
|
373
|
-
'Test with: agent --version'
|
|
374
|
-
: 'Install cursor-agent:\n' +
|
|
375
|
-
' curl https://cursor.com/install -fsS | bash\n\n' +
|
|
376
|
-
'Add ~/.local/bin to your PATH:\n' +
|
|
377
|
-
' echo \'export PATH="$HOME/.local/bin:$PATH"\' >> ~/.zshrc\n' +
|
|
378
|
-
' source ~/.zshrc\n\n' +
|
|
379
|
-
'Test with: agent --version'
|
|
380
|
-
}`
|
|
381
|
-
));
|
|
382
|
-
}
|
|
383
|
-
}, 5000);
|
|
384
|
-
|
|
340
|
+
// Handle stdin write errors gracefully
|
|
385
341
|
if (stdinPrompt) {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
342
|
+
try {
|
|
343
|
+
proc.stdin.write(stdinPrompt);
|
|
344
|
+
proc.stdin.end();
|
|
345
|
+
logger.debug(`[Agent] Prompt also piped to stdin (${stdinPrompt.length} chars)`);
|
|
346
|
+
} catch (err) {
|
|
347
|
+
logger.warn(`[Agent] Failed to write to stdin: ${err.message}`);
|
|
348
|
+
}
|
|
389
349
|
} else {
|
|
390
|
-
|
|
350
|
+
try {
|
|
351
|
+
proc.stdin.end();
|
|
352
|
+
} catch (err) {
|
|
353
|
+
// Process may have already closed
|
|
354
|
+
}
|
|
391
355
|
}
|
|
392
356
|
|
|
393
357
|
const modifiedFiles = new Set();
|
|
@@ -487,12 +451,18 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
487
451
|
|
|
488
452
|
if (!processStarted) {
|
|
489
453
|
processStarted = true;
|
|
490
|
-
clearTimeout(startupTimer);
|
|
491
454
|
}
|
|
492
455
|
|
|
493
456
|
const displayText = streamParser.processChunk(chunk);
|
|
494
|
-
if (displayText) {
|
|
495
|
-
|
|
457
|
+
if (displayText && !processClosed) {
|
|
458
|
+
try {
|
|
459
|
+
process.stdout.write(displayText);
|
|
460
|
+
} catch (err) {
|
|
461
|
+
// Handle EPIPE gracefully - parent process stdout may be closed
|
|
462
|
+
if (err.code !== 'EPIPE') {
|
|
463
|
+
logger.warn(`[Agent] stdout write error: ${err.message}`);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
496
466
|
}
|
|
497
467
|
|
|
498
468
|
const lines = chunk.split('\n').filter(l => l.trim());
|
|
@@ -506,7 +476,6 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
506
476
|
|
|
507
477
|
if (!processStarted) {
|
|
508
478
|
processStarted = true;
|
|
509
|
-
clearTimeout(startupTimer);
|
|
510
479
|
}
|
|
511
480
|
|
|
512
481
|
const lines = chunk.split('\n').filter(l => l.trim());
|
|
@@ -516,8 +485,8 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
516
485
|
});
|
|
517
486
|
|
|
518
487
|
proc.on('close', (code, signal) => {
|
|
488
|
+
processClosed = true;
|
|
519
489
|
clearTimeout(timer);
|
|
520
|
-
clearTimeout(startupTimer);
|
|
521
490
|
clearInterval(heartbeat);
|
|
522
491
|
streamParser.flush();
|
|
523
492
|
const elapsed = Math.round((Date.now() - startTime) / 1000);
|
|
@@ -551,7 +520,6 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
551
520
|
|
|
552
521
|
proc.on('error', (err) => {
|
|
553
522
|
clearTimeout(timer);
|
|
554
|
-
clearTimeout(startupTimer);
|
|
555
523
|
clearInterval(heartbeat);
|
|
556
524
|
reject(new Error(
|
|
557
525
|
`Cursor Agent spawn error: ${err.message}\n` +
|