@makerbi/remodex 2.3.0 → 2.3.1

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 +23 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makerbi/remodex",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Local bridge between Codex and the Remodex mobile app. Run `remodex up` to start.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/bridge.js CHANGED
@@ -148,6 +148,25 @@ const RELAY_TURNS_LIST_PREVIOUS_PAGINATION_RESULT_KEYS = new Set([
148
148
  "previousCursor",
149
149
  "previous_cursor",
150
150
  ]);
151
+
152
+ function buildRelayUserAgentHeader({ version = bridgePackageVersion } = {}) {
153
+ const normalizedVersion = typeof version === "string" && version.trim()
154
+ ? version.trim().replace(/\s+/g, "-")
155
+ : "dev";
156
+ return `RemodexBridge/${normalizedVersion}`;
157
+ }
158
+
159
+ function buildRelayAccessTokenHeaders(config = {}, env = process.env) {
160
+ const token = normalizeNonEmptyString(
161
+ config.relayAccessToken
162
+ || env.REMODEX_RELAY_ACCESS_TOKEN
163
+ || env.PHODEX_RELAY_ACCESS_TOKEN
164
+ );
165
+ return token
166
+ ? { "x-remodex-relay-token": token }
167
+ : {};
168
+ }
169
+
151
170
  const jsonlArtifactItemsCacheByThread = new Map();
152
171
  const jsonlThreadCwdCacheByThread = new Map();
153
172
  const FORWARDED_REQUEST_METHODS_MAX_SIZE = 500;
@@ -1078,8 +1097,10 @@ function startBridge({
1078
1097
  },
1079
1098
  // The relay uses this per-session secret to authenticate the first push registration.
1080
1099
  headers: {
1100
+ "User-Agent": buildRelayUserAgentHeader(),
1081
1101
  "x-role": "mac",
1082
1102
  "x-notification-secret": notificationSecret,
1103
+ ...buildRelayAccessTokenHeaders(config),
1083
1104
  ...buildMacRegistrationHeaders(deviceState, pairingSession),
1084
1105
  },
1085
1106
  });
@@ -5090,6 +5111,8 @@ function shouldSuppressRolloutMirrorForThread(
5090
5111
  module.exports = {
5091
5112
  buildThreadTurnsListRelaySanitizeContext,
5092
5113
  buildHeartbeatBridgeStatus,
5114
+ buildRelayAccessTokenHeaders,
5115
+ buildRelayUserAgentHeader,
5093
5116
  canonicalThreadTurnsListRequest,
5094
5117
  createMacOSBridgeWakeAssertion,
5095
5118
  createThreadTurnsListFastPageCoordinator,