@tomflow/proflow-execution-browser-extension 0.1.20 → 0.1.21

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.
@@ -7,6 +7,29 @@ export declare function materializeProductionConfig(input: {
7
7
  }): Promise<{
8
8
  loadDir: string;
9
9
  }>;
10
+ export type RunningBridgeProbe = {
11
+ kind: "ABSENT";
12
+ } | {
13
+ kind: "PRESENT";
14
+ identity?: {
15
+ extensionId: string;
16
+ extensionInstanceId: string;
17
+ };
18
+ };
19
+ export declare function classifyBrowserLiveSetup(input: {
20
+ baseSetupReady: boolean;
21
+ evidenceInstanceId?: string;
22
+ bridgeProbe: RunningBridgeProbe;
23
+ }): {
24
+ readonly setupReady: boolean;
25
+ issueCode?: never;
26
+ } | {
27
+ setupReady: boolean;
28
+ issueCode: "EXTENSION_SESSION_OFFLINE";
29
+ } | {
30
+ setupReady: boolean;
31
+ issueCode: "EXTENSION_SESSION_REVALIDATION_REQUIRED";
32
+ };
10
33
  export declare function pairBrowserExtensionSetup(context: ModuleCommandContext, options?: {
11
34
  timeoutMs?: number;
12
35
  onWaiting?: (input: {
@@ -24,7 +47,7 @@ export declare const behaviorAdapter: {
24
47
  ok: true;
25
48
  status: "SUCCEEDED";
26
49
  moduleRef: "execution-browser-extension";
27
- moduleVersion: "0.1.20";
50
+ moduleVersion: "0.1.21";
28
51
  data: {
29
52
  loadDir: string;
30
53
  };
@@ -37,7 +60,7 @@ export declare const behaviorAdapter: {
37
60
  readonly ok: true;
38
61
  readonly status: "SUCCEEDED";
39
62
  readonly moduleRef: "execution-browser-extension";
40
- readonly moduleVersion: "0.1.20";
63
+ readonly moduleVersion: "0.1.21";
41
64
  };
42
65
  observedEffects: never[];
43
66
  }>;
@@ -47,17 +70,23 @@ export declare const behaviorAdapter: {
47
70
  ok: true;
48
71
  status: "SUCCEEDED";
49
72
  moduleRef: "execution-browser-extension";
50
- moduleVersion: "0.1.20";
73
+ moduleVersion: "0.1.21";
51
74
  data: {
52
75
  setupStatus: "ACTION_REQUIRED" | "READY";
53
76
  runtimeStatus: "NOT_APPLICABLE";
54
- issues?: {
77
+ issues?: ({
55
78
  scope: "SETUP";
56
79
  code: string;
57
80
  message: string;
58
81
  relatedModuleRefs: string[];
59
82
  nextCommand: string;
60
- }[];
83
+ } | {
84
+ scope: "SETUP";
85
+ code: "EXTENSION_SESSION_OFFLINE" | "EXTENSION_SESSION_REVALIDATION_REQUIRED" | undefined;
86
+ message: string;
87
+ relatedModuleRefs: string[];
88
+ nextCommand: string;
89
+ })[];
61
90
  };
62
91
  };
63
92
  observedEffects: never[];
@@ -66,7 +95,7 @@ export declare const behaviorAdapter: {
66
95
  result: {
67
96
  contract: "deployment.result.v1";
68
97
  moduleRef: "execution-browser-extension";
69
- moduleVersion: "0.1.20";
98
+ moduleVersion: "0.1.21";
70
99
  ok: false;
71
100
  status: "ACTION_REQUIRED";
72
101
  data: {
@@ -98,14 +127,14 @@ export declare const behaviorAdapter: {
98
127
  readonly ok: true;
99
128
  readonly status: "SUCCEEDED";
100
129
  readonly moduleRef: "execution-browser-extension";
101
- readonly moduleVersion: "0.1.20";
130
+ readonly moduleVersion: "0.1.21";
102
131
  };
103
132
  observedEffects: string[];
104
133
  } | {
105
134
  result: {
106
135
  contract: "deployment.result.v1";
107
136
  moduleRef: "execution-browser-extension";
108
- moduleVersion: "0.1.20";
137
+ moduleVersion: "0.1.21";
109
138
  ok: false;
110
139
  status: "FAILED";
111
140
  error: {
@@ -138,7 +167,7 @@ export declare const behaviorAdapter: {
138
167
  ok: true;
139
168
  status: "SUCCEEDED";
140
169
  moduleRef: "execution-browser-extension";
141
- moduleVersion: "0.1.20";
170
+ moduleVersion: "0.1.21";
142
171
  data: {
143
172
  docs: string;
144
173
  };
@@ -151,11 +180,11 @@ export declare const behaviorAdapter: {
151
180
  readonly ok: true;
152
181
  readonly status: "SUCCEEDED";
153
182
  readonly moduleRef: "execution-browser-extension";
154
- readonly moduleVersion: "0.1.20";
183
+ readonly moduleVersion: "0.1.21";
155
184
  } | {
156
185
  contract: "deployment.result.v1";
157
186
  moduleRef: "execution-browser-extension";
158
- moduleVersion: "0.1.20";
187
+ moduleVersion: "0.1.21";
159
188
  ok: false;
160
189
  status: "FAILED";
161
190
  error: {
@@ -172,7 +201,7 @@ export declare const behaviorAdapter: {
172
201
  readonly ok: true;
173
202
  readonly status: "SUCCEEDED";
174
203
  readonly moduleRef: "execution-browser-extension";
175
- readonly moduleVersion: "0.1.20";
204
+ readonly moduleVersion: "0.1.21";
176
205
  };
177
206
  observedEffects: never[];
178
207
  }>;
@@ -255,6 +255,21 @@ async function persistPairedBrowserExtension(context, prepared, identity) {
255
255
  await writeFile(verificationFile(context), `${JSON.stringify(evidence, null, 2)}\n`, { mode: 0o600 });
256
256
  return identity;
257
257
  }
258
+ export function classifyBrowserLiveSetup(input) {
259
+ if (!input.baseSetupReady || input.bridgeProbe.kind === "ABSENT")
260
+ return { setupReady: input.baseSetupReady };
261
+ if (!input.bridgeProbe.identity)
262
+ return {
263
+ setupReady: false,
264
+ issueCode: "EXTENSION_SESSION_OFFLINE",
265
+ };
266
+ if (input.bridgeProbe.identity.extensionInstanceId !== input.evidenceInstanceId)
267
+ return {
268
+ setupReady: false,
269
+ issueCode: "EXTENSION_SESSION_REVALIDATION_REQUIRED",
270
+ };
271
+ return { setupReady: true };
272
+ }
258
273
  function connectionRefused(error) {
259
274
  if (!(error instanceof TypeError))
260
275
  return false;
@@ -392,31 +407,57 @@ export const behaviorAdapter = {
392
407
  loadDir,
393
408
  })
394
409
  : "MISSING";
395
- const setupReady = Boolean(setup &&
410
+ const baseSetupReady = Boolean(setup &&
396
411
  evidence &&
397
412
  setup.extensionId === evidence.extensionId &&
398
413
  chromeState === "ENABLED");
414
+ let bridgeProbe = { kind: "ABSENT" };
415
+ if (baseSetupReady && evidence) {
416
+ const facts = await readModuleSharedFacts(context, descriptor.moduleRef);
417
+ const bridgeEndpoint = factString(facts, "bridgeEndpoint");
418
+ const bridgeTokenFile = factString(facts, "bridgeTokenFile");
419
+ if (bridgeEndpoint && bridgeTokenFile) {
420
+ try {
421
+ bridgeProbe = await probeRunningBridgeSession({ bridgeEndpoint, bridgeTokenFile }, evidence.extensionId, 500);
422
+ }
423
+ catch {
424
+ bridgeProbe = { kind: "PRESENT" };
425
+ }
426
+ }
427
+ }
428
+ const live = classifyBrowserLiveSetup({
429
+ baseSetupReady,
430
+ ...(evidence ? { evidenceInstanceId: evidence.extensionInstanceId } : {}),
431
+ bridgeProbe,
432
+ });
433
+ const issue = !baseSetupReady
434
+ ? {
435
+ scope: "SETUP",
436
+ code: "EXTENSION_LOAD_REQUIRED",
437
+ message: "Chrome 扩展尚未加载或缺少可验证的运行证据",
438
+ relatedModuleRefs: ["chrome-runtime"],
439
+ nextCommand: "platform setup",
440
+ }
441
+ : live.setupReady
442
+ ? undefined
443
+ : {
444
+ scope: "SETUP",
445
+ code: live.issueCode,
446
+ message: live.issueCode === "EXTENSION_SESSION_OFFLINE"
447
+ ? "Chrome 扩展已加载,但当前运行会话未在线"
448
+ : "Chrome 扩展已重新启动,需要自动刷新当前运行会话证据",
449
+ relatedModuleRefs: ["execution-runtime"],
450
+ nextCommand: "platform setup",
451
+ };
399
452
  return {
400
453
  result: {
401
454
  ...base,
402
455
  data: {
403
- setupStatus: setupReady
456
+ setupStatus: live.setupReady
404
457
  ? "READY"
405
458
  : "ACTION_REQUIRED",
406
459
  runtimeStatus: "NOT_APPLICABLE",
407
- ...(setupReady
408
- ? {}
409
- : {
410
- issues: [
411
- {
412
- scope: "SETUP",
413
- code: "EXTENSION_LOAD_REQUIRED",
414
- message: "Chrome 扩展尚未加载或缺少可验证的运行证据",
415
- relatedModuleRefs: ["chrome-runtime"],
416
- nextCommand: "platform setup",
417
- },
418
- ],
419
- }),
460
+ ...(issue ? { issues: [issue] } : {}),
420
461
  },
421
462
  },
422
463
  observedEffects: [],
@@ -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.20";
6
+ readonly moduleVersion: "0.1.21";
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.20",
6
+ moduleVersion: "0.1.21",
7
7
  kind: "browser-extension",
8
8
  templateVersion: "1.0.0",
9
9
  platformCompatibility: ">=1.0.0 <2.0.0",
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.20",
4
+ "version": "0.1.21",
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.20",
3
+ "version": "0.1.21",
4
4
  "description": "Execution-owned MV3 Browser executor, evidence provider and browser application surface.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -31,8 +31,8 @@
31
31
  "@tomflow/proflow-module-contract": "^0.1.13"
32
32
  },
33
33
  "devDependencies": {
34
- "@tomflow/proflow-execution-runtime": "^0.1.15",
35
- "@tomflow/proflow-deployment-conformance": "^0.1.13"
34
+ "@tomflow/proflow-deployment-conformance": "^0.1.13",
35
+ "@tomflow/proflow-execution-runtime": "^0.1.15"
36
36
  },
37
37
  "keywords": [
38
38
  "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.20",
6
+ "moduleVersion": "0.1.21",
7
7
  "kind": "browser-extension",
8
8
  "templateVersion": "1.0.0",
9
9
  "platformCompatibility": ">=1.0.0 <2.0.0",