@everydaydevopsio/pilot 0.6.0 → 0.6.2
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/.mcp.json +9 -0
- package/AGENTS.md +9 -0
- package/CHANGELOG.md +16 -0
- package/README.md +172 -14
- package/dist/browser/browser-manager.d.ts.map +1 -1
- package/dist/browser/browser-manager.js +10 -3
- package/dist/browser/browser-manager.js.map +1 -1
- package/dist/browser/chrome-launcher.d.ts +1 -0
- package/dist/browser/chrome-launcher.d.ts.map +1 -1
- package/dist/browser/chrome-launcher.js +10 -2
- package/dist/browser/chrome-launcher.js.map +1 -1
- package/dist/browser/preflight.d.ts +20 -0
- package/dist/browser/preflight.d.ts.map +1 -0
- package/dist/browser/preflight.js +105 -0
- package/dist/browser/preflight.js.map +1 -0
- package/dist/browser/types.d.ts +1 -0
- package/dist/browser/types.d.ts.map +1 -1
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +33 -48
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/linux-check.d.ts +2 -0
- package/dist/cli/linux-check.d.ts.map +1 -0
- package/dist/cli/linux-check.js +20 -0
- package/dist/cli/linux-check.js.map +1 -0
- package/dist/cli/skill-template.d.ts +1 -1
- package/dist/cli/skill-template.d.ts.map +1 -1
- package/dist/cli/skill-template.js +3 -113
- package/dist/cli/skill-template.js.map +1 -1
- package/dist/mcp/index.js +20 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/tools/browser.d.ts.map +1 -1
- package/dist/mcp/tools/browser.js +10 -3
- package/dist/mcp/tools/browser.js.map +1 -1
- package/package.json +3 -2
- package/skills/pilot/SKILL.md +48 -0
- package/src/browser/browser-manager.ts +12 -4
- package/src/browser/chrome-launcher.ts +13 -2
- package/src/browser/preflight.ts +144 -0
- package/src/browser/types.ts +1 -0
- package/src/cli/init.ts +40 -49
- package/src/cli/linux-check.ts +23 -0
- package/src/cli/skill-template.ts +4 -113
- package/src/mcp/index.ts +24 -2
- package/src/mcp/tools/browser.ts +12 -2
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { constants } from 'fs';
|
|
2
|
+
import { access, mkdir } from 'fs/promises';
|
|
3
|
+
import { request } from 'https';
|
|
4
|
+
import {
|
|
5
|
+
findChromeExecutable,
|
|
6
|
+
findFreePort,
|
|
7
|
+
resolveUserDataDir
|
|
8
|
+
} from './chrome-launcher.js';
|
|
9
|
+
|
|
10
|
+
export interface LinuxCheckResult {
|
|
11
|
+
name: string;
|
|
12
|
+
ok: boolean;
|
|
13
|
+
detail: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface LinuxCheckOptions {
|
|
17
|
+
headless: boolean;
|
|
18
|
+
chromePath?: string;
|
|
19
|
+
profileName: string;
|
|
20
|
+
checkNetwork?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function checkDisplay(headless: boolean): LinuxCheckResult {
|
|
24
|
+
if (headless) {
|
|
25
|
+
return {
|
|
26
|
+
name: 'display',
|
|
27
|
+
ok: true,
|
|
28
|
+
detail: 'not required in headless mode'
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const display = process.env.DISPLAY || process.env.WAYLAND_DISPLAY;
|
|
32
|
+
return display
|
|
33
|
+
? { name: 'display', ok: true, detail: display }
|
|
34
|
+
: {
|
|
35
|
+
name: 'display',
|
|
36
|
+
ok: false,
|
|
37
|
+
detail:
|
|
38
|
+
'headless:false requires DISPLAY or WAYLAND_DISPLAY; use a desktop session, xvfb-run, or headless:true'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function checkChrome(
|
|
43
|
+
chromePath?: string
|
|
44
|
+
): Promise<LinuxCheckResult> {
|
|
45
|
+
try {
|
|
46
|
+
const resolved = findChromeExecutable(chromePath);
|
|
47
|
+
await access(resolved, constants.X_OK);
|
|
48
|
+
return { name: 'chrome', ok: true, detail: resolved };
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return { name: 'chrome', ok: false, detail: String(error) };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function checkProfile(
|
|
55
|
+
profileName: string
|
|
56
|
+
): Promise<LinuxCheckResult> {
|
|
57
|
+
let profileDir: string;
|
|
58
|
+
try {
|
|
59
|
+
profileDir = resolveUserDataDir(profileName);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
return { name: 'profile', ok: false, detail: String(error) };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
await mkdir(profileDir, { recursive: true });
|
|
66
|
+
await access(profileDir, constants.R_OK | constants.W_OK | constants.X_OK);
|
|
67
|
+
return { name: 'profile', ok: true, detail: profileDir };
|
|
68
|
+
} catch (error) {
|
|
69
|
+
return {
|
|
70
|
+
name: 'profile',
|
|
71
|
+
ok: false,
|
|
72
|
+
detail: `${profileDir} is not writable: ${String(error)}; set XDG_DATA_HOME to a writable directory`
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export async function checkLoopback(): Promise<LinuxCheckResult> {
|
|
78
|
+
try {
|
|
79
|
+
const port = await findFreePort();
|
|
80
|
+
return { name: 'loopback', ok: true, detail: `127.0.0.1:${port}` };
|
|
81
|
+
} catch (error) {
|
|
82
|
+
return {
|
|
83
|
+
name: 'loopback',
|
|
84
|
+
ok: false,
|
|
85
|
+
detail: `${String(error)}; Pilot requires permission to bind an ephemeral CDP port on 127.0.0.1`
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export async function checkOutboundHttps(
|
|
91
|
+
timeoutMs = 5000,
|
|
92
|
+
requestFn: typeof request = request
|
|
93
|
+
): Promise<LinuxCheckResult> {
|
|
94
|
+
return new Promise((resolve) => {
|
|
95
|
+
const req = requestFn(
|
|
96
|
+
'https://clients3.google.com/generate_204',
|
|
97
|
+
{ method: 'HEAD', timeout: timeoutMs },
|
|
98
|
+
(response) => {
|
|
99
|
+
response.resume();
|
|
100
|
+
resolve({
|
|
101
|
+
name: 'network',
|
|
102
|
+
ok: response.statusCode === 204,
|
|
103
|
+
detail: `HTTPS status ${response.statusCode ?? 'unknown'} (expected 204)`
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
req.on('timeout', () =>
|
|
108
|
+
req.destroy(new Error(`timeout after ${timeoutMs}ms`))
|
|
109
|
+
);
|
|
110
|
+
req.on('error', (error) =>
|
|
111
|
+
resolve({ name: 'network', ok: false, detail: String(error) })
|
|
112
|
+
);
|
|
113
|
+
req.end();
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export async function runLinuxChecks(
|
|
118
|
+
options: LinuxCheckOptions
|
|
119
|
+
): Promise<LinuxCheckResult[]> {
|
|
120
|
+
if (process.platform !== 'linux') return [];
|
|
121
|
+
const checks = await Promise.all([
|
|
122
|
+
checkChrome(options.chromePath),
|
|
123
|
+
Promise.resolve(checkDisplay(options.headless)),
|
|
124
|
+
checkProfile(options.profileName),
|
|
125
|
+
checkLoopback()
|
|
126
|
+
]);
|
|
127
|
+
if (options.checkNetwork !== false) checks.push(await checkOutboundHttps());
|
|
128
|
+
return checks;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export async function assertLinuxBrowserPrerequisites(
|
|
132
|
+
options: LinuxCheckOptions
|
|
133
|
+
): Promise<void> {
|
|
134
|
+
if (process.platform !== 'linux') return;
|
|
135
|
+
const checks = await runLinuxChecks({ ...options, checkNetwork: false });
|
|
136
|
+
const failures = checks.filter((check) => !check.ok);
|
|
137
|
+
if (failures.length > 0) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
`Linux browser preflight failed:\n${failures
|
|
140
|
+
.map((failure) => `- ${failure.name}: ${failure.detail}`)
|
|
141
|
+
.join('\n')}\nRun "pilot check" for complete diagnostics.`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
package/src/browser/types.ts
CHANGED
package/src/cli/init.ts
CHANGED
|
@@ -1,62 +1,53 @@
|
|
|
1
|
-
import { mkdir,
|
|
2
|
-
import { join } from 'node:path';
|
|
1
|
+
import { mkdir, stat, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
3
|
import { SKILL_CONTENT } from './skill-template.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
export type SkillAgent = 'claude' | 'codex' | 'both';
|
|
6
|
+
|
|
7
|
+
const SKILL_DIRS: Record<Exclude<SkillAgent, 'both'>, string> = {
|
|
8
|
+
claude: '.claude/skills/pilot',
|
|
9
|
+
codex: '.agents/skills/pilot'
|
|
10
|
+
};
|
|
7
11
|
|
|
8
12
|
export async function runInit(
|
|
9
|
-
options: { force?: boolean } = {}
|
|
13
|
+
options: { force?: boolean; agent?: SkillAgent; cwd?: string } = {}
|
|
10
14
|
): Promise<void> {
|
|
11
|
-
const cwd = process.cwd();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
15
|
+
const cwd = options.cwd ?? process.cwd();
|
|
16
|
+
const agent = options.agent ?? 'claude';
|
|
17
|
+
const agents: Array<Exclude<SkillAgent, 'both'>> =
|
|
18
|
+
agent === 'both' ? ['claude', 'codex'] : [agent];
|
|
19
|
+
const skillPaths = agents.map((target) => ({
|
|
20
|
+
target,
|
|
21
|
+
path: join(cwd, SKILL_DIRS[target], 'SKILL.md')
|
|
22
|
+
}));
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
for (const skill of skillPaths) {
|
|
25
|
+
try {
|
|
26
|
+
await stat(skill.path);
|
|
27
|
+
if (!options.force) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`Skill already exists: ${skill.path}\nUse --force to overwrite.`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
throw error;
|
|
22
37
|
}
|
|
23
|
-
} catch {
|
|
24
|
-
// File doesn't exist, continue
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Create directory structure
|
|
28
|
-
try {
|
|
29
|
-
await mkdir(skillDir, { recursive: true });
|
|
30
|
-
} catch (err) {
|
|
31
|
-
console.error(`\x1b[31mFailed to create directory:\x1b[0m ${skillDir}`);
|
|
32
|
-
console.error(err);
|
|
33
|
-
process.exit(1);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
await writeFile(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
process.exit(1);
|
|
40
|
+
for (const skill of skillPaths) {
|
|
41
|
+
await mkdir(dirname(skill.path), { recursive: true });
|
|
42
|
+
await writeFile(skill.path, SKILL_CONTENT, 'utf8');
|
|
43
|
+
console.log(
|
|
44
|
+
`\x1b[32m✓ Installed Pilot skill for ${skill.target}:\x1b[0m ${skill.path}`
|
|
45
|
+
);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
// Success message
|
|
46
|
-
console.log(`\x1b[32m✓ Created Claude Code skill:\x1b[0m ${skillPath}`);
|
|
47
|
-
console.log('');
|
|
48
|
-
console.log('\x1b[1mUsage:\x1b[0m');
|
|
49
|
-
console.log(' In Claude Code, say "debug in browser" or use /debug-browser');
|
|
50
|
-
console.log('');
|
|
51
|
-
console.log('\x1b[1mThe skill will:\x1b[0m');
|
|
52
|
-
console.log(' 1. Start Chrome with remote debugging');
|
|
53
|
-
console.log(' 2. Launch the pilot browser service');
|
|
54
|
-
console.log(' 3. Add the MCP server to your session');
|
|
55
|
-
console.log(' 4. Spawn an error-watching sub-agent');
|
|
56
48
|
console.log('');
|
|
57
|
-
console.log('\x1b[
|
|
58
|
-
console.log('
|
|
59
|
-
console.log(
|
|
60
|
-
|
|
61
|
-
);
|
|
49
|
+
console.log('\x1b[1mNext steps:\x1b[0m');
|
|
50
|
+
console.log(' 1. Configure the pilot MCP server for your agent.');
|
|
51
|
+
console.log(' 2. Restart the agent so it discovers the installed skill.');
|
|
52
|
+
console.log(' 3. Ask it to use Pilot to open or debug a web page.');
|
|
62
53
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { runLinuxChecks } from '../browser/preflight.js';
|
|
2
|
+
|
|
3
|
+
export async function runCheck(): Promise<void> {
|
|
4
|
+
if (process.platform !== 'linux') {
|
|
5
|
+
console.log(
|
|
6
|
+
'pilot check: Linux preflight is not required on this platform.'
|
|
7
|
+
);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const { loadConfig } = await import('../util/config.js');
|
|
11
|
+
const config = loadConfig();
|
|
12
|
+
const checks = await runLinuxChecks({
|
|
13
|
+
headless: config.headless,
|
|
14
|
+
chromePath: config.chromePath,
|
|
15
|
+
profileName: config.profileName
|
|
16
|
+
});
|
|
17
|
+
for (const check of checks) {
|
|
18
|
+
console.log(
|
|
19
|
+
`[${check.ok ? 'PASS' : 'FAIL'}] ${check.name}: ${check.detail}`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
if (checks.some((check) => !check.ok)) process.exitCode = 1;
|
|
23
|
+
}
|
|
@@ -1,113 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
tools:
|
|
5
|
-
- Bash
|
|
6
|
-
- Task
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Debug Browser Skill
|
|
10
|
-
|
|
11
|
-
This skill sets up a browser debugging environment for AI-assisted development using the pilot MCP server. The MCP server manages the Chrome lifecycle automatically via \`browser_start\`.
|
|
12
|
-
|
|
13
|
-
## What This Skill Does
|
|
14
|
-
|
|
15
|
-
1. Adds the pilot MCP server to your Claude Code session
|
|
16
|
-
2. Starts the browser via \`browser_start\`
|
|
17
|
-
3. Spawns a sub-agent to watch for console errors
|
|
18
|
-
|
|
19
|
-
## Instructions
|
|
20
|
-
|
|
21
|
-
Follow these steps in order.
|
|
22
|
-
|
|
23
|
-
### Step 1: Add MCP Server to Claude Code Session
|
|
24
|
-
|
|
25
|
-
Add the pilot MCP server to the current Claude Code session:
|
|
26
|
-
|
|
27
|
-
\`\`\`bash
|
|
28
|
-
claude mcp add pilot --scope session -- npx @everydaydevopsio/pilot
|
|
29
|
-
\`\`\`
|
|
30
|
-
|
|
31
|
-
This gives you access to browser control tools like:
|
|
32
|
-
- \`browser_start\` - Launch Chrome
|
|
33
|
-
- \`browser_stop\` - Stop Chrome
|
|
34
|
-
- \`browser_screenshot\` - Capture screenshots
|
|
35
|
-
- \`browser_navigate\` - Navigate to URLs
|
|
36
|
-
- \`browser_click\` - Click elements
|
|
37
|
-
- \`browser_type\` - Type text
|
|
38
|
-
- \`browser_evaluate\` - Run JavaScript
|
|
39
|
-
- \`browser_get_errors\` - Get console errors
|
|
40
|
-
- \`browser_clear_errors\` - Clear error buffer
|
|
41
|
-
|
|
42
|
-
### Step 2: Start the Browser
|
|
43
|
-
|
|
44
|
-
Use the \`browser_start\` MCP tool to launch Chrome:
|
|
45
|
-
|
|
46
|
-
\`\`\`
|
|
47
|
-
Call browser_start with headless: false to open a visible Chrome window.
|
|
48
|
-
\`\`\`
|
|
49
|
-
|
|
50
|
-
### Step 3: Spawn Error-Watching Sub-Agent
|
|
51
|
-
|
|
52
|
-
Use the Task tool to spawn a background sub-agent that monitors for console errors:
|
|
53
|
-
|
|
54
|
-
\`\`\`
|
|
55
|
-
Spawn a sub-agent with subagent_type "general-purpose" and run_in_background: true with this prompt:
|
|
56
|
-
|
|
57
|
-
"You are an error-watching agent monitoring the browser for console errors.
|
|
58
|
-
|
|
59
|
-
Your job:
|
|
60
|
-
1. First, call browser_clear_errors to start with a clean slate
|
|
61
|
-
2. Report back that monitoring has started
|
|
62
|
-
3. Every 15-20 seconds, call browser_get_errors with includeWarnings: true
|
|
63
|
-
4. If you find errors, report them with:
|
|
64
|
-
- The error message
|
|
65
|
-
- The source file and line number
|
|
66
|
-
- A brief analysis of what might be wrong
|
|
67
|
-
5. Continue monitoring until the main conversation ends
|
|
68
|
-
|
|
69
|
-
Be concise but informative when reporting errors."
|
|
70
|
-
\`\`\`
|
|
71
|
-
|
|
72
|
-
### Step 4: Inform the User
|
|
73
|
-
|
|
74
|
-
Tell the user:
|
|
75
|
-
- The browser debugging environment is ready
|
|
76
|
-
- They can navigate to their app using \`browser_navigate\`
|
|
77
|
-
- You will be notified of any console errors automatically
|
|
78
|
-
- They can ask you to take screenshots, click elements, or run JavaScript
|
|
79
|
-
|
|
80
|
-
## Cleanup
|
|
81
|
-
|
|
82
|
-
When done debugging, call \`browser_stop\` to shut down Chrome cleanly.
|
|
83
|
-
|
|
84
|
-
## Troubleshooting
|
|
85
|
-
|
|
86
|
-
### browser_start fails
|
|
87
|
-
- Check if Chrome is installed: the MCP server auto-detects common paths
|
|
88
|
-
- Set \`PILOT_CHROME_PATH\` env var to the Chrome executable if auto-detect fails
|
|
89
|
-
|
|
90
|
-
### No errors detected
|
|
91
|
-
- Errors are only captured while connected
|
|
92
|
-
- Try \`browser_get_errors\` with \`includeWarnings: true\` to see all console output
|
|
93
|
-
- Verify the page has loaded: \`browser_page_info\`
|
|
94
|
-
|
|
95
|
-
## Example Session
|
|
96
|
-
|
|
97
|
-
User: "debug in browser"
|
|
98
|
-
|
|
99
|
-
Claude executes:
|
|
100
|
-
1. Adds MCP server to session
|
|
101
|
-
2. Calls \`browser_start\` (headless: false)
|
|
102
|
-
3. Spawns error-watching sub-agent
|
|
103
|
-
4. Reports: "Browser debugging environment ready! Navigate to your app and I'll watch for errors."
|
|
104
|
-
|
|
105
|
-
User: "go to localhost:3000"
|
|
106
|
-
Claude: Uses \`browser_navigate\` to go to http://localhost:3000
|
|
107
|
-
|
|
108
|
-
[User interacts with the app, an error occurs]
|
|
109
|
-
|
|
110
|
-
Sub-agent reports: "Error detected: TypeError: Cannot read property 'map' of undefined at App.tsx:42"
|
|
111
|
-
|
|
112
|
-
Claude: Reads App.tsx, identifies the bug, suggests a fix.
|
|
113
|
-
`;
|
|
1
|
+
// Generated by scripts/build-skill.mjs from skills/pilot/SKILL.md.
|
|
2
|
+
// Do not edit this file directly.
|
|
3
|
+
export const SKILL_CONTENT =
|
|
4
|
+
'---\nname: pilot\ndescription: Control and debug web pages with the Pilot MCP browser tools. Use when the user asks to open, inspect, test, or troubleshoot a site in Chrome with Pilot.\n---\n\n# Pilot browser workflow\n\nUse the `pilot` MCP tools to operate Chrome through the Chrome DevTools Protocol.\n\n## Start and inspect\n\n1. Call `browser_start` before any other Pilot browser tool. Use visible mode unless the user requests headless operation or the environment has no graphical display.\n2. Navigate with `browser_navigate`, then confirm the result with `browser_page_info` or `browser_snapshot`.\n3. Use refs returned by `browser_snapshot` or `browser_find` for interaction. Take a fresh snapshot after navigation or substantial DOM changes because refs can become stale.\n4. For debugging, clear errors before reproducing the problem, then inspect `browser_errors`, `browser_console`, and `browser_network`. Use performance tracing only when the user asks about load or runtime performance.\n5. Call `browser_stop` when the browser is no longer needed.\n\nDo not enter credentials, submit consequential forms, upload files, or make other externally visible changes unless the user authorized that action.\n\n## Troubleshooting\n\n### Visible Chrome on Linux\n\nRun `pilot check` when `browser_start` fails. Visible Chrome requires `DISPLAY` or `WAYLAND_DISPLAY` in the Pilot MCP server process. Headless operation does not.\n\nIf desktop applications open but Pilot reports that the display is missing, inspect the graphical session with `printenv DISPLAY`. Forward the returned value through the MCP server configuration and restart the agent so Pilot is relaunched. For Codex:\n\n```toml\n[mcp_servers.pilot]\ncommand = "npx"\nargs = ["-y", "@everydaydevopsio/pilot"]\nenv = { DISPLAY = ":1" }\n```\n\nReplace `:1` with the actual value. If the X server requires a cookie, forward `XAUTHORITY` in the same map. For SSH, use trusted X11 forwarding (`ssh -Y`) when policy permits, or use a remote desktop session and its display value. Use `PILOT_HEADLESS=true` on systems without a desktop. In CI, use headless mode or run Pilot under Xvfb.\n\n### Other Linux preflight failures\n\n- If the profile directory is not writable, set `XDG_DATA_HOME` to a writable directory.\n- If loopback binding fails with `EPERM`, the host or container must allow binding on `127.0.0.1`; disabling Chrome\'s renderer sandbox does not fix it.\n- If Chrome is not detected, set `PILOT_CHROME_PATH` to its executable.\n- Avoid `PILOT_CHROME_NO_SANDBOX=true` unless the runtime genuinely cannot support Chrome\'s sandbox and the user accepts the security tradeoff.\n\n### Connection and page failures\n\n- Confirm the active page with `browser_page_info` and list tabs if Pilot controls the wrong tab.\n- Inspect failed document, script, XHR, and fetch requests with `browser_network`.\n- If element refs stop resolving after a page update, take another snapshot and retry with the new refs.\n';
|
package/src/mcp/index.ts
CHANGED
|
@@ -28,8 +28,12 @@ async function run(): Promise<void> {
|
|
|
28
28
|
console.log('Usage: pilot [command] [options]');
|
|
29
29
|
console.log('');
|
|
30
30
|
console.log('Commands:');
|
|
31
|
+
console.log(' init [--agent claude|codex|both] [--force]');
|
|
31
32
|
console.log(
|
|
32
|
-
'
|
|
33
|
+
' Install the Pilot skill (default: claude)'
|
|
34
|
+
);
|
|
35
|
+
console.log(
|
|
36
|
+
' check Run Linux browser-launch preflight checks'
|
|
33
37
|
);
|
|
34
38
|
console.log(' (default) Start the MCP server on stdio');
|
|
35
39
|
console.log('');
|
|
@@ -74,7 +78,25 @@ async function run(): Promise<void> {
|
|
|
74
78
|
if (subcommand === 'init') {
|
|
75
79
|
const { runInit } = await import('../cli/init.js');
|
|
76
80
|
const force = args.includes('--force');
|
|
77
|
-
|
|
81
|
+
const agentArg = args.find((arg) => arg.startsWith('--agent='));
|
|
82
|
+
const agentIndex = args.indexOf('--agent');
|
|
83
|
+
const agent =
|
|
84
|
+
agentArg?.slice('--agent='.length) ??
|
|
85
|
+
(agentIndex >= 0 ? args[agentIndex + 1] : undefined) ??
|
|
86
|
+
'claude';
|
|
87
|
+
if (!['claude', 'codex', 'both'].includes(agent)) {
|
|
88
|
+
throw new Error('--agent must be one of: claude, codex, both');
|
|
89
|
+
}
|
|
90
|
+
await runInit({
|
|
91
|
+
force,
|
|
92
|
+
agent: agent as 'claude' | 'codex' | 'both'
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (subcommand === 'check') {
|
|
98
|
+
const { runCheck } = await import('../cli/linux-check.js');
|
|
99
|
+
await runCheck();
|
|
78
100
|
return;
|
|
79
101
|
}
|
|
80
102
|
|
package/src/mcp/tools/browser.ts
CHANGED
|
@@ -180,6 +180,14 @@ const startShape = {
|
|
|
180
180
|
.optional()
|
|
181
181
|
.describe(
|
|
182
182
|
'Responsive mode. When true, the page uses real window dimensions and reflows on resize (like a normal browser). Desktop presets default to true; mobile/tablet presets leave this unset (locked viewport). Set to false to lock the viewport with setDeviceMetricsOverride.'
|
|
183
|
+
),
|
|
184
|
+
startupTimeoutMs: z
|
|
185
|
+
.number()
|
|
186
|
+
.int()
|
|
187
|
+
.positive()
|
|
188
|
+
.default(30000)
|
|
189
|
+
.describe(
|
|
190
|
+
'Timeout waiting for Chrome DevTools to become ready, in milliseconds.'
|
|
183
191
|
)
|
|
184
192
|
};
|
|
185
193
|
|
|
@@ -263,7 +271,8 @@ export function registerBrowserTools(
|
|
|
263
271
|
viewportWidth,
|
|
264
272
|
viewportHeight,
|
|
265
273
|
deviceScaleFactor,
|
|
266
|
-
responsive
|
|
274
|
+
responsive,
|
|
275
|
+
startupTimeoutMs
|
|
267
276
|
}) => {
|
|
268
277
|
if (context.manager?.isConnected()) {
|
|
269
278
|
return {
|
|
@@ -291,7 +300,8 @@ export function registerBrowserTools(
|
|
|
291
300
|
viewportWidth,
|
|
292
301
|
viewportHeight,
|
|
293
302
|
deviceScaleFactor,
|
|
294
|
-
responsive
|
|
303
|
+
responsive,
|
|
304
|
+
startupTimeoutMs
|
|
295
305
|
});
|
|
296
306
|
context.manager = manager;
|
|
297
307
|
|