opensteer 0.8.15 → 0.8.17

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.
@@ -1,118 +0,0 @@
1
- # Opensteer CLI Reference
2
-
3
- Use the CLI for fast exploration before writing SDK code.
4
-
5
- ## Quickstart
6
-
7
- ```bash
8
- opensteer open https://example.com --workspace demo
9
- opensteer snapshot action --workspace demo
10
- opensteer input 5 laptop --workspace demo --persist "search input" --capture-network search
11
- opensteer click 7 --workspace demo --persist "search button" --capture-network search
12
- opensteer snapshot extraction --workspace demo
13
- opensteer extract '{"items":[{"name":{"element":13},"price":{"element":14}},{"name":{"element":22},"price":{"element":23}}]}' \
14
- --workspace demo --persist "search results"
15
- opensteer close --workspace demo
16
- ```
17
-
18
- ## What To Read From Snapshots
19
-
20
- `snapshot action` and `snapshot extraction` return filtered HTML in the `html` field.
21
-
22
- - Read the `html` string.
23
- - Find `c="N"` markers in that HTML.
24
- - Use those numbers as positional `element` ids in CLI commands and extraction schemas.
25
- - Re-snapshot after navigation before using new element numbers.
26
-
27
- ## Core Commands
28
-
29
- ### Session and Pages
30
-
31
- ```bash
32
- opensteer open https://example.com --workspace demo
33
- opensteer goto https://example.com/search --workspace demo --capture-network page-load
34
- opensteer snapshot action --workspace demo
35
- opensteer snapshot extraction --workspace demo
36
- opensteer tab list --workspace demo
37
- opensteer tab 2 --workspace demo
38
- opensteer tab close 2 --workspace demo
39
- opensteer close --workspace demo
40
- ```
41
-
42
- ### DOM Actions
43
-
44
- ```bash
45
- opensteer click 7 --workspace demo --persist "primary button"
46
- opensteer hover 7 --workspace demo --persist "primary button"
47
- opensteer input 5 "search term" --workspace demo --persist "search input" --press-enter
48
- opensteer scroll down 400 --workspace demo
49
- opensteer scroll down 400 --workspace demo --element 12 --persist "results list"
50
- opensteer extract '{"title":{"element":3},"url":{"source":"current_url"}}' --workspace demo \
51
- --persist "page summary"
52
- ```
53
-
54
- Rules:
55
-
56
- - `--persist` caches reusable DOM targets and extraction descriptors by persist key.
57
- - `extract <schema> [--persist <key>]` accepts the schema positionally and optionally saves it for replay.
58
- - There is no CLI `--selector`, `--description` target flag, `--text`, or `--input-json`.
59
-
60
- ### Network Discovery
61
-
62
- ```bash
63
- opensteer network query --workspace demo --capture search
64
- opensteer network query --workspace demo --hostname api.example.com --limit 20
65
- opensteer network detail rec_123 --workspace demo
66
- opensteer replay rec_123 --workspace demo
67
- opensteer replay rec_123 --workspace demo --query keyword=headphones --query count=10
68
- opensteer fetch https://api.example.com/search --workspace demo --query keyword=laptop
69
- ```
70
-
71
- `network query` is intentionally short:
72
-
73
- - one compact block per record
74
- - record id
75
- - method and status
76
- - resource type
77
- - URL
78
- - request and response body summaries when useful
79
-
80
- Use `network detail` when you need headers, cookies sent, request body previews, response body previews, GraphQL metadata, or redirect chains.
81
-
82
- ### Browser State
83
-
84
- ```bash
85
- opensteer cookies --workspace demo
86
- opensteer cookies example.com --workspace demo
87
- opensteer storage example.com --workspace demo
88
- opensteer state example.com --workspace demo
89
- ```
90
-
91
- Use these when replay needs cookies, storage-backed tokens, hidden fields, or globals.
92
-
93
- ### Browser Admin
94
-
95
- ```bash
96
- opensteer browser status --workspace demo
97
- opensteer browser clone --workspace github-sync --source-user-data-dir "$HOME/Library/Application Support/Google/Chrome" --source-profile-directory Default
98
- opensteer browser reset --workspace github-sync
99
- opensteer browser delete --workspace github-sync
100
- opensteer record https://example.com --workspace demo
101
- ```
102
-
103
- ## Recommended Exploration Loop
104
-
105
- 1. `opensteer open`
106
- 2. `opensteer goto ... --capture-network <label>` or a DOM action with `--capture-network`
107
- 3. `opensteer network query`
108
- 4. `opensteer network detail <recordId>`
109
- 5. `opensteer replay <recordId>`
110
- 6. `opensteer cookies` / `storage` / `state` if needed
111
- 7. `opensteer close`
112
-
113
- ## Common Mistakes
114
-
115
- - Starting API discovery with `snapshot` instead of `captureNetwork`.
116
- - Parsing the old `counters` metadata instead of reading the `html` string.
117
- - Trying to use removed surfaces such as `opensteer run`, `--input-json`, `--selector`, or `--description` target flags.
118
- - Forgetting to re-snapshot after navigation.
@@ -1,153 +0,0 @@
1
- # Opensteer Request Workflow
2
-
3
- Use this workflow when the task is to understand, validate, or reuse a site API.
4
-
5
- The deliverable is working TypeScript that uses `session.fetch()` or other SDK primitives. The deliverable is not a registry artifact or a raw replay dump.
6
-
7
- ## Core Rules
8
-
9
- 1. Capture real browser traffic instead of guessing request shapes.
10
- 2. Use the filtered summaries first. Only drill into details when needed.
11
- 3. Let `replay` tell you what transport works.
12
- 4. Keep the final artifact as code, not as shell history.
13
-
14
- ## Workflow
15
-
16
- ### 1. Capture
17
-
18
- Trigger the real browser action that causes the request.
19
-
20
- ```bash
21
- opensteer open https://example.com --workspace demo
22
- opensteer goto https://example.com/search --workspace demo --capture-network page-load
23
- opensteer input 5 laptop --workspace demo --persist "search input" --capture-network search
24
- opensteer click 7 --workspace demo --persist "search button" --capture-network search
25
- ```
26
-
27
- Use meaningful capture labels. They make the next step much easier.
28
-
29
- ### 2. Discover
30
-
31
- Scan the captured traffic.
32
-
33
- ```bash
34
- opensteer network query --workspace demo --capture search
35
- opensteer network query --workspace demo --capture search --hostname api.example.com
36
- opensteer network query --workspace demo --capture search --url search --limit 20
37
- ```
38
-
39
- Look for first-party JSON requests that actually carry the data you want. Ignore static assets, analytics, and third-party noise.
40
-
41
- ### 3. Inspect
42
-
43
- Inspect the most promising record deeply.
44
-
45
- ```bash
46
- opensteer network detail rec_123 --workspace demo
47
- ```
48
-
49
- Read:
50
-
51
- - URL and method
52
- - request headers
53
- - cookies sent
54
- - request body preview
55
- - response headers
56
- - response body preview
57
- - GraphQL metadata when present
58
- - redirect chains when present
59
-
60
- ### 4. Test
61
-
62
- Replay the captured request.
63
-
64
- ```bash
65
- opensteer replay rec_123 --workspace demo
66
- opensteer replay rec_123 --workspace demo --query keyword=headphones --query count=10
67
- opensteer replay rec_123 --workspace demo --variables '{"keyword":"headphones"}'
68
- ```
69
-
70
- Use the working transport that `replay` discovers as input to your final SDK code.
71
-
72
- ### 5. Trace Dependencies
73
-
74
- If replay fails or returns `401`/`403`, inspect the surrounding state.
75
-
76
- ```bash
77
- opensteer network query --workspace demo --before rec_123 --limit 50
78
- opensteer cookies example.com --workspace demo
79
- opensteer storage example.com --workspace demo
80
- opensteer state example.com --workspace demo
81
- ```
82
-
83
- Use these to answer:
84
-
85
- - which cookies matter
86
- - which tokens live in storage
87
- - whether hidden fields or globals provide CSRF values or nonces
88
- - which earlier requests set the relevant state
89
-
90
- ### 6. Write Code
91
-
92
- Translate what worked into plain TypeScript.
93
-
94
- ```ts
95
- import { Opensteer } from "opensteer";
96
-
97
- const opensteer = new Opensteer({
98
- workspace: "demo",
99
- rootDir: process.cwd(),
100
- });
101
-
102
- async function ensureSession() {
103
- const cookies = await opensteer.cookies("example.com");
104
- if (cookies.has("session")) {
105
- return;
106
- }
107
- await opensteer.goto("https://example.com");
108
- }
109
-
110
- export async function searchProducts(keyword: string) {
111
- await ensureSession();
112
-
113
- const response = await opensteer.fetch("https://api.example.com/search", {
114
- query: {
115
- keyword,
116
- count: 24,
117
- },
118
- });
119
-
120
- return response.json();
121
- }
122
- ```
123
-
124
- If exploration showed a required transport, carry it into `fetch()`:
125
-
126
- ```ts
127
- const response = await opensteer.fetch("https://api.example.com/search", {
128
- query: { keyword: "laptop" },
129
- transport: "matched-tls",
130
- });
131
- ```
132
-
133
- ## Common Cases
134
-
135
- ### GraphQL
136
-
137
- - `network query` should surface the operation name next to the URL.
138
- - `network detail` should show operation type, operation name, and variables.
139
- - `replay --variables '{...}'` is the fastest way to test new inputs.
140
-
141
- ### Redirect or Auth Chains
142
-
143
- Start with `network detail` on the failing request. If it shows redirects or challenge notes, inspect earlier records with `--before`.
144
-
145
- ### Hidden Form Tokens
146
-
147
- Use `state example.com --workspace demo` when the request depends on hidden fields or globals that do not show up cleanly in cookies or storage alone.
148
-
149
- ## What Not To Do
150
-
151
- - Do not stop at `network query` when the user asked for reusable code.
152
- - Do not bypass Opensteer with raw Playwright when Opensteer already captured the request.
153
- - Do not dump giant raw response blobs into the prompt when the filtered summaries already show the useful shape.
@@ -1,157 +0,0 @@
1
- # Opensteer SDK Reference
2
-
3
- Use the SDK when the result should become reusable TypeScript in the repository.
4
-
5
- ## Construction
6
-
7
- ```ts
8
- import { Opensteer } from "opensteer";
9
-
10
- const opensteer = new Opensteer({
11
- workspace: "demo",
12
- rootDir: process.cwd(),
13
- });
14
- ```
15
-
16
- Key options:
17
-
18
- - `workspace`: persistent repo-local browser state
19
- - `rootDir`: where `.opensteer` lives
20
- - `browser`: local browser mode or attach config
21
- - `provider`: cloud config when applicable
22
-
23
- ## DOM Automation
24
-
25
- Explore with the CLI first. Use the snapshot `html` output to find `c="N"` element numbers.
26
-
27
- Persist a DOM action target during exploration:
28
-
29
- ```ts
30
- await opensteer.click({
31
- element: 3,
32
- persist: "primary button",
33
- });
34
-
35
- await opensteer.input({
36
- element: 7,
37
- persist: "search input",
38
- text: "laptop",
39
- pressEnter: true,
40
- });
41
- ```
42
-
43
- Replay it later without element numbers:
44
-
45
- ```ts
46
- await opensteer.click({ persist: "primary button" });
47
- await opensteer.input({ persist: "search input", text: "laptop", pressEnter: true });
48
- ```
49
-
50
- Persist works for extraction too:
51
-
52
- ```ts
53
- const summary = await opensteer.extract({
54
- persist: "page summary",
55
- schema: {
56
- title: { selector: "title" },
57
- url: { source: "current_url" },
58
- },
59
- });
60
- ```
61
-
62
- Rules:
63
-
64
- - Use `persist` for reusable DOM targets and extraction descriptors.
65
- - Use `selector` only as a low-level escape hatch.
66
-
67
- ## Network Discovery
68
-
69
- ```ts
70
- await opensteer.goto("https://example.com/search", {
71
- captureNetwork: "search",
72
- });
73
-
74
- const records = await opensteer.network.query({
75
- capture: "search",
76
- limit: 20,
77
- });
78
-
79
- const detail = await opensteer.network.detail(records.records[0]!.recordId);
80
- const replay = await opensteer.network.replay(records.records[0]!.recordId, {
81
- query: { keyword: "headphones" },
82
- });
83
- ```
84
-
85
- Use:
86
-
87
- - `network.query()` to shortlist requests
88
- - `network.detail()` to inspect one request deeply
89
- - `network.replay()` to confirm the transport and response shape
90
-
91
- ## Browser State
92
-
93
- ```ts
94
- const cookies = await opensteer.cookies("example.com");
95
- const localStorage = await opensteer.storage("example.com", "local");
96
- const sessionStorage = await opensteer.storage("example.com", "session");
97
- const browserState = await opensteer.state("example.com");
98
- ```
99
-
100
- `cookies()` returns a small cookie-jar helper:
101
-
102
- ```ts
103
- cookies.has("session");
104
- cookies.get("session");
105
- cookies.getAll();
106
- cookies.serialize();
107
- ```
108
-
109
- ## Session-Aware Fetch
110
-
111
- `fetch()` is the main replay primitive for final code.
112
-
113
- ```ts
114
- const response = await opensteer.fetch("https://api.example.com/search", {
115
- query: {
116
- keyword: "laptop",
117
- count: 24,
118
- },
119
- });
120
-
121
- const data = await response.json();
122
- ```
123
-
124
- If exploration showed a required transport:
125
-
126
- ```ts
127
- const response = await opensteer.fetch("https://api.example.com/search", {
128
- query: { keyword: "laptop" },
129
- transport: "matched-tls",
130
- });
131
- ```
132
-
133
- ## Browser Admin
134
-
135
- ```ts
136
- const status = await opensteer.browser.status();
137
-
138
- if (!status.live) {
139
- await opensteer.browser.clone({
140
- sourceUserDataDir: "/Users/me/Library/Application Support/Google/Chrome",
141
- sourceProfileDirectory: "Default",
142
- });
143
- }
144
- ```
145
-
146
- ## Recommended Rules
147
-
148
- - Explore with the CLI first, then write reusable SDK code.
149
- - Use `captureNetwork` on the real browser actions that trigger the traffic.
150
- - Let `replay` tell you the required transport instead of guessing.
151
- - Keep the final artifact as code, not as shell commands or giant logs.
152
-
153
- ## What Not To Do
154
-
155
- - Do not build new abstractions on top of simple `fetch()` code unless the task really needs them.
156
- - Do not bypass Opensteer with raw Playwright when Opensteer already captured the request.
157
- - Do not dump giant raw response blobs into logs or prompts when the filtered previews already show the useful structure.