@tomflow/proflow-execution-browser-extension 0.1.12 → 0.1.14
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 +12 -0
- package/DOCS.md +12 -4
- package/SETUP.md +12 -16
- package/dist/deployment/adapter.d.ts +34 -85
- package/dist/deployment/adapter.js +119 -138
- package/dist/deployment/descriptor.d.ts +4 -1
- package/dist/deployment/descriptor.js +5 -1
- package/dist/extension/background.js +189 -0
- package/dist/extension/provisioning-content.d.ts +1 -0
- package/dist/extension/provisioning-content.js +936 -0
- package/dist/src/custom-gpt-editor-driver.d.ts +51 -0
- package/dist/src/custom-gpt-editor-driver.js +116 -0
- package/dist/src/custom-gpt-knowledge.d.ts +21 -0
- package/dist/src/custom-gpt-knowledge.js +148 -0
- package/dist/src/custom-gpt-provisioner.d.ts +78 -0
- package/dist/src/custom-gpt-provisioner.js +225 -0
- package/dist/src/custom-gpt-role.d.ts +66 -0
- package/dist/src/custom-gpt-role.js +98 -0
- package/dist/src/install-workflow.d.ts +29 -0
- package/dist/src/install-workflow.js +64 -0
- package/dist/src/pairing.d.ts +20 -0
- package/dist/src/pairing.js +176 -0
- package/dist/src/provisioning-bridge.d.ts +46 -0
- package/dist/src/provisioning-bridge.js +314 -0
- package/extension/background.ts +264 -3
- package/extension/provisioning-content.ts +1033 -0
- package/manifest.json +9 -1
- package/package.json +7 -9
- package/proflow.module.json +5 -1
- package/dist/src/configure.d.ts +0 -4
- package/dist/src/configure.js +0 -141
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.
|
|
4
|
+
"version": "0.1.14",
|
|
5
5
|
"permissions": ["tabs", "storage", "sidePanel"],
|
|
6
6
|
"host_permissions": ["https://chatgpt.com/*", "http://127.0.0.1/*"],
|
|
7
7
|
"background": {
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
"matches": ["https://chatgpt.com/g/*"],
|
|
14
14
|
"js": ["dist/extension/content.js"],
|
|
15
15
|
"run_at": "document_idle"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"matches": [
|
|
19
|
+
"https://chatgpt.com/gpts/editor",
|
|
20
|
+
"https://chatgpt.com/gpts/editor/*"
|
|
21
|
+
],
|
|
22
|
+
"js": ["dist/extension/provisioning-content.js"],
|
|
23
|
+
"run_at": "document_idle"
|
|
16
24
|
}
|
|
17
25
|
],
|
|
18
26
|
"side_panel": {
|
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.14",
|
|
4
4
|
"description": "Execution-owned MV3 Browser executor, evidence provider and browser application surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"./deployment/adapter": "./dist/deployment/adapter.js",
|
|
13
13
|
"./deployment/descriptor": "./dist/deployment/descriptor.js",
|
|
14
14
|
"./runtime-composition": "./dist/src/runtime-composition.js",
|
|
15
|
-
"./
|
|
15
|
+
"./custom-gpt-provisioning": "./dist/src/custom-gpt-provisioner.js",
|
|
16
|
+
"./custom-gpt-role": "./dist/src/custom-gpt-role.js"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"dist",
|
|
@@ -26,12 +27,12 @@
|
|
|
26
27
|
"SETUP.md"
|
|
27
28
|
],
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@tomflow/proflow-
|
|
30
|
-
"@tomflow/proflow-
|
|
30
|
+
"@tomflow/proflow-execution-contracts": "^0.1.10",
|
|
31
|
+
"@tomflow/proflow-module-contract": "^0.1.13"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@tomflow/proflow-deployment-conformance": "^0.1.
|
|
34
|
-
"@tomflow/proflow-execution-runtime": "^0.1.
|
|
34
|
+
"@tomflow/proflow-deployment-conformance": "^0.1.12",
|
|
35
|
+
"@tomflow/proflow-execution-runtime": "^0.1.15"
|
|
35
36
|
},
|
|
36
37
|
"keywords": [
|
|
37
38
|
"proflow",
|
|
@@ -43,9 +44,6 @@
|
|
|
43
44
|
"descriptor": "./dist/deployment/descriptor.js",
|
|
44
45
|
"manifest": "./proflow.module.json"
|
|
45
46
|
},
|
|
46
|
-
"bin": {
|
|
47
|
-
"proflow-execution-browser-extension": "./dist/src/configure.js"
|
|
48
|
-
},
|
|
49
47
|
"scripts": {
|
|
50
48
|
"test": "node --test tests/**/*.test.ts",
|
|
51
49
|
"typecheck": "tsc --noEmit"
|
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.14",
|
|
7
7
|
"kind": "browser-extension",
|
|
8
8
|
"templateVersion": "1.0.0",
|
|
9
9
|
"platformCompatibility": ">=1.0.0 <2.0.0",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
{
|
|
16
16
|
"contractRef": "execution-browser-executor",
|
|
17
17
|
"version": "1.0.0"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"contractRef": "custom-gpt-web-provisioning",
|
|
21
|
+
"version": "1.0.0"
|
|
18
22
|
}
|
|
19
23
|
],
|
|
20
24
|
"requires": [
|
package/dist/src/configure.d.ts
DELETED
package/dist/src/configure.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spawn, spawnSync } from "node:child_process";
|
|
3
|
-
import { readFile } from "node:fs/promises";
|
|
4
|
-
import { resolve } from "node:path";
|
|
5
|
-
import { createInterface } from "node:readline/promises";
|
|
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);
|
|
13
|
-
function workspaceFromArgs(args) {
|
|
14
|
-
if (args[0] !== "materialize-config") {
|
|
15
|
-
throw new Error("Usage: proflow-execution-browser-extension materialize-config [--workspace /absolute/path]");
|
|
16
|
-
}
|
|
17
|
-
const workspaceIndex = args.indexOf("--workspace");
|
|
18
|
-
if (workspaceIndex < 0)
|
|
19
|
-
return process.cwd();
|
|
20
|
-
const value = args[workspaceIndex + 1];
|
|
21
|
-
if (!value || args.length !== 3) {
|
|
22
|
-
throw new Error("Usage: proflow-execution-browser-extension materialize-config [--workspace /absolute/path]");
|
|
23
|
-
}
|
|
24
|
-
return resolve(value);
|
|
25
|
-
}
|
|
26
|
-
export async function materializeBrowserExtensionConfig(workspaceRoot) {
|
|
27
|
-
const configPath = resolve(workspaceRoot, ".proflow", "config", "execution-browser-extension.json");
|
|
28
|
-
const parsed = JSON.parse(await readFile(configPath, "utf8"));
|
|
29
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
30
|
-
throw new Error("execution-browser-extension config must be a JSON object");
|
|
31
|
-
}
|
|
32
|
-
const config = Object.fromEntries(Object.entries(parsed).map(([key, value]) => {
|
|
33
|
-
if (typeof value !== "string") {
|
|
34
|
-
throw new Error(`browser extension config ${key} must be a string`);
|
|
35
|
-
}
|
|
36
|
-
return [key, value];
|
|
37
|
-
}));
|
|
38
|
-
return materializeProductionConfig({
|
|
39
|
-
moduleRef: "execution-browser-extension",
|
|
40
|
-
config,
|
|
41
|
-
workspaceRoot,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function openChromeExtensions() {
|
|
45
|
-
const url = "chrome://extensions";
|
|
46
|
-
const command = process.platform === "darwin"
|
|
47
|
-
? "open"
|
|
48
|
-
: process.platform === "win32"
|
|
49
|
-
? "cmd"
|
|
50
|
-
: "xdg-open";
|
|
51
|
-
const parameters = process.platform === "darwin"
|
|
52
|
-
? ["-a", "Google Chrome", url]
|
|
53
|
-
: process.platform === "win32"
|
|
54
|
-
? ["/c", "start", "", url]
|
|
55
|
-
: [url];
|
|
56
|
-
const child = spawn(command, parameters, { detached: true, stdio: "ignore" });
|
|
57
|
-
child.unref();
|
|
58
|
-
}
|
|
59
|
-
async function main() {
|
|
60
|
-
const args = process.argv.slice(2);
|
|
61
|
-
if (args.includes("--json"))
|
|
62
|
-
throw new Error("不支持的选项 --json");
|
|
63
|
-
const option = (name) => {
|
|
64
|
-
const index = args.indexOf(name);
|
|
65
|
-
return index >= 0 ? args[index + 1] : undefined;
|
|
66
|
-
};
|
|
67
|
-
const workspaceRoot = option("--workspace")
|
|
68
|
-
? resolve(option("--workspace"))
|
|
69
|
-
: process.cwd();
|
|
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}`);
|
|
97
|
-
let extensionId = option("--extension-id");
|
|
98
|
-
if (!extensionId && !process.stdin.isTTY)
|
|
99
|
-
throw new Error("非交互环境必须提供 --extension-id");
|
|
100
|
-
if (!extensionId) {
|
|
101
|
-
const prepared = await behaviorAdapter.install({ workspaceRoot });
|
|
102
|
-
const loadDir = String(prepared.result.data.loadDir);
|
|
103
|
-
const prompt = createInterface({
|
|
104
|
-
input: process.stdin,
|
|
105
|
-
output: process.stdout,
|
|
106
|
-
});
|
|
107
|
-
try {
|
|
108
|
-
process.stdout.write(`\nChrome 扩展配置\n\n 1. 已准备扩展目录:${loadDir}\n 2. 在 Chrome 打开“扩展程序”,启用“开发者模式”。\n 3. 点击“加载已解压的扩展程序”,选择上面的目录。\n 4. 确认 Service Worker(后台服务)显示正常,再复制扩展 ID。\n\n`);
|
|
109
|
-
openChromeExtensions();
|
|
110
|
-
extensionId = await prompt.question("◆ Chrome Extension ID(32 位小写字母)\n> ");
|
|
111
|
-
}
|
|
112
|
-
finally {
|
|
113
|
-
prompt.close();
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
const result = await behaviorAdapter.setup({
|
|
117
|
-
workspaceRoot,
|
|
118
|
-
input: { extensionId, serviceWorker: "RUNNING" },
|
|
119
|
-
});
|
|
120
|
-
process.stdout.write(result.result.status === "SUCCEEDED"
|
|
121
|
-
? "\n✓ Extension ID 已保存\n✓ Service Worker 运行证据已记录\n"
|
|
122
|
-
: "\n✕ 浏览器扩展尚未就绪,请检查扩展错误后重试。\n");
|
|
123
|
-
if (result.result.status === "FAILED")
|
|
124
|
-
process.exitCode = 1;
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (args[0] === "verify") {
|
|
128
|
-
const result = await behaviorAdapter.status({ workspaceRoot });
|
|
129
|
-
process.stdout.write(result.result.data.setupStatus === "READY"
|
|
130
|
-
? "验证通过。\n"
|
|
131
|
-
: "验证未通过:扩展尚未就绪。\n");
|
|
132
|
-
if (result.result.data.setupStatus !== "READY")
|
|
133
|
-
process.exitCode = 1;
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
const legacyWorkspaceRoot = workspaceFromArgs(args);
|
|
137
|
-
const result = await materializeBrowserExtensionConfig(legacyWorkspaceRoot);
|
|
138
|
-
process.stdout.write(`浏览器扩展配置已生成:${result.loadDir}\n`);
|
|
139
|
-
}
|
|
140
|
-
if (import.meta.main)
|
|
141
|
-
await main();
|