xibecode 0.9.1 → 0.9.3
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/README.md +3 -23
- package/dist/commands/run-pr.js +1 -1
- package/dist/commands/run.js +1 -1
- package/dist/components/AssistantMarkdown.d.ts +1 -0
- package/dist/components/AssistantMarkdown.d.ts.map +1 -1
- package/dist/components/AssistantMarkdown.js +20 -6
- package/dist/components/AssistantMarkdown.js.map +1 -1
- package/dist/constants/spinnerVerbs.d.ts +6 -0
- package/dist/constants/spinnerVerbs.d.ts.map +1 -0
- package/dist/constants/spinnerVerbs.js +202 -0
- package/dist/constants/spinnerVerbs.js.map +1 -0
- package/dist/core/agent.d.ts +2 -1
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +30 -14
- package/dist/core/agent.js.map +1 -1
- package/dist/core/modes.d.ts +3 -1
- package/dist/core/modes.d.ts.map +1 -1
- package/dist/core/modes.js +16 -7
- package/dist/core/modes.js.map +1 -1
- package/dist/core/swarm.d.ts +15 -0
- package/dist/core/swarm.d.ts.map +1 -1
- package/dist/core/swarm.js +32 -0
- package/dist/core/swarm.js.map +1 -1
- package/dist/core/tools.d.ts +3 -3
- package/dist/core/tools.d.ts.map +1 -1
- package/dist/core/tools.js +102 -87
- package/dist/core/tools.js.map +1 -1
- package/dist/ui/claude-style-chat.d.ts.map +1 -1
- package/dist/ui/claude-style-chat.js +170 -12
- package/dist/ui/claude-style-chat.js.map +1 -1
- package/dist/ui/enhanced-tui.d.ts.map +1 -1
- package/dist/ui/enhanced-tui.js +8 -0
- package/dist/ui/enhanced-tui.js.map +1 -1
- package/dist/utils/auto-memory.d.ts +24 -0
- package/dist/utils/auto-memory.d.ts.map +1 -0
- package/dist/utils/auto-memory.js +153 -0
- package/dist/utils/auto-memory.js.map +1 -0
- package/dist/utils/tool-display.d.ts +5 -0
- package/dist/utils/tool-display.d.ts.map +1 -1
- package/dist/utils/tool-display.js +58 -1
- package/dist/utils/tool-display.js.map +1 -1
- package/dist/webui/server.js +1 -1
- package/package.json +3 -12
package/dist/core/tools.js
CHANGED
|
@@ -9,11 +9,9 @@ import { GitUtils } from '../utils/git.js';
|
|
|
9
9
|
import { TestRunnerDetector } from '../utils/testRunner.js';
|
|
10
10
|
import { SafetyChecker, sanitizePath, sanitizeUrl } from '../utils/safety.js';
|
|
11
11
|
import { PluginManager } from './plugins.js';
|
|
12
|
-
import { BrowserManager } from '../tools/browser.js';
|
|
13
12
|
import * as os from 'os';
|
|
14
13
|
import { SkillManager } from './skills.js';
|
|
15
14
|
import { TestGenerator, writeTestFile } from '../tools/test-generator.js';
|
|
16
|
-
import { VisualFeedbackProvider } from './visual-feedback.js';
|
|
17
15
|
import { PatternMiner } from './pattern-miner.js';
|
|
18
16
|
import { BackgroundAgentManager } from './background-agent.js';
|
|
19
17
|
import { CodeGraph } from './code-graph.js';
|
|
@@ -21,6 +19,8 @@ import { ConflictSolver } from './conflict-solver.js';
|
|
|
21
19
|
import { SwarmOrchestrator } from './swarm.js';
|
|
22
20
|
import { PermissionManager } from './permissions.js';
|
|
23
21
|
const execAsync = promisify(exec);
|
|
22
|
+
/** Returned by former Playwright-backed browser tools; XibeCode does not bundle browsers. */
|
|
23
|
+
export const NO_EMBEDDED_BROWSER_MESSAGE = 'XibeCode does not bundle Playwright or download Chromium. Use run_command with agent-browser (e.g. agent-browser open <url>, agent-browser screenshot out.png) or your environment browser MCP. For Playwright E2E in a repo, add @playwright/test there and run it via run_command.';
|
|
24
24
|
/**
|
|
25
25
|
* Main tool executor for XibeCode agent
|
|
26
26
|
*
|
|
@@ -32,7 +32,7 @@ const execAsync = promisify(exec);
|
|
|
32
32
|
* - Context Operations: code search, file finding, context discovery
|
|
33
33
|
* - Test Operations: run tests, get results
|
|
34
34
|
* - Memory Operations: update neural memory
|
|
35
|
-
* - Browser
|
|
35
|
+
* - Browser guidance: use run_command + agent-browser (no bundled browser)
|
|
36
36
|
*
|
|
37
37
|
* Features:
|
|
38
38
|
* - Mode-based tool permissions
|
|
@@ -76,8 +76,6 @@ export class CodingToolExecutor {
|
|
|
76
76
|
pluginManager;
|
|
77
77
|
mcpClientManager;
|
|
78
78
|
memory;
|
|
79
|
-
browserManager;
|
|
80
|
-
visualFeedback;
|
|
81
79
|
skillManager;
|
|
82
80
|
patternMiner;
|
|
83
81
|
backgroundAgent;
|
|
@@ -131,8 +129,6 @@ export class CodingToolExecutor {
|
|
|
131
129
|
this.pluginManager = options?.pluginManager || new PluginManager();
|
|
132
130
|
this.mcpClientManager = options?.mcpClientManager;
|
|
133
131
|
this.memory = options?.memory;
|
|
134
|
-
this.browserManager = new BrowserManager();
|
|
135
|
-
this.visualFeedback = new VisualFeedbackProvider(workingDir);
|
|
136
132
|
this.patternMiner = new PatternMiner(workingDir);
|
|
137
133
|
this.backgroundAgent = new BackgroundAgentManager(workingDir);
|
|
138
134
|
this.codeGraph = new CodeGraph(workingDir);
|
|
@@ -536,56 +532,15 @@ export class CodingToolExecutor {
|
|
|
536
532
|
await this.memory.addMemory(p.trigger, p.action, p.outcome, p.tags || []);
|
|
537
533
|
return { success: true, message: 'Lesson learned and saved to neural memory.' };
|
|
538
534
|
}
|
|
539
|
-
case 'take_screenshot':
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
case '
|
|
547
|
-
|
|
548
|
-
return { error: true, success: false, message: 'Missing url' };
|
|
549
|
-
return this.browserManager.getConsoleLogs(p.url);
|
|
550
|
-
}
|
|
551
|
-
case 'run_visual_test': {
|
|
552
|
-
if (!p.url || typeof p.url !== 'string')
|
|
553
|
-
return { error: true, success: false, message: 'Missing url' };
|
|
554
|
-
if (!p.baseline_path || typeof p.baseline_path !== 'string')
|
|
555
|
-
return { error: true, success: false, message: 'Missing baseline_path' };
|
|
556
|
-
const outputDir = p.output_dir || '.playwright-baselines';
|
|
557
|
-
return this.browserManager.runVisualTest(p.url, this.resolvePath(p.baseline_path), this.resolvePath(outputDir));
|
|
558
|
-
}
|
|
559
|
-
case 'check_accessibility': {
|
|
560
|
-
if (!p.url || typeof p.url !== 'string')
|
|
561
|
-
return { error: true, success: false, message: 'Missing url' };
|
|
562
|
-
return this.browserManager.checkAccessibility(p.url);
|
|
563
|
-
}
|
|
564
|
-
case 'measure_performance': {
|
|
565
|
-
if (!p.url || typeof p.url !== 'string')
|
|
566
|
-
return { error: true, success: false, message: 'Missing url' };
|
|
567
|
-
return this.browserManager.measurePerformance(p.url);
|
|
568
|
-
}
|
|
569
|
-
case 'test_responsive': {
|
|
570
|
-
if (!p.url || typeof p.url !== 'string')
|
|
571
|
-
return { error: true, success: false, message: 'Missing url' };
|
|
572
|
-
const outputDir = p.output_dir || '.responsive-screenshots';
|
|
573
|
-
return this.browserManager.testResponsive(p.url, this.resolvePath(outputDir), p.viewports);
|
|
574
|
-
}
|
|
575
|
-
case 'capture_network': {
|
|
576
|
-
if (!p.url || typeof p.url !== 'string')
|
|
577
|
-
return { error: true, success: false, message: 'Missing url' };
|
|
578
|
-
return this.browserManager.captureNetworkRequests(p.url);
|
|
579
|
-
}
|
|
580
|
-
case 'run_playwright_test': {
|
|
581
|
-
if (!p.test_path || typeof p.test_path !== 'string')
|
|
582
|
-
return { error: true, success: false, message: 'Missing test_path' };
|
|
583
|
-
return this.browserManager.runPlaywrightTest(this.resolvePath(p.test_path), {
|
|
584
|
-
headed: p.headed,
|
|
585
|
-
browser: p.browser,
|
|
586
|
-
timeout: p.timeout,
|
|
587
|
-
});
|
|
588
|
-
}
|
|
535
|
+
case 'take_screenshot':
|
|
536
|
+
case 'get_console_logs':
|
|
537
|
+
case 'run_visual_test':
|
|
538
|
+
case 'check_accessibility':
|
|
539
|
+
case 'measure_performance':
|
|
540
|
+
case 'test_responsive':
|
|
541
|
+
case 'capture_network':
|
|
542
|
+
case 'preview_app':
|
|
543
|
+
return { error: true, success: false, message: NO_EMBEDDED_BROWSER_MESSAGE };
|
|
589
544
|
case 'search_skills_sh': {
|
|
590
545
|
if (!p.query || typeof p.query !== 'string') {
|
|
591
546
|
return { error: true, success: false, message: 'Missing required parameter: query (string)' };
|
|
@@ -611,12 +566,6 @@ export class CodingToolExecutor {
|
|
|
611
566
|
maxTestsPerFunction: p.max_tests_per_function,
|
|
612
567
|
}, p.write_file);
|
|
613
568
|
}
|
|
614
|
-
case 'preview_app': {
|
|
615
|
-
if (!p.url || typeof p.url !== 'string') {
|
|
616
|
-
return { error: true, success: false, message: 'Missing required parameter: url (string)' };
|
|
617
|
-
}
|
|
618
|
-
return this.visualFeedback.capture(p.url, { fullPage: p.full_page });
|
|
619
|
-
}
|
|
620
569
|
case 'mine_project_patterns': {
|
|
621
570
|
const patterns = await this.patternMiner.mine();
|
|
622
571
|
if (patterns.length === 0) {
|
|
@@ -725,6 +674,51 @@ export class CodingToolExecutor {
|
|
|
725
674
|
worker: p.worker_type
|
|
726
675
|
};
|
|
727
676
|
}
|
|
677
|
+
case 'run_swarm': {
|
|
678
|
+
const subtasks = p.subtasks;
|
|
679
|
+
if (!Array.isArray(subtasks) || subtasks.length === 0) {
|
|
680
|
+
return { error: true, success: false, message: 'run_swarm requires a non-empty subtasks array' };
|
|
681
|
+
}
|
|
682
|
+
const normalized = [];
|
|
683
|
+
for (let i = 0; i < subtasks.length; i++) {
|
|
684
|
+
const st = subtasks[i];
|
|
685
|
+
if (!st || typeof st !== 'object') {
|
|
686
|
+
return { error: true, success: false, message: `Invalid subtasks[${i}]: expected object` };
|
|
687
|
+
}
|
|
688
|
+
const task = st.task;
|
|
689
|
+
const worker_type = st.worker_type;
|
|
690
|
+
if (typeof task !== 'string' || !task.trim()) {
|
|
691
|
+
return { error: true, success: false, message: `subtasks[${i}].task must be a non-empty string` };
|
|
692
|
+
}
|
|
693
|
+
if (typeof worker_type !== 'string' || !isValidMode(worker_type)) {
|
|
694
|
+
return {
|
|
695
|
+
error: true,
|
|
696
|
+
success: false,
|
|
697
|
+
message: `subtasks[${i}].worker_type must be a valid AgentMode (got ${String(worker_type)})`,
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
normalized.push({ mode: worker_type, task: task.trim() });
|
|
701
|
+
}
|
|
702
|
+
const timeoutMs = typeof p.timeout_ms === 'number' && Number.isFinite(p.timeout_ms) && p.timeout_ms > 0
|
|
703
|
+
? Math.floor(p.timeout_ms)
|
|
704
|
+
: undefined;
|
|
705
|
+
const maxConcurrent = typeof p.max_parallel === 'number' && Number.isFinite(p.max_parallel) && p.max_parallel > 0
|
|
706
|
+
? Math.floor(p.max_parallel)
|
|
707
|
+
: undefined;
|
|
708
|
+
const results = await this.swarmOrchestrator.delegateSubtasksParallel(normalized, {
|
|
709
|
+
timeoutMs,
|
|
710
|
+
maxConcurrent,
|
|
711
|
+
});
|
|
712
|
+
const success = results.every((r) => r.success);
|
|
713
|
+
return {
|
|
714
|
+
success,
|
|
715
|
+
parallel: true,
|
|
716
|
+
results,
|
|
717
|
+
message: success
|
|
718
|
+
? 'All swarm subtasks finished successfully.'
|
|
719
|
+
: 'One or more swarm subtasks failed, timed out, or were killed.',
|
|
720
|
+
};
|
|
721
|
+
}
|
|
728
722
|
case 'synthesize_tool': {
|
|
729
723
|
const name = typeof p.name === 'string' ? p.name.trim() : '';
|
|
730
724
|
const description = typeof p.description === 'string' ? p.description.trim() : '';
|
|
@@ -743,7 +737,7 @@ export class CodingToolExecutor {
|
|
|
743
737
|
return { success: true, message: `Tool "${name}" registered. You can call it with the same name. Execution is sandboxed.` };
|
|
744
738
|
}
|
|
745
739
|
default:
|
|
746
|
-
return { error: true, success: false, message: `Unknown tool: ${toolName}. Available tools: read_file, read_multiple_files, write_file, edit_file, edit_lines, insert_at_line, verified_edit, list_directory, search_files, run_command, create_directory, delete_file, move_file, get_context, revert_file, run_tests, get_test_status, get_git_status, get_git_diff_summary, get_git_changed_files, create_git_checkpoint, revert_to_git_checkpoint, git_show_diff, get_mcp_status, grep_code, web_search, fetch_url, remember_lesson, synthesize_tool, take_screenshot, get_console_logs, run_visual_test, check_accessibility, measure_performance, test_responsive, capture_network,
|
|
740
|
+
return { error: true, success: false, message: `Unknown tool: ${toolName}. Available tools: read_file, read_multiple_files, write_file, edit_file, edit_lines, insert_at_line, verified_edit, list_directory, search_files, run_command, create_directory, delete_file, move_file, get_context, revert_file, run_tests, get_test_status, get_git_status, get_git_diff_summary, get_git_changed_files, create_git_checkpoint, revert_to_git_checkpoint, git_show_diff, get_mcp_status, grep_code, web_search, fetch_url, remember_lesson, synthesize_tool, take_screenshot, get_console_logs, run_visual_test, check_accessibility, measure_performance, test_responsive, capture_network, search_skills_sh, install_skill_from_skills_sh, preview_app, delegate_subtask, run_swarm` };
|
|
747
741
|
}
|
|
748
742
|
}
|
|
749
743
|
catch (err) {
|
|
@@ -955,7 +949,7 @@ export class CodingToolExecutor {
|
|
|
955
949
|
},
|
|
956
950
|
{
|
|
957
951
|
name: 'preview_app',
|
|
958
|
-
description: '
|
|
952
|
+
description: 'Disabled: no bundled browser. Returns guidance to use run_command with agent-browser or a browser MCP. Previously captured a screenshot and simplified DOM summary.',
|
|
959
953
|
input_schema: {
|
|
960
954
|
type: 'object',
|
|
961
955
|
properties: {
|
|
@@ -1329,6 +1323,41 @@ export class CodingToolExecutor {
|
|
|
1329
1323
|
required: ['task', 'worker_type']
|
|
1330
1324
|
}
|
|
1331
1325
|
},
|
|
1326
|
+
{
|
|
1327
|
+
name: 'run_swarm',
|
|
1328
|
+
description: 'Run multiple specialized sub-agents in parallel (separate background processes) to save wall-clock time. Each entry has worker_type + task. Cap concurrent workers with max_parallel (default 6). Risk: workers editing the same files can conflict—split work by disjoint paths or use delegate_subtask serially when unsure.',
|
|
1329
|
+
input_schema: {
|
|
1330
|
+
type: 'object',
|
|
1331
|
+
properties: {
|
|
1332
|
+
subtasks: {
|
|
1333
|
+
type: 'array',
|
|
1334
|
+
description: 'One object per worker; each runs as an isolated sub-agent.',
|
|
1335
|
+
items: {
|
|
1336
|
+
type: 'object',
|
|
1337
|
+
properties: {
|
|
1338
|
+
task: { type: 'string', description: 'Task for this worker only.' },
|
|
1339
|
+
worker_type: {
|
|
1340
|
+
type: 'string',
|
|
1341
|
+
description: 'Agent mode for this worker',
|
|
1342
|
+
enum: ['plan', 'agent', 'tester', 'debugger', 'security', 'review', 'team_leader', 'seo', 'product', 'architect', 'engineer', 'data', 'researcher']
|
|
1343
|
+
}
|
|
1344
|
+
},
|
|
1345
|
+
required: ['task', 'worker_type']
|
|
1346
|
+
},
|
|
1347
|
+
minItems: 1
|
|
1348
|
+
},
|
|
1349
|
+
timeout_ms: {
|
|
1350
|
+
type: 'number',
|
|
1351
|
+
description: 'Optional per-subtask timeout in ms (same as delegate_subtask; default five minutes).'
|
|
1352
|
+
},
|
|
1353
|
+
max_parallel: {
|
|
1354
|
+
type: 'number',
|
|
1355
|
+
description: 'Max concurrent background agents (default 6). Lower on small machines; raise only if subtasks are independent.'
|
|
1356
|
+
}
|
|
1357
|
+
},
|
|
1358
|
+
required: ['subtasks']
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1332
1361
|
{
|
|
1333
1362
|
name: 'grep_code',
|
|
1334
1363
|
description: 'Search for a text pattern across your codebase using ripgrep (or grep fallback). Returns matching file paths, line numbers, and line content. Use this to find function usages, variable references, imports, error messages, etc. Much faster than reading files one by one.',
|
|
@@ -1406,7 +1435,7 @@ export class CodingToolExecutor {
|
|
|
1406
1435
|
},
|
|
1407
1436
|
{
|
|
1408
1437
|
name: 'take_screenshot',
|
|
1409
|
-
description: '
|
|
1438
|
+
description: 'Disabled: no bundled browser. Returns guidance; use run_command with agent-browser screenshot or a browser MCP for captures.',
|
|
1410
1439
|
input_schema: {
|
|
1411
1440
|
type: 'object',
|
|
1412
1441
|
properties: {
|
|
@@ -1419,7 +1448,7 @@ export class CodingToolExecutor {
|
|
|
1419
1448
|
},
|
|
1420
1449
|
{
|
|
1421
1450
|
name: 'get_console_logs',
|
|
1422
|
-
description: '
|
|
1451
|
+
description: 'Disabled: no bundled browser. Returns guidance; use agent-browser or host browser tooling for console capture.',
|
|
1423
1452
|
input_schema: {
|
|
1424
1453
|
type: 'object',
|
|
1425
1454
|
properties: {
|
|
@@ -1430,20 +1459,20 @@ export class CodingToolExecutor {
|
|
|
1430
1459
|
},
|
|
1431
1460
|
{
|
|
1432
1461
|
name: 'run_visual_test',
|
|
1433
|
-
description: '
|
|
1462
|
+
description: 'Disabled: no bundled browser. Returns guidance; use external visual regression or agent-browser workflows in the target project.',
|
|
1434
1463
|
input_schema: {
|
|
1435
1464
|
type: 'object',
|
|
1436
1465
|
properties: {
|
|
1437
1466
|
url: { type: 'string', description: 'URL to test (e.g., http://localhost:3000)' },
|
|
1438
1467
|
baseline_path: { type: 'string', description: 'Path to baseline screenshot file (e.g., baselines/homepage.png)' },
|
|
1439
|
-
output_dir: { type: 'string', description: 'Directory for test output (
|
|
1468
|
+
output_dir: { type: 'string', description: 'Directory for test output (unused; tool disabled)' }
|
|
1440
1469
|
},
|
|
1441
1470
|
required: ['url', 'baseline_path']
|
|
1442
1471
|
}
|
|
1443
1472
|
},
|
|
1444
1473
|
{
|
|
1445
1474
|
name: 'check_accessibility',
|
|
1446
|
-
description: '
|
|
1475
|
+
description: 'Disabled: no bundled browser. Returns guidance; use Lighthouse, axe, or agent-browser in the environment.',
|
|
1447
1476
|
input_schema: {
|
|
1448
1477
|
type: 'object',
|
|
1449
1478
|
properties: {
|
|
@@ -1454,7 +1483,7 @@ export class CodingToolExecutor {
|
|
|
1454
1483
|
},
|
|
1455
1484
|
{
|
|
1456
1485
|
name: 'measure_performance',
|
|
1457
|
-
description: '
|
|
1486
|
+
description: 'Disabled: no bundled browser. Returns guidance; use Lighthouse or browser DevTools via your workflow.',
|
|
1458
1487
|
input_schema: {
|
|
1459
1488
|
type: 'object',
|
|
1460
1489
|
properties: {
|
|
@@ -1465,7 +1494,7 @@ export class CodingToolExecutor {
|
|
|
1465
1494
|
},
|
|
1466
1495
|
{
|
|
1467
1496
|
name: 'test_responsive',
|
|
1468
|
-
description: '
|
|
1497
|
+
description: 'Disabled: no bundled browser. Returns guidance; use agent-browser or project E2E tooling for viewport checks.',
|
|
1469
1498
|
input_schema: {
|
|
1470
1499
|
type: 'object',
|
|
1471
1500
|
properties: {
|
|
@@ -1489,7 +1518,7 @@ export class CodingToolExecutor {
|
|
|
1489
1518
|
},
|
|
1490
1519
|
{
|
|
1491
1520
|
name: 'capture_network',
|
|
1492
|
-
description: '
|
|
1521
|
+
description: 'Disabled: no bundled browser. Returns guidance; use browser DevTools HAR, agent-browser, or MCP browser network logs.',
|
|
1493
1522
|
input_schema: {
|
|
1494
1523
|
type: 'object',
|
|
1495
1524
|
properties: {
|
|
@@ -1498,20 +1527,6 @@ export class CodingToolExecutor {
|
|
|
1498
1527
|
required: ['url']
|
|
1499
1528
|
}
|
|
1500
1529
|
},
|
|
1501
|
-
{
|
|
1502
|
-
name: 'run_playwright_test',
|
|
1503
|
-
description: 'Execute a Playwright test file. Runs the test and returns pass/fail results with output. Great for running E2E tests, integration tests, and component tests.',
|
|
1504
|
-
input_schema: {
|
|
1505
|
-
type: 'object',
|
|
1506
|
-
properties: {
|
|
1507
|
-
test_path: { type: 'string', description: 'Path to the Playwright test file (e.g., tests/homepage.spec.ts)' },
|
|
1508
|
-
headed: { type: 'boolean', description: 'Run with visible browser window (default: false)' },
|
|
1509
|
-
browser: { type: 'string', enum: ['chromium', 'firefox', 'webkit'], description: 'Browser to use (default: chromium)' },
|
|
1510
|
-
timeout: { type: 'number', description: 'Test timeout in milliseconds (default: 120000)' }
|
|
1511
|
-
},
|
|
1512
|
-
required: ['test_path']
|
|
1513
|
-
}
|
|
1514
|
-
},
|
|
1515
1530
|
{
|
|
1516
1531
|
name: 'fetch_url',
|
|
1517
1532
|
description: 'Fetch and read content from any URL. HTML is automatically stripped to plain text. Use this to read documentation pages, API references, blog posts, or any web content. Supports HTML, JSON, and plain text.',
|