@agent-om/cli 0.1.0 → 0.1.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
CHANGED
|
@@ -10,11 +10,31 @@ on by ref. It works on any site, built for agents or not.
|
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
12
|
npm install -g @agent-om/cli
|
|
13
|
-
agent-om install # once:
|
|
13
|
+
agent-om install # once: downloads Playwright's Chromium
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
Node 22 or later.
|
|
17
17
|
|
|
18
|
+
### Using your own Chrome (no browser download needed)
|
|
19
|
+
|
|
20
|
+
You can skip `agent-om install` and launch your installed Chrome, or attach to a
|
|
21
|
+
Chrome you already have open (with your sign-ins):
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
# Launch an installed Chrome / Chromium binary directly
|
|
25
|
+
agent-om start --executable "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
|
26
|
+
|
|
27
|
+
# Attach to your running Chrome (enable remote debugging at chrome://inspect/#remote-debugging;
|
|
28
|
+
# Chrome asks you to click Allow each time a session attaches)
|
|
29
|
+
agent-om start --auto-connect # agent's own tabs only (--tabs own, the default)
|
|
30
|
+
agent-om start --auto-connect --tabs active # also the tab currently in front
|
|
31
|
+
agent-om start --cdp 9222 # or attach by explicit CDP port / WebSocket URL
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Run `agent-om help session` for more on profiles (`--profile`), saved auth state
|
|
35
|
+
(`--state`), tab scopes (`--tabs own|active|all`), and site restrictions
|
|
36
|
+
(`--allow-origin`).
|
|
37
|
+
|
|
18
38
|
## Use
|
|
19
39
|
|
|
20
40
|
```console
|
|
@@ -70,14 +90,19 @@ acting (`click`, `fill`, `type`, `select`, `check`, `press`, `scroll`,
|
|
|
70
90
|
## For an agent
|
|
71
91
|
|
|
72
92
|
The package ships a skill text that teaches any model the workflow (skill
|
|
73
|
-
name `agent-om`)
|
|
74
|
-
For Claude Code:
|
|
93
|
+
name `agent-om`). Install it in one command:
|
|
75
94
|
|
|
76
95
|
```sh
|
|
77
|
-
|
|
78
|
-
agent-om skill
|
|
96
|
+
# Install globally for OpenCode, Claude Code, Codex, and Cursor:
|
|
97
|
+
agent-om skill install --global
|
|
98
|
+
|
|
99
|
+
# Or install into the current project (.agents/skills/ and .claude/skills/):
|
|
100
|
+
agent-om skill install
|
|
79
101
|
```
|
|
80
102
|
|
|
103
|
+
`agent-om skill` prints the raw `SKILL.md` to stdout if you want to place it
|
|
104
|
+
somewhere else manually.
|
|
105
|
+
|
|
81
106
|
## Documentation
|
|
82
107
|
|
|
83
108
|
- [How it works](https://github.com/TheAsyncLooop/agent-om/blob/master/docs/semantic-projection.md)
|
package/dist/agent-om.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as LOCATOR_ARGS, a as ALLOW_EVAL, d as screenshotOn, f as ATTACH_MS, h as discover, i as sessionsHome, l as UsageError, m as TAB_LEVELS, n as sessionDir, o as ALLOW_SCREENSHOT, s as SCREENSHOT_WARNING, t as readSession, u as evalOn, v as commandsFor } from "./session-
|
|
2
|
+
import { _ as LOCATOR_ARGS, a as ALLOW_EVAL, d as screenshotOn, f as ATTACH_MS, h as discover, i as sessionsHome, l as UsageError, m as TAB_LEVELS, n as sessionDir, o as ALLOW_SCREENSHOT, s as SCREENSHOT_WARNING, t as readSession, u as evalOn, v as commandsFor } from "./session-Dx2d3ujt.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { spawn, spawnSync } from "node:child_process";
|
|
5
|
-
import { existsSync, mkdirSync, openSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
5
|
+
import { existsSync, mkdirSync, openSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { homedir } from "node:os";
|
|
6
7
|
import { dirname, join, resolve } from "node:path";
|
|
7
8
|
import { createInterface } from "node:readline/promises";
|
|
8
9
|
import { fileURLToPath } from "node:url";
|
|
@@ -110,8 +111,10 @@ function usage() {
|
|
|
110
111
|
"Help",
|
|
111
112
|
" help this text",
|
|
112
113
|
...Object.entries(TOPICS).map(([name, t]) => ` ${`help ${name}`.padEnd(37)}${t.about}`),
|
|
113
|
-
" skill the skill an agent reads to use this tool, for this version
|
|
114
|
-
"
|
|
114
|
+
" skill print the skill an agent reads to use this tool, for this version",
|
|
115
|
+
" skill install [--global] [--dir <folder>]",
|
|
116
|
+
" install the skill into .agents/skills/ and .claude/skills/ (or with --global,",
|
|
117
|
+
" also ~/.config/opencode/skills/ under your home directory)",
|
|
115
118
|
""
|
|
116
119
|
].join("\n");
|
|
117
120
|
}
|
|
@@ -129,9 +132,14 @@ const BOOLEAN = /* @__PURE__ */ new Set([
|
|
|
129
132
|
"confirm",
|
|
130
133
|
"accept",
|
|
131
134
|
"help",
|
|
135
|
+
"global",
|
|
132
136
|
...OPTIONS.filter(([, , value]) => !value).map(([, name]) => name)
|
|
133
137
|
]);
|
|
134
|
-
const VALUE = /* @__PURE__ */ new Set([
|
|
138
|
+
const VALUE = /* @__PURE__ */ new Set([
|
|
139
|
+
"session",
|
|
140
|
+
"dir",
|
|
141
|
+
...OPTIONS.filter(([, , value]) => value).map(([, name]) => name)
|
|
142
|
+
]);
|
|
135
143
|
/** A command line's command, arguments and options. An option the tool hasn't got, or one missing its value, is refused. */
|
|
136
144
|
function parse(argv) {
|
|
137
145
|
const args = {
|
|
@@ -153,6 +161,10 @@ function parse(argv) {
|
|
|
153
161
|
args.flags.interactive = true;
|
|
154
162
|
continue;
|
|
155
163
|
}
|
|
164
|
+
if (a === "-g") {
|
|
165
|
+
args.flags.global = true;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
156
168
|
if (!a.startsWith("--")) {
|
|
157
169
|
word(a);
|
|
158
170
|
continue;
|
|
@@ -410,7 +422,7 @@ async function main(argv, input = process.stdin) {
|
|
|
410
422
|
const { cmd, args } = parsed;
|
|
411
423
|
const name = nameOf(args);
|
|
412
424
|
if (cmd === "__serve") {
|
|
413
|
-
const { serve } = await import("./server-
|
|
425
|
+
const { serve } = await import("./server-CNRN0if0.mjs");
|
|
414
426
|
const [width, height] = String(args.flags.viewport ?? "1280x900").split("x").map(Number);
|
|
415
427
|
try {
|
|
416
428
|
await serve({
|
|
@@ -436,7 +448,44 @@ async function main(argv, input = process.stdin) {
|
|
|
436
448
|
return;
|
|
437
449
|
}
|
|
438
450
|
if (cmd === "skill") {
|
|
439
|
-
|
|
451
|
+
if (args.flags.help) {
|
|
452
|
+
process.stdout.write([
|
|
453
|
+
"agent-om skill print the skill for this version",
|
|
454
|
+
"agent-om skill install [--dir <folder>] install into .agents/skills/agent-om/ and .claude/skills/agent-om/",
|
|
455
|
+
"agent-om skill install --global (-g) install globally for OpenCode, Claude Code, Codex, and Cursor",
|
|
456
|
+
""
|
|
457
|
+
].join("\n"));
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
const text = readFileSync(new URL("../skill/SKILL.md", import.meta.url), "utf8");
|
|
461
|
+
const sub = args._[0];
|
|
462
|
+
if (!sub) {
|
|
463
|
+
process.stdout.write(text);
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (sub !== "install") {
|
|
467
|
+
process.stderr.write(`unknown skill subcommand '${sub}': use 'agent-om skill' to print or 'agent-om skill install [--global] [--dir <folder>]'\n`);
|
|
468
|
+
process.exitCode = 1;
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
const isGlobal = args.flags.global === true;
|
|
472
|
+
const dirFlag = typeof args.flags.dir === "string" ? args.flags.dir : void 0;
|
|
473
|
+
if (isGlobal && dirFlag) {
|
|
474
|
+
process.stderr.write("use either --global or --dir, not both\n");
|
|
475
|
+
process.exitCode = 1;
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
const base = isGlobal ? homedir() : resolve(dirFlag ?? process.cwd());
|
|
479
|
+
const targets = isGlobal ? [
|
|
480
|
+
join(base, ".agents", "skills", "agent-om", "SKILL.md"),
|
|
481
|
+
join(base, ".claude", "skills", "agent-om", "SKILL.md"),
|
|
482
|
+
join(base, ".config", "opencode", "skills", "agent-om", "SKILL.md")
|
|
483
|
+
] : [join(base, ".agents", "skills", "agent-om", "SKILL.md"), join(base, ".claude", "skills", "agent-om", "SKILL.md")];
|
|
484
|
+
for (const target of targets) {
|
|
485
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
486
|
+
writeFileSync(target, text);
|
|
487
|
+
}
|
|
488
|
+
process.stdout.write(`${targets.map((t) => `installed ${t}`).join("\n")}\n`);
|
|
440
489
|
return;
|
|
441
490
|
}
|
|
442
491
|
const own = cmd === "help" ? args._[0] : args.flags.help ? cmd : void 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as LOCATOR_ARGS, c as ToolError, d as screenshotOn, f as ATTACH_MS, g as endpointOf, h as discover, l as UsageError, n as sessionDir, o as ALLOW_SCREENSHOT, p as NO_BROWSER, r as sessionFile, t as readSession, u as evalOn, v as commandsFor } from "./session-
|
|
1
|
+
import { _ as LOCATOR_ARGS, c as ToolError, d as screenshotOn, f as ATTACH_MS, g as endpointOf, h as discover, l as UsageError, n as sessionDir, o as ALLOW_SCREENSHOT, p as NO_BROWSER, r as sessionFile, t as readSession, u as evalOn, v as commandsFor } from "./session-Dx2d3ujt.mjs";
|
|
2
2
|
import { chmodSync, existsSync, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { basename, extname, join } from "node:path";
|
|
4
3
|
import { tmpdir } from "node:os";
|
|
4
|
+
import { basename, extname, join } from "node:path";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
6
|
import http from "node:http";
|
|
7
7
|
import { chromium } from "playwright";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-om/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "agent-om: a command-line tool any agent drives from a shell, on any model: a browser kept open between calls, the page read as the Agent Object Model's view (Chrome's accessibility tree and the DOM, merged, secrets removed), and acted on by ref.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
2
|
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
4
|
// ../core/src/view/commands.ts
|
|
5
5
|
const BOTH = ["cli", "page"];
|
|
6
6
|
const ref = (about = "the element, by its ref") => ({
|