promethios-bridge 1.2.0 → 1.3.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/package.json +1 -1
- package/src/bridge.js +13 -0
package/package.json
CHANGED
package/src/bridge.js
CHANGED
|
@@ -246,6 +246,15 @@ async function registerBridge({ authToken, apiBase, callbackUrl, port, dev }) {
|
|
|
246
246
|
const deviceId = require('crypto').randomBytes(8).toString('hex');
|
|
247
247
|
const capabilities = getSupportedCapabilities();
|
|
248
248
|
|
|
249
|
+
// Detect OS and shell so the cloud can inject OS-aware guidance into the agent
|
|
250
|
+
const osModule = require('os');
|
|
251
|
+
const platform = process.platform; // 'win32' | 'darwin' | 'linux'
|
|
252
|
+
const shell = platform === 'win32'
|
|
253
|
+
? 'cmd'
|
|
254
|
+
: (process.env.SHELL || '/bin/zsh').split('/').pop();
|
|
255
|
+
const homeDir = osModule.homedir();
|
|
256
|
+
const username = osModule.userInfo().username;
|
|
257
|
+
|
|
249
258
|
const res = await fetch(`${apiBase}/api/local-bridge/register`, {
|
|
250
259
|
method: 'POST',
|
|
251
260
|
headers: {
|
|
@@ -257,6 +266,10 @@ async function registerBridge({ authToken, apiBase, callbackUrl, port, dev }) {
|
|
|
257
266
|
callbackUrl,
|
|
258
267
|
capabilities,
|
|
259
268
|
bridgeVersion: require('../package.json').version,
|
|
269
|
+
os: platform, // 'win32' | 'darwin' | 'linux'
|
|
270
|
+
shell, // 'cmd' | 'zsh' | 'bash' etc.
|
|
271
|
+
homeDir, // e.g. 'C:\\Users\\ted' or '/Users/ted'
|
|
272
|
+
username, // e.g. 'ted'
|
|
260
273
|
}),
|
|
261
274
|
});
|
|
262
275
|
|