@zibby/core 0.1.11 → 0.1.13
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
|
@@ -26,6 +26,8 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
26
26
|
'agent',
|
|
27
27
|
'/usr/local/bin/agent',
|
|
28
28
|
'/usr/local/bin/cursor-agent',
|
|
29
|
+
join(homedir(), '.local', 'bin', 'cursor-agent'),
|
|
30
|
+
join(homedir(), '.cursor', 'bin', 'cursor-agent'),
|
|
29
31
|
'/Applications/Cursor.app/Contents/Resources/app/bin/cursor'
|
|
30
32
|
];
|
|
31
33
|
|
|
@@ -84,6 +86,8 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
84
86
|
'agent',
|
|
85
87
|
'/usr/local/bin/agent',
|
|
86
88
|
'/usr/local/bin/cursor-agent',
|
|
89
|
+
join(homedir(), '.local', 'bin', 'cursor-agent'),
|
|
90
|
+
join(homedir(), '.cursor', 'bin', 'cursor-agent'),
|
|
87
91
|
'/Applications/Cursor.app/Contents/Resources/app/bin/cursor'
|
|
88
92
|
];
|
|
89
93
|
|
|
@@ -113,11 +117,14 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
113
117
|
|
|
114
118
|
if (!cursorBin) {
|
|
115
119
|
throw new Error(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
`Cursor Agent CLI not found or not working.\n\n` +
|
|
121
|
+
`Checked paths:\n` +
|
|
122
|
+
`${possibleBins.map(p => ` - ${p}`).join('\n')}\n\n` +
|
|
123
|
+
`Install cursor-agent:\n` +
|
|
124
|
+
` curl https://cursor.com/install -fsS | bash\n\n` +
|
|
125
|
+
`Then add to PATH:\n` +
|
|
126
|
+
` echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc\n\n` +
|
|
127
|
+
`Test with: agent --version`
|
|
121
128
|
);
|
|
122
129
|
}
|
|
123
130
|
|
|
@@ -322,6 +329,7 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
322
329
|
let lastOutputTime = Date.now();
|
|
323
330
|
let lineCount = 0;
|
|
324
331
|
let killed = false;
|
|
332
|
+
let processStarted = false;
|
|
325
333
|
|
|
326
334
|
const proc = spawn(bin, args, {
|
|
327
335
|
cwd,
|
|
@@ -331,6 +339,24 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
331
339
|
|
|
332
340
|
logger.debug(`[Agent] PID: ${proc.pid}`);
|
|
333
341
|
|
|
342
|
+
const startupTimer = setTimeout(() => {
|
|
343
|
+
if (!processStarted && lineCount === 0) {
|
|
344
|
+
killed = true;
|
|
345
|
+
logger.error(`❌ [Agent] Process failed to start within 5 seconds. Binary may not be in PATH.`);
|
|
346
|
+
logger.error(` Binary: ${bin}`);
|
|
347
|
+
logger.error(` PATH: ${process.env.PATH}`);
|
|
348
|
+
logger.error(` Try: export PATH="$HOME/.local/bin:$PATH"`);
|
|
349
|
+
proc.kill('SIGTERM');
|
|
350
|
+
setTimeout(() => { if (!proc.killed) proc.kill('SIGKILL'); }, 2000);
|
|
351
|
+
reject(new Error(
|
|
352
|
+
`Cursor Agent failed to start. Binary '${bin}' not found or not executable.\n\n` +
|
|
353
|
+
`Install cursor-agent and add ~/.local/bin to your PATH:\n` +
|
|
354
|
+
` curl https://cursor.com/install -fsS | bash\n` +
|
|
355
|
+
` echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc`
|
|
356
|
+
));
|
|
357
|
+
}
|
|
358
|
+
}, 5000);
|
|
359
|
+
|
|
334
360
|
if (stdinPrompt) {
|
|
335
361
|
proc.stdin.write(stdinPrompt);
|
|
336
362
|
proc.stdin.end();
|
|
@@ -434,6 +460,11 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
434
460
|
stdout += chunk;
|
|
435
461
|
lastOutputTime = Date.now();
|
|
436
462
|
|
|
463
|
+
if (!processStarted) {
|
|
464
|
+
processStarted = true;
|
|
465
|
+
clearTimeout(startupTimer);
|
|
466
|
+
}
|
|
467
|
+
|
|
437
468
|
const displayText = streamParser.processChunk(chunk);
|
|
438
469
|
if (displayText) {
|
|
439
470
|
process.stdout.write(displayText);
|
|
@@ -448,6 +479,11 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
448
479
|
stderr += chunk;
|
|
449
480
|
lastOutputTime = Date.now();
|
|
450
481
|
|
|
482
|
+
if (!processStarted) {
|
|
483
|
+
processStarted = true;
|
|
484
|
+
clearTimeout(startupTimer);
|
|
485
|
+
}
|
|
486
|
+
|
|
451
487
|
const lines = chunk.split('\n').filter(l => l.trim());
|
|
452
488
|
for (const line of lines) {
|
|
453
489
|
logger.warn(`⚠️ [Agent stderr] ${line}`);
|
|
@@ -456,6 +492,7 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
456
492
|
|
|
457
493
|
proc.on('close', (code, signal) => {
|
|
458
494
|
clearTimeout(timer);
|
|
495
|
+
clearTimeout(startupTimer);
|
|
459
496
|
clearInterval(heartbeat);
|
|
460
497
|
streamParser.flush();
|
|
461
498
|
const elapsed = Math.round((Date.now() - startTime) / 1000);
|
|
@@ -489,8 +526,14 @@ export class CursorAgentStrategy extends AgentStrategy {
|
|
|
489
526
|
|
|
490
527
|
proc.on('error', (err) => {
|
|
491
528
|
clearTimeout(timer);
|
|
529
|
+
clearTimeout(startupTimer);
|
|
492
530
|
clearInterval(heartbeat);
|
|
493
|
-
reject(new Error(
|
|
531
|
+
reject(new Error(
|
|
532
|
+
`Cursor Agent spawn error: ${err.message}\n` +
|
|
533
|
+
`Binary: ${bin}\n` +
|
|
534
|
+
`This usually means the binary is not in PATH. Try:\n` +
|
|
535
|
+
` echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc`
|
|
536
|
+
));
|
|
494
537
|
});
|
|
495
538
|
});
|
|
496
539
|
}
|
|
@@ -47,13 +47,12 @@ export class BrowserTestAutomationAgent extends WorkflowAgent {
|
|
|
47
47
|
BrowserTestResultHandler.saveTitle(result, cwd);
|
|
48
48
|
await BrowserTestResultHandler.saveExecutionData(result);
|
|
49
49
|
|
|
50
|
-
if
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
50
|
+
// Memory end-run hook (if @zibby/memory is installed)
|
|
51
|
+
try {
|
|
52
|
+
const { memoryEndRun, memorySyncPush } = await import('@zibby/memory');
|
|
53
|
+
const sessionId = result.state.sessionPath?.split('/').pop();
|
|
54
|
+
memoryEndRun(cwd, { sessionId, passed: result.success !== false });
|
|
55
|
+
memorySyncPush(cwd);
|
|
56
|
+
} catch { /* @zibby/memory not available */ }
|
|
58
57
|
}
|
|
59
58
|
}
|
|
@@ -14,7 +14,7 @@ import { formatAssertionChecklist } from './utils.mjs';
|
|
|
14
14
|
|
|
15
15
|
export const executeLiveNode = {
|
|
16
16
|
name: 'execute_live',
|
|
17
|
-
skills: [SKILLS.BROWSER,
|
|
17
|
+
skills: [SKILLS.BROWSER, SKILLS.MEMORY],
|
|
18
18
|
timeout: 600000,
|
|
19
19
|
|
|
20
20
|
prompt: (state) => {
|