@tomflow/proflow-execution-browser-extension 0.1.5 → 0.1.7
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 +13 -0
- package/SETUP.md +7 -4
- package/dist/deployment/adapter.d.ts +45 -11
- package/dist/deployment/adapter.js +62 -7
- package/dist/deployment/descriptor.d.ts +1 -1
- package/dist/deployment/descriptor.js +1 -1
- package/dist/src/configure.js +51 -4
- package/manifest.json +1 -1
- package/package.json +5 -5
- package/proflow.module.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @tomflow/proflow-execution-browser-extension
|
|
2
|
+
|
|
3
|
+
## 0.1.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
## 0.1.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Align all Modules to the seven-command setup contract with executable package-owned setup guidance and full Platform setup aggregation.
|
package/SETUP.md
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
# @tomflow/proflow-execution-browser-extension — Module Setup
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## STEP-EXECUTION-BROWSER-EXTENSION-01 — 加载并验证 Chrome 扩展
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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.
|
|
17
|
+
moduleVersion: "0.1.7";
|
|
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.
|
|
30
|
+
readonly moduleVersion: "0.1.7";
|
|
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.
|
|
40
|
+
moduleVersion: "0.1.7";
|
|
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.
|
|
52
|
+
moduleVersion: "0.1.7";
|
|
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.
|
|
82
|
+
moduleVersion: "0.1.7";
|
|
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.
|
|
116
|
+
readonly moduleVersion: "0.1.7";
|
|
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.
|
|
126
|
+
moduleVersion: "0.1.7";
|
|
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.
|
|
139
|
+
readonly moduleVersion: "0.1.7";
|
|
106
140
|
} | {
|
|
107
141
|
contract: "deployment.result.v1";
|
|
108
142
|
moduleRef: "execution-browser-extension";
|
|
109
|
-
moduleVersion: "0.1.
|
|
143
|
+
moduleVersion: "0.1.7";
|
|
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.
|
|
160
|
+
readonly moduleVersion: "0.1.7";
|
|
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:
|
|
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
|
|
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:
|
|
251
|
-
|
|
252
|
-
|
|
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
|
|
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: {
|
|
335
|
+
result: {
|
|
336
|
+
...base,
|
|
337
|
+
data: {
|
|
338
|
+
docs: readFileSync(new URL("../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
|
+
readonly moduleVersion: "0.1.7";
|
|
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
|
+
moduleVersion: "0.1.7",
|
|
7
7
|
kind: "browser-extension",
|
|
8
8
|
templateVersion: "1.0.0",
|
|
9
9
|
platformCompatibility: ">=1.0.0 <2.0.0",
|
package/dist/src/configure.js
CHANGED
|
@@ -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 {
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomflow/proflow-execution-browser-extension",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
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-
|
|
30
|
-
"@tomflow/proflow-
|
|
29
|
+
"@tomflow/proflow-module-contract": "^0.1.8",
|
|
30
|
+
"@tomflow/proflow-execution-contracts": "^0.1.6"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tomflow/proflow-
|
|
34
|
-
"@tomflow/proflow-
|
|
33
|
+
"@tomflow/proflow-deployment-conformance": "^0.1.6",
|
|
34
|
+
"@tomflow/proflow-execution-runtime": "^0.1.9"
|
|
35
35
|
},
|
|
36
36
|
"keywords": [
|
|
37
37
|
"proflow",
|
package/proflow.module.json
CHANGED
|
@@ -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
|
+
"moduleVersion": "0.1.7",
|
|
7
7
|
"kind": "browser-extension",
|
|
8
8
|
"templateVersion": "1.0.0",
|
|
9
9
|
"platformCompatibility": ">=1.0.0 <2.0.0",
|