agentic-factory-bridge 1.0.0 → 1.0.4
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/bridge.js +17 -3
- package/package.json +2 -3
package/bridge.js
CHANGED
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
const express = require('express');
|
|
32
32
|
const cors = require('cors');
|
|
33
33
|
const crypto = require('crypto');
|
|
34
|
-
const { v4: uuidv4 } = require('uuid');
|
|
35
34
|
const { spawn } = require('child_process');
|
|
36
35
|
const http = require('http');
|
|
37
36
|
const https = require('https');
|
|
@@ -51,7 +50,7 @@ const OPENCODE_PATH = process.env.OPENCODE_PATH || 'opencode';
|
|
|
51
50
|
const BRIDGE_SECRET = process.env.BRIDGE_SECRET || crypto.randomBytes(32).toString('hex');
|
|
52
51
|
const CORS_ORIGIN =
|
|
53
52
|
process.env.BRIDGE_CORS_ORIGIN ||
|
|
54
|
-
'http://localhost:4200,https://atos-agentic-factory.onrender.com';
|
|
53
|
+
'http://localhost:4200,https://atos-agentic-factory.onrender.com,https://atos-agentic-factory-qzwe.onrender.com';
|
|
55
54
|
|
|
56
55
|
// Rate limiting configuration
|
|
57
56
|
const RATE_LIMITS = {
|
|
@@ -298,6 +297,15 @@ function runOpenCode(prompt, model) {
|
|
|
298
297
|
const app = express();
|
|
299
298
|
|
|
300
299
|
const allowedOrigins = CORS_ORIGIN.split(',').map((o) => o.trim());
|
|
300
|
+
|
|
301
|
+
// Private Network Access (Chrome 94+) — handle preflight BEFORE cors middleware
|
|
302
|
+
app.use((req, res, next) => {
|
|
303
|
+
if (req.method === 'OPTIONS' && req.headers['access-control-request-private-network']) {
|
|
304
|
+
res.set('Access-Control-Allow-Private-Network', 'true');
|
|
305
|
+
}
|
|
306
|
+
next();
|
|
307
|
+
});
|
|
308
|
+
|
|
301
309
|
app.use(
|
|
302
310
|
cors({
|
|
303
311
|
origin: (origin, callback) => {
|
|
@@ -309,6 +317,12 @@ app.use(
|
|
|
309
317
|
}),
|
|
310
318
|
);
|
|
311
319
|
|
|
320
|
+
// Private Network Access — also set on regular responses
|
|
321
|
+
app.use((_req, res, next) => {
|
|
322
|
+
res.set('Access-Control-Allow-Private-Network', 'true');
|
|
323
|
+
next();
|
|
324
|
+
});
|
|
325
|
+
|
|
312
326
|
app.use(express.json({ limit: '1mb' }));
|
|
313
327
|
|
|
314
328
|
app.use((_req, res, next) => {
|
|
@@ -497,7 +511,7 @@ function checkCommandExists(command) {
|
|
|
497
511
|
const versionProc = spawn(command, ['--version'], {
|
|
498
512
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
499
513
|
timeout: 10000,
|
|
500
|
-
shell:
|
|
514
|
+
shell: true,
|
|
501
515
|
});
|
|
502
516
|
let versionOut = '';
|
|
503
517
|
versionProc.stdout.on('data', (d) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-factory-bridge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Local bridge for Atos Agentic Factory — connects the marketplace to OpenCode CLI on your machine",
|
|
5
5
|
"main": "bridge.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"express": "^4.21.0",
|
|
24
|
-
"cors": "^2.8.5"
|
|
25
|
-
"uuid": "^9.0.0"
|
|
24
|
+
"cors": "^2.8.5"
|
|
26
25
|
},
|
|
27
26
|
"engines": {
|
|
28
27
|
"node": ">=18.0.0"
|