gologin-agent-browser-cli 0.1.0 → 0.1.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/LICENSE +1 -1
- package/README.md +70 -28
- package/dist/cli.js +1 -1
- package/dist/daemon/browser.js +5 -5
- package/dist/daemon/server.js +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Gologin Agent Browser CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Gologin Agent Browser CLI is a cloud browser automation CLI built for AI agents. It turns Gologin Cloud Browser into a persistent, scriptable runtime with compact page snapshots, ref-based interaction, session memory, and shell-friendly commands.
|
|
4
4
|
|
|
5
5
|
It is designed for agent loops that need to stay simple:
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ It is designed for agent loops that need to stay simple:
|
|
|
10
10
|
- keep working across multiple CLI calls through a local daemon
|
|
11
11
|
- save artifacts such as screenshots and PDFs when needed
|
|
12
12
|
|
|
13
|
-
Unlike local-browser automation tools, it runs on top of a cloud browser stack built around
|
|
13
|
+
Unlike local-browser automation tools, it runs on top of a cloud browser stack built around Gologin profiles, proxies, fingerprinting, and anti-detect capabilities.
|
|
14
14
|
|
|
15
15
|
## Why Cloud Browser
|
|
16
16
|
|
|
@@ -22,12 +22,12 @@ Local-browser automation is convenient, but it comes with hard limits for agent
|
|
|
22
22
|
- local networking is limited unless you bolt on your own proxy layer
|
|
23
23
|
- local sessions are harder to standardize across agents and environments
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Gologin Agent Browser CLI takes the opposite approach:
|
|
26
26
|
|
|
27
27
|
- cloud browser runtime instead of a local browser process
|
|
28
|
-
-
|
|
28
|
+
- Gologin profiles as the session identity layer
|
|
29
29
|
- proxy-aware browser sessions
|
|
30
|
-
- fingerprint and anti-detect capabilities inherited from
|
|
30
|
+
- fingerprint and anti-detect capabilities inherited from Gologin
|
|
31
31
|
- a persistent daemon that keeps agent sessions alive across CLI calls
|
|
32
32
|
|
|
33
33
|
## Architecture
|
|
@@ -37,9 +37,9 @@ The system has two parts:
|
|
|
37
37
|
- `gologin-agent-browser` CLI
|
|
38
38
|
- a persistent local daemon
|
|
39
39
|
|
|
40
|
-
The CLI parses commands, auto-starts the daemon when needed, and prints compact output for agents. The daemon owns live browser sessions, connects to
|
|
40
|
+
The CLI parses commands, auto-starts the daemon when needed, and prints compact output for agents. The daemon owns live browser sessions, connects to Gologin Cloud Browser through Playwright `connectOverCDP`, keeps the active page in memory, builds snapshots, resolves refs like `@e1`, and tracks session metadata such as proxy mode, idle timeout, and generated artifacts.
|
|
41
41
|
|
|
42
|
-
If you do not provide a profile id, the daemon creates a temporary
|
|
42
|
+
If you do not provide a profile id, the daemon creates a temporary Gologin cloud profile through the Gologin API, uses it to open the session, and attempts to delete it when the session is closed.
|
|
43
43
|
|
|
44
44
|
Transport is local only:
|
|
45
45
|
|
|
@@ -77,6 +77,28 @@ npm install
|
|
|
77
77
|
npm run build
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
## Get a Gologin Token
|
|
81
|
+
|
|
82
|
+
You need a Gologin account with API access before you can open cloud browser sessions.
|
|
83
|
+
|
|
84
|
+
1. Sign up or log in at [Gologin](https://gologin.com/).
|
|
85
|
+
2. In the Gologin dashboard, open `API & MCP`.
|
|
86
|
+
3. Open the `API` tab.
|
|
87
|
+
4. Click `New Token`.
|
|
88
|
+
5. Copy the generated access token.
|
|
89
|
+
|
|
90
|
+
Then export it in your shell:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
export GOLOGIN_TOKEN='your_gologin_token'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
API access depends on your Gologin account and plan. If token creation is unavailable in the dashboard, check your account access before troubleshooting the CLI.
|
|
97
|
+
|
|
98
|
+
Note: the local daemon reads environment variables and config on startup. If you change `GOLOGIN_TOKEN` or `~/.gologin-agent-browser/config.json`, restart the daemon before running `open` again.
|
|
99
|
+
|
|
100
|
+
If you prefer a local config file instead of an environment variable, save the same token to `~/.gologin-agent-browser/config.json`.
|
|
101
|
+
|
|
80
102
|
## Required Environment
|
|
81
103
|
|
|
82
104
|
- `GOLOGIN_TOKEN` required for `open`
|
|
@@ -100,28 +122,39 @@ Save it as `~/.gologin-agent-browser/config.json`.
|
|
|
100
122
|
## Quickstart
|
|
101
123
|
|
|
102
124
|
```bash
|
|
103
|
-
export GOLOGIN_TOKEN=
|
|
125
|
+
export GOLOGIN_TOKEN='your_gologin_token'
|
|
104
126
|
|
|
105
127
|
gologin-agent-browser open https://example.com
|
|
106
128
|
gologin-agent-browser snapshot -i
|
|
107
|
-
gologin-agent-browser current
|
|
108
129
|
gologin-agent-browser click @e3
|
|
109
|
-
gologin-agent-browser fill "input[name='email']" "test@example.com"
|
|
110
|
-
gologin-agent-browser scroll down 600
|
|
111
|
-
gologin-agent-browser get title
|
|
112
|
-
gologin-agent-browser pdf page.pdf
|
|
113
|
-
gologin-agent-browser screenshot page.png --annotate
|
|
114
|
-
gologin-agent-browser sessions
|
|
115
130
|
gologin-agent-browser close
|
|
116
131
|
```
|
|
117
132
|
|
|
118
|
-
|
|
133
|
+
## How Refs Work
|
|
134
|
+
|
|
135
|
+
`gologin-agent-browser snapshot` prints a compact page view and assigns refs like `@e1`, `@e2`, and `@e3`.
|
|
136
|
+
|
|
137
|
+
Example:
|
|
138
|
+
|
|
139
|
+
```text
|
|
140
|
+
- link "More information..." [ref=@e3]
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
You can then act on that element with commands like:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
gologin-agent-browser click @e3
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Refs are best-effort and should be regenerated after navigation or major DOM changes.
|
|
150
|
+
|
|
151
|
+
## More Examples
|
|
119
152
|
|
|
120
153
|
```bash
|
|
121
154
|
gologin-agent-browser open https://example.com --proxy-host 1.2.3.4 --proxy-port 8080 --proxy-mode http --idle-timeout-ms 300000
|
|
122
155
|
gologin-agent-browser open https://example.com --profile your-preconfigured-gologin-profile
|
|
123
156
|
gologin-agent-browser click "a[href*='iana']"
|
|
124
|
-
gologin-agent-browser type
|
|
157
|
+
gologin-agent-browser type "textarea[name='message']" "hello world"
|
|
125
158
|
gologin-agent-browser focus "input[name='email']"
|
|
126
159
|
gologin-agent-browser press Enter
|
|
127
160
|
gologin-agent-browser select "select[name='plan']" pro
|
|
@@ -177,7 +210,7 @@ Agents can then use those refs:
|
|
|
177
210
|
|
|
178
211
|
```bash
|
|
179
212
|
gologin-agent-browser click @e3
|
|
180
|
-
gologin-agent-browser
|
|
213
|
+
gologin-agent-browser check @e4
|
|
181
214
|
gologin-agent-browser fill "input[name='email']" "test@example.com"
|
|
182
215
|
gologin-agent-browser find role button click --name "Submit"
|
|
183
216
|
gologin-agent-browser screenshot page.png --annotate
|
|
@@ -203,18 +236,27 @@ Supported aliases:
|
|
|
203
236
|
## Current Scope
|
|
204
237
|
|
|
205
238
|
- Session persistence lasts as long as the local daemon is running. Restarting the daemon clears in-memory sessions and refs.
|
|
206
|
-
- Idle timeout is a local daemon policy. It does not change
|
|
239
|
+
- Idle timeout is a local daemon policy. It does not change Gologin account-level cloud limits.
|
|
207
240
|
- Snapshot and ref resolution are best-effort. Dynamic pages can invalidate refs after heavy DOM changes or navigation.
|
|
208
241
|
- Snapshot output is compact and accessibility-informed, but it is not a full accessibility tree dump.
|
|
209
242
|
- Annotated screenshots are based on the current snapshot/ref model, so labels are also best-effort on highly dynamic pages.
|
|
210
243
|
- The daemon keeps only the latest snapshot ref map for each session.
|
|
211
|
-
- Real browser sessions require a valid
|
|
212
|
-
- Token-only mode works by provisioning a temporary cloud profile through the
|
|
213
|
-
- Proxy support is cloud-profile based. Temporary profiles can be created with a custom proxy definition, and existing
|
|
214
|
-
- Local Orbita is intentionally out of scope. This project targets
|
|
215
|
-
-
|
|
216
|
-
- Playwright is the automation layer on top of
|
|
244
|
+
- Real browser sessions require a valid Gologin Cloud Browser account and token. A profile id is optional.
|
|
245
|
+
- Token-only mode works by provisioning a temporary cloud profile through the Gologin API before connecting to Cloud Browser.
|
|
246
|
+
- Proxy support is cloud-profile based. Temporary profiles can be created with a custom proxy definition, and existing Gologin profiles can be reused with `--profile` if they already have a managed proxy attached.
|
|
247
|
+
- Local Orbita is intentionally out of scope. This project targets Gologin Cloud Browser only.
|
|
248
|
+
- Gologin cloud live-view URLs are not auto-fetched by default because the current endpoint can interfere with an active CDP session.
|
|
249
|
+
- Playwright is the automation layer on top of Gologin Cloud Browser. The browser runtime itself does not expose built-in agent actions such as `click()` or `type()`.
|
|
250
|
+
|
|
251
|
+
## Test Coverage
|
|
217
252
|
|
|
218
|
-
|
|
253
|
+
The repository includes unit tests for config loading, snapshot formatting, arg parsing, and URL construction.
|
|
219
254
|
|
|
220
|
-
|
|
255
|
+
A full live browser smoke test is not shipped yet. If you want one, run a manual check with:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
export GOLOGIN_TOKEN='your_gologin_token'
|
|
259
|
+
gologin-agent-browser open https://example.com
|
|
260
|
+
gologin-agent-browser snapshot -i
|
|
261
|
+
gologin-agent-browser close
|
|
262
|
+
```
|
package/dist/cli.js
CHANGED
|
@@ -36,7 +36,7 @@ const errors_1 = require("./lib/errors");
|
|
|
36
36
|
const utils_1 = require("./lib/utils");
|
|
37
37
|
function printUsage() {
|
|
38
38
|
process.stderr.write([
|
|
39
|
-
"
|
|
39
|
+
"Gologin Agent CLI",
|
|
40
40
|
"",
|
|
41
41
|
"Usage:",
|
|
42
42
|
" gologin-agent-browser <command> [args] [options]",
|
package/dist/daemon/browser.js
CHANGED
|
@@ -155,12 +155,12 @@ async function createQuickProfile(token, sessionId) {
|
|
|
155
155
|
})
|
|
156
156
|
});
|
|
157
157
|
if (!response.ok) {
|
|
158
|
-
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", `Failed to create
|
|
158
|
+
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", `Failed to create Gologin profile: ${response.status}`, 502);
|
|
159
159
|
}
|
|
160
160
|
const payload = (await response.json());
|
|
161
161
|
const profileId = extractProfileId(payload);
|
|
162
162
|
if (!profileId) {
|
|
163
|
-
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", "
|
|
163
|
+
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", "Gologin profile creation returned no profile id", 502);
|
|
164
164
|
}
|
|
165
165
|
return profileId;
|
|
166
166
|
}
|
|
@@ -179,12 +179,12 @@ async function createManagedProfile(token, sessionId, proxy) {
|
|
|
179
179
|
body: JSON.stringify(buildCloudProfileBody(sessionId, proxy))
|
|
180
180
|
});
|
|
181
181
|
if (!response.ok) {
|
|
182
|
-
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", `Failed to create
|
|
182
|
+
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", `Failed to create Gologin cloud profile: ${response.status}`, 502);
|
|
183
183
|
}
|
|
184
184
|
const payload = (await response.json());
|
|
185
185
|
const profileId = extractProfileId(payload);
|
|
186
186
|
if (!profileId) {
|
|
187
|
-
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", "
|
|
187
|
+
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", "Gologin profile creation returned no profile id", 502);
|
|
188
188
|
}
|
|
189
189
|
let proxySummary;
|
|
190
190
|
if (payload && typeof payload === "object") {
|
|
@@ -203,7 +203,7 @@ async function deleteProfile(token, profileId) {
|
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
if (!response.ok) {
|
|
206
|
-
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", `Failed to delete
|
|
206
|
+
throw new errors_1.AppError("BROWSER_CONNECTION_FAILED", `Failed to delete Gologin profile ${profileId}`, 502, {
|
|
207
207
|
profileId
|
|
208
208
|
});
|
|
209
209
|
}
|
package/dist/daemon/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gologin-agent-browser-cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Agent-native cloud browser automation CLI for
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Agent-native cloud browser automation CLI for Gologin",
|
|
5
5
|
"main": "dist/cli.js",
|
|
6
6
|
"types": "dist/lib/types.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"playwright",
|
|
44
44
|
"browser"
|
|
45
45
|
],
|
|
46
|
-
"author": "
|
|
46
|
+
"author": "Gologin",
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"engines": {
|
|
49
49
|
"node": ">=18"
|