@jackwener/opencli 1.2.4 → 1.2.5
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.
- package/.github/workflows/build-extension.yml +0 -15
- package/README.md +8 -4
- package/README.zh-CN.md +8 -4
- package/docs/guide/browser-bridge.md +3 -3
- package/docs/zh/guide/browser-bridge.md +3 -3
- package/extension/dist/background.js +3 -2
- package/extension/manifest.json +1 -1
- package/extension/package.json +1 -1
- package/extension/src/background.ts +3 -1
- package/extension/src/cdp.ts +1 -1
- package/package.json +1 -1
|
@@ -45,26 +45,12 @@ jobs:
|
|
|
45
45
|
cd extension-package
|
|
46
46
|
zip -r ../opencli-extension.zip .
|
|
47
47
|
|
|
48
|
-
- name: Create Extension CRX
|
|
49
|
-
run: |
|
|
50
|
-
npm install -g crx3
|
|
51
|
-
if [ -n "${{ secrets.CRX_PRIVATE_KEY }}" ]; then
|
|
52
|
-
echo "Found CRX_PRIVATE_KEY, signing extension..."
|
|
53
|
-
echo "${{ secrets.CRX_PRIVATE_KEY }}" > crx-key.pem
|
|
54
|
-
crx3 pack extension-package -o opencli-extension.crx -p crx-key.pem
|
|
55
|
-
rm crx-key.pem
|
|
56
|
-
else
|
|
57
|
-
echo "No CRX_PRIVATE_KEY configured. Generating CRX with a temporary random key..."
|
|
58
|
-
crx3 pack extension-package -o opencli-extension.crx
|
|
59
|
-
fi
|
|
60
|
-
|
|
61
48
|
- name: Upload Artifacts (Action Run)
|
|
62
49
|
uses: actions/upload-artifact@v4
|
|
63
50
|
with:
|
|
64
51
|
name: opencli-extension-build
|
|
65
52
|
path: |
|
|
66
53
|
opencli-extension.zip
|
|
67
|
-
opencli-extension.crx
|
|
68
54
|
retention-days: 7
|
|
69
55
|
|
|
70
56
|
- name: Attach to GitHub Release
|
|
@@ -73,7 +59,6 @@ jobs:
|
|
|
73
59
|
with:
|
|
74
60
|
files: |
|
|
75
61
|
opencli-extension.zip
|
|
76
|
-
opencli-extension.crx
|
|
77
62
|
draft: false
|
|
78
63
|
prerelease: false
|
|
79
64
|
env:
|
package/README.md
CHANGED
|
@@ -61,11 +61,15 @@ OpenCLI connects to your browser through a lightweight **Browser Bridge** Chrome
|
|
|
61
61
|
You can install the extension via either method:
|
|
62
62
|
|
|
63
63
|
**Method 1: Download Pre-built Release (Recommended)**
|
|
64
|
-
1. Go to the GitHub [Releases page](https://github.com/jackwener/opencli/releases) and download the latest `opencli-extension.zip
|
|
65
|
-
2.
|
|
66
|
-
3.
|
|
64
|
+
1. Go to the GitHub [Releases page](https://github.com/jackwener/opencli/releases) and download the latest `opencli-extension.zip`.
|
|
65
|
+
2. Unzip the file and open `chrome://extensions`, enable **Developer mode** (top-right toggle).
|
|
66
|
+
3. Click **Load unpacked** and select the unzipped folder.
|
|
67
67
|
|
|
68
|
-
**Method 2: Load
|
|
68
|
+
**Method 2: Load from npm Package**
|
|
69
|
+
1. After installing opencli via npm, open `chrome://extensions` and enable **Developer mode**.
|
|
70
|
+
2. Click **Load unpacked** and select `node_modules/@jackwener/opencli/extension` directory.
|
|
71
|
+
|
|
72
|
+
**Method 3: Load Source (For Developers)**
|
|
69
73
|
1. Open `chrome://extensions` and enable **Developer mode**.
|
|
70
74
|
2. Click **Load unpacked** and select the `extension/` directory from this repository.
|
|
71
75
|
|
package/README.zh-CN.md
CHANGED
|
@@ -62,11 +62,15 @@ OpenCLI 通过轻量化的 **Browser Bridge** Chrome 扩展 + 微型 daemon 与
|
|
|
62
62
|
你可以选择以下任一方式安装扩展:
|
|
63
63
|
|
|
64
64
|
**方式一:下载构建好的安装包(推荐)**
|
|
65
|
-
1. 到 GitHub [Releases 页面](https://github.com/jackwener/opencli/releases) 下载最新的 `opencli-extension.zip
|
|
66
|
-
2.
|
|
67
|
-
3.
|
|
65
|
+
1. 到 GitHub [Releases 页面](https://github.com/jackwener/opencli/releases) 下载最新的 `opencli-extension.zip`。
|
|
66
|
+
2. 解压后打开 Chrome 的 `chrome://extensions`,启用右上角的 **开发者模式**。
|
|
67
|
+
3. 点击 **加载已解压的扩展程序**,选择解压后的文件夹。
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
**方式二:从 npm 包加载**
|
|
70
|
+
1. 通过 npm 安装 opencli 后,打开 `chrome://extensions`,启用 **开发者模式**。
|
|
71
|
+
2. 点击 **加载已解压的扩展程序**,选择 `node_modules/@jackwener/opencli/extension` 目录。
|
|
72
|
+
|
|
73
|
+
**方式三:加载源码(针对开发者)**
|
|
70
74
|
1. 同样在 `chrome://extensions` 开启 **开发者模式**。
|
|
71
75
|
2. 点击 **加载已解压的扩展程序**,选择本仓库代码树中的 `extension/` 文件夹。
|
|
72
76
|
|
|
@@ -8,9 +8,9 @@ OpenCLI connects to your browser through a lightweight **Browser Bridge** Chrome
|
|
|
8
8
|
|
|
9
9
|
### Method 1: Download Pre-built Release (Recommended)
|
|
10
10
|
|
|
11
|
-
1. Go to the GitHub [Releases page](https://github.com/jackwener/opencli/releases) and download the latest `opencli-extension.zip
|
|
12
|
-
2.
|
|
13
|
-
3.
|
|
11
|
+
1. Go to the GitHub [Releases page](https://github.com/jackwener/opencli/releases) and download the latest `opencli-extension.zip`.
|
|
12
|
+
2. Unzip the file and open `chrome://extensions`, enable **Developer mode** (top-right toggle).
|
|
13
|
+
3. Click **Load unpacked** and select the unzipped folder.
|
|
14
14
|
|
|
15
15
|
### Method 2: Load Unpacked Source (For Developers)
|
|
16
16
|
|
|
@@ -8,9 +8,9 @@ OpenCLI 通过轻量级 **Browser Bridge** Chrome 扩展 + 微守护进程连接
|
|
|
8
8
|
|
|
9
9
|
### 方法 1:下载预构建版本(推荐)
|
|
10
10
|
|
|
11
|
-
1. 前往 GitHub [Releases 页面](https://github.com/jackwener/opencli/releases) 下载最新的 `opencli-extension.zip
|
|
12
|
-
2.
|
|
13
|
-
3.
|
|
11
|
+
1. 前往 GitHub [Releases 页面](https://github.com/jackwener/opencli/releases) 下载最新的 `opencli-extension.zip`。
|
|
12
|
+
2. 解压后打开 `chrome://extensions`,启用**开发者模式**。
|
|
13
|
+
3. 点击**加载已解压的扩展程序**,选择解压后的文件夹。
|
|
14
14
|
|
|
15
15
|
### 方法 2:加载源码(开发者)
|
|
16
16
|
|
|
@@ -6,7 +6,7 @@ const WS_RECONNECT_MAX_DELAY = 6e4;
|
|
|
6
6
|
|
|
7
7
|
const attached = /* @__PURE__ */ new Set();
|
|
8
8
|
function isDebuggableUrl$1(url) {
|
|
9
|
-
if (!url) return
|
|
9
|
+
if (!url) return true;
|
|
10
10
|
return !url.startsWith("chrome://") && !url.startsWith("chrome-extension://");
|
|
11
11
|
}
|
|
12
12
|
async function ensureAttached(tabId) {
|
|
@@ -242,6 +242,7 @@ async function getAutomationWindow(workspace) {
|
|
|
242
242
|
automationSessions.set(workspace, session);
|
|
243
243
|
console.log(`[opencli] Created automation window ${session.windowId} (${workspace})`);
|
|
244
244
|
resetWindowIdleTimer(workspace);
|
|
245
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
245
246
|
return session.windowId;
|
|
246
247
|
}
|
|
247
248
|
chrome.windows.onRemoved.addListener((windowId) => {
|
|
@@ -302,7 +303,7 @@ async function handleCommand(cmd) {
|
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
function isDebuggableUrl(url) {
|
|
305
|
-
if (!url) return
|
|
306
|
+
if (!url) return true;
|
|
306
307
|
return !url.startsWith("chrome://") && !url.startsWith("chrome-extension://");
|
|
307
308
|
}
|
|
308
309
|
async function resolveTabId(tabId, workspace) {
|
package/extension/manifest.json
CHANGED
package/extension/package.json
CHANGED
|
@@ -152,6 +152,8 @@ async function getAutomationWindow(workspace: string): Promise<number> {
|
|
|
152
152
|
automationSessions.set(workspace, session);
|
|
153
153
|
console.log(`[opencli] Created automation window ${session.windowId} (${workspace})`);
|
|
154
154
|
resetWindowIdleTimer(workspace);
|
|
155
|
+
// Brief delay to let Chrome load the initial data: URI tab
|
|
156
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
155
157
|
return session.windowId;
|
|
156
158
|
}
|
|
157
159
|
|
|
@@ -229,7 +231,7 @@ async function handleCommand(cmd: Command): Promise<Result> {
|
|
|
229
231
|
|
|
230
232
|
/** Check if a URL can be attached via CDP (not chrome:// or chrome-extension://) */
|
|
231
233
|
function isDebuggableUrl(url?: string): boolean {
|
|
232
|
-
if (!url) return
|
|
234
|
+
if (!url) return true; // empty/undefined = tab still loading, allow it
|
|
233
235
|
return !url.startsWith('chrome://') && !url.startsWith('chrome-extension://');
|
|
234
236
|
}
|
|
235
237
|
|
package/extension/src/cdp.ts
CHANGED
|
@@ -10,7 +10,7 @@ const attached = new Set<number>();
|
|
|
10
10
|
|
|
11
11
|
/** Check if a URL can be attached via CDP */
|
|
12
12
|
function isDebuggableUrl(url?: string): boolean {
|
|
13
|
-
if (!url) return
|
|
13
|
+
if (!url) return true; // empty/undefined = tab still loading, allow it
|
|
14
14
|
return !url.startsWith('chrome://') && !url.startsWith('chrome-extension://');
|
|
15
15
|
}
|
|
16
16
|
|