@tomflow/proflow-execution-browser-extension 0.1.32 → 0.1.34

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.
@@ -47,7 +47,7 @@ export declare const behaviorAdapter: {
47
47
  ok: true;
48
48
  status: "SUCCEEDED";
49
49
  moduleRef: "execution-browser-extension";
50
- moduleVersion: "0.1.32";
50
+ moduleVersion: "0.1.34";
51
51
  data: {
52
52
  loadDir: string;
53
53
  };
@@ -60,7 +60,7 @@ export declare const behaviorAdapter: {
60
60
  readonly ok: true;
61
61
  readonly status: "SUCCEEDED";
62
62
  readonly moduleRef: "execution-browser-extension";
63
- readonly moduleVersion: "0.1.32";
63
+ readonly moduleVersion: "0.1.34";
64
64
  };
65
65
  observedEffects: never[];
66
66
  }>;
@@ -70,7 +70,7 @@ export declare const behaviorAdapter: {
70
70
  ok: true;
71
71
  status: "SUCCEEDED";
72
72
  moduleRef: "execution-browser-extension";
73
- moduleVersion: "0.1.32";
73
+ moduleVersion: "0.1.34";
74
74
  data: {
75
75
  setupStatus: "ACTION_REQUIRED" | "READY";
76
76
  runtimeStatus: "NOT_APPLICABLE";
@@ -95,7 +95,7 @@ export declare const behaviorAdapter: {
95
95
  result: {
96
96
  contract: "deployment.result.v1";
97
97
  moduleRef: "execution-browser-extension";
98
- moduleVersion: "0.1.32";
98
+ moduleVersion: "0.1.34";
99
99
  ok: false;
100
100
  status: "ACTION_REQUIRED";
101
101
  data: {
@@ -127,14 +127,14 @@ export declare const behaviorAdapter: {
127
127
  readonly ok: true;
128
128
  readonly status: "SUCCEEDED";
129
129
  readonly moduleRef: "execution-browser-extension";
130
- readonly moduleVersion: "0.1.32";
130
+ readonly moduleVersion: "0.1.34";
131
131
  };
132
132
  observedEffects: string[];
133
133
  } | {
134
134
  result: {
135
135
  contract: "deployment.result.v1";
136
136
  moduleRef: "execution-browser-extension";
137
- moduleVersion: "0.1.32";
137
+ moduleVersion: "0.1.34";
138
138
  ok: false;
139
139
  status: "FAILED";
140
140
  error: {
@@ -167,7 +167,7 @@ export declare const behaviorAdapter: {
167
167
  ok: true;
168
168
  status: "SUCCEEDED";
169
169
  moduleRef: "execution-browser-extension";
170
- moduleVersion: "0.1.32";
170
+ moduleVersion: "0.1.34";
171
171
  data: {
172
172
  docs: string;
173
173
  };
@@ -180,11 +180,11 @@ export declare const behaviorAdapter: {
180
180
  readonly ok: true;
181
181
  readonly status: "SUCCEEDED";
182
182
  readonly moduleRef: "execution-browser-extension";
183
- readonly moduleVersion: "0.1.32";
183
+ readonly moduleVersion: "0.1.34";
184
184
  } | {
185
185
  contract: "deployment.result.v1";
186
186
  moduleRef: "execution-browser-extension";
187
- moduleVersion: "0.1.32";
187
+ moduleVersion: "0.1.34";
188
188
  ok: false;
189
189
  status: "FAILED";
190
190
  error: {
@@ -201,7 +201,7 @@ export declare const behaviorAdapter: {
201
201
  readonly ok: true;
202
202
  readonly status: "SUCCEEDED";
203
203
  readonly moduleRef: "execution-browser-extension";
204
- readonly moduleVersion: "0.1.32";
204
+ readonly moduleVersion: "0.1.34";
205
205
  };
206
206
  observedEffects: never[];
207
207
  }>;
@@ -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.32";
6
+ readonly moduleVersion: "0.1.34";
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.32",
6
+ moduleVersion: "0.1.34",
7
7
  kind: "browser-extension",
8
8
  templateVersion: "1.0.0",
9
9
  platformCompatibility: ">=1.0.0 <2.0.0",
@@ -13876,6 +13876,8 @@ function shouldTriggerObserverRecovery(previous, current) {
13876
13876
  // packages/execution-browser-extension/extension/background.ts
13877
13877
  var extensionInstanceId = `extension:${crypto.randomUUID()}`;
13878
13878
  var sessions = /* @__PURE__ */ new Map();
13879
+ var BROWSER_CARRIER_KEEPALIVE_KEY = "proflowBrowserSnapshot";
13880
+ var BROWSER_CARRIER_KEEPALIVE_MS = 2e4;
13879
13881
  var sleep = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
13880
13882
  async function persistSnapshot() {
13881
13883
  await chrome.storage.session.set({
@@ -14517,7 +14519,12 @@ async function runBridgeLoop() {
14517
14519
  });
14518
14520
  if (!hello.ok) throw new Error("BRIDGE_HELLO_REJECTED");
14519
14521
  let lastHeartbeatAt = 0;
14522
+ let lastExtensionKeepaliveAt = 0;
14520
14523
  while (true) {
14524
+ if (Date.now() - lastExtensionKeepaliveAt >= BROWSER_CARRIER_KEEPALIVE_MS) {
14525
+ await chrome.storage.session.get(BROWSER_CARRIER_KEEPALIVE_KEY).catch(() => ({}));
14526
+ lastExtensionKeepaliveAt = Date.now();
14527
+ }
14521
14528
  if (Date.now() - lastHeartbeatAt >= 5e3) {
14522
14529
  const heartbeat = await bridgeFetch(
14523
14530
  config2,
@@ -28,6 +28,9 @@ export declare function createBrowserRealityBridgeServer(options: BrowserReality
28
28
  extensionInstanceId: string | null;
29
29
  queuedCommands: number;
30
30
  pendingCommands: number;
31
+ lastCommandPollAt: string | null;
32
+ lastCommandDeliveredAt: string | null;
33
+ lastCommandResultAt: string | null;
31
34
  };
32
35
  close(): Promise<void>;
33
36
  }>>;
@@ -108,11 +108,16 @@ export async function createBrowserRealityBridgeServer(options) {
108
108
  const now = options.now ?? (() => new Date());
109
109
  const idFactory = options.idFactory ?? randomUUID;
110
110
  const freshnessMs = options.heartbeatFreshnessMs ?? 10_000;
111
- const commandTimeoutMs = options.commandTimeoutMs ?? 15_000;
111
+ // Browser commands are Promise-driven. This is only an abnormal hung-command
112
+ // watchdog; normal page load / content observation must not be scheduled by it.
113
+ const commandTimeoutMs = options.commandTimeoutMs ?? 120_000;
112
114
  const expectedOrigin = `chrome-extension://${options.extensionId}`;
113
115
  const queue = [];
114
116
  const pending = new Map();
115
117
  let session;
118
+ let lastCommandPollAt = null;
119
+ let lastCommandDeliveredAt = null;
120
+ let lastCommandResultAt = null;
116
121
  let closed = false;
117
122
  let endpoint = "";
118
123
  const taskBootstrap = new Map();
@@ -186,6 +191,11 @@ export async function createBrowserRealityBridgeServer(options) {
186
191
  browserCarrier: {
187
192
  online: session !== undefined && now().getTime() - session.lastHeartbeatAt <= freshnessMs,
188
193
  extensionInstanceId: session?.extensionInstanceId ?? null,
194
+ queuedCommands: queue.length,
195
+ pendingCommands: pending.size,
196
+ lastCommandPollAt,
197
+ lastCommandDeliveredAt,
198
+ lastCommandResultAt,
189
199
  },
190
200
  },
191
201
  });
@@ -230,8 +240,14 @@ export async function createBrowserRealityBridgeServer(options) {
230
240
  if (!isRecord(body) ||
231
241
  stringField(body, "extensionId") !== options.extensionId)
232
242
  throw new BrowserRealityBridgeError("BRIDGE_AUTH_INVALID", "extension identity mismatch");
243
+ const extensionInstanceId = stringField(body, "extensionInstanceId");
244
+ if (session?.extensionInstanceId !== extensionInstanceId) {
245
+ lastCommandPollAt = null;
246
+ lastCommandDeliveredAt = null;
247
+ lastCommandResultAt = null;
248
+ }
233
249
  session = {
234
- extensionInstanceId: stringField(body, "extensionInstanceId"),
250
+ extensionInstanceId,
235
251
  lastHeartbeatAt: now().getTime(),
236
252
  };
237
253
  send(response, 200, { accepted: true });
@@ -258,12 +274,15 @@ export async function createBrowserRealityBridgeServer(options) {
258
274
  return;
259
275
  }
260
276
  if (request.method === "GET" && url.pathname === "/v1/commands/next") {
261
- session.lastHeartbeatAt = now().getTime();
277
+ const stamp = now();
278
+ session.lastHeartbeatAt = stamp.getTime();
279
+ lastCommandPollAt = stamp.toISOString();
262
280
  const command = queue.shift();
263
281
  if (command) {
264
282
  const tracked = pending.get(command.commandId);
265
283
  if (tracked)
266
284
  tracked.stage = "DELIVERED";
285
+ lastCommandDeliveredAt = lastCommandPollAt;
267
286
  }
268
287
  send(response, command ? 200 : 204, command);
269
288
  return;
@@ -278,6 +297,7 @@ export async function createBrowserRealityBridgeServer(options) {
278
297
  throw new BrowserRealityBridgeError("BRIDGE_INPUT_INVALID", "command result is stale or unknown");
279
298
  pending.delete(commandId);
280
299
  clearTimeout(command.timer);
300
+ lastCommandResultAt = now().toISOString();
281
301
  if (body.ok === true)
282
302
  command.resolve(body.value);
283
303
  else
@@ -389,6 +409,9 @@ export async function createBrowserRealityBridgeServer(options) {
389
409
  extensionInstanceId: session?.extensionInstanceId ?? null,
390
410
  queuedCommands: queue.length,
391
411
  pendingCommands: pending.size,
412
+ lastCommandPollAt,
413
+ lastCommandDeliveredAt,
414
+ lastCommandResultAt,
392
415
  };
393
416
  },
394
417
  async close() {
@@ -91,6 +91,9 @@ export declare function createBrowserExecutorComposition(options: BrowserExecuto
91
91
  extensionInstanceId: string | null;
92
92
  queuedCommands: number;
93
93
  pendingCommands: number;
94
+ lastCommandPollAt: string | null;
95
+ lastCommandDeliveredAt: string | null;
96
+ lastCommandResultAt: string | null;
94
97
  };
95
98
  close: () => Promise<void>;
96
99
  }>>;
@@ -106,7 +106,10 @@ type ChromeRuntime = {
106
106
  onInstalled: { addListener(listener: () => void): void };
107
107
  };
108
108
  storage: {
109
- session: { set(value: Record<string, unknown>): Promise<void> };
109
+ session: {
110
+ get(key: string): Promise<Record<string, unknown>>;
111
+ set(value: Record<string, unknown>): Promise<void>;
112
+ };
110
113
  local: {
111
114
  get(key: string): Promise<Record<string, unknown>>;
112
115
  set(value: Record<string, unknown>): Promise<void>;
@@ -138,6 +141,8 @@ declare const chrome: ChromeRuntime;
138
141
 
139
142
  const extensionInstanceId = `extension:${crypto.randomUUID()}`;
140
143
  const sessions = new Map<number, ContentObservation>();
144
+ const BROWSER_CARRIER_KEEPALIVE_KEY = "proflowBrowserSnapshot";
145
+ const BROWSER_CARRIER_KEEPALIVE_MS = 20_000;
141
146
 
142
147
  const sleep = (milliseconds: number) =>
143
148
  new Promise<void>((resolve) => setTimeout(resolve, milliseconds));
@@ -1002,7 +1007,17 @@ async function runBridgeLoop() {
1002
1007
  });
1003
1008
  if (!hello.ok) throw new Error("BRIDGE_HELLO_REJECTED");
1004
1009
  let lastHeartbeatAt = 0;
1010
+ let lastExtensionKeepaliveAt = 0;
1005
1011
  while (true) {
1012
+ if (
1013
+ Date.now() - lastExtensionKeepaliveAt >=
1014
+ BROWSER_CARRIER_KEEPALIVE_MS
1015
+ ) {
1016
+ await chrome.storage.session
1017
+ .get(BROWSER_CARRIER_KEEPALIVE_KEY)
1018
+ .catch(() => ({}));
1019
+ lastExtensionKeepaliveAt = Date.now();
1020
+ }
1006
1021
  if (Date.now() - lastHeartbeatAt >= 5_000) {
1007
1022
  const heartbeat = await bridgeFetch(
1008
1023
  config,
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.32",
4
+ "version": "0.1.34",
5
5
  "permissions": [
6
6
  "tabs",
7
7
  "storage"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/proflow-execution-browser-extension",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
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.16"
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.32",
6
+ "moduleVersion": "0.1.34",
7
7
  "kind": "browser-extension",
8
8
  "templateVersion": "1.0.0",
9
9
  "platformCompatibility": ">=1.0.0 <2.0.0",