agentbrowse 0.1.0 → 0.1.2
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 +31 -17
- package/README.md +4 -2
- package/dist/cli.js +58 -2
- package/package.json +3 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
agentbrowse License (Free Use, No Redistribution)
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2026 Mandar Wagh
|
|
3
|
+
Copyright (c) 2026 Mandar Wagh. All rights reserved.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
1. Grant of use. You are granted a worldwide, royalty-free, non-exclusive,
|
|
6
|
+
non-transferable license to install, run, and use this software (the
|
|
7
|
+
"Software") for any purpose, including commercial purposes. This grant
|
|
8
|
+
includes the incidental copying that a package manager performs to download,
|
|
9
|
+
install, and run the Software (for example, `npm install`), and loading the
|
|
10
|
+
Software into memory to execute it.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
2. Restrictions. Except as expressly permitted in Section 1, you may NOT, in
|
|
13
|
+
whole or in part:
|
|
14
|
+
(a) copy, reproduce, republish, mirror, distribute, transmit, sublicense,
|
|
15
|
+
sell, rent, lease, or otherwise make the Software available to any third
|
|
16
|
+
party;
|
|
17
|
+
(b) modify, adapt, translate, fork, or create derivative works of the
|
|
18
|
+
Software; or
|
|
19
|
+
(c) reverse engineer, decompile, or disassemble the Software, except to the
|
|
20
|
+
extent applicable law expressly permits despite this limitation.
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
3. Reservation of rights. All rights not expressly granted in this license are
|
|
23
|
+
reserved by the copyright holder. No rights are granted by implication,
|
|
24
|
+
estoppel, or otherwise.
|
|
25
|
+
|
|
26
|
+
4. No warranty. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
27
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
28
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO
|
|
29
|
+
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES,
|
|
30
|
+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
|
|
31
|
+
ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
32
|
+
DEALINGS IN THE SOFTWARE.
|
|
33
|
+
|
|
34
|
+
5. Termination. Any breach of Section 2 automatically and immediately terminates
|
|
35
|
+
the rights granted to you under this license.
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ Sessions are isolated by `--session <id>` (default `default`), each with its own
|
|
|
42
42
|
| `read [url]` | Current page (or open `<url>` first) as token-bounded markdown (`--max-chars`, `--page`) |
|
|
43
43
|
| `links [url]` | Numbered, followable links (`--filter`) |
|
|
44
44
|
| `snapshot [url]` | **Accessibility-tree view**: every actionable element with a stable `[ref]`, role, name, state (`--filter`, `--max`, `--json`). The robust way to act |
|
|
45
|
-
| `find <text>` | Locate elements by visible text; numbers reusable by `click` |
|
|
45
|
+
| `find <text>` | Locate elements by visible text (falls back to accessible name); numbers reusable by `click` |
|
|
46
46
|
| `click <target>` | Click by a `snapshot` ref (robust), visible text, a `links`/`find` number, or a CSS selector |
|
|
47
47
|
| `type <field> <text>` | Type into a field (CSS selector or bare `name`) |
|
|
48
48
|
| `fill -f name=value …` | Fill form fields |
|
|
@@ -69,4 +69,6 @@ A manifest declares `pages`, `selectors`, and `commands` as ordered steps with `
|
|
|
69
69
|
|
|
70
70
|
## License
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
Free to use, including commercially — but **not** copyable. You may install, run,
|
|
73
|
+
and use agentbrowse; you may not copy, fork, redistribute, or modify it. See
|
|
74
|
+
[`LICENSE`](./LICENSE). (Versions `0.0.1`–`0.1.1` were released under MIT and keep that license.)
|
package/dist/cli.js
CHANGED
|
@@ -3,6 +3,53 @@
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
|
|
6
|
+
// package.json
|
|
7
|
+
var package_default = {
|
|
8
|
+
name: "agentbrowse",
|
|
9
|
+
version: "0.1.2",
|
|
10
|
+
description: "Agent-browser CLI: drive any website from the terminal.",
|
|
11
|
+
type: "module",
|
|
12
|
+
bin: {
|
|
13
|
+
agentbrowse: "dist/cli.js"
|
|
14
|
+
},
|
|
15
|
+
files: [
|
|
16
|
+
"dist",
|
|
17
|
+
"AGENTS.md"
|
|
18
|
+
],
|
|
19
|
+
engines: {
|
|
20
|
+
node: ">=20"
|
|
21
|
+
},
|
|
22
|
+
scripts: {
|
|
23
|
+
build: "tsup",
|
|
24
|
+
dev: "tsx src/cli.ts",
|
|
25
|
+
test: "vitest run",
|
|
26
|
+
"test:watch": "vitest",
|
|
27
|
+
prepublishOnly: "npm run build && npm test"
|
|
28
|
+
},
|
|
29
|
+
dependencies: {
|
|
30
|
+
"@mozilla/readability": "^0.6.0",
|
|
31
|
+
ajv: "^8.17.1",
|
|
32
|
+
commander: "^12.1.0",
|
|
33
|
+
jsdom: "^24.1.0",
|
|
34
|
+
playwright: "^1.45.0",
|
|
35
|
+
turndown: "^7.2.0"
|
|
36
|
+
},
|
|
37
|
+
devDependencies: {
|
|
38
|
+
"@types/jsdom": "^21.1.0",
|
|
39
|
+
"@types/node": "^20.14.0",
|
|
40
|
+
"@types/turndown": "^5.0.4",
|
|
41
|
+
tsup: "^8.1.0",
|
|
42
|
+
tsx: "^4.16.0",
|
|
43
|
+
typescript: "^5.5.0",
|
|
44
|
+
vitest: "^2.0.0"
|
|
45
|
+
},
|
|
46
|
+
repository: {
|
|
47
|
+
type: "git",
|
|
48
|
+
url: "git+https://github.com/mandarwagh9/agentbrowse.git"
|
|
49
|
+
},
|
|
50
|
+
license: "SEE LICENSE IN LICENSE"
|
|
51
|
+
};
|
|
52
|
+
|
|
6
53
|
// src/daemon/client.ts
|
|
7
54
|
import net from "net";
|
|
8
55
|
import path2 from "path";
|
|
@@ -744,7 +791,16 @@ async function startDaemon(sessionId, opts = {}) {
|
|
|
744
791
|
case "find": {
|
|
745
792
|
const text = String(req.args?.text ?? "");
|
|
746
793
|
if (!text) return err(req, "bad_args", "find requires text");
|
|
747
|
-
|
|
794
|
+
let matches = await page.getByText(text, { exact: false }).all();
|
|
795
|
+
if (matches.length === 0) {
|
|
796
|
+
const needle = text.toLowerCase();
|
|
797
|
+
const named = parseAriaSnapshot(await page.locator("body").ariaSnapshot()).filter(
|
|
798
|
+
(e) => e.actionable && e.name.toLowerCase().includes(needle)
|
|
799
|
+
);
|
|
800
|
+
matches = named.map(
|
|
801
|
+
(e) => page.getByRole(e.role, { name: e.name, exact: true }).nth(e.nth)
|
|
802
|
+
);
|
|
803
|
+
}
|
|
748
804
|
lastRefs = matches.map((locator) => ({ kind: "element", locator }));
|
|
749
805
|
const items = await Promise.all(
|
|
750
806
|
matches.map(async (loc, i) => ({
|
|
@@ -911,7 +967,7 @@ async function emit(produce) {
|
|
|
911
967
|
}
|
|
912
968
|
function buildProgram() {
|
|
913
969
|
const program = new Command();
|
|
914
|
-
program.name("agentbrowse").description("Agent-browser CLI: drive any website from the terminal.").version(
|
|
970
|
+
program.name("agentbrowse").description("Agent-browser CLI: drive any website from the terminal.").version(package_default.version).option("--session <id>", "session name (isolated browser + cookies)", "default");
|
|
915
971
|
const session = (cmd) => cmd.optsWithGlobals().session;
|
|
916
972
|
program.command("open").description("Navigate the session's browser to a URL.").argument("<url>", "URL to open").option("--json", "structured JSON output", false).action((url, opts, cmd) => emit(() => runOpen({ session: session(cmd), json: !!opts.json, url })));
|
|
917
973
|
program.command("read").description("Read the current page (or open <url> first) as token-bounded markdown.").argument("[url]", "optional URL to open before reading").option("--json", "structured JSON output", false).option("--max-chars <n>", "max characters per page", (v) => parseInt(v, 10), 8e3).option("--page <n>", "page number when output is truncated", (v) => parseInt(v, 10), 1).action(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentbrowse",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Agent-browser CLI: drive any website from the terminal.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -40,5 +40,6 @@
|
|
|
40
40
|
"repository": {
|
|
41
41
|
"type": "git",
|
|
42
42
|
"url": "git+https://github.com/mandarwagh9/agentbrowse.git"
|
|
43
|
-
}
|
|
43
|
+
},
|
|
44
|
+
"license": "SEE LICENSE IN LICENSE"
|
|
44
45
|
}
|