promethios-bridge 2.1.2 → 2.1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/bridge.js +26 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promethios-bridge",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Run Promethios agent frameworks locally on your computer with full file, terminal, browser access, ambient context capture, and the always-on-top floating chat overlay. Native Framework Mode supports OpenClaw and other frameworks via the bridge.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/bridge.js CHANGED
@@ -210,6 +210,32 @@ async function startBridge({ setupToken, apiBase, port, dev }) {
210
210
  // Health check
211
211
  app.get('/health', (req, res) => res.json({ ok: true, version: require('../package.json').version }));
212
212
 
213
+ // ── /open-external ─────────────────────────────────────────────────────────
214
+ // POST /open-external?url=<encoded-url>
215
+ // Called by the Promethios web app when the user clicks "Open [Provider] ↗"
216
+ // in a provider thread. Opens the URL in the user's real default browser.
217
+ // No auth required — only accessible from localhost.
218
+ app.post('/open-external', (req, res) => {
219
+ const url = (req.query.url || req.body?.url || '').trim();
220
+ if (!url || !/^https?:\/\//.test(url)) {
221
+ return res.status(400).json({ error: 'Invalid or missing url parameter' });
222
+ }
223
+ const { exec } = require('child_process');
224
+ const platform = process.platform;
225
+ let cmd;
226
+ if (platform === 'win32') {
227
+ cmd = `start "" "${url.replace(/"/g, '')}"`;
228
+ } else if (platform === 'darwin') {
229
+ cmd = `open "${url.replace(/"/g, '')}"`;
230
+ } else {
231
+ cmd = `xdg-open "${url.replace(/"/g, '')}"`;
232
+ }
233
+ exec(cmd, (err) => {
234
+ if (err) console.error('[open-external] Failed to open URL:', err.message);
235
+ });
236
+ res.json({ status: 'ok', url });
237
+ });
238
+
213
239
  // ── /status: used by the Electron overlay to auto-connect without manual token entry ──
214
240
  // Only accessible from localhost (127.0.0.1 or ::1) for security.
215
241
  let bridgeUsername = null; // set after registerBridge resolves