Skip to content

Commit e68644d

Browse files
rgarciamasnwilliamsgithub-actions[bot]
authored
extensions docs (#73)
* extensions docs * update pricing page * docs: update code samples from OpenAPI * pr feedback --------- Co-authored-by: Mason Williams <43387599+masnwilliams@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 578fb1f commit e68644d

File tree

3 files changed

+101
-1
lines changed

3 files changed

+101
-1
lines changed

browsers/extensions.mdx

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
title: "Extensions"
3+
description: "Use browser extensions in Kernel browsers"
4+
---
5+
6+
Kernel's browsers support running with custom Chrome extensions.
7+
Chrome extensions must be unpacked and can be uploaded to Kernel via the CLI or API.
8+
9+
## Uploading extensions
10+
11+
Here is a simple example of an unpacked extension:
12+
13+
<CodeGroup>
14+
```js ./my-extension/content-script.js
15+
document.body.innerHTML = document.body.innerHTML.replace(/AI/g, "A1");
16+
```
17+
18+
```json ./my-extension/manifest.json
19+
{
20+
"manifest_version": 3,
21+
"version": "1.0",
22+
"name": "AI to A1",
23+
"description": "Replace AI with A1",
24+
"content_scripts": [
25+
{
26+
"matches": [
27+
"https://*/*"
28+
],
29+
"js": [
30+
"content-script.js"
31+
]
32+
}
33+
]
34+
}
35+
```
36+
</CodeGroup>
37+
38+
Once these files are in place, you can upload them to Kernel via the CLI (or [API](/api-reference/extensions/upload-a-browser-extension)):
39+
40+
```bash
41+
kernel extensions upload ./my-extension --name my-extension
42+
```
43+
44+
Extensions uploaded to Kernel are assigned a random ID, but you can also give them a name for easier reference.
45+
This name must be unique within your organization.
46+
47+
## Using extensions in a browser
48+
49+
Passing the extension name or ID to the `create` method will load it into the browser:
50+
51+
<CodeGroup>
52+
```typescript Typescript/Javascript
53+
import { Kernel } from '@onkernel/sdk';
54+
55+
const kernel = new Kernel();
56+
const kernelBrowser = await kernel.browsers.create({
57+
extensions: [{ name: "my-extension" }],
58+
});
59+
```
60+
61+
```python Python
62+
import kernel
63+
64+
client = kernel.Kernel()
65+
kernel_browser = client.browsers.create(extensions=[{name: 'my-extension'}])
66+
```
67+
68+
```bash CLI
69+
kernel browsers create --extension my-extension
70+
```
71+
</CodeGroup>
72+
73+
74+
## Using extensions directly from the Chrome Web Store
75+
76+
Kernel's CLI offers a command for fetching and unpacking extensions directly from the Chrome Web Store.
77+
Simply pass the URL of the extension you want to download and the CLI will download the extension and unpack it into the specified directory.
78+
79+
```bash CLI
80+
kernel extensions download-web-store https://chromewebstore.google.com/detail/shutterfly-address-book-e/lddlpciejomhjehckimopnomegilaocb --to ./downloaded-extension
81+
```
82+
83+
From here you can upload the extension to Kernel as normal.
84+
85+
```bash CLI
86+
kernel extensions upload ./downloaded-extension --name my-extension
87+
```
88+
89+
## Loading an extension into a running browser
90+
91+
If you have a browser running and would like to load an extension into it after the browser session has started, Kernel also allows you to do that via the CLI (or [API](http://localhost:3000/api-reference/browsers/ad-hoc-upload-one-or-more-unpacked-extensions-to-a-running-browser-instance)):
92+
93+
```bash CLI
94+
kernel browsers extensions upload <session_id> ./my-extension
95+
```
96+
97+
<Info>
98+
Note that this will restart the browser process and break any connections to the browser CDP URL.
99+
</Info>

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"browsers/file-io",
6666
"browsers/live-view",
6767
"browsers/replays",
68+
"browsers/extensions",
6869
{
6970
"group": "Bot Anti-Detection",
7071
"pages": [

info/pricing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ With Kernel, you only pay for what you use and nothing more. Our goal is to be c
1818
| Browser replays ||||
1919
| Browser profiles ||||
2020
| File uploads & downloads ||||
21-
| Configurable browser extensions || Coming soon | Coming soon |
21+
| Configurable browser extensions || | |
2222
| BYO images & storage mounts ||| Coming soon |
2323
| SOC2 compliance ||||
2424
| HIPAA compliance (BAA) ||||

0 commit comments

Comments
 (0)