opensteer 0.6.13 → 0.7.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 (62) hide show
  1. package/README.md +256 -184
  2. package/dist/chunk-PQYA6IX2.js +32571 -0
  3. package/dist/chunk-PQYA6IX2.js.map +1 -0
  4. package/dist/cli/bin.cjs +38201 -0
  5. package/dist/cli/bin.cjs.map +1 -0
  6. package/dist/cli/bin.d.cts +1 -0
  7. package/dist/cli/bin.d.ts +1 -0
  8. package/dist/cli/bin.js +5612 -0
  9. package/dist/cli/bin.js.map +1 -0
  10. package/dist/index.cjs +31309 -16009
  11. package/dist/index.cjs.map +1 -0
  12. package/dist/index.d.cts +4440 -670
  13. package/dist/index.d.ts +4440 -670
  14. package/dist/index.js +438 -378
  15. package/dist/index.js.map +1 -0
  16. package/package.json +56 -62
  17. package/skills/README.md +21 -20
  18. package/skills/opensteer/SKILL.md +60 -194
  19. package/skills/opensteer/references/cli-reference.md +69 -113
  20. package/skills/opensteer/references/request-workflow.md +81 -0
  21. package/skills/opensteer/references/sdk-reference.md +101 -154
  22. package/CHANGELOG.md +0 -75
  23. package/bin/opensteer.mjs +0 -1423
  24. package/dist/browser-profile-client-CGXc0-P9.d.cts +0 -228
  25. package/dist/browser-profile-client-DHLzMf-K.d.ts +0 -228
  26. package/dist/chunk-2ES46WCO.js +0 -1437
  27. package/dist/chunk-3H5RRIMZ.js +0 -69
  28. package/dist/chunk-AVXUMEDG.js +0 -62
  29. package/dist/chunk-DN3GI5CH.js +0 -57
  30. package/dist/chunk-FAHE5DB2.js +0 -190
  31. package/dist/chunk-HBTSQ2V4.js +0 -15259
  32. package/dist/chunk-K5CL76MG.js +0 -81
  33. package/dist/chunk-U724TBY6.js +0 -1262
  34. package/dist/chunk-ZRCFF546.js +0 -77
  35. package/dist/cli/auth.cjs +0 -2022
  36. package/dist/cli/auth.d.cts +0 -114
  37. package/dist/cli/auth.d.ts +0 -114
  38. package/dist/cli/auth.js +0 -15
  39. package/dist/cli/local-profile.cjs +0 -197
  40. package/dist/cli/local-profile.d.cts +0 -18
  41. package/dist/cli/local-profile.d.ts +0 -18
  42. package/dist/cli/local-profile.js +0 -97
  43. package/dist/cli/profile.cjs +0 -18548
  44. package/dist/cli/profile.d.cts +0 -79
  45. package/dist/cli/profile.d.ts +0 -79
  46. package/dist/cli/profile.js +0 -1328
  47. package/dist/cli/server.cjs +0 -17232
  48. package/dist/cli/server.d.cts +0 -2
  49. package/dist/cli/server.d.ts +0 -2
  50. package/dist/cli/server.js +0 -977
  51. package/dist/cli/skills-installer.cjs +0 -230
  52. package/dist/cli/skills-installer.d.cts +0 -28
  53. package/dist/cli/skills-installer.d.ts +0 -28
  54. package/dist/cli/skills-installer.js +0 -201
  55. package/dist/extractor-4Q3TFZJB.js +0 -8
  56. package/dist/resolver-MGN64KCP.js +0 -7
  57. package/dist/types-Cr10igF3.d.cts +0 -345
  58. package/dist/types-Cr10igF3.d.ts +0 -345
  59. package/skills/electron/SKILL.md +0 -87
  60. package/skills/electron/references/opensteer-electron-recipes.md +0 -88
  61. package/skills/electron/references/opensteer-electron-workflow.md +0 -85
  62. package/skills/opensteer/references/examples.md +0 -118
@@ -1,159 +1,115 @@
1
- # Opensteer CLI Command Reference
1
+ # Opensteer CLI Reference
2
2
 
3
- All commands output JSON. Set session once per shell:
3
+ Use the CLI when you need a fast, stateful loop against a live browser session.
4
4
 
5
- ```bash
6
- export OPENSTEER_SESSION=my-session
7
- # Or for non-interactive runners:
8
- export OPENSTEER_CLIENT_ID=agent-1
9
- ```
10
-
11
- Global flags: `--session <id>`, `--name <namespace>`, `--headless`, `--description <text>`.
12
-
13
- ## Navigation
5
+ ## Session Loop
14
6
 
15
7
  ```bash
16
- opensteer open <url> # Open browser, navigate to URL
17
- opensteer open <url> --name "my-scraper" # Set selector cache namespace
18
- opensteer open <url> --headless # Headless mode
19
- opensteer open --cdp-url http://localhost:9222 # Connect to running browser via CDP
20
- opensteer open <url> --browser real # Use real Chrome profile (headless)
21
- opensteer open <url> --browser real --headed # Real Chrome, visible window
22
- opensteer open <url> --browser real --profile "Work" # Specific Chrome profile
23
- opensteer navigate <url> # Navigate with visual stability wait
24
- opensteer navigate <url> --timeout 60000 # Custom timeout (default 30s)
25
- opensteer back # Go back in history
26
- opensteer forward # Go forward in history
27
- opensteer reload # Reload page
28
- opensteer close # Close browser and stop server
29
- opensteer close --all # Close all active sessions
30
- opensteer sessions # List active sessions
31
- opensteer status # Show resolved session/name state
8
+ opensteer open https://example.com --name demo
9
+ opensteer snapshot action --name demo
10
+ opensteer click 3 --name demo --description "primary button"
11
+ opensteer input 7 "search term" --name demo --press-enter --description "search input"
12
+ opensteer snapshot extraction --name demo
13
+ opensteer extract --name demo \
14
+ --description "page summary" \
15
+ --schema '{"title":{"selector":"title"},"url":{"source":"current_url"}}'
16
+ opensteer close --name demo
32
17
  ```
33
18
 
34
- `open` performs a basic navigation (no stability wait). `navigate` includes `waitForVisualStability`. Use `open` once to start, then `navigate` for subsequent pages.
19
+ ## Core Rules
20
+
21
+ - Keep `--name` stable for the whole workflow.
22
+ - Use `snapshot action` before counter-based interactions.
23
+ - Re-snapshot after any navigation or DOM-changing action before reusing counters.
24
+ - Use `--description` when the interaction or extraction should become replayable later.
25
+ - CLI commands return JSON for machine-readable actions and data commands.
35
26
 
36
- ## Observation
27
+ ## Navigation And Data
37
28
 
38
29
  ```bash
39
- opensteer snapshot action # Same as above (explicit)
40
- opensteer snapshot extraction # Flattened HTML for data scraping
41
- opensteer snapshot clickable # Only clickable elements
42
- opensteer snapshot scrollable # Only scrollable containers
43
- opensteer snapshot full # Minimal cleaning, full HTML
44
- opensteer state # URL + title + cleaned HTML
45
- opensteer screenshot # Save screenshot to screenshot.png
46
- opensteer screenshot output.png # Save to specific file
47
- opensteer screenshot --fullPage # Full page screenshot
30
+ opensteer goto https://example.com/products --name demo
31
+ opensteer snapshot action --name demo
32
+ opensteer snapshot extraction --name demo
33
+ opensteer extract --name demo --schema '{"items":[{"title":{"selector":"h2"}}]}'
48
34
  ```
49
35
 
50
- ## Actions
36
+ ## Browser Connection Modes
51
37
 
52
- First positional argument is element counter (`c="N"` from snapshot).
38
+ Open a brand-new browser:
53
39
 
54
40
  ```bash
55
- opensteer click 5 # Click by counter
56
- opensteer click --description "the submit button" # By cached description
57
- opensteer click 5 --button right # Right-click
58
- opensteer click 5 --clickCount 2 # Double-click
59
- opensteer hover 4 # Hover over element
60
- opensteer hover --description "the user menu" # Hover by description
41
+ opensteer open https://example.com --name demo --headless true
61
42
  ```
62
43
 
63
- ## Input
44
+ Attach to a live Chromium instance:
64
45
 
65
46
  ```bash
66
- opensteer input 3 "Hello" # Type into element (clears first)
67
- opensteer input 3 "Hello" --clear false # Append text
68
- opensteer input 3 "query" --pressEnter # Type and press Enter
69
- opensteer input --description "the search input" --text "query" --pressEnter
47
+ opensteer open https://example.com --name demo --browser attach-live --attach-endpoint 9222
48
+ opensteer browser discover
49
+ opensteer browser inspect --endpoint 9222
70
50
  ```
71
51
 
72
- ## Select / Scroll
52
+ Launch from a copied local profile:
73
53
 
74
54
  ```bash
75
- opensteer select 9 --label "Option A" # Select by visible label
76
- opensteer select 9 --value "opt-a" # Select by value attribute
77
- opensteer select 9 --index 2 # Select by index
78
- opensteer scroll # Scroll page down (default)
79
- opensteer scroll --direction up # Scroll up
80
- opensteer scroll --direction down --amount 1000
81
- opensteer scroll 12 # Scroll within container element
55
+ opensteer open https://example.com --name demo --browser snapshot-session \
56
+ --source-user-data-dir "~/Library/Application Support/Google/Chrome" \
57
+ --source-profile-directory Default
82
58
  ```
83
59
 
84
- ## Keyboard
60
+ Launch from a copied authenticated profile:
85
61
 
86
62
  ```bash
87
- opensteer press Enter
88
- opensteer press Tab
89
- opensteer press Escape
90
- opensteer press "Control+a"
91
- opensteer type "Hello World" # Type into focused element
63
+ opensteer open https://example.com --name demo --browser snapshot-authenticated \
64
+ --source-user-data-dir "~/Library/Application Support/Google/Chrome" \
65
+ --source-profile-directory "Profile 1"
92
66
  ```
93
67
 
94
- ## Element Info
68
+ ## Local Browser Profile Helpers
95
69
 
96
70
  ```bash
97
- opensteer get-text 5 # Get element text content
98
- opensteer get-text --description "the heading"
99
- opensteer get-value 3 # Get input/textarea value
100
- opensteer get-attrs 5 # Get all HTML attributes
101
- opensteer get-html # Full page HTML
102
- opensteer get-html "main" # HTML of element matching selector
71
+ opensteer local-profile list
72
+ opensteer local-profile inspect --user-data-dir "~/Library/Application Support/Opensteer Chrome"
73
+ opensteer local-profile unlock --user-data-dir "~/Library/Application Support/Opensteer Chrome"
103
74
  ```
104
75
 
105
- ## Tabs
76
+ ## Cloud Profile Cookie Sync
106
77
 
107
78
  ```bash
108
- opensteer tabs # List open tabs with indices
109
- opensteer tab-new # Open new blank tab
110
- opensteer tab-new https://example.com # Open URL in new tab
111
- opensteer tab-switch 0 # Switch to tab by index
112
- opensteer tab-close # Close current tab
113
- opensteer tab-close 2 # Close specific tab
79
+ opensteer profile sync \
80
+ --profile-id bp_123 \
81
+ --attach-endpoint 9222 \
82
+ --domain github.com
114
83
  ```
115
84
 
116
- ## Cookies
85
+ ## Network Capture
117
86
 
118
- ```bash
119
- opensteer cookies # Get all cookies
120
- opensteer cookies --url https://example.com # Cookies for specific URL
121
- opensteer cookie-set --name token --value abc123
122
- opensteer cookies-clear # Clear all cookies
123
- opensteer cookies-export /tmp/cookies.json # Export to file
124
- opensteer cookies-import /tmp/cookies.json # Import from file
125
- ```
126
-
127
- ## Utility
87
+ Inspect the traffic triggered by a session:
128
88
 
129
89
  ```bash
130
- opensteer eval "document.title" # Execute JS in page
131
- opensteer wait-for "Success" # Wait for text to appear
132
- opensteer wait-for "Success" --timeout 5000
133
- opensteer wait-selector "h1" # Wait for selector to appear
90
+ opensteer network query --name demo --include-bodies --limit 20
91
+ opensteer network save --name demo --tag login-flow
92
+ opensteer network diff --name demo --left rec_a --right rec_b
93
+ opensteer network probe --name demo --record-id rec_123
94
+ opensteer network minimize --name demo --record-id rec_123 --transport context-http
134
95
  ```
135
96
 
136
- ## Data Extraction
97
+ ## Request Plans
137
98
 
138
- ### Counter-based (preferred)
99
+ Infer a plan from a captured record, then execute it:
139
100
 
140
101
  ```bash
141
- opensteer snapshot extraction
142
- # `schema-json` describes the output shape. It can use explicit bindings or semantic placeholders.
143
-
144
- # Explicit field bindings from observed counters/attributes:
145
- opensteer extract '{"title":{"element":3},"price":{"element":7}}'
146
- opensteer extract '{"url":{"element":5,"attribute":"href"}}'
147
- opensteer extract '{"pageUrl":{"source":"current_url"},"title":{"element":3}}'
148
-
149
- # Explicit array bindings: include multiple items to identify the repeating pattern
150
- opensteer extract '{"results":[{"title":{"element":11},"url":{"element":10,"attribute":"href"}},{"title":{"element":16},"url":{"element":15,"attribute":"href"}}]}'
151
-
152
- # Semantic extraction: use the output shape plus description/prompt
153
- opensteer extract '{"title":"string","price":"string"}' --description "product details"
154
- opensteer extract '{"images":[{"imageUrl":"string","alt":"string","caption":"string","credit":"string"}]}' \
155
- --description "article images with captions and credits" \
156
- --prompt "For each image, return the image URL, alt text, caption, and credit. Prefer caption and credit from the same figure. If missing, look at sibling text, then parent/container text, then nearby alt/data-* attributes."
102
+ opensteer plan infer --name demo --record-id rec_123 --key products.search --version v1
103
+ opensteer plan get --name demo products.search
104
+ opensteer request execute --name demo products.search --query q=laptop
105
+ opensteer request raw --name demo https://example.com/api/search --transport context-http
157
106
  ```
158
107
 
159
- Use explicit bindings when you need deterministic element-to-field mappings. Use semantic extraction when the fields require relationship inference or fallback rules. `--prompt` is the place to describe those rules.
108
+ ## Execution Modes
109
+
110
+ - `managed`: Opensteer launches and owns a fresh browser.
111
+ - `attach-live`: Opensteer attaches to an already running Chromium browser.
112
+ - `snapshot-session`: Opensteer copies an existing profile into an isolated owned session.
113
+ - `snapshot-authenticated`: Opensteer copies a profile while preserving harder authenticated state.
114
+
115
+ Use `--engine abp` on `open` only when the optional `@opensteer/engine-abp` package is installed.
@@ -0,0 +1,81 @@
1
+ # Opensteer Request Workflow
2
+
3
+ Use this workflow when the deliverable is a custom API, a replayable request plan, or a lower-overhead path than full browser automation.
4
+
5
+ ## Transport Selection
6
+
7
+ - `direct-http`: the request is replayable without a browser.
8
+ - `context-http`: browser session state matters, but the request does not need to execute inside page JavaScript.
9
+ - `page-http`: the request must execute inside the live page JavaScript world.
10
+ - `session-http`: use a stored request plan that still depends on a live browser session.
11
+
12
+ When in doubt, start with browser-backed capture first. Opensteer treats browser-backed replay as a first-class path, not a fallback.
13
+
14
+ ## SDK Flow
15
+
16
+ 1. Trigger the request from a real page.
17
+
18
+ ```ts
19
+ await opensteer.open("https://example.com/app");
20
+ await opensteer.click({
21
+ description: "load products",
22
+ networkTag: "products-load",
23
+ });
24
+ ```
25
+
26
+ 2. Inspect the captured traffic.
27
+
28
+ ```ts
29
+ const records = await opensteer.queryNetwork({
30
+ tag: "products-load",
31
+ includeBodies: true,
32
+ limit: 20,
33
+ });
34
+ ```
35
+
36
+ 3. Test the request directly.
37
+
38
+ ```ts
39
+ const response = await opensteer.rawRequest({
40
+ transport: "context-http",
41
+ url: "https://example.com/api/products",
42
+ method: "POST",
43
+ body: {
44
+ json: { page: 1 },
45
+ },
46
+ });
47
+ ```
48
+
49
+ 4. Promote a captured record into a request plan.
50
+
51
+ ```ts
52
+ await opensteer.inferRequestPlan({
53
+ recordId: records.records[0]!.id,
54
+ key: "products.search",
55
+ version: "v1",
56
+ });
57
+ ```
58
+
59
+ 5. Replay the plan from code.
60
+
61
+ ```ts
62
+ const result = await opensteer.request("products.search", {
63
+ query: { q: "laptop" },
64
+ });
65
+ ```
66
+
67
+ ## CLI Equivalents
68
+
69
+ ```bash
70
+ opensteer network query --name demo --tag products-load --include-bodies --limit 20
71
+ opensteer request raw --name demo https://example.com/api/products --transport context-http
72
+ opensteer plan infer --name demo --record-id rec_123 --key products.search --version v1
73
+ opensteer request execute --name demo products.search --query q=laptop
74
+ ```
75
+
76
+ ## Practical Guidance
77
+
78
+ - Capture the browser action first if authentication, cookies, or minted tokens may matter.
79
+ - Save or tag the useful traffic before minimizing or diffing it.
80
+ - Prefer `direct-http` only after proving the request no longer depends on live browser state.
81
+ - Use recipes when the request plan needs deterministic auth refresh or setup work.
@@ -1,174 +1,121 @@
1
- # Opensteer SDK API Reference
1
+ # Opensteer SDK Reference
2
2
 
3
- The SDK is the `Opensteer` class imported from `'opensteer'`. **Only the methods listed below exist.** Do NOT call CLI command names as SDK methods.
3
+ Use the SDK when the workflow should become reusable TypeScript code in the repository.
4
4
 
5
- ## Construction and Lifecycle
5
+ ## Session Ownership
6
6
 
7
- ```typescript
8
- const opensteer = new Opensteer({
9
- name: "my-scraper",
10
- storage: { rootDir: process.cwd() },
11
- });
12
- await opensteer.launch({ headless: false });
13
- await opensteer.close();
7
+ Owned session:
14
8
 
15
- // Use the user's local Chrome profile state:
16
- const opensteer = new Opensteer({
17
- name: "my-scraper",
18
- browser: {
19
- mode: "real",
20
- profileDirectory: "Default",
21
- headless: false,
22
- },
23
- });
24
- await opensteer.launch();
9
+ ```ts
10
+ import { Opensteer } from "opensteer";
25
11
 
26
- // Or pass real-browser mode at launch time:
27
- await opensteer.launch({
28
- mode: "real",
29
- profileDirectory: "Default",
30
- headless: false,
12
+ const opensteer = new Opensteer({
13
+ name: "demo",
14
+ rootDir: process.cwd(),
15
+ browser: { headless: true },
31
16
  });
32
-
33
- // Wrap an existing page instance:
34
- const opensteer = Opensteer.from(existingPage, { name: "my-scraper" });
35
17
  ```
36
18
 
37
- ## Properties
38
-
39
- ```typescript
40
- opensteer.page; // Low-level page handle (see "Advanced: Direct Page Access" in SKILL.md)
41
- opensteer.context; // Low-level browser context handle
42
- ```
43
-
44
- ## Navigation
45
-
46
- ```typescript
47
- await opensteer.goto(url); // Navigate + waitForVisualStability
48
- await opensteer.goto(url, { timeout: 60000 }); // Custom timeout
49
- ```
19
+ Attached session:
50
20
 
51
- ## Observation
21
+ ```ts
22
+ import { Opensteer } from "opensteer";
52
23
 
53
- ```typescript
54
- const html = await opensteer.snapshot(); // Action mode (default)
55
- const html = await opensteer.snapshot({ mode: "extraction" }); // Extraction mode
56
- const state = await opensteer.state(); // { url, title, html }
57
- const buffer = await opensteer.screenshot(); // PNG buffer
58
- const jpeg = await opensteer.screenshot({ type: "jpeg", fullPage: true });
24
+ const opensteer = Opensteer.attach({
25
+ name: "demo",
26
+ rootDir: process.cwd(),
27
+ });
59
28
  ```
60
29
 
61
- ## Interactions
62
-
63
- ```typescript
64
- await opensteer.click({ element: 5 });
65
- await opensteer.click({ description: "the submit button" });
66
- await opensteer.click({ selector: "#btn" });
67
- await opensteer.dblclick({ element: 7 });
68
- await opensteer.rightclick({ element: 7 });
69
- await opensteer.hover({ element: 4 });
70
- await opensteer.input({ element: 3, text: "Hello" });
71
- await opensteer.input({ description: "search", text: "q", pressEnter: true });
72
- await opensteer.select({ element: 9, label: "Option A" });
73
- await opensteer.scroll();
74
- await opensteer.scroll({ direction: "up", amount: 500 });
75
- ```
30
+ Use `close()` for owned sessions. Use `disconnect()` for attached sessions.
76
31
 
77
- ## Data Extraction
32
+ ## Core Browser Flow
78
33
 
79
- ```typescript
80
- // Replay from cached descriptions (preferred in scraper scripts)
34
+ ```ts
35
+ await opensteer.open("https://example.com");
36
+ await opensteer.goto("https://example.com/products");
37
+ await opensteer.snapshot("action");
38
+ await opensteer.click({ description: "primary button" });
39
+ await opensteer.input({ description: "search input", text: "laptop", pressEnter: true });
40
+ await opensteer.hover({ description: "price filter" });
41
+ await opensteer.scroll({ direction: "down", amount: 600 });
81
42
  const data = await opensteer.extract({
82
- description: "product details",
83
- });
84
-
85
- // Semantic extraction: schema is the output shape
86
- const images = await opensteer.extract({
87
- description: "article images with captions and credits",
88
- prompt: "For each image, return the image URL, alt text, caption, and credit. Prefer caption and credit from the same figure. If missing, look at sibling text, then parent/container text, then nearby alt/data-* attributes.",
43
+ description: "page summary",
89
44
  schema: {
90
- images: [{ imageUrl: "string", alt: "string", caption: "string", credit: "string" }],
45
+ title: { selector: "title" },
46
+ url: { source: "current_url" },
91
47
  },
92
48
  });
93
-
94
- // Explicit bindings (during exploration or when no cache exists)
95
- const data = await opensteer.extract({
96
- schema: { title: { element: 3 }, price: { element: 7 } },
97
- description: "product details",
98
- });
99
49
  ```
100
50
 
101
- `schema` describes the output shape, not just selector config. It can use semantic placeholders like `"string"` and arrays of objects, or explicit field bindings such as `{ element: N }`, `{ element: N, attribute: "href" }`, `{ selector: ".price" }`, and `{ source: "current_url" }`.
102
-
103
- Use `prompt` to describe relationship/fallback rules, such as matching each image to its caption and credit.
104
-
105
- For explicit array bindings, include multiple items in the schema so Opensteer can infer the repeating pattern. For semantic extraction, a single representative object shape is enough.
106
-
107
- ## Keyboard
108
-
109
- ```typescript
110
- await opensteer.pressKey("Enter");
111
- await opensteer.pressKey("Control+a");
112
- await opensteer.type("Hello World");
113
- ```
114
-
115
- ## Element Info
116
-
117
- ```typescript
118
- const text = await opensteer.getElementText({ element: 5 });
119
- const value = await opensteer.getElementValue({ element: 3 });
120
- const attrs = await opensteer.getElementAttributes({ element: 5 });
121
- const box = await opensteer.getElementBoundingBox({ element: 5 });
122
- const html = await opensteer.getHtml();
123
- const html = await opensteer.getHtml("main");
124
- const title = await opensteer.getTitle();
125
- ```
126
-
127
- ## Wait
128
-
129
- **Do NOT use wait calls before SDK actions** — each action handles waiting internally. Only use explicit waits for page transitions or confirming SPA content loaded.
130
-
131
- ```typescript
132
- await opensteer.waitForText("Success"); // Literal text on page
133
- await opensteer.waitForText("Success", { timeout: 5000 });
134
- // For CSS selector waits, see "Advanced: Direct Page Access" in SKILL.md
135
- ```
136
-
137
- ## Tabs
138
-
139
- ```typescript
140
- const tabs = await opensteer.tabs();
141
- await opensteer.newTab("https://example.com");
142
- await opensteer.switchTab(0);
143
- await opensteer.closeTab(1);
144
- ```
145
-
146
- ## Cookies
147
-
148
- ```typescript
149
- const cookies = await opensteer.getCookies();
150
- await opensteer.setCookie({ name: "token", value: "abc" });
151
- await opensteer.clearCookies();
152
- await opensteer.exportCookies("/tmp/cookies.json");
153
- await opensteer.importCookies("/tmp/cookies.json");
154
- ```
155
-
156
- ## File Upload
157
-
158
- ```typescript
159
- await opensteer.uploadFile({ element: 5, paths: ["/path/to/file.pdf"] });
160
- ```
161
-
162
- ## Common Mistakes
163
-
164
- | If you want to... | Use this |
165
- | ------------------------ | --------------------------------- |
166
- | Navigate to a URL | `opensteer.goto(url)` |
167
- | Launch the browser | `opensteer.launch()` |
168
- | Close the browser | `opensteer.close()` |
169
- | Get page text content | `opensteer.getElementText()` |
170
- | Get page HTML | `opensteer.getHtml()` |
171
- | Extract structured data | `opensteer.extract()` |
172
- | Wait for content | `opensteer.waitForText()` |
173
-
174
- > **SDK Rule**: Every browser action in a script MUST use an `opensteer.*` method.
51
+ ## Common Methods
52
+
53
+ Session and page control:
54
+
55
+ - `Opensteer.attach({ name?, rootDir? })`
56
+ - `open(url | { url?, name?, browser?, context? })`
57
+ - `goto(url | { url, networkTag? })`
58
+ - `listPages()`
59
+ - `newPage({ url?, openerPageRef? })`
60
+ - `activatePage({ pageRef })`
61
+ - `closePage({ pageRef })`
62
+ - `waitForPage({ openerPageRef?, urlIncludes?, timeoutMs? })`
63
+
64
+ Interaction and extraction:
65
+
66
+ - `snapshot("action" | "extraction")`
67
+ - `click({ element | selector | description, networkTag? })`
68
+ - `hover({ element | selector | description, networkTag? })`
69
+ - `input({ element | selector | description, text, pressEnter?, networkTag? })`
70
+ - `scroll({ element | selector | description, direction, amount, networkTag? })`
71
+ - `extract({ description, schema? })`
72
+
73
+ Inspection and evaluation:
74
+
75
+ - `evaluate(script | { script, pageRef?, args? })`
76
+ - `evaluateJson({ script, pageRef?, args? })`
77
+ - `waitForNetwork({ ...filters, pageRef?, includeBodies?, timeoutMs? })`
78
+ - `waitForResponse({ ...filters, pageRef?, includeBodies?, timeoutMs? })`
79
+ - `queryNetwork({ ...filters, includeBodies?, limit? })`
80
+ - `saveNetwork({ tag, ...filters })`
81
+ - `clearNetwork({ tag? })`
82
+
83
+ Request capture and replay:
84
+
85
+ - `rawRequest({ transport?, pageRef?, url, method?, headers?, body?, followRedirects? })`
86
+ - `inferRequestPlan({ recordId, key, version, lifecycle? })`
87
+ - `writeRequestPlan({ key, version, payload, lifecycle?, tags?, provenance?, freshness? })`
88
+ - `getRequestPlan({ key, version? })`
89
+ - `listRequestPlans({ key? })`
90
+ - `request(key, { path?, query?, headers?, body? })`
91
+ - `writeRecipe({ key, version, payload, tags?, provenance? })`
92
+ - `getRecipe({ key, version? })`
93
+ - `listRecipes({ key? })`
94
+ - `runRecipe({ key, version?, input? })`
95
+
96
+ Instrumentation:
97
+
98
+ - `captureScripts({ pageRef?, includeInline?, includeExternal?, includeDynamic?, includeWorkers?, urlFilter?, persist? })`
99
+ - `addInitScript({ script, args?, pageRef? })`
100
+ - `route({ urlPattern, resourceTypes?, times?, handler })`
101
+ - `interceptScript({ urlPattern, handler, times? })`
102
+
103
+ Browser and profile helpers:
104
+
105
+ - `discoverLocalCdpBrowsers({ timeoutMs? })`
106
+ - `inspectCdpEndpoint({ endpoint, headers?, timeoutMs? })`
107
+ - `inspectLocalBrowserProfile({ userDataDir? })`
108
+ - `unlockLocalBrowserProfile({ userDataDir })`
109
+
110
+ Lifecycle:
111
+
112
+ - `disconnect()`
113
+ - `close()`
114
+
115
+ ## Rules
116
+
117
+ - Wrap owned sessions in `try/finally` and call `close()`.
118
+ - Use `networkTag` on actions that trigger requests you may inspect later.
119
+ - Use `description` when the interaction should be replayable across sessions.
120
+ - Use `element` targets only with a fresh snapshot from the same live session.
121
+ - Prefer Opensteer methods over raw Playwright so browser, extraction, and replay semantics stay consistent.