opensteer 0.5.1 → 0.5.3

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.
@@ -0,0 +1,28 @@
1
+ type ParseMode = 'help' | 'install' | 'error';
2
+ interface ParsedSkillsArgs {
3
+ mode: ParseMode;
4
+ passthroughArgs: string[];
5
+ error?: string;
6
+ }
7
+ interface SkillsInstallInvocation {
8
+ cliPath: string;
9
+ cliArgs: string[];
10
+ }
11
+ interface SkillsInstallerDeps {
12
+ resolveSkillsCliPath: () => string;
13
+ resolveLocalSkillSourcePath: () => string;
14
+ spawnInvocation: (invocation: SkillsInstallInvocation) => Promise<number>;
15
+ writeStdout: (message: string) => void;
16
+ writeStderr: (message: string) => void;
17
+ }
18
+ declare function parseOpensteerSkillsArgs(rawArgs: string[]): ParsedSkillsArgs;
19
+ declare function resolveLocalSkillSourcePath(): string;
20
+ declare function resolveSkillsCliPath(): string;
21
+ declare function createSkillsInstallInvocation(args: {
22
+ localSkillSourcePath: string;
23
+ passthroughArgs: string[];
24
+ skillsCliPath: string;
25
+ }): SkillsInstallInvocation;
26
+ declare function runOpensteerSkillsInstaller(rawArgs: string[], overrideDeps?: Partial<SkillsInstallerDeps>): Promise<number>;
27
+
28
+ export { createSkillsInstallInvocation, parseOpensteerSkillsArgs, resolveLocalSkillSourcePath, resolveSkillsCliPath, runOpensteerSkillsInstaller };
@@ -0,0 +1,201 @@
1
+ // src/cli/skills-installer.ts
2
+ import { spawn } from "child_process";
3
+ import { createRequire } from "module";
4
+ import { existsSync, realpathSync } from "fs";
5
+ import { dirname, join, resolve } from "path";
6
+ var HELP_TEXT = `Usage: opensteer skills <install|add> [options]
7
+
8
+ Installs the first-party Opensteer skill using the upstream "skills" CLI.
9
+
10
+ Commands:
11
+ install Install the opensteer skill
12
+ add Alias for install
13
+
14
+ Supported Options:
15
+ -a, --agent <agents...> Target specific agent(s)
16
+ -g, --global Install globally
17
+ -y, --yes Skip confirmations
18
+ --copy Copy files instead of symlinking
19
+ --all Install to all agents
20
+ -h, --help Show this help
21
+
22
+ Examples:
23
+ opensteer skills install
24
+ opensteer skills add --agent codex --global --yes
25
+ opensteer skills install --all --yes
26
+ `;
27
+ function parseOpensteerSkillsArgs(rawArgs) {
28
+ if (rawArgs.length === 0) {
29
+ return { mode: "help", passthroughArgs: [] };
30
+ }
31
+ const [subcommand, ...rest] = rawArgs;
32
+ if (subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
33
+ return { mode: "help", passthroughArgs: [] };
34
+ }
35
+ if (subcommand !== "install" && subcommand !== "add") {
36
+ return {
37
+ mode: "error",
38
+ passthroughArgs: [],
39
+ error: `Unsupported skills subcommand "${subcommand}". Use "install" or "add".`
40
+ };
41
+ }
42
+ const passthroughArgs = [];
43
+ for (let i = 0; i < rest.length; i += 1) {
44
+ const arg = rest[i];
45
+ if (arg === "--help" || arg === "-h") {
46
+ return { mode: "help", passthroughArgs: [] };
47
+ }
48
+ if (arg === "--global" || arg === "-g") {
49
+ passthroughArgs.push(arg);
50
+ continue;
51
+ }
52
+ if (arg === "--yes" || arg === "-y") {
53
+ passthroughArgs.push(arg);
54
+ continue;
55
+ }
56
+ if (arg === "--copy" || arg === "--all") {
57
+ passthroughArgs.push(arg);
58
+ continue;
59
+ }
60
+ if (arg === "--agent" || arg === "-a") {
61
+ passthroughArgs.push(arg);
62
+ if (i + 1 >= rest.length || rest[i + 1]?.startsWith("-")) {
63
+ return {
64
+ mode: "error",
65
+ passthroughArgs: [],
66
+ error: `${arg} requires at least one value.`
67
+ };
68
+ }
69
+ while (i + 1 < rest.length && !rest[i + 1]?.startsWith("-")) {
70
+ i += 1;
71
+ const agent = rest[i];
72
+ if (agent) {
73
+ passthroughArgs.push(agent);
74
+ }
75
+ }
76
+ continue;
77
+ }
78
+ if (arg.startsWith("-")) {
79
+ return {
80
+ mode: "error",
81
+ passthroughArgs: [],
82
+ error: `Unsupported option "${arg}" for "opensteer skills".`
83
+ };
84
+ }
85
+ return {
86
+ mode: "error",
87
+ passthroughArgs: [],
88
+ error: `Unexpected argument "${arg}".`
89
+ };
90
+ }
91
+ return {
92
+ mode: "install",
93
+ passthroughArgs
94
+ };
95
+ }
96
+ function resolveLocalSkillSourcePath() {
97
+ const packageRoot = resolvePackageRoot();
98
+ const sourcePath = join(packageRoot, "skills");
99
+ if (!existsSync(sourcePath)) {
100
+ throw new Error(
101
+ `Opensteer skill source was not found at "${sourcePath}".`
102
+ );
103
+ }
104
+ return sourcePath;
105
+ }
106
+ function resolveSkillsCliPath() {
107
+ const require2 = createRequire(resolveCliEntrypointPath());
108
+ const skillsPackagePath = require2.resolve("skills/package.json");
109
+ const skillsPackageDir = dirname(skillsPackagePath);
110
+ const cliPath = join(skillsPackageDir, "bin", "cli.mjs");
111
+ if (!existsSync(cliPath)) {
112
+ throw new Error(`skills CLI entrypoint was not found at "${cliPath}".`);
113
+ }
114
+ return cliPath;
115
+ }
116
+ function resolveCliEntrypointPath() {
117
+ const cliEntrypoint = process.argv[1];
118
+ if (!cliEntrypoint) {
119
+ throw new Error("Unable to resolve CLI entrypoint path for skills installer.");
120
+ }
121
+ return realpathSync(cliEntrypoint);
122
+ }
123
+ function resolvePackageRoot() {
124
+ const cliEntrypointPath = resolveCliEntrypointPath();
125
+ const binDir = dirname(cliEntrypointPath);
126
+ return resolve(binDir, "..");
127
+ }
128
+ function createSkillsInstallInvocation(args) {
129
+ return {
130
+ cliPath: args.skillsCliPath,
131
+ cliArgs: [
132
+ "add",
133
+ args.localSkillSourcePath,
134
+ "--skill",
135
+ "opensteer",
136
+ ...args.passthroughArgs
137
+ ]
138
+ };
139
+ }
140
+ async function spawnInvocation(invocation) {
141
+ return await new Promise((resolvePromise, rejectPromise) => {
142
+ const child = spawn(process.execPath, [invocation.cliPath, ...invocation.cliArgs], {
143
+ stdio: "inherit",
144
+ env: process.env,
145
+ cwd: process.cwd()
146
+ });
147
+ child.once("error", (error) => {
148
+ rejectPromise(error);
149
+ });
150
+ child.once("exit", (code) => {
151
+ if (typeof code === "number") {
152
+ resolvePromise(code);
153
+ return;
154
+ }
155
+ resolvePromise(1);
156
+ });
157
+ });
158
+ }
159
+ function createDefaultDeps() {
160
+ return {
161
+ resolveSkillsCliPath,
162
+ resolveLocalSkillSourcePath,
163
+ spawnInvocation,
164
+ writeStdout(message) {
165
+ process.stdout.write(message);
166
+ },
167
+ writeStderr(message) {
168
+ process.stderr.write(message);
169
+ }
170
+ };
171
+ }
172
+ async function runOpensteerSkillsInstaller(rawArgs, overrideDeps = {}) {
173
+ const deps = {
174
+ ...createDefaultDeps(),
175
+ ...overrideDeps
176
+ };
177
+ const parsed = parseOpensteerSkillsArgs(rawArgs);
178
+ if (parsed.mode === "help") {
179
+ deps.writeStdout(HELP_TEXT);
180
+ return 0;
181
+ }
182
+ if (parsed.mode === "error") {
183
+ deps.writeStderr(`${parsed.error}
184
+ `);
185
+ deps.writeStderr('Run "opensteer skills --help" for usage.\n');
186
+ return 1;
187
+ }
188
+ const invocation = createSkillsInstallInvocation({
189
+ localSkillSourcePath: deps.resolveLocalSkillSourcePath(),
190
+ passthroughArgs: parsed.passthroughArgs,
191
+ skillsCliPath: deps.resolveSkillsCliPath()
192
+ });
193
+ return await deps.spawnInvocation(invocation);
194
+ }
195
+ export {
196
+ createSkillsInstallInvocation,
197
+ parseOpensteerSkillsArgs,
198
+ resolveLocalSkillSourcePath,
199
+ resolveSkillsCliPath,
200
+ runOpensteerSkillsInstaller
201
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opensteer",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Open-source browser automation SDK with robust selectors and deterministic replay.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,6 +20,7 @@
20
20
  "files": [
21
21
  "dist",
22
22
  "bin",
23
+ "skills",
23
24
  "README.md",
24
25
  "LICENSE",
25
26
  "CHANGELOG.md"
@@ -37,6 +38,7 @@
37
38
  "dotenv": "^17.2.4",
38
39
  "openai": "^6.25.0",
39
40
  "playwright": "^1.50.0",
41
+ "skills": "1.4.3",
40
42
  "ws": "^8.18.0",
41
43
  "zod": "^4.3.6"
42
44
  },
@@ -63,8 +65,12 @@
63
65
  "type": "git",
64
66
  "url": "https://github.com/steerlabs/opensteer"
65
67
  },
68
+ "homepage": "https://opensteer.com",
69
+ "bugs": {
70
+ "url": "https://github.com/steerlabs/opensteer/issues"
71
+ },
66
72
  "scripts": {
67
- "build": "tsup src/index.ts src/cli/server.ts --dts --format esm,cjs --clean --external ai --external zod --external @ai-sdk/openai --external @ai-sdk/anthropic --external @ai-sdk/google --external @ai-sdk/xai --external @ai-sdk/groq --external openai --external @anthropic-ai/sdk --external @google/genai",
73
+ "build": "tsup src/index.ts src/cli/server.ts src/cli/skills-installer.ts --dts --format esm,cjs --clean --external ai --external zod --external @ai-sdk/openai --external @ai-sdk/anthropic --external @ai-sdk/google --external @ai-sdk/xai --external @ai-sdk/groq --external openai --external @anthropic-ai/sdk --external @google/genai",
68
74
  "test": "vitest run",
69
75
  "test:live-web": "vitest run --config vitest.live-web.config.ts",
70
76
  "test:unit": "vitest run tests/html tests/element-path tests/config.test.ts tests/storage",
@@ -0,0 +1,29 @@
1
+ # Opensteer Skills
2
+
3
+ This directory contains Opensteer-maintained skill packs.
4
+
5
+ ## Layout
6
+
7
+ Use this structure for each skill:
8
+
9
+ ```text
10
+ skills/<skill-name>/
11
+ SKILL.md
12
+ references/
13
+ *.md
14
+ templates/
15
+ *
16
+ ```
17
+
18
+ ## Conventions
19
+
20
+ - Keep one canonical skill per folder (`<skill-name>`).
21
+ - Use `SKILL.md` frontmatter with at least `name` and `description`.
22
+ - Put detailed instructions in `references/` and link them from `SKILL.md`.
23
+ - Put reusable snippets in `templates/` when needed.
24
+ - Use relative Markdown links.
25
+
26
+ ## Built-in Skills
27
+
28
+ - `opensteer`: [skills/opensteer/SKILL.md](./opensteer/SKILL.md)
29
+ - `electron`: [skills/electron/SKILL.md](./electron/SKILL.md)
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: electron
3
+ description: "Automate Electron desktop apps (Slack, VS Code, Discord, Notion, and other Chromium-based desktop apps) with Opensteer by connecting to a running Chrome DevTools endpoint. Use when tasks require interacting with Electron UI, testing desktop app workflows, extracting structured data from app windows, or capturing Electron screenshots."
4
+ ---
5
+
6
+ # Electron App Automation with Opensteer
7
+
8
+ Use this skill when a task targets an Electron desktop app instead of a normal browser tab.
9
+
10
+ Read [opensteer-electron-workflow.md](references/opensteer-electron-workflow.md) first for the Opensteer connection model and execution flow.
11
+
12
+ ## Core Workflow
13
+
14
+ 1. Launch the Electron app with `--remote-debugging-port=<port>`.
15
+ 2. Connect Opensteer with `open --connect-url http://127.0.0.1:<port>`.
16
+ 3. List windows/webviews with `tabs`, then switch with `tab-switch`.
17
+ 4. Run `snapshot action`, interact (`click`, `input`, `press`), then re-snapshot.
18
+ 5. Use `snapshot extraction` and `extract` for structured data.
19
+
20
+ ```bash
21
+ # Connect Opensteer to a running Electron app on port 9222
22
+ opensteer open --connect-url http://127.0.0.1:9222 --session slack-desktop --name slack-desktop
23
+
24
+ # Discover available windows/webviews
25
+ opensteer tabs --session slack-desktop
26
+ opensteer tab-switch 0 --session slack-desktop
27
+
28
+ # Standard action loop
29
+ opensteer snapshot action --session slack-desktop
30
+ opensteer click 12 --session slack-desktop
31
+ opensteer input 8 "release notes" --pressEnter --session slack-desktop
32
+ opensteer snapshot action --session slack-desktop
33
+ ```
34
+
35
+ ## Launching Electron Apps
36
+
37
+ If the app is already running, quit it first, then relaunch with the debugging flag.
38
+
39
+ ```bash
40
+ # macOS examples
41
+ open -a "Slack" --args --remote-debugging-port=9222
42
+ open -a "Visual Studio Code" --args --remote-debugging-port=9223
43
+ open -a "Discord" --args --remote-debugging-port=9224
44
+
45
+ # Linux examples
46
+ slack --remote-debugging-port=9222
47
+ code --remote-debugging-port=9223
48
+ discord --remote-debugging-port=9224
49
+ ```
50
+
51
+ ## Structured Extraction Pattern
52
+
53
+ ```bash
54
+ opensteer snapshot extraction --session slack-desktop
55
+
56
+ opensteer extract '{"channels":[{"name":{"element":21},"unread":{"element":22}}]}' \
57
+ --description "sidebar channels with unread state" \
58
+ --session slack-desktop
59
+ ```
60
+
61
+ Use `--description` when possible so selector paths persist for replay.
62
+
63
+ ## Multiple Apps at Once
64
+
65
+ Use one Opensteer session per app:
66
+
67
+ ```bash
68
+ opensteer open --connect-url http://127.0.0.1:9222 --session slack --name slack-electron
69
+ opensteer open --connect-url http://127.0.0.1:9223 --session vscode --name vscode-electron
70
+
71
+ opensteer snapshot action --session slack
72
+ opensteer snapshot action --session vscode
73
+ ```
74
+
75
+ ## Guardrails
76
+
77
+ - Prefer Opensteer commands over raw Playwright for interaction/extraction.
78
+ - Re-snapshot after each navigation or large UI change before reusing counters.
79
+ - Keep `--name` stable inside a session for deterministic selector replay.
80
+ - Close sessions when done: `opensteer close --session <id>`.
81
+
82
+ ## References
83
+
84
+ - [opensteer-electron-workflow.md](references/opensteer-electron-workflow.md)
85
+ - [opensteer-electron-recipes.md](references/opensteer-electron-recipes.md)
@@ -0,0 +1,86 @@
1
+ # Opensteer Electron Recipes
2
+
3
+ ## Launch Commands
4
+
5
+ Relaunch the app with a debugging port before connecting.
6
+
7
+ ```bash
8
+ # macOS
9
+ open -a "Slack" --args --remote-debugging-port=9222
10
+ open -a "Visual Studio Code" --args --remote-debugging-port=9223
11
+ open -a "Discord" --args --remote-debugging-port=9224
12
+
13
+ # Linux
14
+ slack --remote-debugging-port=9222
15
+ code --remote-debugging-port=9223
16
+ discord --remote-debugging-port=9224
17
+
18
+ # Windows (PowerShell examples)
19
+ "$env:LOCALAPPDATA\slack\slack.exe" --remote-debugging-port=9222
20
+ "$env:LOCALAPPDATA\Programs\Microsoft VS Code\Code.exe" --remote-debugging-port=9223
21
+ ```
22
+
23
+ Optional health check:
24
+
25
+ ```bash
26
+ curl -s http://127.0.0.1:9222/json/version
27
+ ```
28
+
29
+ ## Connect and Select Target
30
+
31
+ ```bash
32
+ opensteer open --connect-url http://127.0.0.1:9222 --session electron --name electron
33
+ opensteer tabs --session electron
34
+ opensteer tab-switch 0 --session electron
35
+ opensteer snapshot action --session electron
36
+ ```
37
+
38
+ If the wrong content appears, iterate with `tab-switch` and `snapshot action` until you reach the correct window/webview.
39
+
40
+ ## Navigation and Interaction
41
+
42
+ ```bash
43
+ opensteer snapshot action --session electron
44
+ opensteer click 11 --description "left sidebar channel" --session electron
45
+ opensteer input 7 "deployment notes" --pressEnter --description "search input" --session electron
46
+ opensteer press Enter --session electron
47
+ opensteer screenshot electron-state.png --session electron
48
+ ```
49
+
50
+ ## Structured Data Extraction
51
+
52
+ ```bash
53
+ # Inspect extraction-focused DOM
54
+ opensteer snapshot extraction --session electron
55
+
56
+ # Build schema from observed counters
57
+ opensteer extract '{"items":[{"title":{"element":15},"meta":{"element":16}}]}' \
58
+ --description "visible item list with metadata" \
59
+ --session electron
60
+ ```
61
+
62
+ ## Multi-App Pattern
63
+
64
+ ```bash
65
+ # Slack
66
+ opensteer open --connect-url http://127.0.0.1:9222 --session slack --name slack-electron
67
+
68
+ # VS Code
69
+ opensteer open --connect-url http://127.0.0.1:9223 --session vscode --name vscode-electron
70
+
71
+ opensteer snapshot action --session slack
72
+ opensteer snapshot action --session vscode
73
+ ```
74
+
75
+ ## Troubleshooting
76
+
77
+ - `connection refused`:
78
+ - App was not launched with `--remote-debugging-port`.
79
+ - Port is wrong or blocked by another process.
80
+ - Empty or incorrect snapshot:
81
+ - You are in the wrong target window; use `tabs` and `tab-switch`.
82
+ - The app has not finished rendering; wait briefly and snapshot again.
83
+ - Counter failures (`element not found`):
84
+ - UI changed and counters are stale; take a fresh `snapshot action`.
85
+ - Wrong selectors on replay:
86
+ - `--description` string differs from the original text; use exact wording.
@@ -0,0 +1,85 @@
1
+ # Opensteer Electron Workflow
2
+
3
+ This document describes the Opensteer-native flow for automating Electron apps.
4
+
5
+ ## 1. Connection Model
6
+
7
+ Electron apps embed Chromium. Opensteer connects through Chrome DevTools Protocol (CDP):
8
+
9
+ - Launch app with `--remote-debugging-port=<port>`
10
+ - Attach with `opensteer open --connect-url http://127.0.0.1:<port>`
11
+
12
+ Example:
13
+
14
+ ```bash
15
+ opensteer open --connect-url http://127.0.0.1:9222 --session electron --name electron
16
+ ```
17
+
18
+ `--session` controls runtime routing (which daemon/browser instance handles commands).
19
+ `--name` controls selector cache namespace for deterministic replay.
20
+
21
+ ## 2. Window/Webview Targeting
22
+
23
+ Electron apps often expose multiple targets. After connecting:
24
+
25
+ ```bash
26
+ opensteer tabs --session electron
27
+ opensteer tab-switch 0 --session electron
28
+ opensteer snapshot action --session electron
29
+ ```
30
+
31
+ Iterate `tab-switch` + `snapshot action` until you are on the correct app window/webview.
32
+
33
+ ## 3. Action Loop
34
+
35
+ Use this loop for all interactions:
36
+
37
+ 1. `snapshot action`
38
+ 2. `click` / `input` / `press`
39
+ 3. re-run `snapshot action`
40
+
41
+ Example:
42
+
43
+ ```bash
44
+ opensteer snapshot action --session electron
45
+ opensteer click 10 --description "navigation item" --session electron
46
+ opensteer input 6 "release checklist" --pressEnter --description "search input" --session electron
47
+ opensteer snapshot action --session electron
48
+ ```
49
+
50
+ ## 4. Extraction Loop
51
+
52
+ For structured data:
53
+
54
+ 1. `snapshot extraction`
55
+ 2. build schema from element counters
56
+ 3. `extract <schema-json>`
57
+
58
+ Example:
59
+
60
+ ```bash
61
+ opensteer snapshot extraction --session electron
62
+ opensteer extract '{"rows":[{"title":{"element":14},"status":{"element":15}}]}' \
63
+ --description "current visible rows with status" \
64
+ --session electron
65
+ ```
66
+
67
+ ## 5. Replay Stability
68
+
69
+ - Keep `--name` stable for the same automation namespace.
70
+ - Keep `--description` text exact across runs.
71
+ - Re-snapshot after meaningful UI changes before reusing counters.
72
+
73
+ ## 6. Session Cleanup
74
+
75
+ Close the session when done:
76
+
77
+ ```bash
78
+ opensteer close --session electron
79
+ ```
80
+
81
+ Or list active sessions:
82
+
83
+ ```bash
84
+ opensteer sessions
85
+ ```