@opengeni/codex 0.2.11 → 0.2.15
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/dist/api-client.d.ts +2 -2
- package/dist/fetch.d.ts +13 -5
- package/dist/images.d.ts +34 -0
- package/dist/index.d.ts +17 -16
- package/dist/index.js +316 -62
- package/dist/index.js.map +1 -1
- package/dist/mcp-sanitize.d.ts +1 -1
- package/dist/model-output-truncation.d.ts +1 -1
- package/dist/normalize.d.ts +6 -0
- package/dist/realtime.d.ts +4 -4
- package/dist/refresh.d.ts +1 -1
- package/dist/response-timeout.d.ts +1 -1
- package/dist/usage-normalize.d.ts +1 -1
- package/package.json +2 -1
- package/src/fetch.ts +166 -77
- package/src/images.ts +209 -0
- package/src/index.ts +1 -0
- package/src/mcp-sanitize.ts +12 -8
- package/src/model-output-truncation.ts +7 -1
- package/src/normalize.ts +26 -0
package/dist/api-client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CodexFetch } from "./device-code";
|
|
2
|
-
import { type CodexRateLimitResetConsumeResponse, type CodexRateLimitResetCreditsDetails } from "./reset-credits";
|
|
1
|
+
import type { CodexFetch } from "./device-code.js";
|
|
2
|
+
import { type CodexRateLimitResetConsumeResponse, type CodexRateLimitResetCreditsDetails } from "./reset-credits.js";
|
|
3
3
|
export type CodexAuthHeaders = {
|
|
4
4
|
accessToken: string;
|
|
5
5
|
chatgptAccountId: string | null;
|
package/dist/fetch.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CodexUsageHeaderSnapshot } from "./request-context";
|
|
1
|
+
import { type CodexUsageHeaderSnapshot } from "./request-context.js";
|
|
2
2
|
export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
3
3
|
/**
|
|
4
4
|
* Internal provenance marker copied onto buffered non-OK Codex responses.
|
|
@@ -7,6 +7,14 @@ export type FetchLike = (input: string | URL | Request, init?: RequestInit) => P
|
|
|
7
7
|
* error that happened during the same Codex turn.
|
|
8
8
|
*/
|
|
9
9
|
export declare const CODEX_TRANSPORT_ERROR_HEADER = "x-opengeni-codex-transport-error";
|
|
10
|
+
/** Internal transport handoff; always removed before network I/O. */
|
|
11
|
+
export declare const CODEX_REQUEST_BODY_NORMALIZED_HEADER = "x-opengeni-request-body-normalized";
|
|
12
|
+
/** Internal resolved-model handoff; always removed before network I/O. */
|
|
13
|
+
export declare const CODEX_REQUEST_MODEL_HEADER = "x-opengeni-request-model";
|
|
14
|
+
/** Internal durable request-identity handoff; always removed before network I/O. */
|
|
15
|
+
export declare const CODEX_REQUEST_ID_HEADER = "x-opengeni-request-id";
|
|
16
|
+
/** Internal original response-mode handoff; always removed before network I/O. */
|
|
17
|
+
export declare const CODEX_REQUEST_CALLER_STREAM_HEADER = "x-opengeni-request-caller-stream";
|
|
10
18
|
/** True only for an error produced from this Codex transport's non-OK response. */
|
|
11
19
|
export declare function isCodexTransportError(error: unknown): boolean;
|
|
12
20
|
export type CodexEncryptedArtifactRejection = {
|
|
@@ -67,9 +75,9 @@ export type CodexSseFailureProjection = {
|
|
|
67
75
|
* A provider terminal carried inside an accepted HTTP-200 stream. The OpenAI
|
|
68
76
|
* SDK cannot turn that late terminal into a non-2xx APIError because headers
|
|
69
77
|
* have already been accepted, so the body transform throws this equivalent
|
|
70
|
-
* bounded shape. Provider-supplied message/param text
|
|
71
|
-
*
|
|
72
|
-
*
|
|
78
|
+
* bounded shape. Provider-supplied message/param text remains exact within the
|
|
79
|
+
* explicit terminal-field byte contract; retry classification is additive and
|
|
80
|
+
* never substitutes for the source diagnostic.
|
|
73
81
|
*/
|
|
74
82
|
export declare class CodexStreamingTerminalError extends Error {
|
|
75
83
|
readonly status: number;
|
|
@@ -80,5 +88,5 @@ export declare class CodexStreamingTerminalError extends Error {
|
|
|
80
88
|
readonly responseStatus?: string;
|
|
81
89
|
readonly headers: Headers;
|
|
82
90
|
readonly error: Record<string, unknown>;
|
|
83
|
-
constructor(projection: CodexSseFailureProjection
|
|
91
|
+
constructor(projection: CodexSseFailureProjection);
|
|
84
92
|
}
|
package/dist/images.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { CodexRequestContext } from "./request-context.js";
|
|
2
|
+
import type { FetchLike } from "./fetch.js";
|
|
3
|
+
export type CodexGeneratedImage = {
|
|
4
|
+
bytes: Uint8Array;
|
|
5
|
+
declaredMediaType: "image/png";
|
|
6
|
+
};
|
|
7
|
+
export type CodexImageReferenceInput = Readonly<{
|
|
8
|
+
mediaType: "image/png" | "image/jpeg" | "image/webp";
|
|
9
|
+
bytes: Uint8Array;
|
|
10
|
+
}>;
|
|
11
|
+
export declare class CodexImageApiError extends Error {
|
|
12
|
+
readonly status: number;
|
|
13
|
+
constructor(status: number, message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class CodexImageRequestTimeoutError extends Error {
|
|
16
|
+
readonly timeoutMs: number;
|
|
17
|
+
constructor(timeoutMs: number);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Execute Codex's standalone, client-side image tool against the same
|
|
21
|
+
* ChatGPT/Codex account as the owning model turn. Only a definitive 401 is
|
|
22
|
+
* retried, after refreshing auth; ambiguous transport/5xx outcomes are never
|
|
23
|
+
* replayed because an image request may already have incurred work or cost.
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateCodexSubscriptionImage(input: {
|
|
26
|
+
prompt: string;
|
|
27
|
+
references?: readonly CodexImageReferenceInput[];
|
|
28
|
+
turnId: string;
|
|
29
|
+
context: Pick<CodexRequestContext, "clientVersion" | "getToken" | "refresh">;
|
|
30
|
+
abortSignal?: AbortSignal;
|
|
31
|
+
fetch?: FetchLike;
|
|
32
|
+
/** Internal test/host override; one absolute budget covers auth retry and body streaming. */
|
|
33
|
+
requestTimeoutMs?: number;
|
|
34
|
+
}): Promise<CodexGeneratedImage>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export * from "./constants";
|
|
2
|
-
export * from "./billing";
|
|
3
|
-
export * from "./device-code";
|
|
4
|
-
export * from "./refresh";
|
|
5
|
-
export * from "./normalize";
|
|
6
|
-
export * from "./usage-normalize";
|
|
7
|
-
export * from "./reset-credits";
|
|
8
|
-
export * from "./api-client";
|
|
9
|
-
export * from "./request-context";
|
|
10
|
-
export * from "./response-timeout";
|
|
11
|
-
export * from "./fetch";
|
|
12
|
-
export * from "./mcp-sanitize";
|
|
13
|
-
export * from "./model-output-truncation";
|
|
14
|
-
export * from "./opaque-artifact";
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./realtime
|
|
1
|
+
export * from "./constants.js";
|
|
2
|
+
export * from "./billing.js";
|
|
3
|
+
export * from "./device-code.js";
|
|
4
|
+
export * from "./refresh.js";
|
|
5
|
+
export * from "./normalize.js";
|
|
6
|
+
export * from "./usage-normalize.js";
|
|
7
|
+
export * from "./reset-credits.js";
|
|
8
|
+
export * from "./api-client.js";
|
|
9
|
+
export * from "./request-context.js";
|
|
10
|
+
export * from "./response-timeout.js";
|
|
11
|
+
export * from "./fetch.js";
|
|
12
|
+
export * from "./mcp-sanitize.js";
|
|
13
|
+
export * from "./model-output-truncation.js";
|
|
14
|
+
export * from "./opaque-artifact.js";
|
|
15
|
+
export * from "./images.js";
|
|
16
|
+
export * from "./realtime.js";
|
|
17
|
+
export * from "./realtime-v3.js";
|