@mario.andreschak/mcp-browser 3.46.1 → 3.47.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 mario-andreschak
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,52 +1,52 @@
1
- # Browser MCP
2
-
3
- The browser MCP provides interactive Patchright sessions, deterministic PNG capture, and WebM recording.
4
-
5
- ## Evidence artifacts
6
-
7
- `browser_screenshot` creates an immutable PNG by default under
8
- `screenshots/browser/<sessionId>/<artifactId>-viewport.png` (or
9
- `-full-page.png`). An optional `outputPath` is accepted only inside the
10
- FLUJO data directory or configured screenshot root. Existing destinations,
11
- root escapes, drive-relative/device/UNC paths, and symlink or junction escapes
12
- are rejected.
13
-
14
- Screenshot results include the artifact ID, SHA-256, capture timestamp, CSS
15
- viewport, DPR, encoded PNG dimensions, and page/session metadata. When the
16
- target is an active recording, the result also links the PNG to its
17
- `recordingId` and configured recording geometry. PNGs are lossless evidence;
18
- callers must still freeze application animation, timestamps, cursors, and
19
- changing overlays before exact comparisons.
20
-
21
- ## Recording geometry
22
-
23
- Recording contexts use an explicit CSS viewport and device scale factor 1.
24
- The configured video surface matches that viewport. Recording sessions have a
25
- fixed viewport policy: resizing the MCP App or dock scales/letterboxes the live
26
- stream and never mutates the page used to produce evidence.
27
-
28
- Start, status, and stop results distinguish:
29
-
30
- - `requestedViewport`
31
- - `actualViewport`
32
- - `deviceScaleFactor`
33
- - `configuredVideoResolution`
34
- - `actualEncodedVideoResolution` (after finalization, or `null` with a warning)
35
- - content bounds, letterbox insets, and `geometryMismatch`
36
-
37
- WebM remains review/playback evidence; use recording-linked PNG screenshots for
38
- exact pixel evidence.
39
-
40
- ## Session lifecycle and ownership
41
-
42
- The backend-provided `_meta.flujo.ownerScope` is authoritative. Calls without
43
- metadata use the process-local `legacy:anonymous` compatibility scope.
44
- Session IDs cannot be listed, used, attached, stopped, or closed across owner
45
- scopes. The live-view gateway additionally requires a private per-session
46
- capability delivered to the MCP App through result metadata.
47
-
48
- Capacity is reserved synchronously before browser creation, so concurrent opens
49
- cannot race above `FLUJO_BROWSER_MAX_SESSIONS`. Dead and expired entries are
50
- reclaimed before enforcing the cap. `browser_list_sessions` returns
51
- owner-filtered lifecycle/capacity diagnostics, and `browser_release_owner`
52
- idempotently finalizes recordings and releases sessions for the caller scope.
1
+ # Browser MCP
2
+
3
+ The browser MCP provides interactive Patchright sessions, deterministic PNG capture, and WebM recording.
4
+
5
+ ## Evidence artifacts
6
+
7
+ `browser_screenshot` creates an immutable PNG by default under
8
+ `screenshots/browser/<sessionId>/<artifactId>-viewport.png` (or
9
+ `-full-page.png`). An optional `outputPath` is accepted only inside the
10
+ FLUJO data directory or configured screenshot root. Existing destinations,
11
+ root escapes, drive-relative/device/UNC paths, and symlink or junction escapes
12
+ are rejected.
13
+
14
+ Screenshot results include the artifact ID, SHA-256, capture timestamp, CSS
15
+ viewport, DPR, encoded PNG dimensions, and page/session metadata. When the
16
+ target is an active recording, the result also links the PNG to its
17
+ `recordingId` and configured recording geometry. PNGs are lossless evidence;
18
+ callers must still freeze application animation, timestamps, cursors, and
19
+ changing overlays before exact comparisons.
20
+
21
+ ## Recording geometry
22
+
23
+ Recording contexts use an explicit CSS viewport and device scale factor 1.
24
+ The configured video surface matches that viewport. Recording sessions have a
25
+ fixed viewport policy: resizing the MCP App or dock scales/letterboxes the live
26
+ stream and never mutates the page used to produce evidence.
27
+
28
+ Start, status, and stop results distinguish:
29
+
30
+ - `requestedViewport`
31
+ - `actualViewport`
32
+ - `deviceScaleFactor`
33
+ - `configuredVideoResolution`
34
+ - `actualEncodedVideoResolution` (after finalization, or `null` with a warning)
35
+ - content bounds, letterbox insets, and `geometryMismatch`
36
+
37
+ WebM remains review/playback evidence; use recording-linked PNG screenshots for
38
+ exact pixel evidence.
39
+
40
+ ## Session lifecycle and ownership
41
+
42
+ The backend-provided `_meta.flujo.ownerScope` is authoritative. Calls without
43
+ metadata use the process-local `legacy:anonymous` compatibility scope.
44
+ Session IDs cannot be listed, used, attached, stopped, or closed across owner
45
+ scopes. The live-view gateway additionally requires a private per-session
46
+ capability delivered to the MCP App through result metadata.
47
+
48
+ Capacity is reserved synchronously before browser creation, so concurrent opens
49
+ cannot race above `FLUJO_BROWSER_MAX_SESSIONS`. Dead and expired entries are
50
+ reclaimed before enforcing the cap. `browser_list_sessions` returns
51
+ owner-filtered lifecycle/capacity diagnostics, and `browser_release_owner`
52
+ idempotently finalizes recordings and releases sessions for the caller scope.
package/dist/audioTap.js CHANGED
@@ -22,126 +22,126 @@
22
22
  */
23
23
  export function audioTapSource(binding, initiallyMuted = false) {
24
24
  const muted = initiallyMuted ? 'true' : 'false';
25
- return `(function(){
26
- if (window.__flujoAudioTap) { window.__flujoAudioMuted = ${muted}; return; }
27
- var NativeCtx = window.AudioContext || window.webkitAudioContext;
28
- if (!NativeCtx) return;
29
- window.__flujoAudioTap = true;
30
- window.__flujoAudioMuted = ${muted};
31
- var CHUNK = 4096;
32
- var SILENCE = 1 / 32768;
33
-
34
- function encode(bytes){
35
- var out = "", step = 0x8000;
36
- for (var i = 0; i < bytes.length; i += step) {
37
- out += String.fromCharCode.apply(null, bytes.subarray(i, i + step));
38
- }
39
- return btoa(out);
40
- }
41
-
42
- /** Insert a silent recorder between a context's graph and its real output. */
43
- function tap(ctx, output){
44
- var input = ctx.createGain();
45
- var processor = ctx.createScriptProcessor(CHUNK, 2, 2);
46
- processor.onaudioprocess = function(event){
47
- var send = window.${binding};
48
- if (window.__flujoAudioMuted || typeof send !== "function") return;
49
- var buffer = event.inputBuffer;
50
- var frames = buffer.length;
51
- var left = buffer.getChannelData(0);
52
- var right = buffer.numberOfChannels > 1 ? buffer.getChannelData(1) : left;
53
- var pcm = new Int16Array(frames * 2);
54
- var silent = true;
55
- for (var i = 0; i < frames; i++) {
56
- var a = left[i], b = right[i];
57
- if (a > 1) a = 1; else if (a < -1) a = -1;
58
- if (b > 1) b = 1; else if (b < -1) b = -1;
59
- if (silent && (a > SILENCE || a < -SILENCE || b > SILENCE || b < -SILENCE)) silent = false;
60
- pcm[i * 2] = a * 32767;
61
- pcm[i * 2 + 1] = b * 32767;
62
- }
63
- // Digital silence is the common case on a normal page; never spend
64
- // bandwidth or CDP round trips on it.
65
- if (silent) return;
66
- try {
67
- send(JSON.stringify({ rate: ctx.sampleRate, pcm: encode(new Uint8Array(pcm.buffer)) }));
68
- } catch (error) {
69
- window.__flujoAudioMuted = true;
70
- }
71
- };
72
- input.connect(processor);
73
- // A ScriptProcessor only runs while it is reachable from the destination.
74
- // Its own output stays silent because onaudioprocess never writes one.
75
- processor.connect(output);
76
- return input;
77
- }
78
-
79
- // 1) Pages with their own AudioContext.
80
- function patch(Ctor){
81
- if (typeof Ctor !== "function") return Ctor;
82
- function Patched(){
83
- var ctx = new (Function.prototype.bind.apply(Ctor, [null].concat([].slice.call(arguments))))();
84
- try {
85
- var input = tap(ctx, ctx.destination);
86
- input.maxChannelCount = ctx.destination.maxChannelCount;
87
- Object.defineProperty(ctx, "destination", {
88
- configurable: true,
89
- get: function(){ return input; }
90
- });
91
- } catch (error) { /* an untappable context still plays normally */ }
92
- return ctx;
93
- }
94
- Patched.prototype = Ctor.prototype;
95
- return Patched;
96
- }
97
- try {
98
- if (window.AudioContext) window.AudioContext = patch(window.AudioContext);
99
- if (window.webkitAudioContext) window.webkitAudioContext = patch(window.webkitAudioContext);
100
- } catch (error) { /* frozen globals: media elements below still work */ }
101
-
102
- // 2) Plain media elements, routed into one shared context on first play.
103
- var mediaCtx, mediaTap, attached = new WeakSet();
104
- function attach(element){
105
- if (attached.has(element)) return;
106
- try {
107
- if (!mediaCtx) {
108
- mediaCtx = new NativeCtx();
109
- mediaTap = tap(mediaCtx, mediaCtx.destination);
110
- }
111
- attached.add(element);
112
- mediaCtx.createMediaElementSource(element).connect(mediaTap);
113
- if (mediaCtx.state === "suspended") mediaCtx.resume();
114
- } catch (error) {
115
- // Cross-origin media without CORS headers taints the graph; leave the
116
- // element alone so at least the picture keeps playing.
117
- }
118
- }
119
- document.addEventListener("play", function(event){
120
- var target = event.target;
121
- if (target && (target.tagName === "AUDIO" || target.tagName === "VIDEO")) attach(target);
122
- }, true);
123
-
124
- // Installing the tap after a session was opened must still recover media
125
- // whose play event already fired. The pre-navigation install is the normal
126
- // path; this scan is the fallback for reused sessions and dynamically added
127
- // elements that began playing before they entered the document.
128
- function attachPlaying(root){
129
- if (!root) return;
130
- if ((root.tagName === "AUDIO" || root.tagName === "VIDEO") && !root.paused && !root.ended) attach(root);
131
- if (typeof root.querySelectorAll !== "function") return;
132
- var media = root.querySelectorAll("audio,video");
133
- for (var i = 0; i < media.length; i++) {
134
- if (!media[i].paused && !media[i].ended) attach(media[i]);
135
- }
136
- }
137
- attachPlaying(document);
138
- if (window.MutationObserver) {
139
- new MutationObserver(function(records){
140
- for (var i = 0; i < records.length; i++) {
141
- for (var j = 0; j < records[i].addedNodes.length; j++) attachPlaying(records[i].addedNodes[j]);
142
- }
143
- }).observe(document.documentElement || document, { childList: true, subtree: true });
144
- }
25
+ return `(function(){
26
+ if (window.__flujoAudioTap) { window.__flujoAudioMuted = ${muted}; return; }
27
+ var NativeCtx = window.AudioContext || window.webkitAudioContext;
28
+ if (!NativeCtx) return;
29
+ window.__flujoAudioTap = true;
30
+ window.__flujoAudioMuted = ${muted};
31
+ var CHUNK = 4096;
32
+ var SILENCE = 1 / 32768;
33
+
34
+ function encode(bytes){
35
+ var out = "", step = 0x8000;
36
+ for (var i = 0; i < bytes.length; i += step) {
37
+ out += String.fromCharCode.apply(null, bytes.subarray(i, i + step));
38
+ }
39
+ return btoa(out);
40
+ }
41
+
42
+ /** Insert a silent recorder between a context's graph and its real output. */
43
+ function tap(ctx, output){
44
+ var input = ctx.createGain();
45
+ var processor = ctx.createScriptProcessor(CHUNK, 2, 2);
46
+ processor.onaudioprocess = function(event){
47
+ var send = window.${binding};
48
+ if (window.__flujoAudioMuted || typeof send !== "function") return;
49
+ var buffer = event.inputBuffer;
50
+ var frames = buffer.length;
51
+ var left = buffer.getChannelData(0);
52
+ var right = buffer.numberOfChannels > 1 ? buffer.getChannelData(1) : left;
53
+ var pcm = new Int16Array(frames * 2);
54
+ var silent = true;
55
+ for (var i = 0; i < frames; i++) {
56
+ var a = left[i], b = right[i];
57
+ if (a > 1) a = 1; else if (a < -1) a = -1;
58
+ if (b > 1) b = 1; else if (b < -1) b = -1;
59
+ if (silent && (a > SILENCE || a < -SILENCE || b > SILENCE || b < -SILENCE)) silent = false;
60
+ pcm[i * 2] = a * 32767;
61
+ pcm[i * 2 + 1] = b * 32767;
62
+ }
63
+ // Digital silence is the common case on a normal page; never spend
64
+ // bandwidth or CDP round trips on it.
65
+ if (silent) return;
66
+ try {
67
+ send(JSON.stringify({ rate: ctx.sampleRate, pcm: encode(new Uint8Array(pcm.buffer)) }));
68
+ } catch (error) {
69
+ window.__flujoAudioMuted = true;
70
+ }
71
+ };
72
+ input.connect(processor);
73
+ // A ScriptProcessor only runs while it is reachable from the destination.
74
+ // Its own output stays silent because onaudioprocess never writes one.
75
+ processor.connect(output);
76
+ return input;
77
+ }
78
+
79
+ // 1) Pages with their own AudioContext.
80
+ function patch(Ctor){
81
+ if (typeof Ctor !== "function") return Ctor;
82
+ function Patched(){
83
+ var ctx = new (Function.prototype.bind.apply(Ctor, [null].concat([].slice.call(arguments))))();
84
+ try {
85
+ var input = tap(ctx, ctx.destination);
86
+ input.maxChannelCount = ctx.destination.maxChannelCount;
87
+ Object.defineProperty(ctx, "destination", {
88
+ configurable: true,
89
+ get: function(){ return input; }
90
+ });
91
+ } catch (error) { /* an untappable context still plays normally */ }
92
+ return ctx;
93
+ }
94
+ Patched.prototype = Ctor.prototype;
95
+ return Patched;
96
+ }
97
+ try {
98
+ if (window.AudioContext) window.AudioContext = patch(window.AudioContext);
99
+ if (window.webkitAudioContext) window.webkitAudioContext = patch(window.webkitAudioContext);
100
+ } catch (error) { /* frozen globals: media elements below still work */ }
101
+
102
+ // 2) Plain media elements, routed into one shared context on first play.
103
+ var mediaCtx, mediaTap, attached = new WeakSet();
104
+ function attach(element){
105
+ if (attached.has(element)) return;
106
+ try {
107
+ if (!mediaCtx) {
108
+ mediaCtx = new NativeCtx();
109
+ mediaTap = tap(mediaCtx, mediaCtx.destination);
110
+ }
111
+ attached.add(element);
112
+ mediaCtx.createMediaElementSource(element).connect(mediaTap);
113
+ if (mediaCtx.state === "suspended") mediaCtx.resume();
114
+ } catch (error) {
115
+ // Cross-origin media without CORS headers taints the graph; leave the
116
+ // element alone so at least the picture keeps playing.
117
+ }
118
+ }
119
+ document.addEventListener("play", function(event){
120
+ var target = event.target;
121
+ if (target && (target.tagName === "AUDIO" || target.tagName === "VIDEO")) attach(target);
122
+ }, true);
123
+
124
+ // Installing the tap after a session was opened must still recover media
125
+ // whose play event already fired. The pre-navigation install is the normal
126
+ // path; this scan is the fallback for reused sessions and dynamically added
127
+ // elements that began playing before they entered the document.
128
+ function attachPlaying(root){
129
+ if (!root) return;
130
+ if ((root.tagName === "AUDIO" || root.tagName === "VIDEO") && !root.paused && !root.ended) attach(root);
131
+ if (typeof root.querySelectorAll !== "function") return;
132
+ var media = root.querySelectorAll("audio,video");
133
+ for (var i = 0; i < media.length; i++) {
134
+ if (!media[i].paused && !media[i].ended) attach(media[i]);
135
+ }
136
+ }
137
+ attachPlaying(document);
138
+ if (window.MutationObserver) {
139
+ new MutationObserver(function(records){
140
+ for (var i = 0; i < records.length; i++) {
141
+ for (var j = 0; j < records[i].addedNodes.length; j++) attachPlaying(records[i].addedNodes[j]);
142
+ }
143
+ }).observe(document.documentElement || document, { childList: true, subtree: true });
144
+ }
145
145
  })();`;
146
146
  }
147
147
  //# sourceMappingURL=audioTap.js.map
package/dist/capture.js CHANGED
@@ -280,46 +280,46 @@ export async function captureRegionPng(page, source, region, timeoutMs) {
280
280
  * passed as *data* arguments only — never string-concatenated into code — so
281
281
  * this cannot become a general JS-evaluate primitive (D4).
282
282
  */
283
- const ELEMENT_METRICS_SCRIPT = `(function(selectors){
284
- function overflowClass(value, scrollSize, clientSize){
285
- if (value === "visible") return "visible";
286
- if (scrollSize > clientSize) return value === "scroll" ? "scroll" : "clipped";
287
- return value;
288
- }
289
- return selectors.map(function(selector){
290
- var el = document.querySelector(selector);
291
- if (!el) return { selector: selector, found: false };
292
- var rect = el.getBoundingClientRect();
293
- var style = window.getComputedStyle(el);
294
- var viewportW = window.innerWidth, viewportH = window.innerHeight;
295
- var isVisible = style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
296
- var isInViewport = rect.top < viewportH && rect.bottom > 0 && rect.left < viewportW && rect.right > 0;
297
- return {
298
- selector: selector,
299
- found: true,
300
- boundingBox: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },
301
- clientRect: { top: rect.top, left: rect.left, right: rect.right, bottom: rect.bottom, width: rect.width, height: rect.height },
302
- scrollWidth: el.scrollWidth,
303
- scrollHeight: el.scrollHeight,
304
- isVisible: isVisible,
305
- isInViewport: isInViewport,
306
- overflowX: overflowClass(style.overflowX, el.scrollWidth, el.clientWidth),
307
- overflowY: overflowClass(style.overflowY, el.scrollHeight, el.clientHeight),
308
- textOverflow: el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight,
309
- actionSafe: isVisible && isInViewport,
310
- computed: {
311
- fontSize: style.fontSize,
312
- lineHeight: style.lineHeight,
313
- color: style.color,
314
- backgroundColor: style.backgroundColor,
315
- opacity: style.opacity,
316
- zIndex: style.zIndex,
317
- transform: style.transform,
318
- display: style.display,
319
- position: style.position,
320
- },
321
- };
322
- });
283
+ const ELEMENT_METRICS_SCRIPT = `(function(selectors){
284
+ function overflowClass(value, scrollSize, clientSize){
285
+ if (value === "visible") return "visible";
286
+ if (scrollSize > clientSize) return value === "scroll" ? "scroll" : "clipped";
287
+ return value;
288
+ }
289
+ return selectors.map(function(selector){
290
+ var el = document.querySelector(selector);
291
+ if (!el) return { selector: selector, found: false };
292
+ var rect = el.getBoundingClientRect();
293
+ var style = window.getComputedStyle(el);
294
+ var viewportW = window.innerWidth, viewportH = window.innerHeight;
295
+ var isVisible = style.visibility !== "hidden" && style.display !== "none" && rect.width > 0 && rect.height > 0;
296
+ var isInViewport = rect.top < viewportH && rect.bottom > 0 && rect.left < viewportW && rect.right > 0;
297
+ return {
298
+ selector: selector,
299
+ found: true,
300
+ boundingBox: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },
301
+ clientRect: { top: rect.top, left: rect.left, right: rect.right, bottom: rect.bottom, width: rect.width, height: rect.height },
302
+ scrollWidth: el.scrollWidth,
303
+ scrollHeight: el.scrollHeight,
304
+ isVisible: isVisible,
305
+ isInViewport: isInViewport,
306
+ overflowX: overflowClass(style.overflowX, el.scrollWidth, el.clientWidth),
307
+ overflowY: overflowClass(style.overflowY, el.scrollHeight, el.clientHeight),
308
+ textOverflow: el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight,
309
+ actionSafe: isVisible && isInViewport,
310
+ computed: {
311
+ fontSize: style.fontSize,
312
+ lineHeight: style.lineHeight,
313
+ color: style.color,
314
+ backgroundColor: style.backgroundColor,
315
+ opacity: style.opacity,
316
+ zIndex: style.zIndex,
317
+ transform: style.transform,
318
+ display: style.display,
319
+ position: style.position,
320
+ },
321
+ };
322
+ });
323
323
  })`;
324
324
  export async function evaluateElementMetrics(page, selectors) {
325
325
  return page.evaluate(ELEMENT_METRICS_SCRIPT, selectors);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import './node-runtime-preflight.mjs';
2
3
  export * from './tools.js';
3
4
  export * from './resources.js';
4
5
  export * from './runtime.js';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import './node-runtime-preflight.mjs';
2
3
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
4
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
5
  import { CallToolRequestSchema, ListResourceTemplatesRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,kCAAkC,EAClC,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,sBAA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CAAC,CAAC;IACzH,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import { assertSupportedNodeRuntime } from './node-runtime.mjs';
2
+
3
+ // Entry points import this before dependencies can initialize private state.
4
+ try {
5
+ assertSupportedNodeRuntime();
6
+ } catch (error) {
7
+ if (error.code !== 'UNSUPPORTED_NODE_RUNTIME') throw error;
8
+ // MCP stdout belongs to the protocol. Never prompt or emit a stack trace here.
9
+ console.error(`[FLUJO] ${error.code}: ${error.message}`);
10
+ process.exit(1);
11
+ }
@@ -0,0 +1,39 @@
1
+ /** The public app and MCP packages share the October 2026 security runtime floor. */
2
+ export const SUPPORTED_NODE_RANGE = '^22.23.4 || ^24.22.1';
3
+
4
+ export function nodeRuntimeDiagnostic(version = process.versions.node, executable = process.execPath) {
5
+ const displayVersion = typeof version === 'string' && /^v?\d+\.\d+\.\d+$/.test(version)
6
+ ? `v${version.replace(/^v/, '').slice(0, 64)}` : 'an unrecognized version';
7
+ const displayPath = String(executable).replace(/[\x00-\x1f\x7f-\x9f]/g, '?').slice(0, 512);
8
+ return `FLUJO cannot start with Node.js ${displayVersion}.\nActive executable: ${displayPath}\n`
9
+ + 'Use a current patched release of Node.js 22.x (22.23.4+) or 24.x (24.22.1+) to include the October 2026 security fixes.';
10
+ }
11
+
12
+ export function nodeRuntimeManualSteps(platform = process.platform) {
13
+ return [
14
+ 'Manual update:',
15
+ ' 1. Install a current patched Node.js 22.x or 24.x from https://nodejs.org/en/download.',
16
+ ...(platform === 'win32'
17
+ ? [' With Windows Package Manager: winget install --id OpenJS.NodeJS.22 --exact --source winget']
18
+ : [' If you use nvm: nvm install 22 && nvm use 22']),
19
+ ' 2. Close and reopen your terminal, then check: node --version',
20
+ platform === 'win32' ? ' Check the active executable: Get-Command node -All' : ' Check the active executable: command -v node',
21
+ ' 3. If the old version is still active, put the new installation first on PATH or activate it with your Node version manager.',
22
+ ' Retry the same FLUJO or MCP command after a supported version is active.',
23
+ ].join('\n');
24
+ }
25
+
26
+ export function isSupportedNodeRuntime(version) {
27
+ if (typeof version !== 'string' || !/^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(version)) return false;
28
+ const [major, minor, patch] = version.replace(/^v/, '').split('.').map(Number);
29
+ if (![major, minor, patch].every((part) => Number.isSafeInteger(part) && part <= 2_147_483_647)) return false;
30
+ return (major === 22 && (minor > 23 || (minor === 23 && patch >= 4)))
31
+ || (major === 24 && (minor > 22 || (minor === 22 && patch >= 1)));
32
+ }
33
+
34
+ export function assertSupportedNodeRuntime(version = process.versions.node) {
35
+ if (isSupportedNodeRuntime(version)) return;
36
+ const error = new Error(`${nodeRuntimeDiagnostic(version)}\n\n${nodeRuntimeManualSteps()}`);
37
+ error.code = 'UNSUPPORTED_NODE_RUNTIME';
38
+ throw error;
39
+ }