unbrowse 2.12.0 → 2.12.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/README.md +8 -0
- package/bin/unbrowse-update-hint.mjs +22 -0
- package/bin/unbrowse-wrapper.mjs +85 -14
- package/dist/cli.js +505 -59
- package/dist/mcp.js +93 -17
- package/package.json +1 -1
- package/runtime-src/api/routes.ts +8 -2
- package/runtime-src/capture/index.ts +7 -5
- package/runtime-src/cli.ts +26 -11
- package/runtime-src/client/index.ts +17 -4
- package/runtime-src/runtime/local-server.ts +35 -6
- package/runtime-src/runtime/setup.ts +4 -0
- package/runtime-src/runtime/update-hints.ts +351 -0
- package/runtime-src/version.ts +12 -0
- package/scripts/postinstall.mjs +17 -4
package/README.md
CHANGED
|
@@ -81,6 +81,14 @@ npx skills add unbrowse-ai/unbrowse
|
|
|
81
81
|
|
|
82
82
|
Unbrowse no longer self-updates at runtime. If you already have Unbrowse installed, upgrade to the latest version after each release or the new flow may not work on your machine.
|
|
83
83
|
|
|
84
|
+
Check the exact command for your install with:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
unbrowse upgrade
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Codex and Claude installs now also get a session-start update hint during `unbrowse setup`, so newer releases are surfaced in the host before the CLI drifts too far behind.
|
|
91
|
+
|
|
84
92
|
If you installed from a repo clone:
|
|
85
93
|
|
|
86
94
|
```bash
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { spawn } from "node:child_process";
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const cliPath = join(__dirname, "..", "dist", "cli.js");
|
|
9
|
+
|
|
10
|
+
const child = spawn(process.execPath, [cliPath, "upgrade", "--hint-only"], {
|
|
11
|
+
stdio: "inherit",
|
|
12
|
+
cwd: process.cwd(),
|
|
13
|
+
env: process.env,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
child.on("exit", (code, signal) => {
|
|
17
|
+
if (signal) {
|
|
18
|
+
process.kill(process.pid, signal);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
process.exit(code ?? 0);
|
|
22
|
+
});
|
package/bin/unbrowse-wrapper.mjs
CHANGED
|
@@ -5,35 +5,106 @@
|
|
|
5
5
|
* falls back to the package-managed Node launcher if not.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { existsSync } from "node:fs";
|
|
8
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
9
10
|
import { join, dirname } from "node:path";
|
|
10
11
|
import { fileURLToPath } from "node:url";
|
|
11
12
|
import { spawn } from "node:child_process";
|
|
12
13
|
|
|
13
14
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const packageRoot = join(__dirname, "..");
|
|
14
16
|
const binaryPath = join(__dirname, "unbrowse");
|
|
17
|
+
const launcherPath = join(__dirname, "unbrowse.js");
|
|
18
|
+
const require = createRequire(import.meta.url);
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
const REQUIRED_FALLBACK_PACKAGES = [
|
|
21
|
+
"tsx",
|
|
22
|
+
"bs58",
|
|
23
|
+
"@solana/kit",
|
|
24
|
+
"@cascade-fyi/splits-sdk",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
const KNOWN_BAD_FALLBACK_VERSIONS = new Set([
|
|
28
|
+
"2.10.2",
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
function readInstalledVersion() {
|
|
32
|
+
try {
|
|
33
|
+
const pkg = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8"));
|
|
34
|
+
return typeof pkg.version === "string" ? pkg.version : "unknown";
|
|
35
|
+
} catch {
|
|
36
|
+
return "unknown";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function printRepairHelp(reason) {
|
|
41
|
+
const installedVersion = readInstalledVersion();
|
|
42
|
+
const lines = [
|
|
43
|
+
`[unbrowse] ${reason}`,
|
|
44
|
+
`[unbrowse] Installed package version: ${installedVersion}`,
|
|
45
|
+
"[unbrowse] Repair: npm uninstall -g unbrowse && npm install -g unbrowse@latest",
|
|
46
|
+
];
|
|
47
|
+
process.stderr.write(lines.join("\n") + "\n");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function failInstall(reason, exitCode = 1) {
|
|
51
|
+
printRepairHelp(reason);
|
|
52
|
+
process.exit(exitCode);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function missingFallbackPackages() {
|
|
56
|
+
const missing = [];
|
|
57
|
+
for (const specifier of REQUIRED_FALLBACK_PACKAGES) {
|
|
58
|
+
try {
|
|
59
|
+
require.resolve(specifier);
|
|
60
|
+
} catch {
|
|
61
|
+
missing.push(specifier);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return missing;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function spawnEntrypoint(command, args) {
|
|
68
|
+
const child = spawn(command, args, {
|
|
19
69
|
stdio: "inherit",
|
|
70
|
+
cwd: process.cwd(),
|
|
20
71
|
env: process.env,
|
|
21
72
|
});
|
|
73
|
+
child.on("error", (error) => {
|
|
74
|
+
const details = error instanceof Error ? error.message : String(error);
|
|
75
|
+
if (error && typeof error === "object" && "code" in error && error.code === "EACCES") {
|
|
76
|
+
failInstall(`Launch target is not executable (${command}). Global install permissions are corrupted.`);
|
|
77
|
+
}
|
|
78
|
+
failInstall(`Failed to launch ${command}: ${details}`);
|
|
79
|
+
});
|
|
22
80
|
child.on("exit", (code, signal) => {
|
|
23
81
|
if (signal) { process.kill(process.pid, signal); return; }
|
|
24
82
|
process.exit(code ?? 1);
|
|
25
83
|
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (process.argv.includes("--version") || process.argv.includes("-v")) {
|
|
87
|
+
process.stdout.write(`${readInstalledVersion()}\n`);
|
|
88
|
+
process.exit(0);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (existsSync(binaryPath)) {
|
|
92
|
+
// Compiled binary — exec directly, replace this process
|
|
93
|
+
spawnEntrypoint(binaryPath, process.argv.slice(2));
|
|
26
94
|
} else {
|
|
95
|
+
const installedVersion = readInstalledVersion();
|
|
96
|
+
if (KNOWN_BAD_FALLBACK_VERSIONS.has(installedVersion)) {
|
|
97
|
+
failInstall(
|
|
98
|
+
`Installed package version ${installedVersion} is known-bad in source fallback mode and shipped an incomplete runtime dependency set.`,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const missing = missingFallbackPackages();
|
|
103
|
+
if (missing.length > 0) {
|
|
104
|
+
failInstall(`Fallback runtime is missing required packages: ${missing.join(", ")}.`);
|
|
105
|
+
}
|
|
106
|
+
|
|
27
107
|
// Fallback: delegate to the stable package launcher so
|
|
28
108
|
// npm installs and npx use the same dependency resolution path.
|
|
29
|
-
|
|
30
|
-
const child = spawn(process.execPath, [launcherPath, ...process.argv.slice(2)], {
|
|
31
|
-
stdio: "inherit",
|
|
32
|
-
cwd: process.cwd(),
|
|
33
|
-
env: process.env,
|
|
34
|
-
});
|
|
35
|
-
child.on("exit", (code, signal) => {
|
|
36
|
-
if (signal) { process.kill(process.pid, signal); return; }
|
|
37
|
-
process.exit(code ?? 1);
|
|
38
|
-
});
|
|
109
|
+
spawnEntrypoint(process.execPath, [launcherPath, ...process.argv.slice(2)]);
|
|
39
110
|
}
|