headroom-opencode 0.39.0 → 0.40.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.
@@ -134,6 +134,9 @@ function injectOptionsEnv(args, optionIndex, state) {
134
134
  const callback = typeof nextArgs.at(-1) === "function" ? nextArgs.pop() : void 0;
135
135
  const existing = isOptions(nextArgs[optionIndex]) ? { ...nextArgs[optionIndex] } : {};
136
136
  existing.env = withShimEnv(existing.env, state.proxyUrl, state.excludeHosts);
137
+ if (process.platform === "win32" && existing.windowsHide === void 0) {
138
+ existing.windowsHide = true;
139
+ }
137
140
  if (isOptions(nextArgs[optionIndex])) {
138
141
  nextArgs[optionIndex] = existing;
139
142
  } else {
@@ -204,6 +207,9 @@ function isExcludedHost(hostname3, excludeHosts) {
204
207
  const normalized = hostname3.toLowerCase().replace(/^\[|\]$/g, "");
205
208
  return excludeHosts.some((host) => normalized === host || normalized.endsWith(`.${host}`));
206
209
  }
210
+ function isLlmEndpointPath(pathname) {
211
+ return pathname.endsWith("/chat/completions") || pathname.endsWith("/responses") || pathname.endsWith("/messages") || pathname.endsWith(":generateContent") || pathname.endsWith(":streamGenerateContent");
212
+ }
207
213
  function shouldRoute(url2, proxy, excludeHosts) {
208
214
  if (url2.protocol !== "http:" && url2.protocol !== "https:") {
209
215
  return false;
@@ -217,7 +223,7 @@ function shouldRoute(url2, proxy, excludeHosts) {
217
223
  if (isExcludedHost(url2.hostname, excludeHosts)) {
218
224
  return false;
219
225
  }
220
- return true;
226
+ return isLlmEndpointPath(url2.pathname);
221
227
  }
222
228
  function routedUrl(upstream, proxy) {
223
229
  return new URL(`${upstream.pathname}${upstream.search}`, proxy.origin);
@@ -399,18 +405,8 @@ function wrapGet(request) {
399
405
  };
400
406
  }
401
407
  function wrapHttp2Connect(originalConnect) {
402
- return function headroomHttp2Connect(authority, ...args) {
403
- const state = getState();
404
- if (state) {
405
- const proxy = normalizeProxyUrl(state.proxyUrl);
406
- const upstream = authority instanceof URL ? authority : new URL(String(authority));
407
- if (shouldRoute(upstream, proxy, state.excludeHosts)) {
408
- throw new Error(
409
- `Headroom OpenCode wrap blocked direct HTTP/2 connection to ${upstream.origin}. Use fetch, http, or https so traffic can be routed through Headroom.`
410
- );
411
- }
412
- }
413
- return Reflect.apply(originalConnect, this, [authority, ...args]);
408
+ return function headroomHttp2Connect(...args) {
409
+ return Reflect.apply(originalConnect, this, args);
414
410
  };
415
411
  }
416
412
  function installHeadroomTransport(options) {
@@ -12963,4 +12959,4 @@ export {
12963
12959
  HeadroomPlugin,
12964
12960
  plugin_default
12965
12961
  };
12966
- //# sourceMappingURL=chunk-6I5ODRCW.js.map
12962
+ //# sourceMappingURL=chunk-RFZCFX4B.js.map