surf-cli 2.8.0 → 2.10.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.
Files changed (47) hide show
  1. package/README.md +146 -8
  2. package/native/abort.cjs +65 -0
  3. package/native/activity-journal.cjs +55 -0
  4. package/native/ai-queue.cjs +64 -0
  5. package/native/aistudio-build.cjs +21 -13
  6. package/native/aistudio-client.cjs +40 -20
  7. package/native/browser-lock.cjs +2 -2
  8. package/native/chatgpt-client.cjs +49 -31
  9. package/native/cli.cjs +352 -482
  10. package/native/client-transport.cjs +168 -0
  11. package/native/do-executor.cjs +68 -510
  12. package/native/do-parser.cjs +8 -249
  13. package/native/doctor.cjs +55 -5
  14. package/native/endpoint.cjs +174 -0
  15. package/native/file-transfer.cjs +734 -0
  16. package/native/gemini-client.cjs +156 -71
  17. package/native/grok-client.cjs +98 -89
  18. package/native/host-helpers.cjs +43 -26
  19. package/native/host-sessions.cjs +287 -0
  20. package/native/host.cjs +998 -620
  21. package/native/listener.cjs +20 -0
  22. package/native/mcp-server.cjs +60 -65
  23. package/native/network-export.cjs +116 -0
  24. package/native/network-store.cjs +38 -58
  25. package/native/perplexity-client.cjs +46 -17
  26. package/native/playbook-authoring.cjs +44 -0
  27. package/native/playbook-cli.cjs +157 -0
  28. package/native/playbook-client.cjs +259 -0
  29. package/native/playbook-receipts.cjs +109 -0
  30. package/native/playbook-records.cjs +208 -0
  31. package/native/playbook-runtime.cjs +177 -0
  32. package/native/playbooks.cjs +235 -0
  33. package/native/private-state.cjs +156 -0
  34. package/native/redaction.cjs +104 -0
  35. package/native/remote-auth.cjs +279 -0
  36. package/native/remote-transport.cjs +337 -0
  37. package/native/request-pending.cjs +148 -0
  38. package/native/socket-path.cjs +1 -1
  39. package/native/workflow-definition.cjs +368 -0
  40. package/native/workflow-runtime.cjs +225 -0
  41. package/package.json +9 -6
  42. package/playbooks/page/ops/read.json +22 -0
  43. package/playbooks/page/playbook.json +7 -0
  44. package/scripts/install-native-host.cjs +36 -5
  45. package/skills/README.md +11 -5
  46. package/skills/deep-x-research/SKILL.md +106 -0
  47. package/skills/surf/SKILL.md +72 -5
@@ -15,6 +15,28 @@ On macOS, Chrome reads the native messaging manifest at `~/Library/Application S
15
15
 
16
16
  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.
17
17
 
18
+ ## Remote Surf
19
+
20
+ Remote clients require a per-client credential; Tailnet reachability alone is not authorization. On the POSIX browser host, authorize the client before installing the listener:
21
+
22
+ ```bash
23
+ surf remote authorize agent-macbook --output ~/agent-macbook.surf-credential.json
24
+ surf install <extension-id> --listen 100.101.102.103:4321
25
+ surf remote list
26
+ ```
27
+
28
+ Move the mode-0600 credential to the client through a secure channel. It grants full trusted Surf authority. Use it explicitly or through `SURF_REMOTE` and `SURF_REMOTE_CREDENTIAL`:
29
+
30
+ ```bash
31
+ surf --remote 100.101.102.103:4321 \
32
+ --remote-credential ~/.config/surf/agent-macbook.json \
33
+ page.read
34
+
35
+ surf remote revoke agent-macbook # Run on the browser host
36
+ ```
37
+
38
+ Remote paths are client-local by default. `local:./file` is explicit client-local syntax; only `remote:/absolute/path` accesses the browser host directly. Remote transfer supports one upload or ChatGPT/Gemini input and one screenshot, network-export, or Gemini image output. Limits are 256 MiB per file, 512 MiB and 32 files per connection, and 256 KiB decoded chunks. `record`, `aistudio.build`, smoke screenshot directories, directories, and multi-file inputs are not supported remotely. Successful action screenshots and failure `--auto-capture` diagnostics are transferred back to client-local paths.
39
+
18
40
  ## CLI Quick Reference
19
41
 
20
42
  ```bash
@@ -68,7 +90,7 @@ surf gemini "analyze" --file data.csv # Attach file
68
90
  surf gemini "a robot surfing" --generate-image /tmp/robot.png
69
91
  surf gemini "add sunglasses" --edit-image photo.jpg --output out.jpg
70
92
  surf gemini "summarize" --youtube "https://youtube.com/..."
71
- surf gemini "hello" --model gemini-2.5-flash # Models: gemini-3-pro (default), gemini-2.5-pro, gemini-2.5-flash
93
+ surf gemini "hello" --model gemini-3.5-flash # Models: gemini-3.1-pro (default), gemini-3.5-flash, gemini-3.1-flash-lite
72
94
  surf gemini "wide banner" --generate-image /tmp/banner.png --aspect-ratio 16:9
73
95
  ```
74
96
 
@@ -89,6 +111,8 @@ surf grok "find viral AI posts" --deep-search # DeepSearch mode
89
111
  surf grok "quick question" --model fast # Models: auto, fast, expert, grok-4.20-beta
90
112
  ```
91
113
 
114
+ For exhaustive, multi-angle X research with categorized findings and full post-URL traceability, use the `deep-x-research` skill (`skills/deep-x-research/`) instead of a single Grok query.
115
+
92
116
  **Grok Validation & Troubleshooting:**
93
117
  ```bash
94
118
  # Validate Grok UI and check available models (no query sent)
@@ -158,6 +182,7 @@ surf tab.list
158
182
  surf tab.new "https://google.com"
159
183
  surf tab.switch 12345
160
184
  surf tab.close 12345
185
+ surf tab.move 12345 --to-window 67890
161
186
  surf tab.reload # Reload current tab
162
187
 
163
188
  # Named tabs (aliases)
@@ -207,12 +232,13 @@ Use `window.new`, `--window-id`, `--tab-id`, and named tabs to keep parallel age
207
232
  ## Input Methods
208
233
 
209
234
  ```bash
210
- # CDP method (real events) - default
235
+ # CDP method (real events) types at the current focus
211
236
  surf type --text "hello"
212
237
  surf click --x 100 --y 200
213
238
 
214
- # JS method (DOM manipulation) - for contenteditable
215
- surf type --text "hello" --selector "#input" --method js
239
+ # Selector/ref targets use frame-aware DOM input
240
+ surf type "hello" --into "#input"
241
+ surf type "hello" --ref e5
216
242
 
217
243
  # Keys
218
244
  surf key Enter
@@ -233,6 +259,7 @@ surf animate-audit --selector ".thing" --duration 2000 --fps 10 # JSON animatio
233
259
  surf page.read --ref e5 # Get specific element details
234
260
  surf page.read --depth 3 # Limit tree depth
235
261
  surf page.read --compact # Minimal output for LLM efficiency
262
+ surf page.read --max-bytes 2000 # Cap visible text at a UTF-8 byte boundary
236
263
  surf page.text # Plain text content only
237
264
  surf page.state # Modals, loading state, scroll info
238
265
  ```
@@ -383,10 +410,13 @@ surf network.body --id "req-123" # Get response body
383
410
  surf network.curl --id "req-123" # Generate curl command
384
411
  surf network.origins # List origins with stats
385
412
  surf network.stats # Capture statistics
386
- surf network.export # Export all requests
413
+ surf network -vv --body-mode text --per-body-bytes 65536
414
+ surf network.export --har --output ./trace.har
387
415
  surf network.clear # Clear captured requests
388
416
  ```
389
417
 
418
+ Response-body capture supports `none`, `text`, and `all` modes plus per-body and per-tab-session byte caps. HAR exports carry body completeness metadata. Persistent network state is private under `~/.surf/state/network/` by default; configure `SURF_NETWORK_PATH` in the native host environment to change it.
419
+
390
420
  ## Console
391
421
 
392
422
  ```bash
@@ -555,6 +585,43 @@ surf workflow.validate workflow.json
555
585
 
556
586
  **Why use `do`?** Instead of 6-8 separate CLI calls with LLM orchestration between each, a workflow executes deterministically. Faster, cheaper, and more reliable.
557
587
 
588
+ ## Playbooks
589
+
590
+ Use `surf do` for a direct command sequence. Use a playbook for a reusable site capability with provenance, browser-session network execution, workflow fallback, and write-safety policy.
591
+
592
+ ```bash
593
+ surf playbook list
594
+ surf pb show page
595
+ surf pb ops page
596
+ surf use page read --json
597
+ ```
598
+
599
+ Resolution order is project (`./.surf/playbooks/`), user (`~/.surf/playbooks/`), then built-in. Provider compatibility commands stay on their validated command paths until provider playbooks have real login-flow validation. A write op requires `--write`; Surf records semantic intent before dispatch so a timeout or concurrent retry cannot silently double-submit.
600
+
601
+ Author from redacted recent activity when it contains only read/navigation behavior, or use an explicit record for richer evidence:
602
+
603
+ ```bash
604
+ surf pb suggest --since 1h
605
+ surf pb save example --op read --from-recent 1h
606
+ surf pb record start example --op read --network --watch
607
+ surf pb record mark "loaded results"
608
+ surf pb record stop --draft
609
+ surf pb save --from-record <record-id>
610
+ surf pb trace export --from-record <record-id> --har ./trace.har
611
+ surf pb export example --out ./example-playbook
612
+ surf pb import ./example-playbook
613
+ ```
614
+
615
+ Records, trace slices, receipts, and the bounded activity journal are private Surf state. Inputs and authentication headers are redacted by default. Use `--include-input-values` only when the saved values are necessary and acceptable.
616
+
617
+ Client projections replay a validated read endpoint and never embed captured browser credentials:
618
+
619
+ ```bash
620
+ surf pb client derive example --op read --from-record <record-id> --request-id <request-id> --out ./client
621
+ surf pb client export example --op read --out ./client
622
+ surf pb client verify ./client
623
+ ```
624
+
558
625
  ## Error Diagnostics
559
626
 
560
627
  ```bash