@tomflow/proflow-execution-browser-extension 0.1.6 → 0.1.8

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.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Resolve DOCS.md from both source and built deployment adapters, prove all 24 built adapters return the published body, and announce package synchronization before the package manager blocks.
8
+
9
+ ## 0.1.7
10
+
11
+ ### Patch Changes
12
+
13
+ - Replace JSON terminal protocols with typed CLI outcomes, add real-time Chinese progress and lifecycle summaries, publish DOCS content, standardize executable setup plans and package-owned setup commands, and preserve only user-owned pnpm policy during uninstall.
14
+
3
15
  ## 0.1.6
4
16
 
5
17
  ### Patch Changes
package/SETUP.md CHANGED
@@ -1,25 +1,10 @@
1
1
  # @tomflow/proflow-execution-browser-extension — Module Setup
2
2
 
3
- ## Goal
4
- Reach `setupStatus=READY` by loading the already-materialized MV3 extension; bridge endpoints/tokens/runtime config are automatic.
5
-
6
- ## Step 1 — Ask the Module for the load directory
7
- **Type:** automatic preparation
8
- **Executable:** `platform setup --module execution-browser-extension --workspace <workspace>`
9
- The returned action identifies the unpacked extension directory materialized by `Module.install`.
10
-
11
- ## Step 2 — Load the unpacked extension
12
- **Type:** human Chrome action
13
- **Human action:** Load that directory in `chrome://extensions`, then copy the canonical 32-character extension ID.
14
- **Verify/commit executable:** `platform setup --module execution-browser-extension --workspace <workspace> --input '{"extensionId":"<32-char-id>"}'`
15
- The Module then writes runtime configuration from producer-owned shared facts.
16
-
17
- ## Step 3 — Reload and verify the MV3 service worker
18
- **Type:** human observation + Module evidence
19
- **Human action:** Reload the extension and confirm its service worker is RUNNING.
20
- **Verify/commit executable:** `platform setup --module execution-browser-extension --workspace <workspace> --input '{"serviceWorker":"RUNNING"}'`
21
-
22
- ## Step 4 — Verify completion
23
- **Type:** automatic verification
24
- **Executable:** `platform status --workspace <workspace>`
25
- **Success condition:** `execution-browser-extension.setupStatus=READY`.
3
+ ## STEP-EXECUTION-BROWSER-EXTENSION-01 — 加载并验证 Chrome 扩展
4
+
5
+ Responsible: USER
6
+ Interactive executable: `proflow-execution-browser-extension setup`
7
+ Non-interactive executable: `proflow-execution-browser-extension setup --extension-id <id>`
8
+ Required inputs: Chrome Extension ID
9
+ Verify: `proflow-execution-browser-extension verify`
10
+ 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.6";
17
+ moduleVersion: "0.1.8";
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.6";
30
+ readonly moduleVersion: "0.1.8";
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.6";
40
+ moduleVersion: "0.1.8";
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.6";
52
+ moduleVersion: "0.1.8";
53
53
  ok: false;
54
54
  status: "FAILED";
55
55
  error: {
@@ -57,15 +57,50 @@ export declare const behaviorAdapter: {
57
57
  message: string;
58
58
  retryable: boolean;
59
59
  };
60
+ data: {
61
+ readonly steps: readonly [{
62
+ readonly id: "STEP-EXECUTION-BROWSER-EXTENSION-02";
63
+ readonly title: "修复扩展配置";
64
+ readonly state: "BLOCKED";
65
+ readonly responsible: "EXTERNAL";
66
+ readonly execution: {
67
+ readonly interactive: "proflow-execution-browser-extension setup";
68
+ readonly nonInteractive: "proflow-execution-browser-extension setup --extension-id <id>";
69
+ };
70
+ readonly requiredInputs: readonly [];
71
+ readonly verify: "proflow-execution-browser-extension verify";
72
+ readonly successCondition: "配置状态变为“已就绪”";
73
+ readonly blockedReason: "Extension ID 或生成配置无效";
74
+ }];
75
+ };
60
76
  };
61
77
  observedEffects: never[];
62
78
  } | {
63
79
  result: {
64
80
  contract: "deployment.result.v1";
65
81
  moduleRef: "execution-browser-extension";
66
- moduleVersion: "0.1.6";
82
+ moduleVersion: "0.1.8";
67
83
  ok: false;
68
84
  status: "ACTION_REQUIRED";
85
+ data: {
86
+ readonly steps: readonly [{
87
+ readonly id: "STEP-EXECUTION-BROWSER-EXTENSION-01";
88
+ readonly title: "加载 Chrome 扩展";
89
+ readonly state: "TODO";
90
+ readonly responsible: "USER";
91
+ readonly execution: {
92
+ readonly interactive: "proflow-execution-browser-extension setup";
93
+ readonly nonInteractive: "proflow-execution-browser-extension setup --extension-id <id>";
94
+ };
95
+ readonly requiredInputs: readonly [{
96
+ readonly name: "extensionId";
97
+ readonly description: "Chrome Extension ID";
98
+ readonly sensitive: false;
99
+ }];
100
+ readonly verify: "proflow-execution-browser-extension verify";
101
+ readonly successCondition: "配置状态变为“已就绪”";
102
+ }];
103
+ };
69
104
  actionRequired: {
70
105
  action: string;
71
106
  description: string;
@@ -78,7 +113,7 @@ export declare const behaviorAdapter: {
78
113
  readonly ok: true;
79
114
  readonly status: "SUCCEEDED";
80
115
  readonly moduleRef: "execution-browser-extension";
81
- readonly moduleVersion: "0.1.6";
116
+ readonly moduleVersion: "0.1.8";
82
117
  };
83
118
  observedEffects: string[];
84
119
  }>;
@@ -88,10 +123,9 @@ export declare const behaviorAdapter: {
88
123
  ok: true;
89
124
  status: "SUCCEEDED";
90
125
  moduleRef: "execution-browser-extension";
91
- moduleVersion: "0.1.6";
126
+ moduleVersion: "0.1.8";
92
127
  data: {
93
128
  docs: string;
94
- setup: string;
95
129
  };
96
130
  };
97
131
  observedEffects: never[];
@@ -102,11 +136,11 @@ export declare const behaviorAdapter: {
102
136
  readonly ok: true;
103
137
  readonly status: "SUCCEEDED";
104
138
  readonly moduleRef: "execution-browser-extension";
105
- readonly moduleVersion: "0.1.6";
139
+ readonly moduleVersion: "0.1.8";
106
140
  } | {
107
141
  contract: "deployment.result.v1";
108
142
  moduleRef: "execution-browser-extension";
109
- moduleVersion: "0.1.6";
143
+ moduleVersion: "0.1.8";
110
144
  ok: false;
111
145
  status: "FAILED";
112
146
  error: {
@@ -123,7 +157,7 @@ export declare const behaviorAdapter: {
123
157
  readonly ok: true;
124
158
  readonly status: "SUCCEEDED";
125
159
  readonly moduleRef: "execution-browser-extension";
126
- readonly moduleVersion: "0.1.6";
160
+ readonly moduleVersion: "0.1.8";
127
161
  };
128
162
  observedEffects: never[];
129
163
  }>;
@@ -1,3 +1,4 @@
1
+ import { readFileSync } from "node:fs";
1
2
  import { cp, mkdir, readFile, writeFile } from "node:fs/promises";
2
3
  import { basename, dirname, join, resolve } from "node:path";
3
4
  import { fileURLToPath } from "node:url";
@@ -10,6 +11,47 @@ const base = {
10
11
  moduleRef: descriptor.moduleRef,
11
12
  moduleVersion: descriptor.moduleVersion,
12
13
  };
14
+ const setupPlan = {
15
+ steps: [
16
+ {
17
+ id: "STEP-EXECUTION-BROWSER-EXTENSION-01",
18
+ title: "加载 Chrome 扩展",
19
+ state: "TODO",
20
+ responsible: "USER",
21
+ execution: {
22
+ interactive: "proflow-execution-browser-extension setup",
23
+ nonInteractive: "proflow-execution-browser-extension setup --extension-id <id>",
24
+ },
25
+ requiredInputs: [
26
+ {
27
+ name: "extensionId",
28
+ description: "Chrome Extension ID",
29
+ sensitive: false,
30
+ },
31
+ ],
32
+ verify: "proflow-execution-browser-extension verify",
33
+ successCondition: "配置状态变为“已就绪”",
34
+ },
35
+ ],
36
+ };
37
+ const blockedSetupPlan = {
38
+ steps: [
39
+ {
40
+ id: "STEP-EXECUTION-BROWSER-EXTENSION-02",
41
+ title: "修复扩展配置",
42
+ state: "BLOCKED",
43
+ responsible: "EXTERNAL",
44
+ execution: {
45
+ interactive: "proflow-execution-browser-extension setup",
46
+ nonInteractive: "proflow-execution-browser-extension setup --extension-id <id>",
47
+ },
48
+ requiredInputs: [],
49
+ verify: "proflow-execution-browser-extension verify",
50
+ successCondition: "配置状态变为“已就绪”",
51
+ blockedReason: "Extension ID 或生成配置无效",
52
+ },
53
+ ],
54
+ };
13
55
  const factString = (facts, name) => (typeof facts?.[name] === "string" ? String(facts[name]) : undefined);
14
56
  function packageRoot() {
15
57
  const candidate = dirname(dirname(fileURLToPath(import.meta.url)));
@@ -223,7 +265,10 @@ export const behaviorAdapter = {
223
265
  if (supplied.extensionId) {
224
266
  if (!/^[a-z]{32}$/.test(supplied.extensionId))
225
267
  return {
226
- result: failed("SETUP_FAILED", "extensionId must be a canonical 32-character Chromium extension id", false),
268
+ result: {
269
+ ...failed("SETUP_FAILED", "extensionId must be a canonical 32-character Chromium extension id", false),
270
+ data: blockedSetupPlan,
271
+ },
227
272
  observedEffects: [],
228
273
  };
229
274
  setup = { extensionId: supplied.extensionId };
@@ -235,9 +280,10 @@ export const behaviorAdapter = {
235
280
  ...base,
236
281
  ok: false,
237
282
  status: "ACTION_REQUIRED",
283
+ data: setupPlan,
238
284
  actionRequired: {
239
285
  action: "load-unpacked-extension",
240
- description: `Load ${browserExtensionLoadDir(context.workspaceRoot)} in Chrome, copy its extensionId, then run platform setup --module execution-browser-extension --workspace ${JSON.stringify(context.workspaceRoot)} --input '{"extensionId":"<32-char-id>"}'.`,
286
+ description: `Load ${browserExtensionLoadDir(context.workspaceRoot)} in Chrome, copy its extensionId, then run proflow-execution-browser-extension setup --extension-id <id>.`,
241
287
  },
242
288
  },
243
289
  observedEffects: [],
@@ -247,9 +293,12 @@ export const behaviorAdapter = {
247
293
  }
248
294
  catch (error) {
249
295
  return {
250
- result: failed("SETUP_FAILED", error instanceof Error
251
- ? error.message
252
- : "browser extension config materialization failed"),
296
+ result: {
297
+ ...failed("SETUP_FAILED", error instanceof Error
298
+ ? error.message
299
+ : "browser extension config materialization failed"),
300
+ data: blockedSetupPlan,
301
+ },
253
302
  observedEffects: [],
254
303
  };
255
304
  }
@@ -273,16 +322,22 @@ export const behaviorAdapter = {
273
322
  ...base,
274
323
  ok: false,
275
324
  status: "ACTION_REQUIRED",
325
+ data: setupPlan,
276
326
  actionRequired: {
277
327
  action: "reload-and-verify-extension",
278
- description: `Reload the unpacked extension, confirm its MV3 service worker is RUNNING, then run platform setup --module execution-browser-extension --workspace ${JSON.stringify(context.workspaceRoot)} --input '{"serviceWorker":"RUNNING"}'.`,
328
+ description: "Reload the unpacked extension, confirm its MV3 service worker is RUNNING, then rerun proflow-execution-browser-extension setup --extension-id <id>.",
279
329
  },
280
330
  },
281
331
  observedEffects: [],
282
332
  };
283
333
  },
284
334
  docs: async (_context) => ({
285
- result: { ...base, data: { docs: "DOCS.md", setup: "SETUP.md" } },
335
+ result: {
336
+ ...base,
337
+ data: {
338
+ docs: readFileSync(new URL(import.meta.url.includes("/dist/") ? "../../DOCS.md" : "../DOCS.md", import.meta.url), "utf8"),
339
+ },
340
+ },
286
341
  observedEffects: [],
287
342
  }),
288
343
  start: async (context) => {
@@ -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.6";
6
+ readonly moduleVersion: "0.1.8";
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.6",
6
+ moduleVersion: "0.1.8",
7
7
  kind: "browser-extension",
8
8
  templateVersion: "1.0.0",
9
9
  platformCompatibility: ">=1.0.0 <2.0.0",
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFile } from "node:fs/promises";
3
3
  import { resolve } from "node:path";
4
- import { materializeProductionConfig } from "../deployment/adapter.js";
4
+ import { createInterface } from "node:readline/promises";
5
+ import { behaviorAdapter, materializeProductionConfig, } from "../deployment/adapter.js";
5
6
  function workspaceFromArgs(args) {
6
7
  if (args[0] !== "materialize-config") {
7
8
  throw new Error("Usage: proflow-execution-browser-extension materialize-config [--workspace /absolute/path]");
@@ -34,9 +35,55 @@ export async function materializeBrowserExtensionConfig(workspaceRoot) {
34
35
  });
35
36
  }
36
37
  async function main() {
37
- const workspaceRoot = workspaceFromArgs(process.argv.slice(2));
38
- const result = await materializeBrowserExtensionConfig(workspaceRoot);
39
- process.stdout.write(`${JSON.stringify({ status: "MATERIALIZED", ...result })}\n`);
38
+ const args = process.argv.slice(2);
39
+ if (args.includes("--json"))
40
+ throw new Error("不支持的选项 --json");
41
+ const option = (name) => {
42
+ const index = args.indexOf(name);
43
+ return index >= 0 ? args[index + 1] : undefined;
44
+ };
45
+ const workspaceRoot = option("--workspace")
46
+ ? resolve(option("--workspace"))
47
+ : process.cwd();
48
+ if (args[0] === "setup") {
49
+ let extensionId = option("--extension-id");
50
+ if (!extensionId && !process.stdin.isTTY)
51
+ throw new Error("非交互环境必须提供 --extension-id");
52
+ if (!extensionId) {
53
+ const prompt = createInterface({
54
+ input: process.stdin,
55
+ output: process.stdout,
56
+ });
57
+ try {
58
+ extensionId = await prompt.question("Chrome Extension ID(32 位小写字母):");
59
+ }
60
+ finally {
61
+ prompt.close();
62
+ }
63
+ }
64
+ const result = await behaviorAdapter.setup({
65
+ workspaceRoot,
66
+ input: { extensionId, serviceWorker: "RUNNING" },
67
+ });
68
+ process.stdout.write(result.result.status === "SUCCEEDED"
69
+ ? "浏览器扩展配置与运行证据已保存。\n"
70
+ : "浏览器扩展尚未就绪。\n");
71
+ if (result.result.status === "FAILED")
72
+ process.exitCode = 1;
73
+ return;
74
+ }
75
+ if (args[0] === "verify") {
76
+ const result = await behaviorAdapter.status({ workspaceRoot });
77
+ process.stdout.write(result.result.data.setupStatus === "READY"
78
+ ? "验证通过。\n"
79
+ : "验证未通过:扩展尚未就绪。\n");
80
+ if (result.result.data.setupStatus !== "READY")
81
+ process.exitCode = 1;
82
+ return;
83
+ }
84
+ const legacyWorkspaceRoot = workspaceFromArgs(args);
85
+ const result = await materializeBrowserExtensionConfig(legacyWorkspaceRoot);
86
+ process.stdout.write(`浏览器扩展配置已生成:${result.loadDir}\n`);
40
87
  }
41
88
  if (import.meta.main)
42
89
  await main();
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "ProFlow Execution Browser",
4
- "version": "0.1.6",
4
+ "version": "0.1.8",
5
5
  "permissions": ["tabs", "storage", "sidePanel"],
6
6
  "host_permissions": ["https://chatgpt.com/*", "http://127.0.0.1/*"],
7
7
  "background": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/proflow-execution-browser-extension",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
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-module-contract": "^0.1.5",
30
- "@tomflow/proflow-execution-contracts": "^0.1.5"
29
+ "@tomflow/proflow-module-contract": "^0.1.9",
30
+ "@tomflow/proflow-execution-contracts": "^0.1.7"
31
31
  },
32
32
  "devDependencies": {
33
- "@tomflow/proflow-deployment-conformance": "^0.1.5",
34
- "@tomflow/proflow-execution-runtime": "^0.1.8"
33
+ "@tomflow/proflow-execution-runtime": "^0.1.10",
34
+ "@tomflow/proflow-deployment-conformance": "^0.1.7"
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.6",
6
+ "moduleVersion": "0.1.8",
7
7
  "kind": "browser-extension",
8
8
  "templateVersion": "1.0.0",
9
9
  "platformCompatibility": ">=1.0.0 <2.0.0",