progon-agent 1.0.1

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 ADDED
@@ -0,0 +1,167 @@
1
+ PROGON LOCAL AGENT
2
+ END-USER LICENSE AGREEMENT
3
+
4
+ Copyright (c) 2026 Progon. All rights reserved.
5
+
6
+ This End-User License Agreement (the "Agreement") is a legal agreement between
7
+ you (an individual or a legal entity, "you") and Progon ("Progon") governing
8
+ your use of the progon-agent software package, including the executable agent,
9
+ the bundled Progon browser extension, and all accompanying files and
10
+ documentation distributed with the package (collectively, the "Software").
11
+
12
+ The Software is proprietary, closed-source software. It is published on the
13
+ public npm registry solely so that customers and authorized users of the
14
+ Progon platform (the "Service") can conveniently install and update it. Public
15
+ availability of the package is not an open-source release and grants no rights
16
+ beyond those set out in this Agreement.
17
+
18
+ By installing, copying, or running the Software, you agree to be bound by this
19
+ Agreement. If you do not agree, do not install or use the Software.
20
+
21
+ 1. LICENSE GRANT
22
+
23
+ Subject to your compliance with this Agreement, Progon grants you a limited,
24
+ revocable, personal, non-exclusive, non-transferable, non-sublicensable
25
+ license to:
26
+
27
+ (a) download and install unmodified copies of the Software, via the npm
28
+ registry, on machines that you own or control; and
29
+
30
+ (b) run the Software on those machines for the sole purpose of executing
31
+ test scenarios through the Service under an account you are authorized
32
+ to use.
33
+
34
+ Use of the Software requires a valid Progon account and enrollment of the
35
+ machine with the Service. This Agreement does not grant you any rights to the
36
+ Service itself, which is governed by the applicable Progon terms of service or
37
+ your separate agreement with Progon.
38
+
39
+ 2. RESTRICTIONS
40
+
41
+ Except to the extent such a restriction is prohibited by applicable law, you
42
+ shall not, and shall not permit or assist any third party to:
43
+
44
+ (a) copy the Software other than as reasonably necessary to install and run
45
+ it as permitted in Section 1;
46
+
47
+ (b) modify, adapt, translate, or create derivative works of the Software,
48
+ including the bundled browser extension;
49
+
50
+ (c) reverse engineer, decompile, disassemble, or otherwise attempt to
51
+ derive or reconstruct the source code, underlying ideas, algorithms,
52
+ file formats, or non-public interfaces of the Software;
53
+
54
+ (d) distribute, redistribute, publish, sell, resell, rent, lease, lend,
55
+ sublicense, or otherwise transfer the Software, or make it available to
56
+ any third party, including as part of a hosted, time-sharing, or
57
+ service-bureau offering;
58
+
59
+ (e) use the Software to access or interact with any service other than a
60
+ Progon deployment you are authorized to use, or use it to build,
61
+ train, or improve a product or service that competes with the Service;
62
+
63
+ (f) remove, obscure, or alter any copyright, trademark, or other
64
+ proprietary notices in or on the Software; or
65
+
66
+ (g) work around any technical limitation of the Software.
67
+
68
+ 3. OWNERSHIP
69
+
70
+ The Software is licensed, not sold. Progon and its licensors retain all
71
+ right, title, and interest in and to the Software, including all copyright,
72
+ trademark, trade secret, and other intellectual property rights. No rights
73
+ are granted to you other than those expressly set out in this Agreement. Any
74
+ feedback or suggestions you provide regarding the Software may be used by
75
+ Progon without restriction or obligation to you.
76
+
77
+ 4. UPDATES
78
+
79
+ Progon may from time to time make updated versions of the Software available
80
+ through the npm registry. Updates may add, modify, or remove features, and
81
+ changes to the wire protocol between the Software and the Service may require
82
+ you to update the Software or re-enroll a machine for it to continue working.
83
+ This Agreement applies to all updates unless an update is accompanied by a
84
+ separate license, in which case that license governs. Progon has no
85
+ obligation to provide updates or to maintain any particular feature of the
86
+ Software.
87
+
88
+ 5. DATA TRANSMISSION
89
+
90
+ The Software operates by communicating with the Progon deployment it is
91
+ enrolled against, over outbound HTTPS connections initiated by the Software.
92
+ In the course of that operation it transmits to that deployment data
93
+ concerning the agent and the test runs it executes, including enrollment and
94
+ agent identity information, run claims and status, scenario execution results
95
+ and step reports, and failure reports. This data is transmitted to the Progon
96
+ service associated with the account under which the machine was enrolled and
97
+ is handled in accordance with the agreement governing that account and the
98
+ applicable Progon privacy documentation.
99
+
100
+ On first start (or after certain updates), the Software also downloads a
101
+ Chromium browser build from the Playwright content delivery network, as
102
+ described in the accompanying documentation.
103
+
104
+ 6. THIRD-PARTY COMPONENTS
105
+
106
+ The Software depends on third-party open-source packages that are installed
107
+ alongside it by npm and on a Chromium browser build provisioned at first
108
+ start. Such third-party components are governed solely by their own license
109
+ terms, and nothing in this Agreement limits your rights, or grants you
110
+ rights, under those terms. This Agreement applies only to the proprietary
111
+ components of the Software.
112
+
113
+ 7. DISCLAIMER OF WARRANTIES
114
+
115
+ THE SOFTWARE IS PROVIDED "AS IS" AND "AS AVAILABLE", WITH ALL FAULTS AND
116
+ WITHOUT WARRANTY OF ANY KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE
117
+ LAW, PROGON DISCLAIMS ALL WARRANTIES, WHETHER EXPRESS, IMPLIED, STATUTORY, OR
118
+ OTHERWISE, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OF
119
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT,
120
+ AND ANY WARRANTIES ARISING OUT OF COURSE OF DEALING OR USAGE OF TRADE.
121
+ PROGON DOES NOT WARRANT THAT THE SOFTWARE WILL BE UNINTERRUPTED, ERROR-FREE,
122
+ OR FREE OF HARMFUL COMPONENTS.
123
+
124
+ 8. LIMITATION OF LIABILITY
125
+
126
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL PROGON
127
+ BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, EXEMPLARY, OR
128
+ PUNITIVE DAMAGES, OR FOR ANY LOSS OF PROFITS, REVENUE, DATA, OR GOODWILL,
129
+ ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT OR THE USE OF OR
130
+ INABILITY TO USE THE SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
131
+ DAMAGES. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, PROGON'S
132
+ AGGREGATE LIABILITY ARISING OUT OF OR RELATING TO THIS AGREEMENT OR THE
133
+ SOFTWARE SHALL NOT EXCEED THE AMOUNTS PAID BY YOU FOR THE USE OF THE SERVICE
134
+ DURING THE TWELVE (12) MONTHS PRECEDING THE EVENT GIVING RISE TO THE CLAIM,
135
+ OR, IF NO SUCH AMOUNTS WERE PAID, ONE HUNDRED (100) US DOLLARS. NOTHING IN
136
+ THIS AGREEMENT EXCLUDES OR LIMITS LIABILITY THAT CANNOT BE EXCLUDED OR
137
+ LIMITED UNDER APPLICABLE LAW.
138
+
139
+ 9. TERMINATION
140
+
141
+ This Agreement is effective until terminated. It terminates automatically,
142
+ without notice, if you breach any of its terms. Progon may also terminate
143
+ this Agreement upon termination or suspension of your right to use the
144
+ Service, or upon revocation of the enrollment of the relevant machine. Upon
145
+ termination, the license granted in Section 1 ends and you must cease all use
146
+ of the Software and delete all copies in your possession or control.
147
+ Sections 2, 3, and 5 through 11 survive any termination of this Agreement.
148
+
149
+ 10. GOVERNING LAW
150
+
151
+ This Agreement is governed by and construed in accordance with the laws of
152
+ [jurisdiction], without regard to its conflict-of-laws rules, and the courts
153
+ of [jurisdiction] shall have exclusive jurisdiction over any dispute arising
154
+ out of or in connection with this Agreement, subject to any mandatory
155
+ consumer-protection rules of your place of residence.
156
+
157
+ 11. GENERAL
158
+
159
+ If any provision of this Agreement is held unenforceable, it shall be
160
+ enforced to the maximum extent permissible and the remaining provisions shall
161
+ remain in full force. A failure by Progon to enforce any provision is not a
162
+ waiver of it. You may not assign this Agreement without Progon's prior
163
+ written consent; Progon may assign it in connection with a merger,
164
+ acquisition, or sale of assets. This Agreement, together with the agreement
165
+ governing your use of the Service, constitutes the entire agreement between
166
+ you and Progon concerning the Software and supersedes all prior or
167
+ contemporaneous understandings regarding it.
package/README.md ADDED
@@ -0,0 +1,340 @@
1
+ # progon-agent
2
+
3
+ The Progon **local agent**: a daemon you run on your own machine so Progon scenarios execute
4
+ there instead of on Progon's infrastructure.
5
+
6
+ It launches **its own Chromium** — downloaded by the `playwright-core` bundled in this package,
7
+ installed with `--no-shell` so it can load extensions — with the Progon browser extension bundled
8
+ in this same package. It then talks to the Progon backend over **outbound HTTPS only**: it
9
+ long-polls for work, claims a run, executes it locally and reports back.
10
+
11
+ **There is no inbound port, no WebSocket and no listening socket.** Nothing needs to be opened in
12
+ your firewall or NAT. If the machine can reach `https://<your-progon-host>`, the agent works.
13
+
14
+ **This package is built for Progon's own cloud.** The bundled extension has that deployment's
15
+ address compiled into it at build time, so one published package serves one deployment. The exact
16
+ address this copy was built against is in `extension-bundle.json` inside the installed package. To
17
+ run an agent against a staging or self-hosted Progon, build the agent from a source checkout
18
+ instead — the bundled extension has to be rebuilt against that deployment.
19
+
20
+ ---
21
+
22
+ ## 1. Prerequisites
23
+
24
+ | Requirement | Detail |
25
+ | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
26
+ | **Node.js** | `>=20.0.0` (`package.json` → `engines`) |
27
+ | **OS** | `darwin`, `linux`, `win32`. Any other platform must set `PROGON_RUNNER_STATE_DIR` explicitly — there is no default state directory for it and the daemon refuses to start. |
28
+ | **System Chrome** | **Not needed.** The agent provisions its own Chromium; a system Chrome/Chromium is neither used nor detected. |
29
+ | **Disk** | Roughly **500 MB unpacked** for Chromium in the Playwright browsers cache (`PLAYWRIGHT_BROWSERS_PATH`, or the per-user default cache). |
30
+ | **Network** | Outbound HTTPS to your Progon server. The Chromium download on first start also needs outbound access to the Playwright CDN. |
31
+
32
+ **First start downloads Chromium.** This happens automatically, once, on the machine's first
33
+ `progon-agent start` (and again after an agent upgrade that moves the Chromium revision). It is a
34
+ fast, offline no-op afterwards. The daemon waits up to **60 minutes** for that download and then
35
+ kills it — that ceiling is a hang backstop, not a speed limit. Pre-warm it with
36
+ `progon-agent install-browser` if you would rather not pay for it at first run.
37
+
38
+ `https://` is required for `PROGON_SERVER_URL`. `http://` is accepted **only** for loopback hosts
39
+ (`localhost`, `127.0.0.1`, `[::1]`) for local smoke tests.
40
+
41
+ ### Corporate networks
42
+
43
+ The Chromium installer is spawned with the daemon's whole environment, so the standard Playwright
44
+ and Node escape hatches apply to the download exactly as they later apply to the launch:
45
+
46
+ | Variable | When you need it |
47
+ | ------------------------------ | ------------------------------------------------------------------------------ |
48
+ | `HTTPS_PROXY` (and `NO_PROXY`) | Outbound traffic goes through a proxy |
49
+ | `NODE_EXTRA_CA_CERTS` | TLS is intercepted by a corporate gateway — point this at the root certificate |
50
+ | `PLAYWRIGHT_DOWNLOAD_HOST` | The Playwright CDN is blocked — point this at an internal mirror |
51
+ | `PLAYWRIGHT_BROWSERS_PATH` | The browser cache must live somewhere other than the per-user default |
52
+
53
+ ---
54
+
55
+ ## 2. Install
56
+
57
+ ```bash
58
+ npm i -g progon-agent
59
+ ```
60
+
61
+ That is the whole installation: no build step, no install script, nothing downloaded at install
62
+ time. The extension ships inside the package, and Chromium arrives on the first `start`.
63
+
64
+ The enrollment dialog in Progon (**Settings → Agents**) hands you the complete command for a new
65
+ machine, install included:
66
+
67
+ ```bash
68
+ npm i -g progon-agent && progon-agent enroll <code> --server "https://your-progon-host" && progon-agent start
69
+ ```
70
+
71
+ On Windows, run this in PowerShell 7 or cmd — Windows PowerShell 5.1 does not support `&&`;
72
+ there, run the commands one at a time.
73
+
74
+ ### Updating
75
+
76
+ ```bash
77
+ npm i -g progon-agent@latest
78
+ ```
79
+
80
+ Same command as the install — it is idempotent. Restart the daemon afterwards. If the update
81
+ crosses a change in the local-agent wire protocol, the agent will also ask you to re-enroll; see
82
+ [Troubleshooting](#6-troubleshooting).
83
+
84
+ ### `EACCES` on a global install
85
+
86
+ If `npm i -g` fails with a permissions error, npm is installing into a directory your user does
87
+ not own. Do **not** re-run it with `sudo` — follow npm's own fix (change npm's global directory or
88
+ use a version manager):
89
+ <https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally>.
90
+
91
+ ---
92
+
93
+ ## 3. Enroll this machine
94
+
95
+ Enrollment binds this machine to one agent record in your Progon company and gives it a long-lived
96
+ `pgat_` credential. It happens **once** per machine.
97
+
98
+ 1. In Progon web, go to **Settings → Agents**, create the agent and mint its enrollment code.
99
+ 2. The code is **shown exactly once** — it cannot be shown again — and **expires after 15
100
+ minutes**. The dialog also assembles the ready-to-paste command for you.
101
+ 3. On the agent machine, run:
102
+
103
+ ```bash
104
+ progon-agent enroll <code> --server "https://your-progon-host"
105
+ ```
106
+
107
+ `--server` is how `PROGON_SERVER_URL` gets set for this command; it may be omitted only if that
108
+ variable is already exported. The command redeems the code, persists the credential and exits — it
109
+ does not start the daemon, does not download Chromium and does not need the extension dist.
110
+
111
+ ### Enroll without a code (browser approval)
112
+
113
+ If you would rather not carry a one-shot code to the machine — or you are asking an assistant to
114
+ set the agent up for you — run `enroll` with **no code** and approve the machine in a browser
115
+ instead:
116
+
117
+ ```bash
118
+ progon-agent enroll --server "https://your-progon-host"
119
+ ```
120
+
121
+ The command prints a short confirmation code and an approval link, and waits:
122
+
123
+ ```
124
+ Enrollment requested for this machine.
125
+ Confirmation code: 4KRQ-7M2X
126
+ Approve at: https://your-progon-host/enroll/4KRQ-7M2X
127
+ Waiting for approval (expires in 10m)...
128
+ ```
129
+
130
+ Open the link (it opens by itself where that is possible), **check that the code on the page matches
131
+ the code in your terminal**, review the machine facts the page shows — hostname, platform,
132
+ architecture, agent version, the IP the request came from — name the agent, and confirm. The
133
+ terminal then prints which company the machine was let into and who let it in:
134
+
135
+ ```
136
+ Enrolled into Acme QA (approved by anton@acme.test). Start the daemon: progon-agent start
137
+ ```
138
+
139
+ **Read that line.** It is how you find out if the code was approved into someone else's company: if
140
+ the company or the e-mail is not yours, revoke the agent immediately in **Settings → Agents**.
141
+
142
+ Approving requires an ordinary Progon **web session** — a personal access token or an OAuth
143
+ credential cannot do it. The request lives **10 minutes** and can be approved once.
144
+
145
+ | Flag | Effect |
146
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------ |
147
+ | `--no-open` | Never try to open a browser. The approval URL is printed either way. |
148
+ | `--timeout <seconds>` | Stop waiting after this many seconds (1–3600). Omitted: wait until the request expires on the server (10 minutes). |
149
+
150
+ **On a server, over SSH, or on headless Linux** no browser is opened — `SSH_CONNECTION`, `SSH_TTY`
151
+ and a Linux box with neither `DISPLAY` nor `WAYLAND_DISPLAY` all suppress it — and nothing is lost:
152
+ copy the printed `Approve at:` link to a machine that has a browser and approve it there.
153
+
154
+ **Nothing secret is printed.** Neither the credential the machine receives nor the secret it proves
155
+ itself with ever reaches the terminal, which is what makes this flow safe to run from an assistant
156
+ whose transcript you do not control. The confirmation code is useless to anyone without your own
157
+ web session.
158
+
159
+ Exit codes: `0` enrolled (or already enrolled); `1` the enrollment did not happen — denied,
160
+ expired, `--timeout` exhausted, already completed from another machine, no longer valid, or the
161
+ network still failing when the deadline passed; `2` the command line was wrong; `130` interrupted
162
+ with Ctrl-C — the first Ctrl-C withdraws the pending request before exiting, a second one exits at
163
+ once and leaves the request to expire on its own.
164
+
165
+ Which command to prefer: `enroll <code>` is the older path and stays exactly as it was; use it when
166
+ you already have a code. `enroll` with no code needs nothing carried to the machine, but needs
167
+ someone with a browser session at the moment it runs.
168
+
169
+ ### Where the credential lands
170
+
171
+ `<stateDir>/runner-state.json`, mode `0600`, inside a `0700` directory:
172
+
173
+ | Platform | Default state directory |
174
+ | -------- | ------------------------------------------------------------------ |
175
+ | macOS | `~/Library/Application Support/progon-agent` |
176
+ | Linux | `$XDG_STATE_HOME/progon-agent`, else `~/.local/state/progon-agent` |
177
+ | Windows | `%APPDATA%\progon-agent` |
178
+
179
+ Override with `PROGON_RUNNER_STATE_DIR`. The file holds `{agentId, agentToken, protocolVersion,
180
+ serverUrl}` and is written atomically before anything else can fail — the code is burned
181
+ server-side the moment the response arrives, so it must never be lost to a crash.
182
+
183
+ ### Which credential the daemon uses
184
+
185
+ Precedence, highest first:
186
+
187
+ 1. **`PROGON_AGENT_TOKEN`** env var — the rotation path. Always wins, never touches disk.
188
+ 2. **The state file** — the ordinary restart path. This is what `enroll` writes.
189
+ 3. **`PROGON_AGENT_ENROLL_CODE`** env var — an alternative to the `enroll` command for a first
190
+ start (same one-shot code).
191
+ 4. Nothing → the daemon refuses to start and tells you to enroll.
192
+
193
+ Two consequences worth knowing:
194
+
195
+ - **The server URL must match the enrollment.** On the state-file path the daemon refuses to start
196
+ if `PROGON_SERVER_URL` differs from the URL the credential was enrolled against — a `pgat_`
197
+ token is meaningless at another deployment, and authenticating blind would show up as an endless
198
+ 401 backoff.
199
+ - **`PROGON_AGENT_TOKEN` alone is not enough to run.** An env token carries no `agentId`, and the
200
+ extension's `agent-manifest.json` must name one, so that path additionally requires
201
+ `PROGON_AGENT_EXTENSION_DIST` pointing at an already agent-mode dist. For ordinary operation,
202
+ enroll instead.
203
+
204
+ ---
205
+
206
+ ## 4. Run
207
+
208
+ ```bash
209
+ progon-agent start
210
+ ```
211
+
212
+ Requires `PROGON_SERVER_URL` and an enrolled machine. The daemon boots (config → identity →
213
+ extension dist → Chromium → gateway), then reconciles the backend's desired state and executes the
214
+ runs it is given, until you stop it.
215
+
216
+ ```bash
217
+ progon-agent install-browser
218
+ ```
219
+
220
+ Downloads Chromium and stops. Useful ahead of enrollment or inside an image build: it reads no
221
+ config, so it works on a machine that has not been pointed at a Progon instance yet. Playwright's
222
+ own progress bar goes straight to your terminal. Re-running it once installed is a fast offline
223
+ no-op.
224
+
225
+ ```bash
226
+ progon-agent --help
227
+ ```
228
+
229
+ ### Exit codes
230
+
231
+ | Code | Meaning |
232
+ | ---- | ------------------------------------------------------------------------------------ |
233
+ | `0` | The command did what it was asked (including a clean signalled shutdown of `start`). |
234
+ | `1` | The command failed — **or** the daemon stopped because this agent was **revoked**. |
235
+ | `2` | The command line itself was wrong. Nothing was attempted. |
236
+
237
+ A bare `progon-agent` prints the usage and exits `0`; it never assumes `start`.
238
+
239
+ ### Revocation
240
+
241
+ If the agent is revoked in Progon, the next gateway call answers `403 agents.revoked` (or the
242
+ desired-state snapshot reports it). The daemon then **wipes the local credential** — both
243
+ `runner-state.json` and any leftover `runner-state.json.tmp` — and exits `1`. Restarting changes
244
+ nothing: mint a new enrollment code in **Settings → Agents** and run `progon-agent enroll <code>`
245
+ again.
246
+
247
+ A `401` is _not_ revocation: it backs off and retries, and never wipes anything.
248
+
249
+ ---
250
+
251
+ ## 5. Environment variables
252
+
253
+ ### Runtime
254
+
255
+ | Variable | Required | Meaning |
256
+ | ----------------------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
257
+ | `PROGON_SERVER_URL` | **yes** (`enroll`, `start`) | Base URL of the Progon backend. `https://` only, except loopback hosts. Scheme + host + optional path prefix — **no** embedded credentials, **no** query string, **no** fragment (the agent-gateway routes are appended to it). |
258
+ | `PROGON_AGENT_TOKEN` | no | An existing `pgat_` credential. Takes precedence over the state file — this is the rotation mechanism. Must match the `pgat_` wire format; set-but-empty is rejected. |
259
+ | `PROGON_AGENT_ENROLL_CODE` | no | One-shot enrollment code, the env form of `progon-agent enroll <code>`. Must be at least 32 characters. |
260
+ | `PROGON_RUNNER_STATE_DIR` | no | Overrides the platform state directory. **Required** on platforms other than darwin/linux/win32, and when the user has no home directory. |
261
+ | `PROGON_AGENT_EXTENSION_DIST` | no | Absolute path of an already agent-mode qa-extension dist, replacing the bundled one (dev/E2E). Relative paths are rejected. |
262
+ | `PROGON_AGENT_HEADFUL` | no | `true`/`false`/`1`/`0`. Shows the browser window on this machine's desktop. Default `false`. It can only turn headful **on** — the server still decides per run. Any other value is rejected. |
263
+ | `PROGON_LOG_LEVEL` | no | pino log level. Default: `info` when `NODE_ENV=production`, `debug` otherwise. |
264
+ | `NODE_ENV` | no | Default `production`. Anything else additionally switches logging to human-readable `pino-pretty` output. |
265
+
266
+ ### Inherited by the Chromium installer and launch
267
+
268
+ `HTTPS_PROXY`, `NO_PROXY`, `NODE_EXTRA_CA_CERTS`, `PLAYWRIGHT_DOWNLOAD_HOST`,
269
+ `PLAYWRIGHT_BROWSERS_PATH` — see [Corporate networks](#corporate-networks). The agent reads none of
270
+ them itself; it passes the whole environment through, so they behave exactly as Playwright and Node
271
+ document.
272
+
273
+ ---
274
+
275
+ ## 6. Troubleshooting
276
+
277
+ **`enroll` fails with an invalid-code error.** Unknown, expired and already-redeemed codes are
278
+ **one single answer** by contract — the server does not distinguish them and neither does the
279
+ agent. Codes live 15 minutes and are one-shot, so the remedy is always the same: mint a fresh one
280
+ in **Settings → Agents** and re-run `enroll`. Check you pasted the code whole (32 characters); a
281
+ truncated paste is rejected locally before any request goes out.
282
+
283
+ **`enroll` says the code was _not_ redeemed.** This machine already holds a credential that ranks
284
+ higher (an env token, or a state file). The code was **not** spent and stays valid. To enroll as a
285
+ new agent, unset `PROGON_AGENT_TOKEN`, remove the state file in the state directory, and run
286
+ `enroll` again.
287
+
288
+ **`enroll` fails with a protocol-version mismatch (409).** The agent and the server disagree on the
289
+ local-agent wire protocol; the error carries the expected and received versions. Update the agent:
290
+
291
+ ```bash
292
+ npm i -g progon-agent@latest
293
+ ```
294
+
295
+ A protocol change also invalidates an existing enrollment: if `start` then refuses with a protocol
296
+ mismatch against the state file, remove the state file, mint a fresh code in **Settings → Agents**
297
+ and enroll again.
298
+
299
+ **Chromium fails to download.** This is treated as an **environment condition, not a transient
300
+ one**, so there are no retries — hammering the CDN turns a 30-second diagnosis into a 15-minute
301
+ one. Work through the four causes the error message lists: proxy (`HTTPS_PROXY`), intercepted TLS
302
+ (`NODE_EXTRA_CA_CERTS`), blocked CDN (`PLAYWRIGHT_DOWNLOAD_HOST`), out of disk (~500 MB unpacked).
303
+ A download killed at the 60-minute deadline is the known Playwright stall
304
+ (microsoft/playwright#40998) — usually a connection that went silent rather than failed. Nothing is
305
+ assumed installed: the next start simply downloads again.
306
+
307
+ **`start` fails with "No extension dist is bundled in this package".** The installation is damaged:
308
+ every published package ships the extension inside it. Reinstall:
309
+
310
+ ```bash
311
+ npm i -g progon-agent@latest
312
+ ```
313
+
314
+ **`start` fails saying the credential was enrolled against a different server.** `PROGON_SERVER_URL`
315
+ no longer matches the enrollment. Point it back, or remove the state file and enroll against the
316
+ new deployment.
317
+
318
+ **The daemon exits 1 mid-run reporting a revocation.** The agent was revoked server-side and its
319
+ local credential has been wiped. Mint a new code and re-enroll — see
320
+ [Revocation](#revocation).
321
+
322
+ **Stopping during the Chromium download.** `SIGTERM`/`SIGINT` are covered for the whole
323
+ provisioning window: the installer is killed, a warning line is written to stderr, and the next
324
+ start downloads again. Nothing is left holding Playwright's directory lock.
325
+
326
+ ---
327
+
328
+ ## 7. What the agent talks to
329
+
330
+ Four outbound calls, all to `PROGON_SERVER_URL` + `/api/agent-gateway`:
331
+
332
+ | Call | Route |
333
+ | ----------------------------------------------------- | ---------------------------------------- |
334
+ | Enroll (unauthenticated — the code is the credential) | `POST /api/agent-gateway/enroll` |
335
+ | Desired-state long poll | `GET /api/agent-gateway/state?waitSec=` |
336
+ | Claim a run | `POST /api/agent-gateway/runs/:id/claim` |
337
+ | Report a failed run | `POST /api/agent-gateway/runs/:id/fail` |
338
+
339
+ Everything else — the credential, the browser, the extension, the run itself — stays on this
340
+ machine. The `pgat_` token never reaches the browser, and it is never logged.