@pxlarified/browser 1.9.6 → 1.9.8

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 CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  <p align="center">
10
10
  <img alt="Node.js" src="https://img.shields.io/badge/Node.js-%3E%3D20-339933?style=flat-square&logo=node.js&logoColor=white">
11
- <img alt="Version" src="https://img.shields.io/badge/version-1.9.6-blue?style=flat-square">
11
+ <img alt="Version" src="https://img.shields.io/badge/version-1.9.8-blue?style=flat-square">
12
12
  <img alt="Browser" src="https://img.shields.io/badge/browser-Zen-7F52FF?style=flat-square">
13
13
  <img alt="Firefox Extension" src="https://img.shields.io/badge/Firefox-WebExtension-FF7139?style=flat-square&logo=firefoxbrowser&logoColor=white">
14
14
  </p>
@@ -25,7 +25,7 @@ The npm package is published as `@pxlarified/browser` and is intended to be used
25
25
  npx @pxlarified/browser <command>
26
26
  ```
27
27
 
28
- The local agent skill lives in `skills/OpenBrowser/` and is not published as a separate npm skill package.
28
+ The local agent skill lives in `skills/browser/` and can be installed from the npm package.
29
29
 
30
30
  ## License
31
31
 
@@ -71,6 +71,18 @@ The installer does the following.
71
71
 
72
72
  Restart Zen if the extension update does not load immediately.
73
73
 
74
+ ### Agent skill installation
75
+
76
+ Install the bundled `browser` skill into a Pi agent directory or an existing `skills` directory.
77
+
78
+ ```sh
79
+ npx @pxlarified/browser install skills --to '.pi/agent/'
80
+ # alias:
81
+ npx @pxlarified/browser install skill --to '.pi/agent/'
82
+ ```
83
+
84
+ If `--to` points at an agent directory such as `.pi/agent`, OpenBrowser writes `.pi/agent/skills/browser/SKILL.md`. If `--to` already points at `.pi/agent/skills`, it writes `.pi/agent/skills/browser/SKILL.md` without appending another `skills` segment.
85
+
74
86
  ## Usage
75
87
 
76
88
  `--browser zen` is optional while Zen is the only supported browser.
@@ -265,7 +277,7 @@ The package is configured with.
265
277
  }
266
278
  ```
267
279
 
268
- The npm package includes the CLI, source, extension source, and bundled extension artifacts. It does not publish `.env`, `node_modules`, build scratch files, or the local `skills/` directory.
280
+ The npm package includes the CLI, source, extension source, bundled extension artifacts, and the installable `skills/browser/` skill. It does not publish `.env`, `node_modules`, or build scratch files.
269
281
 
270
282
  ## Development
271
283
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 2,
3
3
  "name": "OpenBrowser",
4
- "version": "1.9.6",
4
+ "version": "1.9.8",
5
5
  "description": "Local user-scoped browser control bridge for the OpenBrowser CLI.",
6
6
  "icons": {
7
7
  "48": "assets/logo.svg",
@@ -16,7 +16,9 @@
16
16
  "<all_urls>"
17
17
  ],
18
18
  "background": {
19
- "scripts": ["background.js"],
19
+ "scripts": [
20
+ "background.js"
21
+ ],
20
22
  "persistent": true
21
23
  },
22
24
  "browser_specific_settings": {
@@ -24,7 +26,9 @@
24
26
  "id": "openbrowser@mizius.com",
25
27
  "strict_min_version": "109.0",
26
28
  "data_collection_permissions": {
27
- "required": ["none"]
29
+ "required": [
30
+ "none"
31
+ ]
28
32
  }
29
33
  }
30
34
  }
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@pxlarified/browser",
3
- "version": "1.9.6",
3
+ "version": "1.9.8",
4
4
  "description": "Minimal local browser-control CLI for OpenBrowser.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "OpenBrowser": "./bin/OpenBrowser.js"
8
8
  },
9
9
  "scripts": {
10
+ "sync:version": "node scripts/sync-version.js",
10
11
  "build": "node scripts/build.js firefox",
11
12
  "build:firefox": "node scripts/build.js firefox",
12
13
  "release:firefox": "node scripts/sign-firefox.js",
@@ -22,6 +23,7 @@
22
23
  "assets/",
23
24
  "dist/extensions/",
24
25
  "scripts/",
26
+ "skills/browser/",
25
27
  "README.md",
26
28
  "package.json"
27
29
  ],
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
7
+ const packageJsonPath = path.join(root, "package.json");
8
+ const manifestPath = path.join(root, "extensions", "manifest.json");
9
+ const readmePath = path.join(root, "README.md");
10
+
11
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
12
+ const version = packageJson.version;
13
+
14
+ if (!version) throw new Error("package.json is missing a version.");
15
+
16
+ let changed = false;
17
+
18
+ const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
19
+ if (manifest.version !== version) {
20
+ manifest.version = version;
21
+ fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
22
+ console.log(`Updated extensions/manifest.json version to ${version}`);
23
+ changed = true;
24
+ }
25
+
26
+ const readme = fs.readFileSync(readmePath, "utf8");
27
+ const escapedVersion = version.replace(/-/g, "--").replace(/_/g, "__");
28
+ const updatedReadme = readme.replace(
29
+ /https:\/\/img\.shields\.io\/badge\/version-[^-\s"]+-blue\?style=flat-square/g,
30
+ `https://img.shields.io/badge/version-${escapedVersion}-blue?style=flat-square`,
31
+ );
32
+
33
+ if (updatedReadme !== readme) {
34
+ fs.writeFileSync(readmePath, updatedReadme);
35
+ console.log(`Updated README.md version badge to ${version}`);
36
+ changed = true;
37
+ }
38
+
39
+ if (!changed) console.log(`Version metadata already matches ${version}`);
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: browser
3
+ description: Use a web browser.
4
+ ---
5
+
6
+ ## OpenBrowser
7
+
8
+ Run commands through the npm package.
9
+ ```bash
10
+ npx @pxlarified/browser <command>
11
+ ```
12
+
13
+ Close the session after you are done (unless it contains important information or you want to keep it warm for another session).
14
+
15
+ ### Usage
16
+ `--browser zen` is optional.
17
+
18
+ ```bash
19
+ # Installation
20
+ npx @pxlarified/browser install zen
21
+
22
+ # Session management
23
+ npx @pxlarified/browser open <url> --browser zen
24
+ npx @pxlarified/browser close --browser zen
25
+ npx @pxlarified/browser status --browser zen
26
+
27
+ # Navigation
28
+ npx @pxlarified/browser navigate <url> --browser zen
29
+ npx @pxlarified/browser reload --browser zen
30
+ npx @pxlarified/browser back --browser zen
31
+ npx @pxlarified/browser forward --browser zen
32
+
33
+ # Page state
34
+ npx @pxlarified/browser state --browser zen
35
+
36
+ # Screenshots
37
+ npx @pxlarified/browser screenshot --browser zen
38
+ npx @pxlarified/browser screenshot --base64 --browser zen
39
+
40
+ # Interaction
41
+ npx @pxlarified/browser click <ref> --browser zen
42
+ npx @pxlarified/browser keys <text> --browser zen
43
+ npx @pxlarified/browser press <key> --browser zen
44
+ npx @pxlarified/browser select <ref> <option> --browser zen
45
+
46
+ # Content inspection
47
+ npx @pxlarified/browser get --html --browser zen
48
+ npx @pxlarified/browser get --html --ref <ref> --browser zen
49
+
50
+ # Scrolling
51
+ npx @pxlarified/browser scroll up [pixels] --browser zen
52
+ npx @pxlarified/browser scroll down [pixels] --browser zen
53
+ npx @pxlarified/browser scroll --to <ref> --browser zen
54
+ ```
package/src/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import crypto from "node:crypto";
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
4
5
  import { resolveBrowser, supportedBrowsers } from "./browsers/registry.js";
5
6
  import { BridgeUnavailableError, sendBridgeCommandWithRetry } from "./bridge/client.js";
6
7
  import { screenshotsDir } from "./util/paths.js";
@@ -16,7 +17,15 @@ export async function runCli(argv) {
16
17
  const adapter = resolveBrowser(parsed.browser);
17
18
 
18
19
  if (command === "install") {
19
- const browserName = positionals[0] || parsed.browser;
20
+ const target = positionals[0];
21
+ if (target === "skill" || target === "skills") {
22
+ const result = installBrowserSkill(parsed.flags.get("to"));
23
+ console.error(result.note);
24
+ console.log(JSON.stringify(result, null, 2));
25
+ return;
26
+ }
27
+
28
+ const browserName = target || parsed.browser;
20
29
  if (!browserName) throw new Error(`Usage: OpenBrowser install <browser>`);
21
30
  const installAdapter = resolveBrowser(browserName);
22
31
  const result = await installAdapter.install();
@@ -126,6 +135,25 @@ function requireArgs(name, args, count, request) {
126
135
  return request;
127
136
  }
128
137
 
138
+ function installBrowserSkill(to) {
139
+ if (!to) throw new Error("Usage: OpenBrowser install skills --to <agent-dir-or-skills-dir>");
140
+
141
+ const requested = path.resolve(to);
142
+ const skillsDir = path.basename(requested) === "skills" ? requested : path.join(requested, "skills");
143
+ const destination = path.join(skillsDir, "browser");
144
+ const source = fileURLToPath(new URL("../skills/browser/SKILL.md", import.meta.url));
145
+
146
+ fs.mkdirSync(destination, { recursive: true });
147
+ fs.copyFileSync(source, path.join(destination, "SKILL.md"));
148
+
149
+ return {
150
+ skill: "browser",
151
+ destination,
152
+ files: [path.join(destination, "SKILL.md")],
153
+ note: `Installed browser skill to ${destination}.`,
154
+ };
155
+ }
156
+
129
157
  async function printResult(request, result) {
130
158
  if (request.command === "screenshot") {
131
159
  const base64 = normalizeBase64(result.dataUrl || result.base64 || "");
@@ -151,5 +179,5 @@ function normalizeBase64(value) {
151
179
  }
152
180
 
153
181
  function printHelp() {
154
- console.log(`OpenBrowser\n\nUsage:\n OpenBrowser install <browser>\n OpenBrowser open <url> [--browser zen]\n OpenBrowser close [--browser zen]\n OpenBrowser status [--browser zen]\n OpenBrowser navigate <url> [--browser zen]\n OpenBrowser reload|back|forward [--browser zen]\n OpenBrowser state [--browser zen]\n OpenBrowser screenshot [--base64] [--browser zen]\n OpenBrowser click <ref> [--browser zen]\n OpenBrowser keys <text> [--browser zen]\n OpenBrowser press <key> [--browser zen]\n OpenBrowser select <ref> <option> [--browser zen]\n OpenBrowser get --html [--ref <ref>] [--browser zen]\n OpenBrowser scroll up|down [pixels] [--browser zen]\n OpenBrowser scroll --to <ref> [--browser zen]\n\nSupported browsers: ${supportedBrowsers().join(", ")}`);
182
+ console.log(`OpenBrowser\n\nUsage:\n OpenBrowser install <browser>\n OpenBrowser install skills --to <agent-dir-or-skills-dir>\n OpenBrowser open <url> [--browser zen]\n OpenBrowser close [--browser zen]\n OpenBrowser status [--browser zen]\n OpenBrowser navigate <url> [--browser zen]\n OpenBrowser reload|back|forward [--browser zen]\n OpenBrowser state [--browser zen]\n OpenBrowser screenshot [--base64] [--browser zen]\n OpenBrowser click <ref> [--browser zen]\n OpenBrowser keys <text> [--browser zen]\n OpenBrowser press <key> [--browser zen]\n OpenBrowser select <ref> <option> [--browser zen]\n OpenBrowser get --html [--ref <ref>] [--browser zen]\n OpenBrowser scroll up|down [pixels] [--browser zen]\n OpenBrowser scroll --to <ref> [--browser zen]\n\nSupported browsers: ${supportedBrowsers().join(", ")}`);
155
183
  }