@opengeni/codex 0.2.13 → 0.2.16

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.
@@ -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 = {
@@ -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 "./realtime";
16
- export * from "./realtime-v3";
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";