claude4arc 0.5.0
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 +21 -0
- package/README.md +275 -0
- package/bin/claude4arc.js +405 -0
- package/extension/background.js +153 -0
- package/extension/guard.js +66 -0
- package/extension/icons/icon-128.png +0 -0
- package/extension/icons/icon-16.png +0 -0
- package/extension/icons/icon-32.png +0 -0
- package/extension/icons/icon-48.png +0 -0
- package/extension/manifest.json +41 -0
- package/host/host.js +368 -0
- package/lib/blocklist.js +52 -0
- package/lib/browsers.js +56 -0
- package/lib/client.js +89 -0
- package/lib/commands.js +353 -0
- package/lib/config.js +22 -0
- package/lib/dnd.js +60 -0
- package/lib/editors.js +373 -0
- package/lib/frames.js +39 -0
- package/lib/housekeeping.js +46 -0
- package/lib/inpage.js +1381 -0
- package/lib/input.js +242 -0
- package/lib/keys.js +109 -0
- package/lib/page.js +1530 -0
- package/lib/paths.js +10 -0
- package/lib/shim.js +186 -0
- package/lib/task.js +350 -0
- package/lib/util.js +64 -0
- package/package.json +43 -0
- package/skill/SKILL.md +138 -0
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude4arc
|
|
3
|
+
description: Control the user's real Arc browser (their logged-in sessions, cookies, and open tabs) through the claude4arc CLI. Use when the user mentions Arc, asks you to do something "in my browser", or needs a site where they are already signed in. Opens and operates websites, fills forms, clicks, types, takes screenshots, extracts page data, and works with the user's existing tabs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# claude4arc
|
|
7
|
+
|
|
8
|
+
Drives the user's own Arc (real profile, trusted input) in background tabs, so
|
|
9
|
+
the user is not interrupted. Set `CLAUDE4ARC_BROWSER=dia` (or `chrome`,
|
|
10
|
+
`brave`, `edge`, `chromium`) only when the user names another browser. If a
|
|
11
|
+
command fails with "bridge is not running", run `claude4arc doctor` and relay
|
|
12
|
+
its output.
|
|
13
|
+
|
|
14
|
+
## Speed rules (each tool call costs seconds; the browser is fast)
|
|
15
|
+
|
|
16
|
+
- Do not look before you act. Guess selectors from the task's words:
|
|
17
|
+
`text=Save`, `role=button[name="Sign in"]`, or a field's label
|
|
18
|
+
(`fill "text=Full name" Ada`, `select text=Country Spain`). Selectors also
|
|
19
|
+
search cross-origin iframes. Only when a guess fails, `find <words>`.
|
|
20
|
+
- Several tasks: do ALL of them in ONE `claude4arc batch` call. One chain per
|
|
21
|
+
line, optional `label:` prefix. Each line prints
|
|
22
|
+
`== label ok|FAILED <start ms>-<end ms>` and its output; a failure does not
|
|
23
|
+
stop later lines, and the tab closes at the end (no `new`, `finish`, ids, or
|
|
24
|
+
timestamp commands needed). Then retry only the failed lines.
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
claude4arc batch <<'EOF'
|
|
28
|
+
A: goto https://a.test/form -- fill "text=Name" Ada -- select "text=Country" Spain -- check "text=I agree" -- click "text=Submit" -s
|
|
29
|
+
B: goto https://b.test -- accept -- click "text=Delete" -s
|
|
30
|
+
C: goto https://c.test -- click "text=Open report" -- text
|
|
31
|
+
D: goto https://d.test -- fill role=textbox $'line 1\n line 2' -- click "text=Save" -s
|
|
32
|
+
E: goto https://e.test -- drag "text=Date" "css=li >> nth=0" -- click "text=Save" -s
|
|
33
|
+
F: goto https://f.test -- click "text=Account" -- click "text=Sign out" -s
|
|
34
|
+
G: goto https://g.test/list -- seek "Row 500" -- click 'text="Row 500"' -s
|
|
35
|
+
H: goto https://h.test/wiki -- text 'css=tr:has-text("Iron")' 400
|
|
36
|
+
I: goto https://i.test/docs -- section "Return value"
|
|
37
|
+
EOF
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
All of these work blind: a popup becomes the current page, `fill` handles
|
|
41
|
+
code editors and iframe fields, `drag` handles HTML5 and mouse lists (drop on
|
|
42
|
+
the first item to move to the top), menus open on `click`, `seek` scrolls
|
|
43
|
+
virtual lists and pages through paginated ones, and `click` waits up to 5 s
|
|
44
|
+
for late content. If a target is in a hidden tab or wizard step, the error
|
|
45
|
+
names the tab or step to open first.
|
|
46
|
+
- One task: open and act in one call, `claude4arc new <url> -- fill … -- click … -s`,
|
|
47
|
+
then reuse it with `claude4arc 7 goto …` and `finish` once at the end.
|
|
48
|
+
- Read with `section <heading>`, plain `text` (main content), or `text <sel>`.
|
|
49
|
+
A guessed CSS selector often misses; a missed `text` selector falls back to
|
|
50
|
+
the main text.
|
|
51
|
+
- Trust receipts: `ok`, `popup p2`, `confirm "…" accepted`, `navigated → …`,
|
|
52
|
+
or a `-s` diff confirm the step. Do not re-check with `eval` or `snap`.
|
|
53
|
+
- Quote selectors that contain `[`, `]`, spaces, or `*`.
|
|
54
|
+
|
|
55
|
+
## Commands
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
claude4arc new <url> [-- <cmd> ...] [-s] # new task, act right away; -s appends a diff snapshot
|
|
59
|
+
claude4arc 7 <cmd> [args] [-- <cmd> ...] # run on task 7's current page (7:p2 for page p2)
|
|
60
|
+
claude4arc batch [7] [--keep] <<'EOF' # one chain per line
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
| Command | Does |
|
|
64
|
+
|---|---|
|
|
65
|
+
| `find <words>` | matching elements on the page and in frames, with refs |
|
|
66
|
+
| `snap` / `snap full` / `snap @12`, `diff` | snapshot of the viewport, the page, or a subtree; changes since the last one |
|
|
67
|
+
| `text [sel] [chars]`, `text all`, `section <heading>` | readable text of `<main>`, an element, the page, or one section |
|
|
68
|
+
| `table [sel]`, `links [words]` | a table as tab-separated rows; links with full URLs |
|
|
69
|
+
| `seek <sel\|words> [container]` | scroll a feed or virtual list until a match renders |
|
|
70
|
+
| `goto <url>`, `back`, `forward`, `reload` | navigate and wait for load |
|
|
71
|
+
| `click <sel>`, `dblclick`, `hover` | trusted pointer input; `click 420,260` uses screenshot coordinates |
|
|
72
|
+
| `fill <sel> <text>`, `type <text>`, `press [sel] <key>` | text and keys (`Enter`, `Meta+a`); `fill` sets editors and date, range, and color inputs |
|
|
73
|
+
| `select <sel> <value>`, `check`, `uncheck`, `upload <sel> <path...>` | form controls |
|
|
74
|
+
| `drag <from> <to>` | drag and drop; `drag 400,300 600,420` for canvas apps |
|
|
75
|
+
| `accept [text]` | accept the next confirm or prompt; put it before the action |
|
|
76
|
+
| `wait <sel\|ms\|url:part\|gone:sel>`, `wait download` | wait for a condition or a download (prints its path) |
|
|
77
|
+
| `scroll <dy> [sel]`, `eval [@frame] <js>`, `shot [full]` | scroll; run JS; screenshot path (image x,y = mouse x,y) |
|
|
78
|
+
| `open <url>`, `use p2`, `pages`, `tabs`, `adopt [tabId]`, `close`, `finish [keep...]` | pages and tabs; `finish` closes only Claude's tabs |
|
|
79
|
+
|
|
80
|
+
`fill` sets Monaco, CodeMirror, Ace, Quill, ProseMirror, Lexical, CKEditor, and
|
|
81
|
+
TinyMCE through their own APIs, so newlines and indentation stay exact.
|
|
82
|
+
|
|
83
|
+
## Snapshots and selectors
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
Title | url | 1680x1050 y=0/3199
|
|
87
|
+
@24 h1 "Welcome"
|
|
88
|
+
the [free](@26) encyclopedia
|
|
89
|
+
@4 checkbox "Newsletter" [checked]
|
|
90
|
+
@3 textbox "Email" ="ada@x.co"
|
|
91
|
+
@9 iframe "Checkout" (cross-origin)
|
|
92
|
+
@9.1 textbox "Card number"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
One space of indent is one level of nesting; `[text](@N)` is an inline link.
|
|
96
|
+
Diffs mark `~` changed, `+` new, `-` gone. Refs stay valid until navigation.
|
|
97
|
+
`@9.1` is element 1 in frame `@9`; `@9 >> text=Pay` scopes a selector to it.
|
|
98
|
+
|
|
99
|
+
Selectors: `@12`, `text=Sign in` (substring, any case), `text="Sign in"`
|
|
100
|
+
(exact), `role=link[name*="docs"]` (also `=`, `^=`, `$=`), `loc=href:/pricing`,
|
|
101
|
+
`xpath=…`, `css=.card:has-text("Pro")`, raw CSS (includes shadow roots), and a
|
|
102
|
+
`>> nth=0` suffix. An ambiguous selector fails and lists candidates.
|
|
103
|
+
|
|
104
|
+
## Scripts
|
|
105
|
+
|
|
106
|
+
`claude4arc run 7 <<'EOF' … EOF` runs Node with `t` (task) and `page`
|
|
107
|
+
predefined; `claude4arc help` lists the Page API. Do not sleep a fixed time
|
|
108
|
+
between actions: they return once the page reacts. Wait for a condition:
|
|
109
|
+
`await page.waitForFunction(() => …, undefined, { timeout: 3000 })`.
|
|
110
|
+
|
|
111
|
+
## Behavior
|
|
112
|
+
|
|
113
|
+
- `alert`/`confirm`/`prompt` never reach the user's screen; confirms are
|
|
114
|
+
dismissed unless you arm `accept` first.
|
|
115
|
+
- `target=_blank` and `window.open` open a background page (`popup p2`);
|
|
116
|
+
OAuth popups can talk to their opener.
|
|
117
|
+
- Claude's tabs are muted. Clipboard writes stay in the page; print, share,
|
|
118
|
+
permission prompts, file pickers, and `mailto:` links are blocked and
|
|
119
|
+
reported. Use `upload` for files.
|
|
120
|
+
- `adopt` takes over the user's current tab. Never close, navigate, or submit
|
|
121
|
+
there unless asked; `finish` only releases it.
|
|
122
|
+
- Google Docs and Sheets: `text` returns the real content. To edit a Doc,
|
|
123
|
+
`click css=.kix-page-paginated >> nth=0` and `type`. In Sheets, go to a cell
|
|
124
|
+
with `fill css=#t-name-box B2 -- press css=#t-name-box Enter`, then `type`
|
|
125
|
+
with `\t` between cells and `\n` between rows. PDFs: `text` reads them.
|
|
126
|
+
- Notion-style toolbars hide while typing: `hover 900,20` first.
|
|
127
|
+
- In mail and documents, read only what the task needs; do not dump inboxes.
|
|
128
|
+
|
|
129
|
+
## Safety
|
|
130
|
+
|
|
131
|
+
- Ask the user before you send messages, post, buy, delete data, or change
|
|
132
|
+
account settings.
|
|
133
|
+
- A command that fails with "is on the claude4arc blocklist" is off limits:
|
|
134
|
+
stop and tell the user. Never run `claude4arc block` or `unblock` yourself.
|
|
135
|
+
- Hand over passwords, 2FA, CAPTCHAs, and permission prompts to the user, then
|
|
136
|
+
continue with the same task id.
|
|
137
|
+
- Use only the task ids you created. Run `finish` once at the end; `finish p2`
|
|
138
|
+
keeps a page open for the user.
|