@giselles-ai/browser-tool 0.1.20 → 0.1.21

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.
@@ -125,15 +125,13 @@ var RelayClient = class {
125
125
  sessionId;
126
126
  token;
127
127
  timeoutMs;
128
- vercelProtectionBypass;
129
- giselleProtectionBypass;
128
+ extraHeaders;
130
129
  constructor(input) {
131
130
  this.url = trimTrailingSlash(input.url);
132
131
  this.sessionId = input.sessionId;
133
132
  this.token = input.token;
134
133
  this.timeoutMs = input.timeoutMs ?? 2e4;
135
- this.vercelProtectionBypass = input.vercelProtectionBypass?.trim() || null;
136
- this.giselleProtectionBypass = input.giselleProtectionBypass?.trim() || null;
134
+ this.extraHeaders = input.extraHeaders ?? {};
137
135
  }
138
136
  async requestSnapshot(input) {
139
137
  const response = await this.dispatch({
@@ -164,14 +162,9 @@ var RelayClient = class {
164
162
  let response;
165
163
  try {
166
164
  const headers = {
167
- "content-type": "application/json"
165
+ "content-type": "application/json",
166
+ ...this.extraHeaders
168
167
  };
169
- if (this.vercelProtectionBypass) {
170
- headers["x-vercel-protection-bypass"] = this.vercelProtectionBypass;
171
- }
172
- if (this.giselleProtectionBypass) {
173
- headers["x-giselle-protection-bypass"] = this.giselleProtectionBypass;
174
- }
175
168
  response = await fetch(`${this.url}`, {
176
169
  method: "POST",
177
170
  headers,
@@ -217,21 +210,30 @@ var RelayClient = class {
217
210
  return parsedResponse;
218
211
  }
219
212
  };
213
+ function parseRelayHeaders() {
214
+ const raw = process.env.BROWSER_TOOL_RELAY_HEADERS?.trim();
215
+ if (!raw) {
216
+ return {};
217
+ }
218
+ try {
219
+ return JSON.parse(raw);
220
+ } catch {
221
+ console.error(
222
+ "[relay-client] Failed to parse BROWSER_TOOL_RELAY_HEADERS, ignoring."
223
+ );
224
+ return {};
225
+ }
226
+ }
220
227
  function createRelayClientFromEnv() {
221
- const vercelProtectionBypass = process.env.VERCEL_PROTECTION_BYPASS;
222
- const giselleProtectionBypass = process.env.GISELLE_PROTECTION_BYPASS;
223
- console.error(
224
- `[relay-client] VERCEL_PROTECTION_BYPASS=${vercelProtectionBypass?.trim() ? "(set)" : "(unset)"}`
225
- );
228
+ const extraHeaders = parseRelayHeaders();
226
229
  console.error(
227
- `[relay-client] GISELLE_PROTECTION_BYPASS=${giselleProtectionBypass?.trim() ? "(set)" : "(unset)"}`
230
+ `[relay-client] BROWSER_TOOL_RELAY_HEADERS keys=${Object.keys(extraHeaders).join(", ") || "(none)"}`
228
231
  );
229
232
  return new RelayClient({
230
233
  url: requiredEnv("BROWSER_TOOL_RELAY_URL"),
231
234
  sessionId: requiredEnv("BROWSER_TOOL_RELAY_SESSION_ID"),
232
235
  token: requiredEnv("BROWSER_TOOL_RELAY_TOKEN"),
233
- vercelProtectionBypass,
234
- giselleProtectionBypass
236
+ extraHeaders
235
237
  });
236
238
  }
237
239
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giselles-ai/browser-tool",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "Apache-2.0",