surf-cli 2.19.0 → 2.20.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/README.md +169 -3
- package/dist/content/index.js +4 -4
- package/dist/content/index.js.map +1 -1
- package/dist/options/options.html +1 -18
- package/dist/service-worker/index.js +44 -15
- package/dist/service-worker/index.js.map +1 -1
- package/native/cli.cjs +109 -6
- package/native/do-executor.cjs +35 -8
- package/native/doctor.cjs +200 -40
- package/native/host-helpers.cjs +95 -10
- package/native/host.cjs +24 -2
- package/native/native-host-launch-probe.cjs +69 -0
- package/native/private-state.cjs +25 -1
- package/native/semantic-cli.cjs +764 -0
- package/native/semantic-core.cjs +369 -0
- package/native/semantic-credentials.cjs +207 -0
- package/native/semantic-provider.cjs +61 -0
- package/native/semantic-workflow-executor.cjs +65 -0
- package/native/semantic-workflow-state.cjs +271 -0
- package/native/semantic-workflow.cjs +398 -0
- package/native/tool-scope.cjs +1 -0
- package/native/workflow-definition.cjs +125 -1
- package/native/workflow-runtime.cjs +71 -5
- package/package.json +8 -4
- package/scripts/install-native-host.cjs +103 -60
- package/scripts/uninstall-native-host.cjs +40 -38
- package/scripts/windows-interop.cjs +89 -0
- package/skills/surf/SKILL.md +78 -1
package/skills/surf/SKILL.md
CHANGED
|
@@ -13,7 +13,7 @@ Ordinary socket-backed CLI commands report top-level host tool-response errors o
|
|
|
13
13
|
|
|
14
14
|
For WSL2 with Windows Chrome, run `surf install <extension-id>` inside WSL2. Surf detects WSL2 and writes the Windows-side native messaging manifest plus a wrapper that launches the WSL host. Use `surf install <extension-id> --target linux` only for Linux browsers running inside WSLg.
|
|
15
15
|
|
|
16
|
-
On macOS, Chrome reads the native messaging manifest at `~/Library/Application Support/Google/Chrome/NativeMessagingHosts/surf.browser.host.json`. If native messaging fails, confirm that file exists, its `allowed_origins` extension ID matches `chrome://extensions`, then rerun `surf install <extension-id>`, restart Chrome, reload the extension
|
|
16
|
+
On macOS, Chrome reads the native messaging manifest at `~/Library/Application Support/Google/Chrome/NativeMessagingHosts/surf.browser.host.json`. If native messaging fails, confirm that file exists, its `allowed_origins` extension ID matches `chrome://extensions`, then rerun `surf install <extension-id>`, restart Chrome, and reload the extension. Open Surf's service-worker console from `chrome://extensions`; in **Details > Extension options**, enable **Debug Mode**, reproduce the failure, then disable it when finished.
|
|
17
17
|
|
|
18
18
|
If a command reports `Socket connect failed`, run `surf doctor` first, then check the `Attempted socket:` line. Default sockets are `/tmp/surf.sock` on macOS/Linux/WSL2 and `//./pipe/surf` on Windows. If `SURF_SOCKET` is set, the browser-launched host and the shell running `surf` must use the same value.
|
|
19
19
|
|
|
@@ -94,6 +94,83 @@ surf screenshot --full-page --output /tmp/shot.png
|
|
|
94
94
|
surf animate-audit --selector ".thing" --duration 2000 --fps 10
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
+
## Optional semantic decisions
|
|
98
|
+
|
|
99
|
+
`semantic.act` is a bounded, goal-driven website controller. It repeatedly
|
|
100
|
+
observes the page, lets Jev select the next action from Surf's allowed menu,
|
|
101
|
+
validates and executes that action, and checks the overall goal:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
goal -> observe -> choose -> validate + act -> verify
|
|
105
|
+
^ |
|
|
106
|
+
+-------- incomplete ----------+
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
It returns when the goal is complete, a decision is uncertain, or a configured
|
|
110
|
+
budget is exhausted. Use `semantic.find` for one control, `semantic.filter` for
|
|
111
|
+
relevant page regions, and
|
|
112
|
+
`semantic.verify` for one outcome. Use Jev when the page or happy path is
|
|
113
|
+
unfamiliar; once the path is stable, prefer deterministic Surf commands for
|
|
114
|
+
repeated runs. The agent owns the goal and final confirmation, while Surf retains
|
|
115
|
+
execution authority. Only `semantic.*` sends bounded, value-free page text to
|
|
116
|
+
TypeSafe.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
surf semantic.find "the settings control"
|
|
120
|
+
surf semantic.verify "Settings were saved" --json
|
|
121
|
+
surf semantic.filter "settings"
|
|
122
|
+
surf semantic.act "Open settings" --max-steps 5
|
|
123
|
+
surf semantic.act "Fill email" --input email="$EMAIL" --allow-write --allow-ref e3
|
|
124
|
+
surf semantic.act 'Add the selected item to the cart' --allow-write --threshold write=0.85
|
|
125
|
+
printf '%s\n' "$TYPESAFE_KEY" | surf semantic auth set
|
|
126
|
+
surf semantic auth status
|
|
127
|
+
surf semantic auth clear
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
For reusable bounded recipes, put only linear `semantic.step` operations in a
|
|
131
|
+
workflow with `"semantic":{"version":1}`. Check it offline with
|
|
132
|
+
`surf workflow.validate flow.json` or `surf do --file flow.json --dry-run`, then
|
|
133
|
+
run with `--allow-semantic`; declared fill/check/click operations also require
|
|
134
|
+
`--allow-write`. Supply private fill slots as a bounded JSON object on stdin:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
printf '%s' '{"quantity":"2"}' | SURF_SESSION=shopping surf do --file flow.json \
|
|
138
|
+
--inputs-stdin --allow-semantic --allow-write --json
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The closed operations are `find`, same-origin direct `open`, `ensureChecked`,
|
|
142
|
+
`fill`, one-shot `click` with an explicit expectation, and `assert`. Search is
|
|
143
|
+
bounded overlapping coverage, not global ranking. Unknown write outcomes stop
|
|
144
|
+
without replay; a later new run can still repeat an external effect. Input
|
|
145
|
+
values never enter provider state, workflow variables, events, or checkpoints.
|
|
146
|
+
|
|
147
|
+
Required argument shapes:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
find target (+ optional search), usually save with "as"
|
|
151
|
+
open target
|
|
152
|
+
ensureChecked target + checked
|
|
153
|
+
fill target + input
|
|
154
|
+
click target + expect
|
|
155
|
+
assert mode + claim (semantic) or predicate (local)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The complete valid six-operation example in the README uses these shapes; start
|
|
159
|
+
from it instead of inventing fields.
|
|
160
|
+
|
|
161
|
+
Every click/fill requires `--allow-write`; repeat `--allow-ref` to narrow it.
|
|
162
|
+
Broad writes use threshold `0.95`; exactly one allowed ref with one applicable
|
|
163
|
+
write uses `0.65`. The applied threshold is included in decision/trace output.
|
|
164
|
+
Repeatable `--threshold name=value` overrides applicable confidence thresholds
|
|
165
|
+
for one run only; defaults remain safer, and overrides never grant write authority.
|
|
166
|
+
`TYPESAFE_API_KEY` is the ephemeral/CI override.
|
|
167
|
+
The shared credential schema is `{"version":1,"apiKey":"..."}` at
|
|
168
|
+
`${XDG_CONFIG_HOME:-~/.config}/typesafe/credentials.json` (Unix/macOS) or
|
|
169
|
+
`%APPDATA%\TypeSafe\credentials.json` (Windows), independent of Surf state and
|
|
170
|
+
the project. POSIX directories/files use `0700`/`0600`; Windows relies on the
|
|
171
|
+
current user's profile ACL. `TYPESAFE_API_KEY` wins. Status reveals only source
|
|
172
|
+
and fingerprint; clear affects all clients using the shared file.
|
|
173
|
+
|
|
97
174
|
## AI Assistants (No API Keys)
|
|
98
175
|
|
|
99
176
|
Query AI models using your browser's logged-in session. Must be logged into the respective service in Chrome.
|