@everydaydevopsio/pilot 0.6.2 → 0.7.0
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/AGENTS.md +11 -0
- package/CHANGELOG.md +45 -0
- package/README.md +105 -11
- package/dist/browser/browser-manager.d.ts +7 -1
- package/dist/browser/browser-manager.d.ts.map +1 -1
- package/dist/browser/browser-manager.js +196 -40
- package/dist/browser/browser-manager.js.map +1 -1
- package/dist/browser/chrome-launcher.d.ts +13 -2
- package/dist/browser/chrome-launcher.d.ts.map +1 -1
- package/dist/browser/chrome-launcher.js +33 -4
- package/dist/browser/chrome-launcher.js.map +1 -1
- package/dist/browser/driver/capabilities.d.ts +22 -0
- package/dist/browser/driver/capabilities.d.ts.map +1 -0
- package/dist/browser/driver/capabilities.js +70 -0
- package/dist/browser/driver/capabilities.js.map +1 -0
- package/dist/browser/driver/cdp-driver.d.ts +77 -0
- package/dist/browser/driver/cdp-driver.d.ts.map +1 -0
- package/dist/browser/driver/cdp-driver.js +190 -0
- package/dist/browser/driver/cdp-driver.js.map +1 -0
- package/dist/browser/driver/factory.d.ts +10 -0
- package/dist/browser/driver/factory.d.ts.map +1 -0
- package/dist/browser/driver/factory.js +23 -0
- package/dist/browser/driver/factory.js.map +1 -0
- package/dist/browser/driver/index.d.ts +6 -0
- package/dist/browser/driver/index.d.ts.map +1 -0
- package/dist/browser/driver/index.js +5 -0
- package/dist/browser/driver/index.js.map +1 -0
- package/dist/browser/driver/types.d.ts +106 -0
- package/dist/browser/driver/types.d.ts.map +1 -0
- package/dist/browser/driver/types.js +25 -0
- package/dist/browser/driver/types.js.map +1 -0
- package/dist/browser/sessions.d.ts +49 -0
- package/dist/browser/sessions.d.ts.map +1 -0
- package/dist/browser/sessions.js +249 -0
- package/dist/browser/sessions.js.map +1 -0
- package/dist/browser/types.d.ts +13 -0
- package/dist/browser/types.d.ts.map +1 -1
- 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 +1 -1
- package/dist/cli/skill-template.js.map +1 -1
- package/dist/commands/connect.d.ts +2 -2
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +2 -2
- package/dist/commands/connect.js.map +1 -1
- package/dist/mcp/server.d.ts +9 -15
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +32 -74
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/browser.d.ts +2 -3
- package/dist/mcp/tools/browser.d.ts.map +1 -1
- package/dist/mcp/tools/browser.js +85 -70
- package/dist/mcp/tools/browser.js.map +1 -1
- package/dist/mcp/tools/connect.d.ts +2 -3
- package/dist/mcp/tools/connect.d.ts.map +1 -1
- package/dist/mcp/tools/connect.js +9 -9
- package/dist/mcp/tools/connect.js.map +1 -1
- package/dist/mcp/tools/driver-context.d.ts +14 -0
- package/dist/mcp/tools/driver-context.d.ts.map +1 -0
- package/dist/mcp/tools/driver-context.js +43 -0
- package/dist/mcp/tools/driver-context.js.map +1 -0
- package/dist/mcp/tools/files.d.ts.map +1 -1
- package/dist/mcp/tools/files.js +5 -15
- package/dist/mcp/tools/files.js.map +1 -1
- package/dist/mcp/tools/interaction.d.ts.map +1 -1
- package/dist/mcp/tools/interaction.js +7 -26
- package/dist/mcp/tools/interaction.js.map +1 -1
- package/dist/mcp/tools/names.d.ts +1 -1
- package/dist/mcp/tools/names.d.ts.map +1 -1
- package/dist/mcp/tools/names.js +2 -0
- package/dist/mcp/tools/names.js.map +1 -1
- package/dist/mcp/tools/network.d.ts.map +1 -1
- package/dist/mcp/tools/network.js +3 -11
- package/dist/mcp/tools/network.js.map +1 -1
- package/dist/mcp/tools/performance.d.ts.map +1 -1
- package/dist/mcp/tools/performance.js +2 -12
- package/dist/mcp/tools/performance.js.map +1 -1
- package/dist/mcp/tools/snapshot.d.ts.map +1 -1
- package/dist/mcp/tools/snapshot.js +3 -14
- package/dist/mcp/tools/snapshot.js.map +1 -1
- package/dist/mcp/tools/styles.d.ts.map +1 -1
- package/dist/mcp/tools/styles.js +2 -11
- package/dist/mcp/tools/styles.js.map +1 -1
- package/package.json +1 -1
- package/skills/pilot/SKILL.md +9 -0
- package/src/browser/browser-manager.ts +248 -41
- package/src/browser/chrome-launcher.ts +40 -4
- package/src/browser/driver/capabilities.ts +88 -0
- package/src/browser/driver/cdp-driver.ts +260 -0
- package/src/browser/driver/factory.ts +33 -0
- package/src/browser/driver/index.ts +22 -0
- package/src/browser/driver/types.ts +156 -0
- package/src/browser/sessions.ts +299 -0
- package/src/browser/types.ts +14 -0
- package/src/cli/skill-template.ts +1 -1
- package/src/commands/connect.ts +3 -3
- package/src/mcp/server.ts +48 -91
- package/src/mcp/tools/browser.ts +105 -87
- package/src/mcp/tools/connect.ts +10 -11
- package/src/mcp/tools/driver-context.ts +56 -0
- package/src/mcp/tools/files.ts +5 -16
- package/src/mcp/tools/interaction.ts +7 -27
- package/src/mcp/tools/names.ts +2 -0
- package/src/mcp/tools/network.ts +2 -12
- package/src/mcp/tools/performance.ts +2 -13
- package/src/mcp/tools/snapshot.ts +3 -15
- package/src/mcp/tools/styles.ts +2 -12
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { ConsoleBuffer } from '../../mcp/console-buffer.js';
|
|
2
|
+
import type { ElementRefMap } from '../inspect/element-ref.js';
|
|
3
|
+
import type { DialogQueue } from '../interaction/dialogs.js';
|
|
4
|
+
import type { DownloadTracker } from '../interaction/downloads.js';
|
|
5
|
+
import type { NetworkBuffer } from '../network/network-buffer.js';
|
|
6
|
+
import type { TraceState } from '../performance/trace.js';
|
|
7
|
+
import type { LaunchOptions, SessionInfo, TabInfo } from '../types.js';
|
|
8
|
+
import type { ViewportConfig } from '../../viewport.js';
|
|
9
|
+
import type { CheckParams, CheckResult } from '../../commands/check.js';
|
|
10
|
+
import type { ClickParams, ClickResult } from '../../commands/click.js';
|
|
11
|
+
import type { DialogParams, DialogResult } from '../../commands/dialog.js';
|
|
12
|
+
import type { EvaluateParams, EvaluateResult } from '../../commands/evaluate.js';
|
|
13
|
+
import type { FillParams, FillResult } from '../../commands/fill.js';
|
|
14
|
+
import type { FindCommandResult, FindQuery } from '../../commands/find.js';
|
|
15
|
+
import type { HoverParams, HoverResult } from '../../commands/hover.js';
|
|
16
|
+
import type { NavigateParams, NavigateResult } from '../../commands/navigate.js';
|
|
17
|
+
import type { NetworkParams, NetworkResult } from '../../commands/network.js';
|
|
18
|
+
import type { PageInfoResult } from '../../commands/page_info.js';
|
|
19
|
+
import type { PerformanceParams, PerformanceResult } from '../../commands/performance.js';
|
|
20
|
+
import type { PressKeyParams, PressKeyResult } from '../../commands/press_key.js';
|
|
21
|
+
import type { ScreenshotParams, ScreenshotResult } from '../../commands/screenshot.js';
|
|
22
|
+
import type { ScrollParams, ScrollResult } from '../../commands/scroll.js';
|
|
23
|
+
import type { SelectParams, SelectResult } from '../../commands/select.js';
|
|
24
|
+
import type { SnapshotCommandResult } from '../../commands/snapshot.js';
|
|
25
|
+
import type { StylesCommandResult, StylesParams } from '../../commands/styles.js';
|
|
26
|
+
import type { NewTabResult } from '../../commands/tabs.js';
|
|
27
|
+
import type { TypeParams, TypeResult } from '../../commands/type.js';
|
|
28
|
+
import type { UploadParams, UploadResult } from '../../commands/upload.js';
|
|
29
|
+
import type { WaitParams, WaitResult } from '../../commands/wait.js';
|
|
30
|
+
/** Browsers Pilot knows about. Only `chrome` has a driver today. */
|
|
31
|
+
export declare const BROWSER_KINDS: readonly ["chrome", "firefox", "safari", "webkit"];
|
|
32
|
+
export type BrowserKind = (typeof BROWSER_KINDS)[number];
|
|
33
|
+
/**
|
|
34
|
+
* Features a driver may or may not provide. Each MCP tool declares the
|
|
35
|
+
* capabilities it needs (see capabilities.ts); a tool whose capabilities the
|
|
36
|
+
* active driver lacks fails with a CapabilityError before touching the browser.
|
|
37
|
+
*/
|
|
38
|
+
export declare const CAPABILITIES: readonly ["tabs", "navigation", "evaluate", "input", "screenshot", "viewport", "accessibilitySnapshot", "styles", "console", "network", "dialogs", "uploads", "downloads", "performanceTrace", "connectExisting"];
|
|
39
|
+
export type Capability = (typeof CAPABILITIES)[number];
|
|
40
|
+
/**
|
|
41
|
+
* Per-session buffers shared between a driver and the MCP tools. The driver
|
|
42
|
+
* fills them from browser events; tools such as browser_console read them
|
|
43
|
+
* directly.
|
|
44
|
+
*/
|
|
45
|
+
export interface DriverSession {
|
|
46
|
+
consoleBuffer: ConsoleBuffer;
|
|
47
|
+
elementRefMap: ElementRefMap;
|
|
48
|
+
networkBuffer: NetworkBuffer;
|
|
49
|
+
dialogQueue: DialogQueue;
|
|
50
|
+
downloadTracker: DownloadTracker;
|
|
51
|
+
traceState: TraceState;
|
|
52
|
+
}
|
|
53
|
+
export interface ConnectExistingOptions {
|
|
54
|
+
host?: string;
|
|
55
|
+
port?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface ViewportResizeParams {
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
deviceScaleFactor?: number;
|
|
61
|
+
mobile?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Browser-agnostic surface the MCP tools call. Each implementation owns its
|
|
65
|
+
* protocol (CDP, WebDriver BiDi, ...) and must not leak protocol types here.
|
|
66
|
+
*/
|
|
67
|
+
export interface BrowserDriver {
|
|
68
|
+
readonly kind: BrowserKind;
|
|
69
|
+
readonly capabilities: ReadonlySet<Capability>;
|
|
70
|
+
launch(opts?: LaunchOptions): Promise<{
|
|
71
|
+
headless: boolean;
|
|
72
|
+
viewport: string;
|
|
73
|
+
}>;
|
|
74
|
+
connectExisting(opts: ConnectExistingOptions): Promise<{
|
|
75
|
+
tabs: TabInfo[];
|
|
76
|
+
}>;
|
|
77
|
+
destroy(): Promise<void>;
|
|
78
|
+
isConnected(): boolean;
|
|
79
|
+
getSessionInfo(): SessionInfo;
|
|
80
|
+
listTabs(): Promise<TabInfo[]>;
|
|
81
|
+
newTab(url?: string): Promise<NewTabResult>;
|
|
82
|
+
closeTab(targetId: string): Promise<void>;
|
|
83
|
+
switchTab(targetId: string): Promise<void>;
|
|
84
|
+
navigate(params: NavigateParams): Promise<NavigateResult>;
|
|
85
|
+
pageInfo(): Promise<PageInfoResult>;
|
|
86
|
+
evaluate(params: EvaluateParams): Promise<EvaluateResult>;
|
|
87
|
+
wait(params: WaitParams): Promise<WaitResult>;
|
|
88
|
+
screenshot(params: ScreenshotParams): Promise<ScreenshotResult>;
|
|
89
|
+
resizeViewport(params: ViewportResizeParams): Promise<ViewportConfig>;
|
|
90
|
+
snapshot(): Promise<SnapshotCommandResult>;
|
|
91
|
+
find(query: FindQuery): Promise<FindCommandResult>;
|
|
92
|
+
styles(params: StylesParams): Promise<StylesCommandResult>;
|
|
93
|
+
click(params: ClickParams): Promise<ClickResult>;
|
|
94
|
+
type(params: TypeParams): Promise<TypeResult>;
|
|
95
|
+
fill(params: FillParams): Promise<FillResult>;
|
|
96
|
+
hover(params: HoverParams): Promise<HoverResult>;
|
|
97
|
+
pressKey(params: PressKeyParams): Promise<PressKeyResult>;
|
|
98
|
+
select(params: SelectParams): Promise<SelectResult>;
|
|
99
|
+
check(params: CheckParams): Promise<CheckResult>;
|
|
100
|
+
scroll(params: ScrollParams): Promise<ScrollResult>;
|
|
101
|
+
dialog(params: DialogParams): Promise<DialogResult>;
|
|
102
|
+
upload(params: UploadParams): Promise<UploadResult>;
|
|
103
|
+
network(params: NetworkParams): Promise<NetworkResult>;
|
|
104
|
+
performance(params: PerformanceParams): Promise<PerformanceResult>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/browser/driver/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAA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_KINDS = ['chrome', 'firefox', 'safari', 'webkit'];
|
|
3
|
+
/**
|
|
4
|
+
* Features a driver may or may not provide. Each MCP tool declares the
|
|
5
|
+
* capabilities it needs (see capabilities.ts); a tool whose capabilities the
|
|
6
|
+
* active driver lacks fails with a CapabilityError before touching the browser.
|
|
7
|
+
*/
|
|
8
|
+
export const CAPABILITIES = [
|
|
9
|
+
'tabs',
|
|
10
|
+
'navigation',
|
|
11
|
+
'evaluate',
|
|
12
|
+
'input',
|
|
13
|
+
'screenshot',
|
|
14
|
+
'viewport',
|
|
15
|
+
'accessibilitySnapshot',
|
|
16
|
+
'styles',
|
|
17
|
+
'console',
|
|
18
|
+
'network',
|
|
19
|
+
'dialogs',
|
|
20
|
+
'uploads',
|
|
21
|
+
'downloads',
|
|
22
|
+
'performanceTrace',
|
|
23
|
+
'connectExisting'
|
|
24
|
+
];
|
|
25
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/browser/driver/types.ts"],"names":[],"mappings":"AAgDA,oEAAoE;AACpE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AAGhF;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;IACN,YAAY;IACZ,UAAU;IACV,OAAO;IACP,YAAY;IACZ,UAAU;IACV,uBAAuB;IACvB,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;IACT,SAAS;IACT,WAAW;IACX,kBAAkB;IAClB,iBAAiB;CACT,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export type ProfileLockState =
|
|
2
|
+
/** No lock files: the profile is free. */
|
|
3
|
+
'unlocked'
|
|
4
|
+
/** Locked by a live process on this host. */
|
|
5
|
+
| 'locked'
|
|
6
|
+
/** Locked by a process on this host that is no longer running. */
|
|
7
|
+
| 'stale'
|
|
8
|
+
/** Locked from another host; liveness cannot be checked here. */
|
|
9
|
+
| 'locked_other_host'
|
|
10
|
+
/** Lock files exist but name no owner Pilot can read. */
|
|
11
|
+
| 'locked_unknown';
|
|
12
|
+
export interface ProfileStatus {
|
|
13
|
+
profile: string;
|
|
14
|
+
userDataDir: string;
|
|
15
|
+
state: ProfileLockState;
|
|
16
|
+
pid?: number;
|
|
17
|
+
host?: string;
|
|
18
|
+
/** True when the lock owner's command line shows Chrome using this Pilot profile. */
|
|
19
|
+
pilotChrome?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function pilotDataDir(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Report the lock state of every Pilot profile. Read-only: unlike
|
|
24
|
+
* isProfileLocked, it never removes stale locks.
|
|
25
|
+
*/
|
|
26
|
+
export declare function listProfiles(): ProfileStatus[];
|
|
27
|
+
/** The full command line of a process, or null when it cannot be read. */
|
|
28
|
+
export declare function readProcessCommand(pid: number): string | null;
|
|
29
|
+
/**
|
|
30
|
+
* Whether pid is a Chrome or Chromium browser started with exactly this Pilot
|
|
31
|
+
* profile directory. A pid read from a lock can be reused by an unrelated
|
|
32
|
+
* process, so stop-all only signals processes that pass this check.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isPilotChrome(pid: number, userDataDir: string): boolean;
|
|
35
|
+
export interface StopResult {
|
|
36
|
+
profile: string;
|
|
37
|
+
pid?: number;
|
|
38
|
+
outcome: 'stopped' | 'cleaned' | 'failed' | 'skipped';
|
|
39
|
+
detail: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Stop every Chrome on this host that holds a Pilot profile lock. Processes
|
|
43
|
+
* are only signalled after their command line confirms they use that
|
|
44
|
+
* profile's directory; nothing else is touched.
|
|
45
|
+
*/
|
|
46
|
+
export declare function stopPilotBrowsers(): Promise<StopResult[]>;
|
|
47
|
+
/** Stop the Chrome holding a profile lock, if it is verifiably Pilot's. */
|
|
48
|
+
export declare function stopLockedProfile(status: ProfileStatus): Promise<StopResult>;
|
|
49
|
+
//# sourceMappingURL=sessions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../src/browser/sessions.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,gBAAgB;AAC1B,0CAA0C;AACxC,UAAU;AACZ,6CAA6C;GAC3C,QAAQ;AACV,kEAAkE;GAChE,OAAO;AACT,iEAAiE;GAC/D,mBAAmB;AACrB,yDAAyD;GACvD,gBAAgB,CAAC;AAErB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,gBAAgB,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,aAAa,EAAE,CAoB9C;AAsDD,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE7D;AAMD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAevE;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACtD,MAAM,EAAE,MAAM,CAAC;CAChB;AAiED;;;;GAIG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CA8C/D;AAED,2EAA2E;AAC3E,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,UAAU,CAAC,CAwBrB"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { execFileSync } from 'child_process';
|
|
2
|
+
import { existsSync, lstatSync, readdirSync, statSync } from 'fs';
|
|
3
|
+
import { hostname } from 'os';
|
|
4
|
+
import { basename, dirname, join } from 'path';
|
|
5
|
+
import { PROFILE_NAME_RE, cleanupLockFiles, isProcessAlive, profileLockOwner, resolveUserDataDir } from './chrome-launcher.js';
|
|
6
|
+
export function pilotDataDir() {
|
|
7
|
+
// resolveUserDataDir validates the name; any valid name gives the parent.
|
|
8
|
+
return dirname(resolveUserDataDir('profile1'));
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Report the lock state of every Pilot profile. Read-only: unlike
|
|
12
|
+
* isProfileLocked, it never removes stale locks.
|
|
13
|
+
*/
|
|
14
|
+
export function listProfiles() {
|
|
15
|
+
const dataDir = pilotDataDir();
|
|
16
|
+
let names;
|
|
17
|
+
try {
|
|
18
|
+
names = readdirSync(dataDir);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
return names
|
|
24
|
+
.filter((name) => PROFILE_NAME_RE.test(name))
|
|
25
|
+
.filter((name) => {
|
|
26
|
+
try {
|
|
27
|
+
return statSync(join(dataDir, name)).isDirectory();
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
.sort()
|
|
34
|
+
.map((profile) => profileStatus(profile, join(dataDir, profile)));
|
|
35
|
+
}
|
|
36
|
+
function profileStatus(profile, userDataDir) {
|
|
37
|
+
const owner = profileLockOwner(userDataDir);
|
|
38
|
+
const base = { profile, userDataDir };
|
|
39
|
+
if (!owner) {
|
|
40
|
+
const hasLock = lockPresent(join(userDataDir, 'SingletonLock')) ||
|
|
41
|
+
existsSync(join(userDataDir, 'lockfile'));
|
|
42
|
+
return { ...base, state: hasLock ? 'locked_unknown' : 'unlocked' };
|
|
43
|
+
}
|
|
44
|
+
if (owner.lockHost !== hostname()) {
|
|
45
|
+
return {
|
|
46
|
+
...base,
|
|
47
|
+
state: 'locked_other_host',
|
|
48
|
+
pid: owner.pid,
|
|
49
|
+
host: owner.lockHost
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (!isProcessAlive(owner.pid)) {
|
|
53
|
+
return { ...base, state: 'stale', pid: owner.pid, host: owner.lockHost };
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
...base,
|
|
57
|
+
state: 'locked',
|
|
58
|
+
pid: owner.pid,
|
|
59
|
+
host: owner.lockHost,
|
|
60
|
+
pilotChrome: isPilotChrome(owner.pid, userDataDir)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function lockPresent(path) {
|
|
64
|
+
try {
|
|
65
|
+
lstatSync(path);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function ps(pid, field) {
|
|
73
|
+
if (process.platform === 'win32')
|
|
74
|
+
return null;
|
|
75
|
+
try {
|
|
76
|
+
const out = execFileSync('ps', ['-o', `${field}=`, '-p', String(pid)], {
|
|
77
|
+
encoding: 'utf8',
|
|
78
|
+
stdio: ['ignore', 'pipe', 'ignore']
|
|
79
|
+
}).trim();
|
|
80
|
+
return out || null;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** The full command line of a process, or null when it cannot be read. */
|
|
87
|
+
export function readProcessCommand(pid) {
|
|
88
|
+
return ps(pid, 'args');
|
|
89
|
+
}
|
|
90
|
+
// Chrome's main executable: "chrome" or "chromium-browser" on Linux (comm is
|
|
91
|
+
// truncated to 15 characters), "Google Chrome" or "Chromium" on macOS.
|
|
92
|
+
const CHROME_EXECUTABLE_RE = /chrom(e|ium)/i;
|
|
93
|
+
/**
|
|
94
|
+
* Whether pid is a Chrome or Chromium browser started with exactly this Pilot
|
|
95
|
+
* profile directory. A pid read from a lock can be reused by an unrelated
|
|
96
|
+
* process, so stop-all only signals processes that pass this check.
|
|
97
|
+
*/
|
|
98
|
+
export function isPilotChrome(pid, userDataDir) {
|
|
99
|
+
const executable = ps(pid, 'comm');
|
|
100
|
+
if (!executable || !CHROME_EXECUTABLE_RE.test(basename(executable))) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
const command = readProcessCommand(pid);
|
|
104
|
+
if (!command)
|
|
105
|
+
return false;
|
|
106
|
+
const flag = ` --user-data-dir=${userDataDir}`;
|
|
107
|
+
let at = command.indexOf(flag);
|
|
108
|
+
while (at !== -1) {
|
|
109
|
+
const next = command.charAt(at + flag.length);
|
|
110
|
+
if (next === '' || next === ' ')
|
|
111
|
+
return true;
|
|
112
|
+
at = command.indexOf(flag, at + 1);
|
|
113
|
+
}
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
async function waitForProcessExit(pid, ms) {
|
|
117
|
+
const deadline = Date.now() + ms;
|
|
118
|
+
while (Date.now() < deadline) {
|
|
119
|
+
if (!isProcessAlive(pid))
|
|
120
|
+
return true;
|
|
121
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
122
|
+
}
|
|
123
|
+
return !isProcessAlive(pid);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* SIGTERM, then SIGKILL. The pid's identity is re-checked right before each
|
|
127
|
+
* signal: a process seen earlier can exit and its pid be reused while
|
|
128
|
+
* other browsers are being stopped.
|
|
129
|
+
*/
|
|
130
|
+
async function terminate(pid, userDataDir) {
|
|
131
|
+
const signal = (sig) => {
|
|
132
|
+
if (!isPilotChrome(pid, userDataDir))
|
|
133
|
+
return 'gone';
|
|
134
|
+
try {
|
|
135
|
+
process.kill(pid, sig);
|
|
136
|
+
return 'sent';
|
|
137
|
+
}
|
|
138
|
+
catch (err) {
|
|
139
|
+
const code = err.code;
|
|
140
|
+
if (code === 'ESRCH')
|
|
141
|
+
return 'gone';
|
|
142
|
+
return { error: `could not send ${sig} to pid ${pid} (${code})` };
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
const term = signal('SIGTERM');
|
|
146
|
+
if (term === 'gone') {
|
|
147
|
+
return isProcessAlive(pid)
|
|
148
|
+
? { outcome: 'not_pilot' }
|
|
149
|
+
: { outcome: 'stopped' };
|
|
150
|
+
}
|
|
151
|
+
if (typeof term === 'object')
|
|
152
|
+
return { outcome: 'failed', detail: term.error };
|
|
153
|
+
if (await waitForProcessExit(pid, 5000))
|
|
154
|
+
return { outcome: 'stopped' };
|
|
155
|
+
const kill = signal('SIGKILL');
|
|
156
|
+
if (kill === 'gone') {
|
|
157
|
+
// Only a confirmed exit counts as stopped. A live pid that no longer
|
|
158
|
+
// verifies (ps failed, or the process changed) is left alone.
|
|
159
|
+
return isProcessAlive(pid)
|
|
160
|
+
? {
|
|
161
|
+
outcome: 'failed',
|
|
162
|
+
detail: `pid ${pid} did not exit after SIGTERM and could no longer be verified as Chrome using ${userDataDir}; not killed, lock kept`
|
|
163
|
+
}
|
|
164
|
+
: { outcome: 'stopped' };
|
|
165
|
+
}
|
|
166
|
+
if (typeof kill === 'object')
|
|
167
|
+
return { outcome: 'failed', detail: kill.error };
|
|
168
|
+
return (await waitForProcessExit(pid, 2000))
|
|
169
|
+
? { outcome: 'stopped' }
|
|
170
|
+
: { outcome: 'failed', detail: `pid ${pid} did not exit after SIGKILL` };
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Stop every Chrome on this host that holds a Pilot profile lock. Processes
|
|
174
|
+
* are only signalled after their command line confirms they use that
|
|
175
|
+
* profile's directory; nothing else is touched.
|
|
176
|
+
*/
|
|
177
|
+
export async function stopPilotBrowsers() {
|
|
178
|
+
const results = [];
|
|
179
|
+
for (const status of listProfiles()) {
|
|
180
|
+
const { profile, pid } = status;
|
|
181
|
+
switch (status.state) {
|
|
182
|
+
case 'unlocked':
|
|
183
|
+
continue;
|
|
184
|
+
case 'stale': {
|
|
185
|
+
const removed = cleanupLockFiles(status.userDataDir, pid);
|
|
186
|
+
results.push(removed
|
|
187
|
+
? {
|
|
188
|
+
profile,
|
|
189
|
+
pid,
|
|
190
|
+
outcome: 'cleaned',
|
|
191
|
+
detail: `removed stale lock left by pid ${pid}, which is no longer running`
|
|
192
|
+
}
|
|
193
|
+
: {
|
|
194
|
+
profile,
|
|
195
|
+
pid,
|
|
196
|
+
outcome: 'failed',
|
|
197
|
+
detail: `stale lock left by pid ${pid} could not be removed (the lock changed owner or is not writable)`
|
|
198
|
+
});
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
case 'locked_other_host':
|
|
202
|
+
results.push({
|
|
203
|
+
profile,
|
|
204
|
+
pid,
|
|
205
|
+
outcome: 'skipped',
|
|
206
|
+
detail: `locked by pid ${pid} on host "${status.host}"; Pilot can only stop browsers on this host`
|
|
207
|
+
});
|
|
208
|
+
continue;
|
|
209
|
+
case 'locked_unknown':
|
|
210
|
+
results.push({
|
|
211
|
+
profile,
|
|
212
|
+
outcome: 'skipped',
|
|
213
|
+
detail: 'lock files name no owner; left in place'
|
|
214
|
+
});
|
|
215
|
+
continue;
|
|
216
|
+
case 'locked':
|
|
217
|
+
results.push(await stopLockedProfile(status));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return results;
|
|
221
|
+
}
|
|
222
|
+
/** Stop the Chrome holding a profile lock, if it is verifiably Pilot's. */
|
|
223
|
+
export async function stopLockedProfile(status) {
|
|
224
|
+
const { profile, pid, userDataDir } = status;
|
|
225
|
+
const notPilot = {
|
|
226
|
+
profile,
|
|
227
|
+
pid,
|
|
228
|
+
outcome: 'skipped',
|
|
229
|
+
detail: `pid ${pid} holds the lock but its command line does not show Chrome using ${userDataDir}; not stopped`
|
|
230
|
+
};
|
|
231
|
+
if (pid === undefined || !status.pilotChrome)
|
|
232
|
+
return notPilot;
|
|
233
|
+
const result = await terminate(pid, userDataDir);
|
|
234
|
+
if (result.outcome === 'not_pilot')
|
|
235
|
+
return notPilot;
|
|
236
|
+
if (result.outcome === 'failed') {
|
|
237
|
+
return { profile, pid, outcome: 'failed', detail: result.detail };
|
|
238
|
+
}
|
|
239
|
+
const removed = cleanupLockFiles(userDataDir, pid);
|
|
240
|
+
return {
|
|
241
|
+
profile,
|
|
242
|
+
pid,
|
|
243
|
+
outcome: 'stopped',
|
|
244
|
+
detail: removed
|
|
245
|
+
? `stopped Chrome pid ${pid}`
|
|
246
|
+
: `stopped Chrome pid ${pid}, but its lock could not be removed`
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../src/browser/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAwB9B,MAAM,UAAU,YAAY;IAC1B,0EAA0E;IAC1E,OAAO,OAAO,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;AACjD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,YAAY,EAAE,CAAC;IAC/B,IAAI,KAAe,CAAC;IACpB,IAAI,CAAC;QACH,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;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AG,CAAC,CAAC;IACnD,OAAO;QACL,OAAO;QACP,GAAG;QACH,OAAO,EAAE,SAAS;QAClB,MAAM,EAAE,OAAO;YACb,CAAC,CAAC,sBAAsB,GAAG,EAAE;YAC7B,CAAC,CAAC,sBAAsB,GAAG,qCAAqC;KACnE,CAAC;AACJ,CAAC"}
|
package/dist/browser/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Client } from 'chrome-remote-interface';
|
|
2
|
+
import type { BrowserKind } from './driver/types.js';
|
|
2
3
|
export type BrowserEventCallback = (event: string, data: unknown) => void;
|
|
3
4
|
export interface TabInfo {
|
|
4
5
|
targetId: string;
|
|
@@ -23,6 +24,18 @@ export interface LaunchOptions {
|
|
|
23
24
|
responsive?: boolean;
|
|
24
25
|
startupTimeoutMs?: number;
|
|
25
26
|
}
|
|
27
|
+
export interface SessionInfo {
|
|
28
|
+
/** Browser the session drives; set by the driver. */
|
|
29
|
+
browser?: BrowserKind;
|
|
30
|
+
/** launched: Chrome started by this session; external: browser_connect. */
|
|
31
|
+
mode: 'launched' | 'external' | 'none';
|
|
32
|
+
connected: boolean;
|
|
33
|
+
profile?: string;
|
|
34
|
+
userDataDir?: string;
|
|
35
|
+
pid?: number;
|
|
36
|
+
host?: string;
|
|
37
|
+
cdpPort?: number;
|
|
38
|
+
}
|
|
26
39
|
export type SandboxDecision = {
|
|
27
40
|
disable: false;
|
|
28
41
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/browser/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/browser/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,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GAAG;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,cAAc,GAAG,WAAW,CAAA;CAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SKILL_CONTENT = "---\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";
|
|
1
|
+
export declare const SKILL_CONTENT = "---\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### Startup failures\n\nRead the `Launch:`, `Cleanup:`, and `Next:` lines in the `browser_start` error before retrying.\n\n- A failed `browser_start` stops the Chrome it launched and frees the profile unless `Cleanup:` names a pid that did not stop. Do not switch profiles just because a start failed.\n- On a timeout, retry once with a larger `startupTimeoutMs` (for example `180000`). First runs and software-rendered Linux desktops can be slow.\n- If Chrome exited in visible mode, check the display (above) or retry with `headless: true`.\n- If the profile is already in use, the error names the owning Chrome pid and host. `browser_stop` cannot stop a browser that this session did not launch. Call `browser_status` to see which profiles are free and who holds the others. Use a different `profileName`, or, only after the user agrees, call `browser_stop_all`. It also stops browsers that other agents may be using.\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";
|
|
2
2
|
//# sourceMappingURL=skill-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-template.d.ts","sourceRoot":"","sources":["../../src/cli/skill-template.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"skill-template.d.ts","sourceRoot":"","sources":["../../src/cli/skill-template.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,g1HAC+yH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Generated by scripts/build-skill.mjs from skills/pilot/SKILL.md.
|
|
2
2
|
// Do not edit this file directly.
|
|
3
|
-
export const SKILL_CONTENT = '---\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';
|
|
3
|
+
export const SKILL_CONTENT = '---\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### Startup failures\n\nRead the `Launch:`, `Cleanup:`, and `Next:` lines in the `browser_start` error before retrying.\n\n- A failed `browser_start` stops the Chrome it launched and frees the profile unless `Cleanup:` names a pid that did not stop. Do not switch profiles just because a start failed.\n- On a timeout, retry once with a larger `startupTimeoutMs` (for example `180000`). First runs and software-rendered Linux desktops can be slow.\n- If Chrome exited in visible mode, check the display (above) or retry with `headless: true`.\n- If the profile is already in use, the error names the owning Chrome pid and host. `browser_stop` cannot stop a browser that this session did not launch. Call `browser_status` to see which profiles are free and who holds the others. Use a different `profileName`, or, only after the user agrees, call `browser_stop_all`. It also stops browsers that other agents may be using.\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';
|
|
4
4
|
//# sourceMappingURL=skill-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-template.js","sourceRoot":"","sources":["../../src/cli/skill-template.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,kCAAkC;AAClC,MAAM,CAAC,MAAM,aAAa,GACxB,
|
|
1
|
+
{"version":3,"file":"skill-template.js","sourceRoot":"","sources":["../../src/cli/skill-template.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,kCAAkC;AAClC,MAAM,CAAC,MAAM,aAAa,GACxB,u0HAAu0H,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BrowserDriver } from '../browser/driver/types.js';
|
|
2
2
|
import type { TabInfo } from '../browser/types.js';
|
|
3
3
|
export interface ConnectParams {
|
|
4
4
|
host?: string;
|
|
@@ -9,6 +9,6 @@ export interface ConnectResult {
|
|
|
9
9
|
port: number;
|
|
10
10
|
tabs: TabInfo[];
|
|
11
11
|
}
|
|
12
|
-
export declare function executeConnect(
|
|
12
|
+
export declare function executeConnect(driver: Pick<BrowserDriver, 'connectExisting'>, params: ConnectParams): Promise<ConnectResult>;
|
|
13
13
|
export declare function formatConnectResult(result: ConnectResult): string;
|
|
14
14
|
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AAED,wBAAsB,cAAc,CAClC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,iBAAiB,CAAC,EAC9C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,CAAC,CAOxB;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAajE"}
|
package/dist/commands/connect.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export async function executeConnect(
|
|
1
|
+
export async function executeConnect(driver, params) {
|
|
2
2
|
const host = params.host ?? '127.0.0.1';
|
|
3
3
|
const port = params.port ?? 9222;
|
|
4
|
-
const { tabs } = await
|
|
4
|
+
const { tabs } = await driver.connectExisting({ host, port });
|
|
5
5
|
return { host, port, tabs };
|
|
6
6
|
}
|
|
7
7
|
export function formatConnectResult(result) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA8C,EAC9C,MAAqB;IAErB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC;IACxC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC;IAEjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAE9D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAqB;IACvD,MAAM,KAAK,GAAG;QACZ,0BAA0B,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE;QACtD,EAAE;QACF,SAAS,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI;KAChC,CAAC;IAEF,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,GAAG,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/mcp/server.d.ts
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import {
|
|
3
|
-
import { ElementRefMap } from '../browser/inspect/element-ref.js';
|
|
4
|
-
import { DialogQueue } from '../browser/interaction/dialogs.js';
|
|
5
|
-
import { DownloadTracker } from '../browser/interaction/downloads.js';
|
|
6
|
-
import { NetworkBuffer } from '../browser/network/network-buffer.js';
|
|
7
|
-
import { ConsoleBuffer } from './console-buffer.js';
|
|
8
|
-
import { createTraceState } from '../browser/performance/trace.js';
|
|
2
|
+
import type { BrowserDriver, DriverSession } from '../browser/driver/types.js';
|
|
9
3
|
export interface McpConfig {
|
|
10
4
|
bufferSize: number;
|
|
11
5
|
cdpPort?: number;
|
|
12
6
|
cdpHost?: string;
|
|
13
7
|
}
|
|
14
|
-
export interface BrowserContext {
|
|
15
|
-
|
|
16
|
-
consoleBuffer: ConsoleBuffer;
|
|
17
|
-
elementRefMap: ElementRefMap;
|
|
18
|
-
networkBuffer: NetworkBuffer;
|
|
19
|
-
dialogQueue: DialogQueue;
|
|
20
|
-
downloadTracker: DownloadTracker;
|
|
21
|
-
traceState: ReturnType<typeof createTraceState>;
|
|
8
|
+
export interface BrowserContext extends DriverSession {
|
|
9
|
+
driver: BrowserDriver | null;
|
|
22
10
|
baseConfig: McpConfig;
|
|
23
11
|
}
|
|
12
|
+
export type DriverFactory = () => BrowserDriver;
|
|
13
|
+
/**
|
|
14
|
+
* Register every Pilot tool behind the capability gate, so a tool the active
|
|
15
|
+
* driver cannot support fails before its handler runs.
|
|
16
|
+
*/
|
|
17
|
+
export declare function registerAllTools(server: McpServer, context: BrowserContext, makeDriver: DriverFactory): void;
|
|
24
18
|
export declare function createMcpServer(config: McpConfig): Promise<{
|
|
25
19
|
server: McpServer;
|
|
26
20
|
cleanup: () => Promise<void>;
|
package/dist/mcp/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAoB/E,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,cAAc,EACvB,UAAU,EAAE,aAAa,GACxB,IAAI,CAYN;AAED,wBAAsB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAChE,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC,CAmCD"}
|