@pure01fx/dsh-openai-codex-auth 0.10.1 → 0.11.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 +12 -0
- package/README.md +3 -1
- package/client.js +115 -2
- package/lib/catalog.js +2 -7
- package/lib/cloud-context.d.ts +1 -1
- package/lib/cloud-context.js +3 -6
- package/lib/cloud-http.d.ts +0 -3
- package/lib/cloud-http.js +3 -12
- package/lib/cloud-images.d.ts +2 -3
- package/lib/cloud-images.js +9 -14
- package/lib/cloud-media.js +9 -12
- package/lib/cloud-search.d.ts +1 -1
- package/lib/cloud-search.js +11 -30
- package/lib/cloud-tools.js +2 -2
- package/lib/cloud-vision.js +2 -10
- package/lib/cloud-web-tool.js +11 -21
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -0
- package/lib/native-http.d.ts +4 -5
- package/lib/native-http.js +43 -25
- package/lib/native-websocket-session.js +1 -3
- package/lib/native-websocket-socket.d.ts +2 -1
- package/lib/native-websocket-socket.js +22 -31
- package/lib/native-websocket.d.ts +1 -2
- package/lib/native-websocket.js +53 -46
- package/lib/network-telemetry.d.ts +61 -0
- package/lib/network-telemetry.js +104 -0
- package/lib/replay.d.ts +2 -3
- package/lib/replay.js +13 -43
- package/lib/responses.d.ts +0 -2
- package/lib/responses.js +1 -14
- package/lib/sse.d.ts +1 -3
- package/lib/sse.js +2 -17
- package/package.json +3 -1
package/lib/sse.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Cancellable Server-Sent Events byte framing. */
|
|
2
2
|
import { LlmError } from '@deepseek-ai/dsh-llm';
|
|
3
|
-
export const DEFAULT_MAX_SSE_EVENT_BYTES = 64 * 1024 * 1024;
|
|
4
3
|
function aborted() {
|
|
5
4
|
return new LlmError('native Codex SSE stream was cancelled', 'ABORTED');
|
|
6
5
|
}
|
|
7
|
-
|
|
8
|
-
return new LlmError('native Codex SSE event exceeded the size limit', 'SSE_EVENT_TOO_LARGE');
|
|
9
|
-
}
|
|
10
|
-
/** Decode a byte stream into bounded SSE frames. */
|
|
6
|
+
/** Decode a byte stream into SSE frames. */
|
|
11
7
|
export async function* parseSse(stream, options = {}) {
|
|
12
|
-
const limit = options.maxEventBytes ?? DEFAULT_MAX_SSE_EVENT_BYTES;
|
|
13
|
-
if (!Number.isSafeInteger(limit) || limit <= 0) {
|
|
14
|
-
throw new LlmError('native Codex SSE size limit is invalid', 'INVALID_CONFIG');
|
|
15
|
-
}
|
|
16
8
|
if (options.signal?.aborted === true)
|
|
17
9
|
throw aborted();
|
|
18
10
|
const reader = stream.getReader();
|
|
@@ -20,7 +12,6 @@ export async function* parseSse(stream, options = {}) {
|
|
|
20
12
|
let pending = '';
|
|
21
13
|
let dataLines = [];
|
|
22
14
|
let eventName;
|
|
23
|
-
let eventBytes = 0;
|
|
24
15
|
let cancelled = false;
|
|
25
16
|
const onAbort = () => {
|
|
26
17
|
cancelled = true;
|
|
@@ -39,8 +30,6 @@ export async function* parseSse(stream, options = {}) {
|
|
|
39
30
|
options.onActivity?.();
|
|
40
31
|
options.onBytes?.(value.byteLength);
|
|
41
32
|
pending += decoder.decode(value, { stream: true });
|
|
42
|
-
if (Buffer.byteLength(pending) > limit && !pending.includes('\n'))
|
|
43
|
-
throw tooLarge();
|
|
44
33
|
let newline = pending.indexOf('\n');
|
|
45
34
|
while (newline >= 0) {
|
|
46
35
|
let line = pending.slice(0, newline);
|
|
@@ -57,12 +46,8 @@ export async function* parseSse(stream, options = {}) {
|
|
|
57
46
|
}
|
|
58
47
|
dataLines = [];
|
|
59
48
|
eventName = undefined;
|
|
60
|
-
eventBytes = 0;
|
|
61
49
|
continue;
|
|
62
50
|
}
|
|
63
|
-
eventBytes += Buffer.byteLength(line) + 1;
|
|
64
|
-
if (eventBytes > limit)
|
|
65
|
-
throw tooLarge();
|
|
66
51
|
if (line.startsWith(':'))
|
|
67
52
|
options.onActivity?.();
|
|
68
53
|
else if (line.startsWith('data:'))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pure01fx/dsh-openai-codex-auth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Native ChatGPT Codex provider, device-code-first login, and same-origin Web integration for DeepSeek Harness",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
"lib/native-adapter.d.ts",
|
|
42
42
|
"lib/native-http.js",
|
|
43
43
|
"lib/native-http.d.ts",
|
|
44
|
+
"lib/network-telemetry.js",
|
|
45
|
+
"lib/network-telemetry.d.ts",
|
|
44
46
|
"lib/native-websocket.js",
|
|
45
47
|
"lib/native-websocket.d.ts",
|
|
46
48
|
"lib/native-websocket-session.js",
|