@tomflow/proflow-execution-browser-extension 0.1.9 → 0.1.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @tomflow/proflow-execution-browser-extension
2
2
 
3
+ ## 0.1.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Upgrade the ProFlow terminal experience, stream Registry and package-manager progress, publish structured Chinese Module documentation, and provide numbered package-owned Setup assistants.
8
+
9
+ ## 0.1.10
10
+
11
+ ### Patch Changes
12
+
13
+ - Make every setup command directly runnable from a workspace and render setup failures without Node stack traces.
14
+
3
15
  ## 0.1.9
4
16
 
5
17
  ### Patch Changes
package/DOCS.md CHANGED
@@ -1,13 +1,39 @@
1
- # execution-browser-extension
1
+ # execution-browser-extension — 浏览器执行扩展
2
2
 
3
- Execution Browser Extension(浏览器执行扩展)让 ProFlow 在 Chrome 中执行受控页面操作、采集页面证据,并提供任务与审批界面。
3
+ ## 模块定位与作用
4
4
 
5
- ## 什么时候需要
5
+ Execution 领域拥有的 Chrome MV3 Extension,负责 Task UI、审批提醒、Conversation Carrier 和真实 Browser Effect。
6
6
 
7
- 首次部署浏览器能力、扩展升级,或者 Chrome 报告扩展未连接时使用。
7
+ ## 主要能力
8
8
 
9
- ## 如何配置
9
+ - 提供 New Task 与 Side Panel UI、Task Observer 和 System Observer。
10
+ - 创建、恢复和唤醒 Custom GPT Conversation,稳定观察 workerRef/c-id。
11
+ - 执行 DOM-first 浏览器操作,必要时使用截图与 Vision 辅助观察。
10
12
 
11
- 运行 `proflow-execution-browser-extension setup`。向导会准备扩展目录、打开 Chrome 扩展管理页,并说明如何加载已解压扩展;完成后收集 Extension ID(扩展标识)并验证连接状态。
13
+ ## 提供的 API Public Contract
12
14
 
13
- 扩展不保存 Task(任务)或 Approval(审批)的业务真相,只负责浏览器侧交互。
15
+ - 提供 `execution-browser-executor` Contract,版本 `1.0.0`。
16
+ - 通过本地 Bridge 接收 typed Browser operation 并返回 Evidence。
17
+
18
+ ## 依赖的 Module、Contract 和外部资源
19
+
20
+ - 依赖 `execution`、`task-orchestration` 和 `agent-runtime`,兼容版本均为 `>=1.0.0 <2.0.0`。
21
+ - 依赖 Chrome、用户加载 MV3 扩展和真实 ChatGPT 页面。
22
+
23
+ ## 运行形态与生命周期
24
+
25
+ 类型为 Browser Extension。后台 Service Worker 由 Chrome 管理,本地配置由 Module setup 生成。
26
+
27
+ ## 使用方式
28
+
29
+ 运行 `pnpm exec -- proflow-execution-browser-extension setup`,加载准备好的目录、登记 Extension ID、Reload 并验证 Bridge。
30
+
31
+ ## 职责边界与限制
32
+
33
+ 不拥有 Task/Agent 业务事实,不依赖坐标点击,不维持 frame registry,也不创建第二套 Effect 状态机。
34
+
35
+ ## 术语
36
+
37
+ - MV3(Manifest V3):Chrome 扩展当前使用的清单与运行模型。
38
+ - Service Worker(后台服务):Chrome 管理的扩展后台执行环境。
39
+ - DOM-first(DOM 优先):优先使用结构化页面元素完成观察和操作。
package/SETUP.md CHANGED
@@ -1,10 +1,25 @@
1
- # @tomflow/proflow-execution-browser-extension — Module Setup
1
+ # execution-browser-extension Setup
2
2
 
3
- ## STEP-EXECUTION-BROWSER-EXTENSION-01 — 加载并验证 Chrome 扩展
3
+ ## STEP-EXECUTION-BROWSER-EXTENSION-01 — 准备扩展并打开 Chrome
4
+ Responsible: USER
5
+ Interactive executable: `pnpm exec -- proflow-execution-browser-extension setup 01`
6
+ Non-interactive executable: `pnpm exec -- proflow-execution-browser-extension setup 01`
7
+ Required inputs: none
8
+ Verify: `pnpm exec -- proflow-execution-browser-extension setup 01`
9
+ Success condition: 扩展目录已生成并可选择。
4
10
 
11
+ ## STEP-EXECUTION-BROWSER-EXTENSION-02 — 登记 Extension ID 并生成配置
5
12
  Responsible: USER
6
- Interactive executable: `proflow-execution-browser-extension setup`
7
- Non-interactive executable: `proflow-execution-browser-extension setup --extension-id <id>`
13
+ Interactive executable: `pnpm exec -- proflow-execution-browser-extension setup 02`
14
+ Non-interactive executable: `pnpm exec -- proflow-execution-browser-extension setup 02 --extension-id <id>`
8
15
  Required inputs: Chrome Extension ID
9
- Verify: `proflow-execution-browser-extension verify`
16
+ Verify: `pnpm exec -- proflow-execution-browser-extension verify`
17
+ Success condition: Extension ID 和运行配置已保存。
18
+
19
+ ## STEP-EXECUTION-BROWSER-EXTENSION-03 — 验证 Service Worker 与 Bridge
20
+ Responsible: AI
21
+ Interactive executable: `pnpm exec -- proflow-execution-browser-extension setup 03`
22
+ Non-interactive executable: `pnpm exec -- proflow-execution-browser-extension verify`
23
+ Required inputs: none
24
+ Verify: `pnpm exec -- proflow-execution-browser-extension verify`
10
25
  Success condition: `execution-browser-extension.setupStatus=READY`.
@@ -14,7 +14,7 @@ export declare const behaviorAdapter: {
14
14
  ok: true;
15
15
  status: "SUCCEEDED";
16
16
  moduleRef: "execution-browser-extension";
17
- moduleVersion: "0.1.9";
17
+ moduleVersion: "0.1.11";
18
18
  data: {
19
19
  loadDir: string;
20
20
  };
@@ -27,7 +27,7 @@ export declare const behaviorAdapter: {
27
27
  readonly ok: true;
28
28
  readonly status: "SUCCEEDED";
29
29
  readonly moduleRef: "execution-browser-extension";
30
- readonly moduleVersion: "0.1.9";
30
+ readonly moduleVersion: "0.1.11";
31
31
  };
32
32
  observedEffects: never[];
33
33
  }>;
@@ -37,7 +37,7 @@ export declare const behaviorAdapter: {
37
37
  ok: true;
38
38
  status: "SUCCEEDED";
39
39
  moduleRef: "execution-browser-extension";
40
- moduleVersion: "0.1.9";
40
+ moduleVersion: "0.1.11";
41
41
  data: {
42
42
  setupStatus: "ACTION_REQUIRED" | "READY";
43
43
  runtimeStatus: "RUNNING" | "STOPPED";
@@ -49,7 +49,7 @@ export declare const behaviorAdapter: {
49
49
  result: {
50
50
  contract: "deployment.result.v1";
51
51
  moduleRef: "execution-browser-extension";
52
- moduleVersion: "0.1.9";
52
+ moduleVersion: "0.1.11";
53
53
  ok: false;
54
54
  status: "FAILED";
55
55
  error: {
@@ -59,16 +59,16 @@ export declare const behaviorAdapter: {
59
59
  };
60
60
  data: {
61
61
  readonly steps: readonly [{
62
- readonly id: "STEP-EXECUTION-BROWSER-EXTENSION-02";
62
+ readonly id: "STEP-EXECUTION-BROWSER-EXTENSION-04";
63
63
  readonly title: "修复扩展配置";
64
64
  readonly state: "BLOCKED";
65
65
  readonly responsible: "EXTERNAL";
66
66
  readonly execution: {
67
- readonly interactive: "proflow-execution-browser-extension setup";
68
- readonly nonInteractive: "proflow-execution-browser-extension setup --extension-id <id>";
67
+ readonly interactive: "pnpm exec -- proflow-execution-browser-extension setup";
68
+ readonly nonInteractive: "pnpm exec -- proflow-execution-browser-extension setup --extension-id <id>";
69
69
  };
70
70
  readonly requiredInputs: readonly [];
71
- readonly verify: "proflow-execution-browser-extension verify";
71
+ readonly verify: "pnpm exec -- proflow-execution-browser-extension verify";
72
72
  readonly successCondition: "配置状态变为“已就绪”";
73
73
  readonly blockedReason: "Extension ID 或生成配置无效";
74
74
  }];
@@ -79,26 +79,55 @@ export declare const behaviorAdapter: {
79
79
  result: {
80
80
  contract: "deployment.result.v1";
81
81
  moduleRef: "execution-browser-extension";
82
- moduleVersion: "0.1.9";
82
+ moduleVersion: "0.1.11";
83
83
  ok: false;
84
84
  status: "ACTION_REQUIRED";
85
85
  data: {
86
86
  readonly steps: readonly [{
87
87
  readonly id: "STEP-EXECUTION-BROWSER-EXTENSION-01";
88
- readonly title: "加载 Chrome 扩展";
88
+ readonly title: "准备扩展并打开 Chrome";
89
+ readonly description: "生成 unpacked 目录,复制路径并打开扩展管理页。";
90
+ readonly state: "TODO";
91
+ readonly responsible: "USER";
92
+ readonly execution: {
93
+ readonly interactive: "pnpm exec -- proflow-execution-browser-extension setup 01";
94
+ readonly nonInteractive: "pnpm exec -- proflow-execution-browser-extension setup 01";
95
+ };
96
+ readonly requiredInputs: readonly [];
97
+ readonly verify: "pnpm exec -- proflow-execution-browser-extension setup 01";
98
+ readonly successCondition: "扩展目录已生成并可选择";
99
+ readonly humanAction: "启用开发者模式并选择脚本复制的目录。";
100
+ }, {
101
+ readonly id: "STEP-EXECUTION-BROWSER-EXTENSION-02";
102
+ readonly title: "登记 Extension ID 并生成配置";
103
+ readonly description: "保存扩展 ID,生成 Bridge 配置并提示 Reload。";
89
104
  readonly state: "TODO";
90
105
  readonly responsible: "USER";
91
106
  readonly execution: {
92
- readonly interactive: "proflow-execution-browser-extension setup";
93
- readonly nonInteractive: "proflow-execution-browser-extension setup --extension-id <id>";
107
+ readonly interactive: "pnpm exec -- proflow-execution-browser-extension setup 02";
108
+ readonly nonInteractive: "pnpm exec -- proflow-execution-browser-extension setup 02 --extension-id <id>";
94
109
  };
95
110
  readonly requiredInputs: readonly [{
96
111
  readonly name: "extensionId";
97
112
  readonly description: "Chrome Extension ID";
98
113
  readonly sensitive: false;
99
114
  }];
100
- readonly verify: "proflow-execution-browser-extension verify";
101
- readonly successCondition: "配置状态变为“已就绪”";
115
+ readonly verify: "pnpm exec -- proflow-execution-browser-extension verify";
116
+ readonly successCondition: "Extension ID 和运行配置已保存";
117
+ readonly humanAction: "复制扩展 ID,并在配置生成后点击 Reload。";
118
+ }, {
119
+ readonly id: "STEP-EXECUTION-BROWSER-EXTENSION-03";
120
+ readonly title: "验证 Service Worker 与 Bridge";
121
+ readonly description: "重新观察扩展后台和本地 Bridge。";
122
+ readonly state: "TODO";
123
+ readonly responsible: "AI";
124
+ readonly execution: {
125
+ readonly interactive: "pnpm exec -- proflow-execution-browser-extension setup 03";
126
+ readonly nonInteractive: "pnpm exec -- proflow-execution-browser-extension verify";
127
+ };
128
+ readonly requiredInputs: readonly [];
129
+ readonly verify: "pnpm exec -- proflow-execution-browser-extension verify";
130
+ readonly successCondition: "execution-browser-extension.setupStatus=READY";
102
131
  }];
103
132
  };
104
133
  actionRequired: {
@@ -113,7 +142,7 @@ export declare const behaviorAdapter: {
113
142
  readonly ok: true;
114
143
  readonly status: "SUCCEEDED";
115
144
  readonly moduleRef: "execution-browser-extension";
116
- readonly moduleVersion: "0.1.9";
145
+ readonly moduleVersion: "0.1.11";
117
146
  };
118
147
  observedEffects: string[];
119
148
  }>;
@@ -123,7 +152,7 @@ export declare const behaviorAdapter: {
123
152
  ok: true;
124
153
  status: "SUCCEEDED";
125
154
  moduleRef: "execution-browser-extension";
126
- moduleVersion: "0.1.9";
155
+ moduleVersion: "0.1.11";
127
156
  data: {
128
157
  docs: string;
129
158
  };
@@ -136,11 +165,11 @@ export declare const behaviorAdapter: {
136
165
  readonly ok: true;
137
166
  readonly status: "SUCCEEDED";
138
167
  readonly moduleRef: "execution-browser-extension";
139
- readonly moduleVersion: "0.1.9";
168
+ readonly moduleVersion: "0.1.11";
140
169
  } | {
141
170
  contract: "deployment.result.v1";
142
171
  moduleRef: "execution-browser-extension";
143
- moduleVersion: "0.1.9";
172
+ moduleVersion: "0.1.11";
144
173
  ok: false;
145
174
  status: "FAILED";
146
175
  error: {
@@ -157,7 +186,7 @@ export declare const behaviorAdapter: {
157
186
  readonly ok: true;
158
187
  readonly status: "SUCCEEDED";
159
188
  readonly moduleRef: "execution-browser-extension";
160
- readonly moduleVersion: "0.1.9";
189
+ readonly moduleVersion: "0.1.11";
161
190
  };
162
191
  observedEffects: never[];
163
192
  }>;
@@ -15,12 +15,28 @@ const setupPlan = {
15
15
  steps: [
16
16
  {
17
17
  id: "STEP-EXECUTION-BROWSER-EXTENSION-01",
18
- title: "加载 Chrome 扩展",
18
+ title: "准备扩展并打开 Chrome",
19
+ description: "生成 unpacked 目录,复制路径并打开扩展管理页。",
19
20
  state: "TODO",
20
21
  responsible: "USER",
21
22
  execution: {
22
- interactive: "proflow-execution-browser-extension setup",
23
- nonInteractive: "proflow-execution-browser-extension setup --extension-id <id>",
23
+ interactive: "pnpm exec -- proflow-execution-browser-extension setup 01",
24
+ nonInteractive: "pnpm exec -- proflow-execution-browser-extension setup 01",
25
+ },
26
+ requiredInputs: [],
27
+ verify: "pnpm exec -- proflow-execution-browser-extension setup 01",
28
+ successCondition: "扩展目录已生成并可选择",
29
+ humanAction: "启用开发者模式并选择脚本复制的目录。",
30
+ },
31
+ {
32
+ id: "STEP-EXECUTION-BROWSER-EXTENSION-02",
33
+ title: "登记 Extension ID 并生成配置",
34
+ description: "保存扩展 ID,生成 Bridge 配置并提示 Reload。",
35
+ state: "TODO",
36
+ responsible: "USER",
37
+ execution: {
38
+ interactive: "pnpm exec -- proflow-execution-browser-extension setup 02",
39
+ nonInteractive: "pnpm exec -- proflow-execution-browser-extension setup 02 --extension-id <id>",
24
40
  },
25
41
  requiredInputs: [
26
42
  {
@@ -29,24 +45,39 @@ const setupPlan = {
29
45
  sensitive: false,
30
46
  },
31
47
  ],
32
- verify: "proflow-execution-browser-extension verify",
33
- successCondition: "配置状态变为“已就绪”",
48
+ verify: "pnpm exec -- proflow-execution-browser-extension verify",
49
+ successCondition: "Extension ID 和运行配置已保存",
50
+ humanAction: "复制扩展 ID,并在配置生成后点击 Reload。",
51
+ },
52
+ {
53
+ id: "STEP-EXECUTION-BROWSER-EXTENSION-03",
54
+ title: "验证 Service Worker 与 Bridge",
55
+ description: "重新观察扩展后台和本地 Bridge。",
56
+ state: "TODO",
57
+ responsible: "AI",
58
+ execution: {
59
+ interactive: "pnpm exec -- proflow-execution-browser-extension setup 03",
60
+ nonInteractive: "pnpm exec -- proflow-execution-browser-extension verify",
61
+ },
62
+ requiredInputs: [],
63
+ verify: "pnpm exec -- proflow-execution-browser-extension verify",
64
+ successCondition: "execution-browser-extension.setupStatus=READY",
34
65
  },
35
66
  ],
36
67
  };
37
68
  const blockedSetupPlan = {
38
69
  steps: [
39
70
  {
40
- id: "STEP-EXECUTION-BROWSER-EXTENSION-02",
71
+ id: "STEP-EXECUTION-BROWSER-EXTENSION-04",
41
72
  title: "修复扩展配置",
42
73
  state: "BLOCKED",
43
74
  responsible: "EXTERNAL",
44
75
  execution: {
45
- interactive: "proflow-execution-browser-extension setup",
46
- nonInteractive: "proflow-execution-browser-extension setup --extension-id <id>",
76
+ interactive: "pnpm exec -- proflow-execution-browser-extension setup",
77
+ nonInteractive: "pnpm exec -- proflow-execution-browser-extension setup --extension-id <id>",
47
78
  },
48
79
  requiredInputs: [],
49
- verify: "proflow-execution-browser-extension verify",
80
+ verify: "pnpm exec -- proflow-execution-browser-extension verify",
50
81
  successCondition: "配置状态变为“已就绪”",
51
82
  blockedReason: "Extension ID 或生成配置无效",
52
83
  },
@@ -3,7 +3,7 @@ export declare const descriptor: {
3
3
  readonly contractVersion: "1.0.0";
4
4
  readonly moduleRef: "execution-browser-extension";
5
5
  readonly packageName: "@tomflow/proflow-execution-browser-extension";
6
- readonly moduleVersion: "0.1.9";
6
+ readonly moduleVersion: "0.1.11";
7
7
  readonly kind: "browser-extension";
8
8
  readonly templateVersion: "1.0.0";
9
9
  readonly platformCompatibility: ">=1.0.0 <2.0.0";
@@ -3,7 +3,7 @@ export const descriptor = {
3
3
  contractVersion: "1.0.0",
4
4
  moduleRef: "execution-browser-extension",
5
5
  packageName: "@tomflow/proflow-execution-browser-extension",
6
- moduleVersion: "0.1.9",
6
+ moduleVersion: "0.1.11",
7
7
  kind: "browser-extension",
8
8
  templateVersion: "1.0.0",
9
9
  platformCompatibility: ">=1.0.0 <2.0.0",
@@ -1,9 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { spawn } from "node:child_process";
2
+ import { spawn, spawnSync } from "node:child_process";
3
3
  import { readFile } from "node:fs/promises";
4
4
  import { resolve } from "node:path";
5
5
  import { createInterface } from "node:readline/promises";
6
6
  import { behaviorAdapter, materializeProductionConfig, } from "../deployment/adapter.js";
7
+ function reportFatal(error) {
8
+ process.stderr.write(`✕ 配置失败\n ${error instanceof Error ? error.message : String(error)}\n`);
9
+ process.exitCode = 1;
10
+ }
11
+ process.on("uncaughtException", reportFatal);
12
+ process.on("unhandledRejection", reportFatal);
7
13
  function workspaceFromArgs(args) {
8
14
  if (args[0] !== "materialize-config") {
9
15
  throw new Error("Usage: proflow-execution-browser-extension materialize-config [--workspace /absolute/path]");
@@ -62,6 +68,32 @@ async function main() {
62
68
  ? resolve(option("--workspace"))
63
69
  : process.cwd();
64
70
  if (args[0] === "setup") {
71
+ const step = args[1]?.startsWith("--") ? undefined : args[1];
72
+ if (step === "01") {
73
+ const prepared = await behaviorAdapter.install({ workspaceRoot });
74
+ const loadDir = String(prepared.result.data.loadDir);
75
+ const command = process.platform === "darwin"
76
+ ? "pbcopy"
77
+ : process.platform === "win32"
78
+ ? "clip"
79
+ : "xclip";
80
+ const parameters = process.platform === "linux" ? ["-selection", "clipboard"] : [];
81
+ spawnSync(command, parameters, { input: loadDir, encoding: "utf8" });
82
+ openChromeExtensions();
83
+ process.stdout.write(`\n✓ 扩展目录已准备并复制到剪贴板\n ${loadDir}\n 启用开发者模式并加载该目录,然后运行 setup 02。\n`);
84
+ return;
85
+ }
86
+ if (step === "03") {
87
+ const result = await behaviorAdapter.status({ workspaceRoot });
88
+ process.stdout.write(result.result.data.setupStatus === "READY"
89
+ ? "✓ Service Worker 与 Bridge 验证通过\n"
90
+ : "✕ 扩展尚未就绪,请检查 Reload 和后台错误\n");
91
+ if (result.result.data.setupStatus !== "READY")
92
+ process.exitCode = 1;
93
+ return;
94
+ }
95
+ if (step !== undefined && step !== "02")
96
+ throw new Error(`UNSUPPORTED_SETUP_STEP:${step}`);
65
97
  let extensionId = option("--extension-id");
66
98
  if (!extensionId && !process.stdin.isTTY)
67
99
  throw new Error("非交互环境必须提供 --extension-id");
package/manifest.json CHANGED
@@ -1,28 +1,17 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "ProFlow Execution Browser",
4
- "version": "0.1.9",
5
- "permissions": [
6
- "tabs",
7
- "storage",
8
- "sidePanel"
9
- ],
10
- "host_permissions": [
11
- "https://chatgpt.com/*",
12
- "http://127.0.0.1/*"
13
- ],
4
+ "version": "0.1.11",
5
+ "permissions": ["tabs", "storage", "sidePanel"],
6
+ "host_permissions": ["https://chatgpt.com/*", "http://127.0.0.1/*"],
14
7
  "background": {
15
8
  "service_worker": "dist/extension/background.js",
16
9
  "type": "module"
17
10
  },
18
11
  "content_scripts": [
19
12
  {
20
- "matches": [
21
- "https://chatgpt.com/g/*"
22
- ],
23
- "js": [
24
- "dist/extension/content.js"
25
- ],
13
+ "matches": ["https://chatgpt.com/g/*"],
14
+ "js": ["dist/extension/content.js"],
26
15
  "run_at": "document_idle"
27
16
  }
28
17
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/proflow-execution-browser-extension",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Execution-owned MV3 Browser executor, evidence provider and browser application surface.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -26,12 +26,12 @@
26
26
  "SETUP.md"
27
27
  ],
28
28
  "dependencies": {
29
- "@tomflow/proflow-execution-contracts": "^0.1.8",
30
- "@tomflow/proflow-module-contract": "^0.1.10"
29
+ "@tomflow/proflow-module-contract": "^0.1.11",
30
+ "@tomflow/proflow-execution-contracts": "^0.1.9"
31
31
  },
32
32
  "devDependencies": {
33
- "@tomflow/proflow-deployment-conformance": "^0.1.8",
34
- "@tomflow/proflow-execution-runtime": "^0.1.11"
33
+ "@tomflow/proflow-deployment-conformance": "^0.1.9",
34
+ "@tomflow/proflow-execution-runtime": "^0.1.12"
35
35
  },
36
36
  "keywords": [
37
37
  "proflow",
@@ -3,7 +3,7 @@
3
3
  "contractVersion": "1.0.0",
4
4
  "moduleRef": "execution-browser-extension",
5
5
  "packageName": "@tomflow/proflow-execution-browser-extension",
6
- "moduleVersion": "0.1.9",
6
+ "moduleVersion": "0.1.11",
7
7
  "kind": "browser-extension",
8
8
  "templateVersion": "1.0.0",
9
9
  "platformCompatibility": ">=1.0.0 <2.0.0",