@onkernel/cli 0.9.4 → 0.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 (3) hide show
  1. package/README.md +65 -0
  2. package/lib.js +9 -49
  3. package/package.json +19 -19
package/README.md CHANGED
@@ -241,6 +241,50 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
241
241
 
242
242
  - `kernel browsers extensions upload <id or persistent id> <extension-path>...` - Ad-hoc upload of one or more unpacked extensions to a running browser instance.
243
243
 
244
+ ### Browser Computer Controls
245
+
246
+ - `kernel browsers computer click-mouse <id or persistent id>` - Click mouse at coordinates
247
+ - `--x <coordinate>` - X coordinate (required)
248
+ - `--y <coordinate>` - Y coordinate (required)
249
+ - `--num-clicks <n>` - Number of clicks (default: 1)
250
+ - `--button <button>` - Mouse button: left, right, middle, back, forward (default: left)
251
+ - `--click-type <type>` - Click type: down, up, click (default: click)
252
+ - `--hold-key <key>` - Modifier keys to hold (repeatable)
253
+ - `kernel browsers computer move-mouse <id or persistent id>` - Move mouse to coordinates
254
+ - `--x <coordinate>` - X coordinate (required)
255
+ - `--y <coordinate>` - Y coordinate (required)
256
+ - `--hold-key <key>` - Modifier keys to hold (repeatable)
257
+ - `kernel browsers computer screenshot <id or persistent id>` - Capture a screenshot
258
+ - `--to <path>` - Output file path for the PNG image (required)
259
+ - `--x <coordinate>` - Top-left X for region capture (optional)
260
+ - `--y <coordinate>` - Top-left Y for region capture (optional)
261
+ - `--width <pixels>` - Region width (optional)
262
+ - `--height <pixels>` - Region height (optional)
263
+ - `kernel browsers computer type <id or persistent id>` - Type text on the browser instance
264
+
265
+ - `--text <text>` - Text to type (required)
266
+ - `--delay <ms>` - Delay in milliseconds between keystrokes (optional)
267
+
268
+ - `kernel browsers computer press-key <id or persistent id>` - Press one or more keys
269
+
270
+ - `--key <key>` - Key symbols to press (repeatable)
271
+ - `--duration <ms>` - Duration to hold keys down in ms (0=tap)
272
+ - `--hold-key <key>` - Modifier keys to hold (repeatable)
273
+
274
+ - `kernel browsers computer scroll <id or persistent id>` - Scroll the mouse wheel
275
+
276
+ - `--x <coordinate>` - X coordinate (required)
277
+ - `--y <coordinate>` - Y coordinate (required)
278
+ - `--delta-x <pixels>` - Horizontal scroll amount (+right, -left)
279
+ - `--delta-y <pixels>` - Vertical scroll amount (+down, -up)
280
+ - `--hold-key <key>` - Modifier keys to hold (repeatable)
281
+
282
+ - `kernel browsers computer drag-mouse <id or persistent id>` - Drag the mouse along a path
283
+ - `--point <x,y>` - Add a point as x,y (repeatable)
284
+ - `--delay <ms>` - Delay before dragging starts in ms
285
+ - `--button <button>` - Mouse button: left, middle, right (default: left)
286
+ - `--hold-key <key>` - Modifier keys to hold (repeatable)
287
+
244
288
  ### Extension Management
245
289
 
246
290
  - `kernel extensions list` - List all uploaded extensions
@@ -330,6 +374,27 @@ kernel browsers fs upload my-browser --file "local.txt:remote.txt" --dest-dir "/
330
374
 
331
375
  # List files in a directory
332
376
  kernel browsers fs list-files my-browser --path "/tmp"
377
+
378
+ # Click the mouse at coordinates (100, 200)
379
+ kernel browsers computer click-mouse my-browser --x 100 --y 200
380
+
381
+ # Double-click the right mouse button
382
+ kernel browsers computer click-mouse my-browser --x 100 --y 200 --num-clicks 2 --button right
383
+
384
+ # Move the mouse to coordinates (500, 300)
385
+ kernel browsers computer move-mouse my-browser --x 500 --y 300
386
+
387
+ # Take a full screenshot
388
+ kernel browsers computer screenshot my-browser --to screenshot.png
389
+
390
+ # Take a screenshot of a specific region
391
+ kernel browsers computer screenshot my-browser --to region.png --x 0 --y 0 --width 800 --height 600
392
+
393
+ # Type text in the browser
394
+ kernel browsers computer type my-browser --text "Hello, World!"
395
+
396
+ # Type text with a 100ms delay between keystrokes
397
+ kernel browsers computer type my-browser --text "Slow typing..." --delay 100
333
398
  ```
334
399
 
335
400
  ### Extension management
package/lib.js CHANGED
@@ -19,61 +19,31 @@ const getArchive = () => {
19
19
 
20
20
  const binDir = path.join(__dirname, "bin");
21
21
 
22
- async function extractTar(tarPath, binaries, dir, wrappedIn) {
22
+ async function extractTar(tarPath, binaries, dir) {
23
23
  try {
24
- const filesToExtract = wrappedIn
25
- ? binaries.map((bin) =>
26
- path.join(wrappedIn, bin).replace(/\\/g, "/"),
27
- )
28
- : binaries;
29
-
30
24
  await tar.x({
31
25
  file: tarPath,
32
26
  cwd: dir,
33
- filter: (path) => filesToExtract.includes(path),
27
+ filter: (path) => binaries.includes(path),
34
28
  });
35
-
36
- // If wrapped, move files from wrapped directory to bin directory
37
- if (wrappedIn) {
38
- const wrappedDir = path.join(dir, wrappedIn);
39
- for (const binary of binaries) {
40
- const srcPath = path.join(wrappedDir, binary);
41
- const destPath = path.join(dir, binary);
42
- if (fs.existsSync(srcPath)) {
43
- fs.renameSync(srcPath, destPath);
44
- }
45
- }
46
- // Clean up empty wrapped directory
47
- try {
48
- fs.rmSync(wrappedDir, { recursive: true, force: true });
49
- } catch (err) {
50
- // Ignore cleanup errors
51
- }
52
- }
53
-
54
- console.log(`Successfully extracted ${binaries} to "${dir}"`);
29
+ console.log(`Successfully extracted binaries to "${dir}"`);
55
30
  } catch (err) {
56
31
  throw new Error(`Extraction failed: ${err.message}`);
57
32
  }
58
33
  }
59
34
 
60
- async function extractZip(zipPath, binaries, dir, wrappedIn) {
35
+ async function extractZip(zipPath, binaries, dir) {
61
36
  try {
62
37
  const zipData = fs.readFileSync(zipPath);
63
38
  const zip = await JSZip.loadAsync(zipData);
64
-
65
39
  for (const binary of binaries) {
66
- const binaryPath = wrappedIn
67
- ? path.join(wrappedIn, binary).replace(/\\/g, "/")
68
- : binary;
69
-
70
- if (!zip.files[binaryPath]) {
40
+ if (!zip.files[binary]) {
71
41
  throw new Error(
72
- `Error: ${binaryPath} does not exist in ${zipPath}`,
42
+ `Error: ${binary} does not exist in ${zipPath}`,
73
43
  );
74
44
  }
75
45
 
76
- const content = await zip.files[binaryPath].async("nodebuffer");
46
+ const content = await zip.files[binary].async("nodebuffer");
77
47
  if (!fs.existsSync(dir)) {
78
48
  fs.mkdirSync(dir, { recursive: true });
79
49
  }
@@ -124,21 +94,11 @@ const install = async () => {
124
94
  fs.chmodSync(bin, 0o755);
125
95
  return;
126
96
  case "zip":
127
- return extractZip(
128
- archivePath,
129
- archive.bins,
130
- binDir,
131
- archive.wrappedIn,
132
- );
97
+ return extractZip(archivePath, archive.bins, binDir);
133
98
  case "tar":
134
99
  case "tar.gz":
135
100
  case "tgz":
136
- return extractTar(
137
- archivePath,
138
- archive.bins,
139
- binDir,
140
- archive.wrappedIn,
141
- );
101
+ return extractTar(archivePath, archive.bins, binDir);
142
102
  case "tar.zst":
143
103
  case "tzst":
144
104
  case "tar.xz":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onkernel/cli",
3
- "version": "0.9.4",
3
+ "version": "0.10.0",
4
4
  "description": "Kernel CLI",
5
5
  "scripts": {
6
6
  "postinstall": "node install.js",
@@ -33,75 +33,75 @@
33
33
  },
34
34
  "archives": {
35
35
  "darwin-arm64": {
36
- "name": "kernel_0.9.4_darwin_arm64.tar.gz",
37
- "url": "https://github.com/onkernel/cli/releases/download/v0.9.4/kernel_0.9.4_darwin_arm64.tar.gz",
36
+ "name": "kernel_0.10.0_darwin_arm64.tar.gz",
37
+ "url": "https://github.com/onkernel/cli/releases/download/v0.10.0/kernel_0.10.0_darwin_arm64.tar.gz",
38
38
  "bins": [
39
39
  "kernel"
40
40
  ],
41
41
  "format": "tar.gz",
42
42
  "checksum": {
43
43
  "algorithm": "sha256",
44
- "digest": "88b3ed0877292861758d37bef41b466215fbde28f608935adea4ffb0163c6e2e"
44
+ "digest": "b230200efd876777345d705e60ed44e064ee85dd28040ded956c4c4b8f3b9360"
45
45
  }
46
46
  },
47
47
  "darwin-x64": {
48
- "name": "kernel_0.9.4_darwin_amd64.tar.gz",
49
- "url": "https://github.com/onkernel/cli/releases/download/v0.9.4/kernel_0.9.4_darwin_amd64.tar.gz",
48
+ "name": "kernel_0.10.0_darwin_amd64.tar.gz",
49
+ "url": "https://github.com/onkernel/cli/releases/download/v0.10.0/kernel_0.10.0_darwin_amd64.tar.gz",
50
50
  "bins": [
51
51
  "kernel"
52
52
  ],
53
53
  "format": "tar.gz",
54
54
  "checksum": {
55
55
  "algorithm": "sha256",
56
- "digest": "9ec72b246c8ec169a8bb68a44396325e081a42d27b49a3347a019f95cff640c0"
56
+ "digest": "7d95facb8f7d61b88d9116ed91e33941855f1f316ceffcd49e1215fd48f07615"
57
57
  }
58
58
  },
59
59
  "linux-arm64": {
60
- "name": "kernel_0.9.4_linux_arm64.tar.gz",
61
- "url": "https://github.com/onkernel/cli/releases/download/v0.9.4/kernel_0.9.4_linux_arm64.tar.gz",
60
+ "name": "kernel_0.10.0_linux_arm64.tar.gz",
61
+ "url": "https://github.com/onkernel/cli/releases/download/v0.10.0/kernel_0.10.0_linux_arm64.tar.gz",
62
62
  "bins": [
63
63
  "kernel"
64
64
  ],
65
65
  "format": "tar.gz",
66
66
  "checksum": {
67
67
  "algorithm": "sha256",
68
- "digest": "e387b41258a00674c9486b96de616f631d15bb9b738d3ab1c25161c12b0d045e"
68
+ "digest": "400c1262d5556e9930e4894e4b1865085681f37fc82e4dee6c8f13cc65e717bc"
69
69
  }
70
70
  },
71
71
  "linux-x64": {
72
- "name": "kernel_0.9.4_linux_amd64.tar.gz",
73
- "url": "https://github.com/onkernel/cli/releases/download/v0.9.4/kernel_0.9.4_linux_amd64.tar.gz",
72
+ "name": "kernel_0.10.0_linux_amd64.tar.gz",
73
+ "url": "https://github.com/onkernel/cli/releases/download/v0.10.0/kernel_0.10.0_linux_amd64.tar.gz",
74
74
  "bins": [
75
75
  "kernel"
76
76
  ],
77
77
  "format": "tar.gz",
78
78
  "checksum": {
79
79
  "algorithm": "sha256",
80
- "digest": "ac964b673c93314e6feabd9aa1b8c2db250dfddc80eb0b90592aed648660b471"
80
+ "digest": "ceeebb892a8e71a7288afc1eb990b2af8b4405db23c205ee19515e0a3e6d6db4"
81
81
  }
82
82
  },
83
83
  "win32-arm64": {
84
- "name": "kernel_0.9.4_windows_arm64.tar.gz",
85
- "url": "https://github.com/onkernel/cli/releases/download/v0.9.4/kernel_0.9.4_windows_arm64.tar.gz",
84
+ "name": "kernel_0.10.0_windows_arm64.tar.gz",
85
+ "url": "https://github.com/onkernel/cli/releases/download/v0.10.0/kernel_0.10.0_windows_arm64.tar.gz",
86
86
  "bins": [
87
87
  "kernel.exe"
88
88
  ],
89
89
  "format": "tar.gz",
90
90
  "checksum": {
91
91
  "algorithm": "sha256",
92
- "digest": "99d07b36952c7b3c0fc26708bf111a142fa97b5f4b8c373da0bae1704bbc28e4"
92
+ "digest": "da408a28b2faca29eefb1a409530a9c9dfb8d7ef40c286b8046822c7a72502b2"
93
93
  }
94
94
  },
95
95
  "win32-x64": {
96
- "name": "kernel_0.9.4_windows_amd64.tar.gz",
97
- "url": "https://github.com/onkernel/cli/releases/download/v0.9.4/kernel_0.9.4_windows_amd64.tar.gz",
96
+ "name": "kernel_0.10.0_windows_amd64.tar.gz",
97
+ "url": "https://github.com/onkernel/cli/releases/download/v0.10.0/kernel_0.10.0_windows_amd64.tar.gz",
98
98
  "bins": [
99
99
  "kernel.exe"
100
100
  ],
101
101
  "format": "tar.gz",
102
102
  "checksum": {
103
103
  "algorithm": "sha256",
104
- "digest": "1639fc43a02e369d540bf77fda65fc711dbfe484fb9e8260624de3f59e52d0ea"
104
+ "digest": "32366beec54a73500670d6efdb6257a207e9e12de9b1781751d0fce64c0c8b9d"
105
105
  }
106
106
  }
107
107
  }