chrome-relay 0.5.5 → 0.5.7
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/dist/cli.js +69 -14
- package/dist/index.js +1 -1
- package/dist/native-host.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -43,7 +43,7 @@ var RelayError = class extends Error {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
// src/index.ts
|
|
46
|
-
var CHROME_RELAY_VERSION = true ? "0.5.
|
|
46
|
+
var CHROME_RELAY_VERSION = true ? "0.5.7" : "0.0.0-dev";
|
|
47
47
|
|
|
48
48
|
// src/install/install.ts
|
|
49
49
|
import os from "os";
|
|
@@ -196,6 +196,16 @@ async function callTool(name, args) {
|
|
|
196
196
|
|
|
197
197
|
// src/release-notes.ts
|
|
198
198
|
var RELEASE_NOTES = {
|
|
199
|
+
"0.5.7": [
|
|
200
|
+
"`chrome-relay update` returns structured verification metadata (code-quality-hardening PR 5). Output now has `install: { attempted, packageManager, status, command }`, `binary: { path, reexeced }`, `releaseNotes: { source: 'current_process' | 'updated_binary', changes }`, and a `warnings[]` array.",
|
|
201
|
+
"Surfaces the 'install said success but binary didn't change' failure mode (PATH mismatch, stale shim, cross-package-manager confusion) as `warnings[].code === 'update_not_verified'`. Agents can branch on it.",
|
|
202
|
+
"Falls back gracefully: when the re-exec can't be proven, release notes are read from the current (pre-update) process and marked `source: 'current_process'`. The agent knows the bullets may be stale."
|
|
203
|
+
],
|
|
204
|
+
"0.5.6": [
|
|
205
|
+
"BEHAVIOR CHANGE \u2014 `chrome-relay network har --with-bodies` is now strict by default (code-quality-hardening PR 4). When ANY body fails to fetch, the call throws `partial_success_disallowed` with details about which entries failed.",
|
|
206
|
+
"New `--best-effort-bodies` flag restores the legacy behavior: HAR still emits, missing/errored bodies are recorded per-entry in `_chrome_relay.bodyState` and `_chrome_relay.bodyError` (with code, message, and phase).",
|
|
207
|
+
"New `bodyState: 'error'` value (was just 'missing' before). 'error' fires when the CDP call threw; 'missing' fires when the body returned empty. Lets the caller distinguish 'Chrome GC'd it' from 'still in flight' from 'permission denied.'"
|
|
208
|
+
],
|
|
199
209
|
"0.5.5": [
|
|
200
210
|
"BEHAVIOR CHANGE \u2014 `chrome_navigate --new` no longer silently falls back to 'wherever Chrome picks' when an explicit routing intent fails (code-quality-hardening PR 3).",
|
|
201
211
|
"`navigate --new --tab <id>` where <id> doesn't exist now throws `target_not_found` instead of silently letting Chrome drop the tab in the focused (often the user's) window.",
|
|
@@ -289,31 +299,75 @@ Notes:
|
|
|
289
299
|
program.command("update").description("Update chrome-relay CLI to the latest version and print what changed (agent-readable JSON).").option("--dry-run", "skip the install; just show what changed since the current version").action(async (opts) => {
|
|
290
300
|
const fromVersion = CHROME_RELAY_VERSION;
|
|
291
301
|
const { spawnSync } = await import("child_process");
|
|
302
|
+
const out = {
|
|
303
|
+
updatedFrom: fromVersion,
|
|
304
|
+
updatedTo: fromVersion,
|
|
305
|
+
install: { attempted: false },
|
|
306
|
+
binary: { path: process.argv[1] ?? "", reexeced: false },
|
|
307
|
+
releaseNotes: { source: "current_process", changes: [] },
|
|
308
|
+
warnings: []
|
|
309
|
+
};
|
|
292
310
|
if (!opts.dryRun) {
|
|
293
311
|
const argv0 = process.argv[1] ?? "";
|
|
294
312
|
const pm = /[\\/](pnpm|\.pnpm)[\\/]/.test(argv0) ? "pnpm" : /[\\/]bun[\\/]/.test(argv0) ? "bun" : "npm";
|
|
295
313
|
const cmd = pm === "pnpm" ? ["pnpm", ["add", "-g", "chrome-relay@latest"]] : pm === "bun" ? ["bun", ["add", "-g", "chrome-relay@latest"]] : ["npm", ["install", "-g", "chrome-relay@latest"]];
|
|
314
|
+
out.install = {
|
|
315
|
+
attempted: true,
|
|
316
|
+
packageManager: pm,
|
|
317
|
+
command: `${cmd[0]} ${cmd[1].join(" ")}`
|
|
318
|
+
};
|
|
296
319
|
process.stderr.write(`[chrome-relay] updating from ${fromVersion} via ${pm}...
|
|
297
320
|
`);
|
|
298
321
|
const install = spawnSync(cmd[0], cmd[1], { stdio: "inherit" });
|
|
322
|
+
out.install.status = install.status;
|
|
299
323
|
if (install.status !== 0) {
|
|
300
|
-
process.stderr.write(`[chrome-relay] install failed (${pm} exited ${install.status}). Try manually: ${
|
|
324
|
+
process.stderr.write(`[chrome-relay] install failed (${pm} exited ${install.status}). Try manually: ${cmd[0]} ${cmd[1].join(" ")}
|
|
301
325
|
`);
|
|
326
|
+
out.warnings.push({
|
|
327
|
+
code: "update_install_failed",
|
|
328
|
+
message: `Package-manager exit ${install.status}. Active binary unchanged.`
|
|
329
|
+
});
|
|
330
|
+
process.stdout.write(JSON.stringify(out, null, 2) + "\n");
|
|
302
331
|
process.exit(1);
|
|
303
332
|
}
|
|
304
333
|
const which = spawnSync("which", ["chrome-relay"]);
|
|
305
334
|
const newBin = which.stdout?.toString().trim();
|
|
306
|
-
if (which.status === 0 && newBin
|
|
307
|
-
spawnSync(newBin, ["
|
|
308
|
-
|
|
335
|
+
if (which.status === 0 && newBin) {
|
|
336
|
+
const versionOut = spawnSync(newBin, ["--version"]);
|
|
337
|
+
const newVersion = (versionOut.stdout?.toString() ?? "").trim();
|
|
338
|
+
out.binary.path = newBin;
|
|
339
|
+
if (newVersion && newVersion !== fromVersion) {
|
|
340
|
+
out.updatedTo = newVersion;
|
|
341
|
+
const rn = spawnSync(newBin, ["release-notes", "--since", fromVersion]);
|
|
342
|
+
try {
|
|
343
|
+
const parsed = JSON.parse(rn.stdout?.toString() ?? "");
|
|
344
|
+
if (Array.isArray(parsed.changes)) {
|
|
345
|
+
out.releaseNotes = { source: "updated_binary", changes: parsed.changes };
|
|
346
|
+
}
|
|
347
|
+
} catch {
|
|
348
|
+
out.warnings.push({
|
|
349
|
+
code: "release_notes_parse_failed",
|
|
350
|
+
message: `Could not parse output of "${newBin} release-notes --since ${fromVersion}".`
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
out.binary.reexeced = true;
|
|
354
|
+
} else {
|
|
355
|
+
out.warnings.push({
|
|
356
|
+
code: "update_not_verified",
|
|
357
|
+
message: `Install completed but \`${newBin} --version\` still reports ${newVersion || "unknown"}. The active binary may not have changed \u2014 check your PATH or run "${cmd[0]} ${cmd[1].join(" ")}" manually and verify.`
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
out.warnings.push({
|
|
362
|
+
code: "update_not_verified",
|
|
363
|
+
message: `Install completed but \`which chrome-relay\` did not return a path. Could not verify the active binary changed.`
|
|
364
|
+
});
|
|
309
365
|
}
|
|
310
366
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
changes
|
|
316
|
-
}, null, 2) + "\n");
|
|
367
|
+
if (out.releaseNotes.source === "current_process") {
|
|
368
|
+
out.releaseNotes.changes = listReleaseNotesSince(fromVersion);
|
|
369
|
+
}
|
|
370
|
+
process.stdout.write(JSON.stringify(out, null, 2) + "\n");
|
|
317
371
|
});
|
|
318
372
|
program.command("release-notes").description("Print release notes since a version (no install). JSON output for agents.").option("--since <version>", "show release notes for versions newer than this", "0.0.0").action((opts) => {
|
|
319
373
|
const changes = listReleaseNotesSince(opts.since);
|
|
@@ -786,13 +840,14 @@ Notes:
|
|
|
786
840
|
await run("chrome_network", args);
|
|
787
841
|
});
|
|
788
842
|
tabOpt(netFilterOpts(
|
|
789
|
-
network.command("har").description("Emit HAR-compatible JSON for the captured entries.").option("--with-bodies", "fetch response bodies before emitting (best-effort
|
|
843
|
+
network.command("har").description("Emit HAR-compatible JSON for the captured entries.").option("--with-bodies", "fetch response bodies before emitting; strict by default \u2014 fails if any body cannot be fetched").option("--best-effort-bodies", "with --with-bodies: keep the HAR even when some bodies are missing/errored (legacy behavior); per-entry _chrome_relay.bodyState/bodyError records what failed")
|
|
790
844
|
)).action(async (opts) => {
|
|
791
845
|
const args = { ...baseArgs(opts), ...netFilterArgs(opts), action: "har" };
|
|
792
846
|
if (opts.withBodies) args.withBodies = true;
|
|
793
|
-
|
|
847
|
+
if (opts.bestEffortBodies) args.bestEffortBodies = true;
|
|
848
|
+
if (!opts.withBodies) {
|
|
794
849
|
process.stderr.write(
|
|
795
|
-
"[chrome-relay] HAR exported WITHOUT response bodies. Pass --with-bodies to include them (best-effort
|
|
850
|
+
"[chrome-relay] HAR exported WITHOUT response bodies. Pass --with-bodies to include them (strict by default; add --best-effort-bodies to allow per-entry misses).\n"
|
|
796
851
|
);
|
|
797
852
|
}
|
|
798
853
|
await run("chrome_network", args);
|
package/dist/index.js
CHANGED
package/dist/native-host.js
CHANGED
|
@@ -48,7 +48,7 @@ function toBridgeError(unknownErr, fallbackTool) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
// src/index.ts
|
|
51
|
-
var CHROME_RELAY_VERSION = true ? "0.5.
|
|
51
|
+
var CHROME_RELAY_VERSION = true ? "0.5.7" : "0.0.0-dev";
|
|
52
52
|
|
|
53
53
|
// src/release-notes.ts
|
|
54
54
|
function compareSemver(a, b) {
|