@phnx-labs/agents-cli 1.15.0 → 1.16.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/CHANGELOG.md +78 -39
- package/README.md +6 -6
- package/dist/commands/alias.js +2 -2
- package/dist/commands/browser-picker.d.ts +21 -0
- package/dist/commands/browser-picker.js +114 -0
- package/dist/commands/browser.js +546 -75
- package/dist/commands/commands.js +72 -22
- package/dist/commands/daemon.js +2 -2
- package/dist/commands/fork.js +2 -2
- package/dist/commands/hooks.js +71 -26
- package/dist/commands/mcp.js +81 -39
- package/dist/commands/plugins.js +48 -15
- package/dist/commands/prune.js +23 -1
- package/dist/commands/pull.js +3 -3
- package/dist/commands/repo.js +1 -1
- package/dist/commands/routines.js +2 -2
- package/dist/commands/secrets.js +37 -1
- package/dist/commands/sessions.js +62 -19
- package/dist/commands/{init.d.ts → setup.d.ts} +7 -6
- package/dist/commands/{init.js → setup.js} +22 -21
- package/dist/commands/skills.js +60 -19
- package/dist/commands/subagents.js +41 -13
- package/dist/commands/utils.d.ts +16 -0
- package/dist/commands/utils.js +32 -0
- package/dist/commands/view.js +61 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -20
- package/dist/lib/agents.js +2 -2
- package/dist/lib/auto-pull-worker.js +2 -3
- package/dist/lib/auto-pull.js +2 -2
- package/dist/lib/browser/cdp.d.ts +7 -1
- package/dist/lib/browser/cdp.js +29 -1
- package/dist/lib/browser/chrome.js +5 -2
- package/dist/lib/browser/devices.d.ts +4 -0
- package/dist/lib/browser/devices.js +27 -0
- package/dist/lib/browser/drivers/local.js +9 -4
- package/dist/lib/browser/drivers/ssh.js +9 -2
- package/dist/lib/browser/ipc.js +144 -23
- package/dist/lib/browser/profiles.d.ts +5 -2
- package/dist/lib/browser/profiles.js +77 -37
- package/dist/lib/browser/service.d.ts +81 -13
- package/dist/lib/browser/service.js +738 -131
- package/dist/lib/browser/types.d.ts +81 -3
- package/dist/lib/browser/types.js +16 -0
- package/dist/lib/cloud/rush.js +2 -2
- package/dist/lib/cloud/store.js +2 -2
- package/dist/lib/commands.d.ts +1 -0
- package/dist/lib/commands.js +6 -2
- package/dist/lib/daemon.js +2 -3
- package/dist/lib/doctor-diff.js +4 -4
- package/dist/lib/events.js +2 -2
- package/dist/lib/hooks.d.ts +11 -7
- package/dist/lib/hooks.js +125 -49
- package/dist/lib/migrate.d.ts +1 -1
- package/dist/lib/migrate.js +1178 -21
- package/dist/lib/models.js +2 -2
- package/dist/lib/permissions.d.ts +8 -8
- package/dist/lib/permissions.js +8 -8
- package/dist/lib/plugins.d.ts +30 -1
- package/dist/lib/plugins.js +75 -3
- package/dist/lib/pty-server.js +9 -10
- package/dist/lib/resources/hooks.d.ts +5 -1
- package/dist/lib/resources/hooks.js +21 -4
- package/dist/lib/rotate.js +3 -4
- package/dist/lib/session/active.d.ts +3 -0
- package/dist/lib/session/active.js +92 -6
- package/dist/lib/session/cloud.js +2 -2
- package/dist/lib/session/db.js +8 -3
- package/dist/lib/session/discover.js +30 -15
- package/dist/lib/session/team-filter.js +2 -2
- package/dist/lib/shims.d.ts +2 -2
- package/dist/lib/shims.js +6 -6
- package/dist/lib/skills.js +6 -2
- package/dist/lib/state.d.ts +86 -14
- package/dist/lib/state.js +150 -23
- package/dist/lib/subagents.d.ts +28 -0
- package/dist/lib/subagents.js +98 -1
- package/dist/lib/sync-manifest.d.ts +1 -1
- package/dist/lib/sync-manifest.js +3 -3
- package/dist/lib/teams/persistence.js +15 -5
- package/dist/lib/teams/registry.js +2 -2
- package/dist/lib/types.d.ts +32 -3
- package/dist/lib/types.js +3 -3
- package/dist/lib/usage.js +2 -2
- package/dist/lib/versions.js +20 -21
- package/package.json +1 -1
- package/scripts/postinstall.js +1 -1
package/dist/lib/browser/ipc.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as net from 'net';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import * as path from 'path';
|
|
4
|
-
import {
|
|
4
|
+
import { getHelpersDir } from '../state.js';
|
|
5
5
|
import { startDaemon } from '../daemon.js';
|
|
6
6
|
const SOCKET_NAME = 'browser.sock';
|
|
7
7
|
export function getSocketPath() {
|
|
8
|
-
return path.join(
|
|
8
|
+
return path.join(getHelpersDir(), SOCKET_NAME);
|
|
9
9
|
}
|
|
10
10
|
export class BrowserIPCServer {
|
|
11
11
|
server = null;
|
|
@@ -67,8 +67,23 @@ export class BrowserIPCServer {
|
|
|
67
67
|
if (!request.profile) {
|
|
68
68
|
return { ok: false, error: 'Profile required' };
|
|
69
69
|
}
|
|
70
|
-
const result = await this.service.start(request.profile,
|
|
71
|
-
|
|
70
|
+
const result = await this.service.start(request.profile, {
|
|
71
|
+
taskName: request.taskName,
|
|
72
|
+
url: request.url,
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
ok: true,
|
|
76
|
+
task: result.name,
|
|
77
|
+
tabId: result.tabId,
|
|
78
|
+
windowTargetId: result.windowId,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
case 'done': {
|
|
82
|
+
if (!request.task) {
|
|
83
|
+
return { ok: false, error: 'Task required' };
|
|
84
|
+
}
|
|
85
|
+
const result = await this.service.done(request.task);
|
|
86
|
+
return { ok: result.ok, error: result.ok ? undefined : 'Task not found' };
|
|
72
87
|
}
|
|
73
88
|
case 'stop': {
|
|
74
89
|
if (request.task) {
|
|
@@ -85,6 +100,10 @@ export class BrowserIPCServer {
|
|
|
85
100
|
const profiles = await this.service.status(request.profile);
|
|
86
101
|
return { ok: true, profiles };
|
|
87
102
|
}
|
|
103
|
+
case 'history': {
|
|
104
|
+
const history = await this.service.getHistory(request.limit ?? 10);
|
|
105
|
+
return { ok: true, history };
|
|
106
|
+
}
|
|
88
107
|
case 'navigate': {
|
|
89
108
|
if (!request.task || !request.url) {
|
|
90
109
|
return { ok: false, error: 'Task and URL required' };
|
|
@@ -92,20 +111,37 @@ export class BrowserIPCServer {
|
|
|
92
111
|
const result = await this.service.navigate(request.task, request.url, request.profile);
|
|
93
112
|
return { ok: true, tabId: result.tabId };
|
|
94
113
|
}
|
|
95
|
-
case '
|
|
96
|
-
|
|
97
|
-
|
|
114
|
+
case 'tab-add': {
|
|
115
|
+
if (!request.task || !request.url) {
|
|
116
|
+
return { ok: false, error: 'Task and URL required' };
|
|
117
|
+
}
|
|
118
|
+
const result = await this.service.tabAdd(request.task, request.url, request.profile);
|
|
119
|
+
return { ok: true, tabId: result.tabId };
|
|
120
|
+
}
|
|
121
|
+
case 'tab-focus': {
|
|
122
|
+
if (!request.task || !request.tabId) {
|
|
123
|
+
return { ok: false, error: 'Task and tabId required' };
|
|
124
|
+
}
|
|
125
|
+
const result = await this.service.tabFocus(request.task, request.tabId);
|
|
126
|
+
return { ok: true, tabId: result.tabId };
|
|
98
127
|
}
|
|
99
|
-
case 'close': {
|
|
128
|
+
case 'tab-close': {
|
|
100
129
|
if (!request.task) {
|
|
101
130
|
return { ok: false, error: 'Task required' };
|
|
102
131
|
}
|
|
103
|
-
await this.service.
|
|
132
|
+
await this.service.tabClose(request.task, request.tabId);
|
|
104
133
|
return { ok: true };
|
|
105
134
|
}
|
|
135
|
+
case 'tab-list': {
|
|
136
|
+
if (!request.task) {
|
|
137
|
+
return { ok: false, error: 'Task required' };
|
|
138
|
+
}
|
|
139
|
+
const tabs = await this.service.tabList(request.task);
|
|
140
|
+
return { ok: true, tabs: tabs.map(t => ({ id: t.id, url: t.url, title: t.title, task: request.task })) };
|
|
141
|
+
}
|
|
106
142
|
case 'evaluate': {
|
|
107
|
-
if (!request.task ||
|
|
108
|
-
return { ok: false, error: 'Task
|
|
143
|
+
if (!request.task || !request.expr) {
|
|
144
|
+
return { ok: false, error: 'Task and expression required' };
|
|
109
145
|
}
|
|
110
146
|
const result = await this.service.evaluate(request.task, request.tabId, request.expr);
|
|
111
147
|
return { ok: true, result };
|
|
@@ -128,33 +164,118 @@ export class BrowserIPCServer {
|
|
|
128
164
|
return { ok: true, refs };
|
|
129
165
|
}
|
|
130
166
|
case 'click': {
|
|
131
|
-
if (!request.task ||
|
|
132
|
-
return { ok: false, error: 'Task
|
|
167
|
+
if (!request.task || request.ref === undefined) {
|
|
168
|
+
return { ok: false, error: 'Task and ref required' };
|
|
133
169
|
}
|
|
134
|
-
await this.service.click(request.task, request.
|
|
170
|
+
await this.service.click(request.task, request.ref, request.tabId);
|
|
135
171
|
return { ok: true };
|
|
136
172
|
}
|
|
137
173
|
case 'type': {
|
|
138
|
-
if (!request.task ||
|
|
139
|
-
return { ok: false, error: 'Task,
|
|
174
|
+
if (!request.task || request.ref === undefined || !request.text) {
|
|
175
|
+
return { ok: false, error: 'Task, ref, and text required' };
|
|
140
176
|
}
|
|
141
|
-
await this.service.type(request.task, request.
|
|
177
|
+
await this.service.type(request.task, request.ref, request.text, request.tabId);
|
|
142
178
|
return { ok: true };
|
|
143
179
|
}
|
|
144
180
|
case 'press': {
|
|
145
|
-
if (!request.task || !request.
|
|
146
|
-
return { ok: false, error: 'Task
|
|
181
|
+
if (!request.task || !request.key) {
|
|
182
|
+
return { ok: false, error: 'Task and key required' };
|
|
147
183
|
}
|
|
148
|
-
await this.service.press(request.task, request.
|
|
184
|
+
await this.service.press(request.task, request.key, request.tabId);
|
|
149
185
|
return { ok: true };
|
|
150
186
|
}
|
|
151
187
|
case 'hover': {
|
|
152
|
-
if (!request.task ||
|
|
153
|
-
return { ok: false, error: 'Task
|
|
188
|
+
if (!request.task || request.ref === undefined) {
|
|
189
|
+
return { ok: false, error: 'Task and ref required' };
|
|
154
190
|
}
|
|
155
|
-
await this.service.hover(request.task, request.
|
|
191
|
+
await this.service.hover(request.task, request.ref, request.tabId);
|
|
192
|
+
return { ok: true };
|
|
193
|
+
}
|
|
194
|
+
case 'set-viewport': {
|
|
195
|
+
if (!request.task || !request.width || !request.height) {
|
|
196
|
+
return { ok: false, error: 'Task, width, and height required' };
|
|
197
|
+
}
|
|
198
|
+
await this.service.setViewport(request.task, request.width, request.height, {
|
|
199
|
+
mobile: request.mobile,
|
|
200
|
+
deviceScaleFactor: request.deviceScaleFactor,
|
|
201
|
+
tabHint: request.tabId,
|
|
202
|
+
});
|
|
156
203
|
return { ok: true };
|
|
157
204
|
}
|
|
205
|
+
case 'set-device': {
|
|
206
|
+
if (!request.task || !request.deviceName) {
|
|
207
|
+
return { ok: false, error: 'Task and device name required' };
|
|
208
|
+
}
|
|
209
|
+
await this.service.setDevice(request.task, request.deviceName, request.tabId);
|
|
210
|
+
return { ok: true };
|
|
211
|
+
}
|
|
212
|
+
case 'console': {
|
|
213
|
+
if (!request.task) {
|
|
214
|
+
return { ok: false, error: 'Task required' };
|
|
215
|
+
}
|
|
216
|
+
const logs = await this.service.getConsoleLogs(request.task, {
|
|
217
|
+
level: request.level,
|
|
218
|
+
clear: request.clear,
|
|
219
|
+
tabHint: request.tabId,
|
|
220
|
+
});
|
|
221
|
+
return { ok: true, logs };
|
|
222
|
+
}
|
|
223
|
+
case 'errors': {
|
|
224
|
+
if (!request.task) {
|
|
225
|
+
return { ok: false, error: 'Task required' };
|
|
226
|
+
}
|
|
227
|
+
const errors = await this.service.getErrors(request.task, {
|
|
228
|
+
clear: request.clear,
|
|
229
|
+
tabHint: request.tabId,
|
|
230
|
+
});
|
|
231
|
+
return { ok: true, errors };
|
|
232
|
+
}
|
|
233
|
+
case 'requests': {
|
|
234
|
+
if (!request.task) {
|
|
235
|
+
return { ok: false, error: 'Task required' };
|
|
236
|
+
}
|
|
237
|
+
const requests = await this.service.getNetworkRequests(request.task, {
|
|
238
|
+
filter: request.filter,
|
|
239
|
+
clear: request.clear,
|
|
240
|
+
tabHint: request.tabId,
|
|
241
|
+
});
|
|
242
|
+
return { ok: true, requests };
|
|
243
|
+
}
|
|
244
|
+
case 'response-body': {
|
|
245
|
+
if (!request.task || !request.urlPattern) {
|
|
246
|
+
return { ok: false, error: 'Task and URL pattern required' };
|
|
247
|
+
}
|
|
248
|
+
const body = await this.service.getResponseBody(request.task, request.urlPattern, {
|
|
249
|
+
timeout: request.timeout,
|
|
250
|
+
maxChars: request.maxChars,
|
|
251
|
+
tabHint: request.tabId,
|
|
252
|
+
});
|
|
253
|
+
return { ok: true, body };
|
|
254
|
+
}
|
|
255
|
+
case 'wait': {
|
|
256
|
+
if (!request.task || !request.waitType || request.waitValue === undefined) {
|
|
257
|
+
return { ok: false, error: 'Task, wait type, and wait value required' };
|
|
258
|
+
}
|
|
259
|
+
await this.service.wait(request.task, request.waitType, request.waitValue, {
|
|
260
|
+
timeout: request.timeout,
|
|
261
|
+
tabHint: request.tabId,
|
|
262
|
+
});
|
|
263
|
+
return { ok: true };
|
|
264
|
+
}
|
|
265
|
+
case 'set-download-path': {
|
|
266
|
+
if (!request.task || !request.downloadPath) {
|
|
267
|
+
return { ok: false, error: 'Task and download path required' };
|
|
268
|
+
}
|
|
269
|
+
await this.service.setDownloadPath(request.task, request.downloadPath, request.tabId);
|
|
270
|
+
return { ok: true };
|
|
271
|
+
}
|
|
272
|
+
case 'wait-download': {
|
|
273
|
+
if (!request.task) {
|
|
274
|
+
return { ok: false, error: 'Task required' };
|
|
275
|
+
}
|
|
276
|
+
const downloadPath = await this.service.waitForDownload(request.task, request.timeout);
|
|
277
|
+
return { ok: true, downloadPath };
|
|
278
|
+
}
|
|
158
279
|
default:
|
|
159
280
|
return { ok: false, error: `Unknown action: ${request.action}` };
|
|
160
281
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { BrowserProfile } from './types.js';
|
|
2
2
|
export type { BrowserProfile } from './types.js';
|
|
3
|
-
export declare function getBrowserProfilesDir(): string;
|
|
4
3
|
export declare function getBrowserRuntimeDir(): string;
|
|
5
|
-
export declare function getProfilePath(name: string): string;
|
|
6
4
|
export declare function getProfileRuntimeDir(name: string): string;
|
|
7
5
|
export declare function listProfiles(): Promise<BrowserProfile[]>;
|
|
8
6
|
export declare function getProfile(name: string): Promise<BrowserProfile | null>;
|
|
9
7
|
export declare function createProfile(profile: BrowserProfile): Promise<void>;
|
|
10
8
|
export declare function updateProfile(profile: BrowserProfile): Promise<void>;
|
|
11
9
|
export declare function deleteProfile(name: string): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Extract the port intended by the profile's first endpoint.
|
|
12
|
+
* Returns undefined for endpoint shapes that don't carry a port (e.g. ws:// without one).
|
|
13
|
+
*/
|
|
14
|
+
export declare function extractConfiguredPort(profile: BrowserProfile): number | undefined;
|
|
@@ -1,61 +1,101 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
1
|
import * as path from 'path';
|
|
3
|
-
import
|
|
4
|
-
import * as yaml from 'yaml';
|
|
5
|
-
import { getUserAgentsDir } from '../state.js';
|
|
6
|
-
export function getBrowserProfilesDir() {
|
|
7
|
-
return path.join(getUserAgentsDir(), 'browser', 'profiles');
|
|
8
|
-
}
|
|
2
|
+
import { getBrowserRuntimeDir as getBrowserRuntimeDirRoot, readMeta, writeMeta, } from '../state.js';
|
|
9
3
|
export function getBrowserRuntimeDir() {
|
|
10
|
-
|
|
11
|
-
return path.join(agentsDir, 'browser');
|
|
12
|
-
}
|
|
13
|
-
export function getProfilePath(name) {
|
|
14
|
-
return path.join(getBrowserProfilesDir(), `${name}.yaml`);
|
|
4
|
+
return getBrowserRuntimeDirRoot();
|
|
15
5
|
}
|
|
16
6
|
export function getProfileRuntimeDir(name) {
|
|
17
7
|
return path.join(getBrowserRuntimeDir(), name);
|
|
18
8
|
}
|
|
9
|
+
function configToProfile(name, config) {
|
|
10
|
+
return {
|
|
11
|
+
name,
|
|
12
|
+
description: config.description,
|
|
13
|
+
browser: config.browser,
|
|
14
|
+
binary: config.binary,
|
|
15
|
+
electron: config.electron,
|
|
16
|
+
endpoints: config.endpoints,
|
|
17
|
+
chrome: config.chrome,
|
|
18
|
+
secrets: config.secrets,
|
|
19
|
+
viewport: config.viewport,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function profileToConfig(profile) {
|
|
23
|
+
const config = {
|
|
24
|
+
browser: profile.browser,
|
|
25
|
+
endpoints: profile.endpoints,
|
|
26
|
+
};
|
|
27
|
+
if (profile.description)
|
|
28
|
+
config.description = profile.description;
|
|
29
|
+
if (profile.binary)
|
|
30
|
+
config.binary = profile.binary;
|
|
31
|
+
if (profile.electron)
|
|
32
|
+
config.electron = profile.electron;
|
|
33
|
+
if (profile.chrome)
|
|
34
|
+
config.chrome = profile.chrome;
|
|
35
|
+
if (profile.secrets)
|
|
36
|
+
config.secrets = profile.secrets;
|
|
37
|
+
if (profile.viewport)
|
|
38
|
+
config.viewport = profile.viewport;
|
|
39
|
+
return config;
|
|
40
|
+
}
|
|
19
41
|
export async function listProfiles() {
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
42
|
+
const meta = readMeta();
|
|
43
|
+
if (!meta.browser)
|
|
22
44
|
return [];
|
|
23
|
-
|
|
24
|
-
const profiles = [];
|
|
25
|
-
for (const file of files) {
|
|
26
|
-
const content = fs.readFileSync(path.join(dir, file), 'utf-8');
|
|
27
|
-
const profile = yaml.parse(content);
|
|
28
|
-
profiles.push(profile);
|
|
29
|
-
}
|
|
30
|
-
return profiles;
|
|
45
|
+
return Object.entries(meta.browser).map(([name, config]) => configToProfile(name, config));
|
|
31
46
|
}
|
|
32
47
|
export async function getProfile(name) {
|
|
33
|
-
const
|
|
34
|
-
|
|
48
|
+
const meta = readMeta();
|
|
49
|
+
const config = meta.browser?.[name];
|
|
50
|
+
if (!config)
|
|
35
51
|
return null;
|
|
36
|
-
|
|
37
|
-
return yaml.parse(content);
|
|
52
|
+
return configToProfile(name, config);
|
|
38
53
|
}
|
|
39
54
|
export async function createProfile(profile) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const filePath = getProfilePath(profile.name);
|
|
43
|
-
if (fs.existsSync(filePath)) {
|
|
55
|
+
const meta = readMeta();
|
|
56
|
+
if (meta.browser?.[profile.name]) {
|
|
44
57
|
throw new Error(`Profile "${profile.name}" already exists`);
|
|
45
58
|
}
|
|
46
|
-
|
|
59
|
+
meta.browser = meta.browser ?? {};
|
|
60
|
+
meta.browser[profile.name] = profileToConfig(profile);
|
|
61
|
+
writeMeta(meta);
|
|
47
62
|
}
|
|
48
63
|
export async function updateProfile(profile) {
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
64
|
+
const meta = readMeta();
|
|
65
|
+
if (!meta.browser?.[profile.name]) {
|
|
51
66
|
throw new Error(`Profile "${profile.name}" does not exist`);
|
|
52
67
|
}
|
|
53
|
-
|
|
68
|
+
meta.browser[profile.name] = profileToConfig(profile);
|
|
69
|
+
writeMeta(meta);
|
|
54
70
|
}
|
|
55
71
|
export async function deleteProfile(name) {
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
72
|
+
const meta = readMeta();
|
|
73
|
+
if (!meta.browser?.[name]) {
|
|
58
74
|
throw new Error(`Profile "${name}" does not exist`);
|
|
59
75
|
}
|
|
60
|
-
|
|
76
|
+
delete meta.browser[name];
|
|
77
|
+
writeMeta(meta);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Extract the port intended by the profile's first endpoint.
|
|
81
|
+
* Returns undefined for endpoint shapes that don't carry a port (e.g. ws:// without one).
|
|
82
|
+
*/
|
|
83
|
+
export function extractConfiguredPort(profile) {
|
|
84
|
+
const endpoint = profile.endpoints[0];
|
|
85
|
+
if (!endpoint)
|
|
86
|
+
return undefined;
|
|
87
|
+
let url;
|
|
88
|
+
try {
|
|
89
|
+
url = new URL(endpoint);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
if (url.port)
|
|
95
|
+
return parseInt(url.port, 10);
|
|
96
|
+
if (url.protocol === 'cdp:')
|
|
97
|
+
return 9222;
|
|
98
|
+
if (url.protocol === 'ssh:')
|
|
99
|
+
return 9222;
|
|
100
|
+
return undefined;
|
|
61
101
|
}
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
import { type TabInfo, type ProfileStatus } from './types.js';
|
|
1
|
+
import { type TabInfo, type ProfileStatus, type HistoricalTask } from './types.js';
|
|
2
2
|
import { type RefOpts, type RefNode } from './refs.js';
|
|
3
3
|
export declare class BrowserService {
|
|
4
4
|
private connections;
|
|
5
5
|
private forkingProfiles;
|
|
6
|
-
|
|
6
|
+
private consoleLogs;
|
|
7
|
+
private pageErrors;
|
|
8
|
+
private networkRequests;
|
|
9
|
+
private pendingDownloads;
|
|
10
|
+
private enabledSessions;
|
|
11
|
+
start(profileName: string, opts?: {
|
|
12
|
+
taskName?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
}): Promise<{
|
|
7
15
|
task: string;
|
|
8
|
-
|
|
16
|
+
name: string;
|
|
17
|
+
tabId?: string;
|
|
18
|
+
windowId?: string;
|
|
9
19
|
}>;
|
|
10
|
-
stop(
|
|
20
|
+
stop(taskName: string): Promise<{
|
|
21
|
+
ok: boolean;
|
|
22
|
+
profile?: string;
|
|
23
|
+
}>;
|
|
24
|
+
done(taskName: string): Promise<{
|
|
11
25
|
ok: boolean;
|
|
12
26
|
profile?: string;
|
|
13
27
|
}>;
|
|
@@ -15,28 +29,80 @@ export declare class BrowserService {
|
|
|
15
29
|
navigate(taskId: string, url: string, profileName?: string): Promise<{
|
|
16
30
|
tabId: string;
|
|
17
31
|
url: string;
|
|
32
|
+
created: boolean;
|
|
18
33
|
}>;
|
|
34
|
+
tabAdd(taskId: string, url: string, profileName?: string): Promise<{
|
|
35
|
+
tabId: string;
|
|
36
|
+
url: string;
|
|
37
|
+
}>;
|
|
38
|
+
tabFocus(taskId: string, tabHint: string): Promise<{
|
|
39
|
+
tabId: string;
|
|
40
|
+
}>;
|
|
41
|
+
tabList(taskId: string): Promise<Array<{
|
|
42
|
+
id: string;
|
|
43
|
+
url: string;
|
|
44
|
+
title: string;
|
|
45
|
+
current: boolean;
|
|
46
|
+
}>>;
|
|
47
|
+
private resolveTabHint;
|
|
48
|
+
private resolveCurrentTab;
|
|
49
|
+
private getCdpTargetId;
|
|
19
50
|
tabs(taskId?: string, profileName?: string): Promise<TabInfo[]>;
|
|
20
|
-
|
|
21
|
-
evaluate(taskId: string,
|
|
22
|
-
screenshot(taskId: string,
|
|
51
|
+
tabClose(taskId: string, tabHint?: string): Promise<void>;
|
|
52
|
+
evaluate(taskId: string, tabHint: string | undefined, expression: string): Promise<unknown>;
|
|
53
|
+
screenshot(taskId: string, tabHint?: string, outputPath?: string): Promise<string>;
|
|
23
54
|
private refsCache;
|
|
24
|
-
refs(taskId: string,
|
|
55
|
+
refs(taskId: string, tabHint?: string, opts?: RefOpts): Promise<{
|
|
25
56
|
refs: string;
|
|
26
57
|
nodeMap: Map<number, RefNode>;
|
|
27
58
|
}>;
|
|
28
|
-
click(taskId: string,
|
|
29
|
-
type(taskId: string,
|
|
30
|
-
press(taskId: string,
|
|
31
|
-
hover(taskId: string,
|
|
59
|
+
click(taskId: string, ref: number, tabHint?: string): Promise<void>;
|
|
60
|
+
type(taskId: string, ref: number, text: string, tabHint?: string): Promise<void>;
|
|
61
|
+
press(taskId: string, key: string, tabHint?: string): Promise<void>;
|
|
62
|
+
hover(taskId: string, ref: number, tabHint?: string): Promise<void>;
|
|
32
63
|
status(profileName?: string): Promise<ProfileStatus[]>;
|
|
64
|
+
private reconcileFromDisk;
|
|
65
|
+
setViewport(taskId: string, width: number, height: number, options?: {
|
|
66
|
+
mobile?: boolean;
|
|
67
|
+
deviceScaleFactor?: number;
|
|
68
|
+
tabHint?: string;
|
|
69
|
+
}): Promise<void>;
|
|
70
|
+
setDevice(taskId: string, deviceName: string, tabHint?: string): Promise<void>;
|
|
71
|
+
private enableRuntimeForSession;
|
|
72
|
+
getConsoleLogs(taskId: string, options?: {
|
|
73
|
+
level?: string;
|
|
74
|
+
clear?: boolean;
|
|
75
|
+
tabHint?: string;
|
|
76
|
+
}): Promise<import('./types.js').ConsoleEntry[]>;
|
|
77
|
+
getErrors(taskId: string, options?: {
|
|
78
|
+
clear?: boolean;
|
|
79
|
+
tabHint?: string;
|
|
80
|
+
}): Promise<import('./types.js').ErrorEntry[]>;
|
|
81
|
+
private enableNetworkForSession;
|
|
82
|
+
getNetworkRequests(taskId: string, options?: {
|
|
83
|
+
filter?: string;
|
|
84
|
+
clear?: boolean;
|
|
85
|
+
tabHint?: string;
|
|
86
|
+
}): Promise<import('./types.js').NetworkRequest[]>;
|
|
87
|
+
getResponseBody(taskId: string, urlPattern: string, options?: {
|
|
88
|
+
timeout?: number;
|
|
89
|
+
maxChars?: number;
|
|
90
|
+
tabHint?: string;
|
|
91
|
+
}): Promise<string>;
|
|
92
|
+
wait(taskId: string, type: 'time' | 'selector' | 'url' | 'function' | 'load', value: string | number, options?: {
|
|
93
|
+
timeout?: number;
|
|
94
|
+
tabHint?: string;
|
|
95
|
+
}): Promise<void>;
|
|
96
|
+
setDownloadPath(taskId: string, downloadPath: string, tabHint?: string): Promise<void>;
|
|
97
|
+
waitForDownload(taskId: string, timeout?: number): Promise<string>;
|
|
98
|
+
private findTaskBySession;
|
|
33
99
|
shutdown(): Promise<void>;
|
|
34
100
|
private findAvailableFork;
|
|
35
101
|
private forkElectronProfile;
|
|
36
102
|
private connectProfile;
|
|
37
103
|
private connectEndpoint;
|
|
38
104
|
private enableDomains;
|
|
39
|
-
private
|
|
105
|
+
private getOrCreateWindow;
|
|
40
106
|
private findTask;
|
|
41
107
|
private getTabsForTask;
|
|
42
108
|
private getProfileStatus;
|
|
@@ -45,4 +111,6 @@ export declare class BrowserService {
|
|
|
45
111
|
private invalidateTargetCache;
|
|
46
112
|
private saveTaskState;
|
|
47
113
|
private loadTaskState;
|
|
114
|
+
private saveToHistory;
|
|
115
|
+
getHistory(limit?: number): Promise<HistoricalTask[]>;
|
|
48
116
|
}
|