unbrowse 2.12.2 → 2.12.4

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.
Files changed (60) hide show
  1. package/README.md +86 -5
  2. package/SKILL.md +754 -0
  3. package/bin/unbrowse-update-hint.mjs +22 -0
  4. package/bin/unbrowse-wrapper.mjs +84 -16
  5. package/bin/unbrowse.js +0 -1
  6. package/dist/cli.js +1899 -19159
  7. package/dist/mcp.js +1796 -0
  8. package/package.json +6 -3
  9. package/runtime-src/agent-outcome.ts +166 -0
  10. package/runtime-src/analytics-session.ts +28 -6
  11. package/runtime-src/api/browse-session.ts +520 -51
  12. package/runtime-src/api/browse-submit-prereqs.ts +48 -0
  13. package/runtime-src/api/browse-submit.ts +746 -17
  14. package/runtime-src/api/routes.ts +950 -427
  15. package/runtime-src/auth/index.ts +160 -7
  16. package/runtime-src/browser/index.ts +17 -9
  17. package/runtime-src/build-info.generated.ts +4 -0
  18. package/runtime-src/capture/index.ts +30 -22
  19. package/runtime-src/cli.ts +412 -83
  20. package/runtime-src/client/index.ts +97 -24
  21. package/runtime-src/execution/index.ts +351 -60
  22. package/runtime-src/indexer/index.ts +208 -247
  23. package/runtime-src/kuri/client.ts +774 -267
  24. package/runtime-src/mcp.ts +1522 -0
  25. package/runtime-src/orchestrator/first-pass-action.ts +69 -28
  26. package/runtime-src/orchestrator/index.ts +603 -133
  27. package/runtime-src/orchestrator/passive-publish.ts +33 -3
  28. package/runtime-src/payments/wallet.ts +76 -11
  29. package/runtime-src/publish/sanitize.ts +197 -0
  30. package/runtime-src/publish-admission.ts +279 -0
  31. package/runtime-src/reverse-engineer/description-prompt.ts +83 -2
  32. package/runtime-src/reverse-engineer/index.ts +29 -10
  33. package/runtime-src/routing-telemetry.ts +395 -0
  34. package/runtime-src/runtime/browser-auth.ts +12 -0
  35. package/runtime-src/runtime/local-server.ts +107 -24
  36. package/runtime-src/runtime/setup.ts +11 -7
  37. package/runtime-src/runtime/update-hints.ts +351 -0
  38. package/runtime-src/server.ts +5 -0
  39. package/runtime-src/settings.ts +221 -0
  40. package/runtime-src/site-policy.ts +54 -0
  41. package/runtime-src/stale-cleanup-runner.ts +144 -0
  42. package/runtime-src/stale-cleanup.ts +133 -0
  43. package/runtime-src/telemetry-attribution.ts +120 -0
  44. package/runtime-src/types/skill.ts +439 -0
  45. package/runtime-src/verification/auth-gate.ts +8 -0
  46. package/runtime-src/verification/candidates.ts +27 -0
  47. package/runtime-src/verification/index.ts +21 -15
  48. package/runtime-src/version.ts +73 -13
  49. package/runtime-src/workflow/artifact.ts +161 -0
  50. package/runtime-src/workflow/compile.ts +808 -0
  51. package/runtime-src/workflow/publish.ts +205 -0
  52. package/runtime-src/workflow/runtime.ts +213 -0
  53. package/scripts/postinstall.mjs +43 -19
  54. package/scripts/release-assets.mjs +24 -0
  55. package/scripts/verify-release-assets.mjs +39 -0
  56. package/vendor/kuri/darwin-arm64/kuri +0 -0
  57. package/vendor/kuri/darwin-x64/kuri +0 -0
  58. package/vendor/kuri/linux-arm64/kuri +0 -0
  59. package/vendor/kuri/linux-x64/kuri +0 -0
  60. package/vendor/kuri/manifest.json +24 -0
@@ -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
+ });
@@ -5,35 +5,103 @@
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
- if (existsSync(binaryPath)) {
17
- // Compiled binary — exec directly, replace this process
18
- const child = spawn(binaryPath, process.argv.slice(2), {
19
- stdio: "inherit",
20
- env: process.env,
21
- });
22
- child.on("exit", (code, signal) => {
23
- if (signal) { process.kill(process.pid, signal); return; }
24
- process.exit(code ?? 1);
25
- });
26
- } else {
27
- // Fallback: delegate to the stable package launcher so
28
- // npm installs and npx use the same dependency resolution path.
29
- const launcherPath = join(__dirname, "unbrowse.js");
30
- const child = spawn(process.execPath, [launcherPath, ...process.argv.slice(2)], {
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, {
31
69
  stdio: "inherit",
32
70
  cwd: process.cwd(),
33
71
  env: process.env,
34
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
+ });
35
80
  child.on("exit", (code, signal) => {
36
81
  if (signal) { process.kill(process.pid, signal); return; }
37
82
  process.exit(code ?? 1);
38
83
  });
39
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
+ spawnEntrypoint(binaryPath, process.argv.slice(2));
93
+ } else {
94
+ const installedVersion = readInstalledVersion();
95
+ if (KNOWN_BAD_FALLBACK_VERSIONS.has(installedVersion)) {
96
+ failInstall(
97
+ `Installed package version ${installedVersion} is known-bad in source fallback mode and shipped an incomplete runtime dependency set.`,
98
+ );
99
+ }
100
+
101
+ const missing = missingFallbackPackages();
102
+ if (missing.length > 0) {
103
+ failInstall(`Fallback runtime is missing required packages: ${missing.join(", ")}.`);
104
+ }
105
+
106
+ spawnEntrypoint(process.execPath, [launcherPath, ...process.argv.slice(2)]);
107
+ }
package/bin/unbrowse.js CHANGED
@@ -19,7 +19,6 @@ const cliArgs = cliEntrypoint.endsWith(".js")
19
19
  const tsxLoader = path.join(path.dirname(tsxPkg), "dist", "loader.mjs");
20
20
  return ["--import", tsxLoader, cliEntrypoint, ...process.argv.slice(2)];
21
21
  })();
22
- const req = createRequire(import.meta.url);
23
22
  const child = spawn(process.execPath, cliArgs, {
24
23
  stdio: "inherit",
25
24
  cwd: process.cwd(),