@eddyskywalker/dsh-chatgpt-subscription 0.46.0 → 0.46.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.
- package/CHANGELOG.md +8 -0
- package/lib/client.js.map +1 -1
- package/lib/index.js +28 -3
- package/lib/types/compat.d.ts +1 -1
- package/lib/types/host/responses-client.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -141,7 +141,7 @@ const ROUTE_PREFIX$4 = "/api/dsh-chatgpt-subscription";
|
|
|
141
141
|
* `test/responses-client.test.ts` asserts the two agree, so a release that
|
|
142
142
|
* forgets this constant fails the suite instead of shipping quietly.
|
|
143
143
|
*/
|
|
144
|
-
const PLUGIN_VERSION = "0.46.
|
|
144
|
+
const PLUGIN_VERSION = "0.46.1";
|
|
145
145
|
const CODEX_CHATGPT_PROVIDER_ID = "codex-chatgpt";
|
|
146
146
|
const CODEX_API_BASE = "https://chatgpt.com/backend-api/codex";
|
|
147
147
|
const CODEX_RESPONSES_URL = `${CODEX_API_BASE}/responses`;
|
|
@@ -11585,6 +11585,13 @@ function record$3(value) {
|
|
|
11585
11585
|
//#endregion
|
|
11586
11586
|
//#region src/host/responses-client.ts
|
|
11587
11587
|
const MAX_VISIBLE_REASONING_CHARS = 12e3;
|
|
11588
|
+
/**
|
|
11589
|
+
* A handshake/connect failure happens before any request bytes reach ChatGPT,
|
|
11590
|
+
* so only that narrow family is safe to replay here. Two short retries ride out
|
|
11591
|
+
* the intermittent proxy/VPN paths that otherwise fail a whole model request.
|
|
11592
|
+
*/
|
|
11593
|
+
const PRE_CONNECTION_RETRIES = 2;
|
|
11594
|
+
const PRE_CONNECTION_RETRY_BASE_MS = 400;
|
|
11588
11595
|
/** Cooldown a rotated account takes when the provider states no retry delay. */
|
|
11589
11596
|
const DEFAULT_POOL_COOLDOWN_MS = 15 * 6e4;
|
|
11590
11597
|
const REASONING_DELTA_FLUSH_CHARS = 768;
|
|
@@ -11802,7 +11809,7 @@ var ResponsesClient = class {
|
|
|
11802
11809
|
}
|
|
11803
11810
|
}
|
|
11804
11811
|
async request(payload, credentials, sessionId, turnKey, signal) {
|
|
11805
|
-
try {
|
|
11812
|
+
for (let attempt = 0;; attempt += 1) try {
|
|
11806
11813
|
return await this.fetchFn(CODEX_RESPONSES_URL, {
|
|
11807
11814
|
method: "POST",
|
|
11808
11815
|
headers: {
|
|
@@ -11815,12 +11822,30 @@ var ResponsesClient = class {
|
|
|
11815
11822
|
});
|
|
11816
11823
|
} catch (cause) {
|
|
11817
11824
|
if (signal?.aborted) throw signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
11825
|
+
if (attempt < PRE_CONNECTION_RETRIES && isPreConnectionFailure$2(cause)) {
|
|
11826
|
+
try {
|
|
11827
|
+
await setTimeout$1(PRE_CONNECTION_RETRY_BASE_MS * (attempt + 1), void 0, { signal });
|
|
11828
|
+
} catch (waitError) {
|
|
11829
|
+
if (signal?.aborted) throw signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
11830
|
+
throw waitError;
|
|
11831
|
+
}
|
|
11832
|
+
continue;
|
|
11833
|
+
}
|
|
11818
11834
|
const chain = errorChain(cause).trim();
|
|
11819
|
-
throw new LlmError(`Codex request failed: ${chain === "" ? "the connection failed before any response arrived" : chain.slice(0, 500)}`, "NETWORK", { cause });
|
|
11835
|
+
throw new LlmError(`Codex request failed: ${chain === "" ? "the connection failed before any response arrived" : chain.slice(0, 500)}${isPreConnectionFailure$2(cause) ? " The request never reached ChatGPT. Check the network, proxy/VPN/TUN, or the plugin proxy settings." : ""}`, "NETWORK", { cause });
|
|
11820
11836
|
}
|
|
11821
11837
|
}
|
|
11822
11838
|
};
|
|
11823
11839
|
/**
|
|
11840
|
+
* Whether the transport failed before the request could reach ChatGPT.
|
|
11841
|
+
*
|
|
11842
|
+
* Deliberately exclude `ECONNRESET` and generic socket deaths: either can happen
|
|
11843
|
+
* after the server accepted the body, where replaying a POST would be ambiguous.
|
|
11844
|
+
*/
|
|
11845
|
+
function isPreConnectionFailure$2(error) {
|
|
11846
|
+
return /Client network socket disconnected before secure TLS connection|Connect Timeout Error|UND_ERR_CONNECT_TIMEOUT|ECONNREFUSED|ENOTFOUND|EAI_AGAIN|getaddrinfo/i.test(errorChain(error));
|
|
11847
|
+
}
|
|
11848
|
+
/**
|
|
11824
11849
|
* The failure a stream that died mid-body is reported as.
|
|
11825
11850
|
*
|
|
11826
11851
|
* Everything above the response body is already typed — the request path raises
|
package/lib/types/compat.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export declare const ROUTE_PREFIX: "/api/dsh-chatgpt-subscription";
|
|
|
71
71
|
* `test/responses-client.test.ts` asserts the two agree, so a release that
|
|
72
72
|
* forgets this constant fails the suite instead of shipping quietly.
|
|
73
73
|
*/
|
|
74
|
-
export declare const PLUGIN_VERSION: "0.46.
|
|
74
|
+
export declare const PLUGIN_VERSION: "0.46.1";
|
|
75
75
|
export declare const CODEX_CHATGPT_PROVIDER_ID: "codex-chatgpt";
|
|
76
76
|
export { MINIMAX_CODE_PROVIDER_ID, MINIMAX_CODE_ROUTE_PREFIX } from './shared/minimax-code-contracts.ts';
|
|
77
77
|
export declare const CODEX_API_BASE: "https://chatgpt.com/backend-api/codex";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responses-client.d.ts","sourceRoot":"","sources":["../../../src/host/responses-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"responses-client.d.ts","sourceRoot":"","sources":["../../../src/host/responses-client.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EAA0D,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAA;AACvH,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAwD,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