Changesets · Branches · Tags · Compare
| Changeset | 79e9aa43867eaa7618a0e384a6a7e3da831df8bf7d9a5d7a7b33f3ed8455d92d |
|---|---|
| Author | Tomasz Stefaniak <tomasz.p.stefaniak@gmail.com> · 2025-06-30 10:43 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-06-30 10:43 -07:00 |
| Parents | 483c37bb84f4, a10cd9114232 |
8 files changed
modified packages/fetch/package-lock.json +2 −2
| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | { |
| 2 | 2 | "name": "@continuedev/fetch", |
| 3 | - "version": "1.0.13", | |
| 3 | + "version": "1.0.15", | |
| 4 | 4 | "lockfileVersion": 3, |
| 5 | 5 | "requires": true, |
| 6 | 6 | "packages": { |
| 7 | 7 | "": { |
| 8 | 8 | "name": "@continuedev/fetch", |
| 9 | - "version": "1.0.13", | |
| 9 | + "version": "1.0.15", | |
| 10 | 10 | "license": "Apache-2.0", |
| 11 | 11 | "dependencies": { |
| 12 | 12 | "@continuedev/config-types": "^1.0.5", |
modified packages/fetch/package.json +1 −1
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | { |
| 2 | 2 | "name": "@continuedev/fetch", |
| 3 | - "version": "1.0.14", | |
| 3 | + "version": "1.0.15", | |
| 4 | 4 | "description": "", |
| 5 | 5 | "main": "dist/index.js", |
| 6 | 6 | "types": "dist/index.d.ts", |
modified packages/fetch/src/fetch.ts +2 −2
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | import { HttpsProxyAgent } from "https-proxy-agent"; |
| 5 | 5 | import { BodyInit, RequestInit, Response } from "node-fetch"; |
| 6 | 6 | import { getAgentOptions } from "./getAgentOptions.js"; |
| 7 | -import fetch from "./node-fetch-patch.js"; | |
| 7 | +import patchedFetch from "./node-fetch-patch.js"; | |
| 8 | 8 | import { getProxy, shouldBypassProxy } from "./util.js"; |
| 9 | 9 | |
| 10 | 10 | const { http, https } = (followRedirects as any).default; |
| @@ -144,7 +144,7 @@ | ||
| 144 | 144 | |
| 145 | 145 | // fetch the request with the provided options |
| 146 | 146 | try { |
| 147 | - const resp = await fetch(url, { | |
| 147 | + const resp = await patchedFetch(url, { | |
| 148 | 148 | ...init, |
| 149 | 149 | body: finalBody, |
| 150 | 150 | headers: headers, |
modified packages/fetch/src/index.ts +3 −0
| @@ -5,10 +5,13 @@ | ||
| 5 | 5 | toAsyncIterable, |
| 6 | 6 | } from "./stream.js"; |
| 7 | 7 | |
| 8 | +import patchedFetch from "./node-fetch-patch.js"; | |
| 9 | + | |
| 8 | 10 | import { fetchwithRequestOptions } from "./fetch.js"; |
| 9 | 11 | |
| 10 | 12 | export { |
| 11 | 13 | fetchwithRequestOptions, |
| 14 | + patchedFetch, | |
| 12 | 15 | streamJSON, |
| 13 | 16 | streamResponse, |
| 14 | 17 | streamSse, |
modified packages/openai-adapters/package-lock.json +7 −6
| @@ -1,17 +1,17 @@ | ||
| 1 | 1 | { |
| 2 | 2 | "name": "@continuedev/openai-adapters", |
| 3 | - "version": "1.0.42", | |
| 3 | + "version": "1.0.44", | |
| 4 | 4 | "lockfileVersion": 3, |
| 5 | 5 | "requires": true, |
| 6 | 6 | "packages": { |
| 7 | 7 | "": { |
| 8 | 8 | "name": "@continuedev/openai-adapters", |
| 9 | - "version": "1.0.42", | |
| 9 | + "version": "1.0.44", | |
| 10 | 10 | "license": "Apache-2.0", |
| 11 | 11 | "dependencies": { |
| 12 | 12 | "@continuedev/config-types": "^1.0.5", |
| 13 | 13 | "@continuedev/config-yaml": "^1.0.51", |
| 14 | - "@continuedev/fetch": "^1.0.11", | |
| 14 | + "@continuedev/fetch": "^1.0.15", | |
| 15 | 15 | "dotenv": "^16.5.0", |
| 16 | 16 | "json-schema": "^0.4.0", |
| 17 | 17 | "node-fetch": "^3.3.2", |
| @@ -595,9 +595,10 @@ | ||
| 595 | 595 | } |
| 596 | 596 | }, |
| 597 | 597 | "node_modules/@continuedev/fetch": { |
| 598 | - "version": "1.0.11", | |
| 599 | - "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.11.tgz", | |
| 600 | - "integrity": "sha512-GRYqAdV3DhRxg463zeSzOdVIk/bhjuuxAxzX0fG35Kz6sHUsU2wr7SDY91zO2ataYUkjnbOa3q1xIpnRnOoRHA==", | |
| 598 | + "version": "1.0.15", | |
| 599 | + "resolved": "https://registry.npmjs.org/@continuedev/fetch/-/fetch-1.0.15.tgz", | |
| 600 | + "integrity": "sha512-49jLwAwAOczcFLfa2Og9+c+qxrq+Z6+p+B5BbXgHENrQIsuST1liKTXEiga5gSVAyHD+m+1Ftl4jqRq2oxMngw==", | |
| 601 | + "license": "Apache-2.0", | |
| 601 | 602 | "dependencies": { |
| 602 | 603 | "@continuedev/config-types": "^1.0.5", |
| 603 | 604 | "follow-redirects": "^1.15.6", |
modified packages/openai-adapters/package.json +2 −2
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | { |
| 2 | 2 | "name": "@continuedev/openai-adapters", |
| 3 | - "version": "1.0.42", | |
| 3 | + "version": "1.0.44", | |
| 4 | 4 | "description": "", |
| 5 | 5 | "main": "dist/index.js", |
| 6 | 6 | "types": "dist/index.d.ts", |
| @@ -14,7 +14,7 @@ | ||
| 14 | 14 | "dependencies": { |
| 15 | 15 | "@continuedev/config-types": "^1.0.5", |
| 16 | 16 | "@continuedev/config-yaml": "^1.0.51", |
| 17 | - "@continuedev/fetch": "^1.0.11", | |
| 17 | + "@continuedev/fetch": "^1.0.15", | |
| 18 | 18 | "dotenv": "^16.5.0", |
| 19 | 19 | "json-schema": "^0.4.0", |
| 20 | 20 | "node-fetch": "^3.3.2", |
modified packages/openai-adapters/src/apis/Relace.ts +1 −2
| @@ -67,7 +67,6 @@ | ||
| 67 | 67 | body: ChatCompletionCreateParamsStreaming, |
| 68 | 68 | signal: AbortSignal, |
| 69 | 69 | ): AsyncGenerator<ChatCompletionChunk> { |
| 70 | - const fetch = customFetch(this.config.requestOptions); | |
| 71 | 70 | const headers = { |
| 72 | 71 | "Content-Type": "application/json", |
| 73 | 72 | Authorization: `Bearer ${this.config.apiKey}`, |
| @@ -98,7 +97,7 @@ | ||
| 98 | 97 | }; |
| 99 | 98 | |
| 100 | 99 | const url = this.apiBase + "code/apply"; |
| 101 | - const response = await fetch(url, { | |
| 100 | + const response = await customFetch(this.config.requestOptions)(url, { | |
| 102 | 101 | method: "POST", |
| 103 | 102 | headers, |
| 104 | 103 | body: JSON.stringify(data), |
modified packages/openai-adapters/src/util.ts +16 −4
| @@ -1,11 +1,13 @@ | ||
| 1 | 1 | import { RequestOptions } from "@continuedev/config-types"; |
| 2 | -import { fetchwithRequestOptions } from "@continuedev/fetch"; | |
| 2 | +import { fetchwithRequestOptions, patchedFetch } from "@continuedev/fetch"; | |
| 3 | +import { type RequestInfo, type RequestInit } from "openai/_shims/index"; | |
| 3 | 4 | import { |
| 4 | 5 | ChatCompletionChunk, |
| 5 | 6 | CompletionUsage, |
| 6 | 7 | CreateEmbeddingResponse, |
| 7 | 8 | Model, |
| 8 | 9 | } from "openai/resources/index"; |
| 10 | + | |
| 9 | 11 | import { ChatCompletion } from "openai/src/resources/index.js"; |
| 10 | 12 | import { CreateRerankResponse } from "./apis/base.js"; |
| 11 | 13 | |
| @@ -136,7 +138,17 @@ | ||
| 136 | 138 | }; |
| 137 | 139 | } |
| 138 | 140 | |
| 139 | -export function customFetch(requestOptions: RequestOptions | undefined) { | |
| 140 | - return (url: any, init: any) => | |
| 141 | - fetchwithRequestOptions(url, init, requestOptions); | |
| 141 | +export function customFetch( | |
| 142 | + requestOptions: RequestOptions | undefined, | |
| 143 | +): typeof patchedFetch { | |
| 144 | + if (process.env.FEATURE_FLAG_DISABLE_CUSTOM_FETCH) { | |
| 145 | + return patchedFetch; | |
| 146 | + } | |
| 147 | + return (req: URL | RequestInfo, init?: RequestInit) => { | |
| 148 | + if (typeof req === "string" || req instanceof URL) { | |
| 149 | + return fetchwithRequestOptions(req, init, requestOptions); | |
| 150 | + } else { | |
| 151 | + return fetchwithRequestOptions(req.url, req, requestOptions); | |
| 152 | + } | |
| 153 | + }; | |
| 142 | 154 | } |